17 lines
641 B
CMake
17 lines
641 B
CMake
# 查找编译器和Python
|
|
find_program(PYTHON_EXECUTABLE python)
|
|
find_program(GLSLANG_VALIDATOR glslangValidator)
|
|
find_program(SLANG_COMPILER slangc)
|
|
|
|
function(shader_compile_target INPUT_DIR)
|
|
# 将路径拼接到全局着色器路径列表中
|
|
list(APPEND SHADER_SOURCE_DIRS ${INPUT_DIR})
|
|
endfunction()
|
|
|
|
# 添加自定义命令, 用于编译着色器, 调用scripts/compile_shaders.py
|
|
add_custom_target(compile_aorii_shaders
|
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/compile_shaders.py --input-dir ${SHADER_SOURCE_DIRS} --output-dir ${SHADER_OUTPUT_DIR}
|
|
COMMENT "Compiling shaders"
|
|
VERBATIM
|
|
)
|