be6756ae01
This adds an option WICKED_EMBED_SHADERS (off by default). When ON, offlineshadercompiler will be compiled first and run every time a *.hlsl? file changes, the resulting wiShaderDump.h will be put in the build directory, and then wiRenderer will be compiled again with the build directory in the include path; this will cause the __hasinclude to trigger embedded shaders mode. A nice side effect is that the hacky solution to handle the __hasinclude is not needed anymore, all dependencies are now handled correctly. offlineshadercompiler was also extended with a "quiet" option to suppress messages during compilation.
47 lines
1.3 KiB
CMake
47 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.19)
|
|
project(Template_Linux)
|
|
|
|
# if the engine is installed system-wise,
|
|
# you can set INSTALLED_ENGINE to ON
|
|
# moving your project folder wherever you want
|
|
set(INSTALLED_ENGINE OFF)
|
|
# you may also want to remove the copy mechanism of the startup.lua file
|
|
|
|
if (${INSTALLED_ENGINE})
|
|
find_package(WickedEngine REQUIRED)
|
|
endif()
|
|
|
|
set(SOURCE_FILES
|
|
main.cpp
|
|
)
|
|
|
|
set(LIB_DXCOMPILER "libdxcompiler.so")
|
|
|
|
add_executable(Template_Linux ${SOURCE_FILES})
|
|
|
|
target_link_libraries(Template_Linux PUBLIC
|
|
$<IF:$<BOOL:${INSTALLED_ENGINE}>,WickedEngine::WickedEngine,WickedEngine>
|
|
)
|
|
|
|
if(WICKED_ENABLE_IPO)
|
|
set_target_properties(Template_Linux PROPERTIES
|
|
INTERPROCEDURAL_OPTIMIZATION ON
|
|
INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF
|
|
)
|
|
endif()
|
|
|
|
if (${INSTALLED_ENGINE})
|
|
get_property(LIBDXCOMPILER_PATH
|
|
TARGET WickedEngine::dxcompiler
|
|
PROPERTY IMPORTED_LOCATION)
|
|
get_filename_component(WICKED_LIBFOLDER ${LIBDXCOMPILER_PATH} DIRECTORY)
|
|
else()
|
|
set(LIBDXCOMPILER_PATH "${WICKED_ROOT_DIR}/WickedEngine/${LIB_DXCOMPILER}")
|
|
endif()
|
|
message("libdxcompiler found at ${LIBDXCOMPILER_PATH}")
|
|
|
|
add_custom_command(
|
|
TARGET Template_Linux POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBDXCOMPILER_PATH} ${CMAKE_CURRENT_BINARY_DIR}
|
|
)
|