Added new CMake option to use relative paths for shaders and assets (USE_RELATIVE_ASSET_PATH)
See BUILD.md for details Refs #1090
This commit is contained in:
parent
3c0f3e18cd
commit
b77417e7c8
2 changed files with 26 additions and 10 deletions
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
|
||||
# This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
|
||||
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
|
|
@ -18,6 +21,7 @@ OPTION(USE_D2D_WSI "Build the project using Direct to Display swapchain" OFF)
|
|||
OPTION(USE_DIRECTFB_WSI "Build the project using DirectFB swapchain" OFF)
|
||||
OPTION(USE_WAYLAND_WSI "Build the project using Wayland swapchain" OFF)
|
||||
OPTION(USE_HEADLESS "Build the project using headless extension swapchain" OFF)
|
||||
OPTION(USE_RELATIVE_ASSET_PATH "Load assets (shaders, models, textures) from a fixed path relative to the binar" OFF)
|
||||
|
||||
set(RESOURCE_INSTALL_DIR "" CACHE PATH "Path to install resources to (leave empty for running uninstalled)")
|
||||
|
||||
|
|
@ -111,14 +115,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
|
||||
file(GLOB SOURCE *.cpp )
|
||||
|
||||
# Asset and shader path selection
|
||||
if(RESOURCE_INSTALL_DIR)
|
||||
add_definitions(-DVK_EXAMPLE_ASSETS_DIR=\"${RESOURCE_INSTALL_DIR}/\")
|
||||
add_definitions(-DVK_EXAMPLE_SHADERS_DIR=\"${RESOURCE_INSTALL_DIR}/shaders/\")
|
||||
install(DIRECTORY assets/ DESTINATION ${RESOURCE_INSTALL_DIR}/)
|
||||
install(DIRECTORY shaders/ DESTINATION ${RESOURCE_INSTALL_DIR}/shaders/)
|
||||
else()
|
||||
add_definitions(-DVK_EXAMPLE_ASSETS_DIR=\"${CMAKE_SOURCE_DIR}/assets/\")
|
||||
add_definitions(-DVK_EXAMPLE_SHADERS_DIR=\"${CMAKE_SOURCE_DIR}/shaders/\")
|
||||
if(NOT USE_RELATIVE_ASSET_PATH)
|
||||
add_definitions(-DVK_EXAMPLE_ASSETS_DIR=\"${CMAKE_SOURCE_DIR}/assets/\")
|
||||
add_definitions(-DVK_EXAMPLE_SHADERS_DIR=\"${CMAKE_SOURCE_DIR}/shaders/\")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Compiler specific stuff
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue