Files
TheChef/CMakeLists.txt
2026-01-22 02:04:26 +01:00

55 lines
1.4 KiB
CMake

add_executable(TheChef
main.cpp
"ShaderCompiler.h" "ShaderCompiler.cpp"
)
target_compile_features(TheChef PRIVATE cxx_std_17)
# Good practice for tools
target_compile_definitions(TheChef PRIVATE
_CRT_SECURE_NO_WARNINGS
)
if (NOT TARGET nlohmann_json::nlohmann_json)
add_subdirectory(third_party/json)
endif()
if(NOT TARGET spdlog::spdlog)
add_subdirectory(third_party/spdlog)
endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
set(GLSLANG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/glslang")
set(SCRIPT "${GLSLANG_DIR}/update_glslang_sources.py")
execute_process(
COMMAND "${Python3_EXECUTABLE}" "${SCRIPT}"
WORKING_DIRECTORY "${GLSLANG_DIR}"
RESULT_VARIABLE rc
OUTPUT_VARIABLE out
ERROR_VARIABLE err
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT rc EQUAL 0)
message(FATAL_ERROR
"update_glslang_sources.py failed (exit code ${rc})\n"
"--- stdout ---\n${out}\n"
"--- stderr ---\n${err}\n"
)
endif()
add_subdirectory(third_party/glslang)
target_link_libraries(TheChef PRIVATE nlohmann_json::nlohmann_json spdlog::spdlog glslang glslang-default-resource-limits)
# Optional: warnings
if (MSVC)
target_compile_options(TheChef PRIVATE /W4)
else()
target_compile_options(TheChef PRIVATE -Wall -Wextra -Wpedantic)
endif()