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.
45 lines
1.3 KiB
CMake
45 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.19)
|
|
project(Template_Windows)
|
|
|
|
file(GLOB SOURCE_FILES CONFIGURE_DEPENDS "*.cpp" "*.h")
|
|
|
|
set(LIB_DXCOMPILER "dxcompiler.dll")
|
|
|
|
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
|
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
|
WickedEngine
|
|
)
|
|
|
|
if(MSVC)
|
|
add_compile_options(/MP)
|
|
endif()
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
WIN32_EXECUTABLE YES
|
|
)
|
|
|
|
if(WICKED_ENABLE_IPO)
|
|
set_target_properties(${PROJEC_NAME} PROPERTIES
|
|
INTERPROCEDURAL_OPTIMIZATION ON
|
|
INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF
|
|
)
|
|
endif()
|
|
|
|
set(PLATFORM "Windows")
|
|
add_compile_definitions(WIN32 _WINDOWS)
|
|
|
|
set(LIBDXCOMPILER_PATH "${WICKED_ROOT_DIR}/WickedEngine/${LIB_DXCOMPILER}")
|
|
set(STARTUP_LUA "${WICKED_ROOT_DIR}/Editor/startup.lua")
|
|
message("libdxcompiler found at ${LIBDXCOMPILER_PATH}")
|
|
message("startup lua found at ${STARTUP_LUA}")
|
|
|
|
# NOTE: this wont work because client never has prvileges to copy files
|
|
add_custom_command(
|
|
TARGET ${PROJECT_NAME} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBDXCOMPILER_PATH} ${CMAKE_CURRENT_BINARY_DIR}
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${STARTUP_LUA} ${CMAKE_CURRENT_BINARY_DIR}/startup.lua
|
|
)
|