diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 155185b3..7cdd305e 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -121,19 +121,6 @@ set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) set(CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) set(CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL}) -if(CMAKE_C_COMPILER_ID MATCHES MSVC) - # Required by DirectXShaderCompiler - foreach(flagVar - CMAKE_C_FLAGS CMAKE_CXX_FLAGS) - set(${flagVar} "${${flagVar}} /UNDEBUG") - endforeach() -endif() -add_definitions(-DDBG -DSUPPORT_QUERY_GIT_COMMIT_INFO -DENABLE_SPIRV_CODEGEN - -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS - -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS - -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS - -D_GNU_SOURCE) - add_subdirectory(Core) add_subdirectory(Tests) add_subdirectory(Tools) diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index 66676102..8ccf5c54 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -14,14 +14,6 @@ set(HEADER_FILES source_group("Source Files" FILES ${SOURCE_FILES}) source_group("Header Files" FILES ${HEADER_FILES}) -add_definitions(-DSHADER_CONDUCTOR_SOURCE) - -include_directories( - ${SC_ROOT_DIR}/Include - ${SC_BUILD_DIR}/External/DirectXShaderCompiler/include - ${SC_ROOT_DIR}/External/DirectXShaderCompiler/include - ${SC_ROOT_DIR}/External/SPIRV-Cross -) link_directories( ${SC_BUILD_DIR}/External/DirectXShaderCompiler/${CMAKE_CFG_INTDIR}/lib ${SC_BUILD_DIR}/External/DirectXShaderCompiler/lib/${CMAKE_CFG_INTDIR} @@ -31,9 +23,17 @@ add_library(${LIB_NAME} "SHARED" ${SOURCE_FILES} ${HEADER_FILES} ) +target_include_directories(${LIB_NAME} + PUBLIC ${SC_ROOT_DIR}/Include + PRIVATE ${SC_BUILD_DIR}/External/DirectXShaderCompiler/include + PRIVATE ${SC_ROOT_DIR}/External/DirectXShaderCompiler/include + PRIVATE ${SC_ROOT_DIR}/External/SPIRV-Cross +) +target_compile_definitions(${LIB_NAME} PRIVATE + -DSHADER_CONDUCTOR_SOURCE -DDBG -DSUPPORT_QUERY_GIT_COMMIT_INFO -DENABLE_SPIRV_CODEGEN + -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) target_link_libraries(${LIB_NAME} - LLVMDxcSupport LLVMHLSL LLVMOption LLVMSupport dxcompiler SPIRV-Tools LLVMDxcSupport LLVMBitReader - LLVMipa LLVMAnalysis LLVMCore LLVMSupport + dxcompiler LLVMDxcSupport LLVMSupport spirv-cross-core spirv-cross-glsl spirv-cross-hlsl spirv-cross-msl ) diff --git a/Source/Tests/CMakeLists.txt b/Source/Tests/CMakeLists.txt index a27bf1db..6bfa0114 100644 --- a/Source/Tests/CMakeLists.txt +++ b/Source/Tests/CMakeLists.txt @@ -27,19 +27,18 @@ set_source_files_properties(${DATA_FILES} source_group("Source Files" FILES ${SOURCE_FILES}) source_group("Data Files\\Input" FILES ${DATA_FILES}) -add_definitions(-DTEST_DATA_DIR="${SC_ROOT_DIR}/Source/Tests/Data/") - -include_directories( - ${SC_ROOT_DIR}/Include - ${SC_ROOT_DIR}/External/googletest/googletest/include -) - link_directories( ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ) add_executable(${EXE_NAME} ${SOURCE_FILES} ${DATA_FILES}) +target_include_directories(${EXE_NAME} PRIVATE + ${SC_ROOT_DIR}/Include + ${SC_ROOT_DIR}/External/googletest/googletest/include +) +target_compile_definitions(${EXE_NAME} PRIVATE + -DTEST_DATA_DIR="${SC_ROOT_DIR}/Source/Tests/Data/") target_link_libraries(${EXE_NAME} ShaderConductor debug gtestd optimized gtest diff --git a/Source/Tools/CMakeLists.txt b/Source/Tools/CMakeLists.txt index d30dc1b7..d3bf856b 100644 --- a/Source/Tools/CMakeLists.txt +++ b/Source/Tools/CMakeLists.txt @@ -9,17 +9,12 @@ set(SOURCE_FILES source_group("Source Files" FILES ${SOURCE_FILES}) -include_directories( +add_executable(${EXE_NAME} ${SOURCE_FILES}) + +target_include_directories(${EXE_NAME} PRIVATE ${SC_ROOT_DIR}/Include ${SC_ROOT_DIR}/External/cxxopts/include ) - -link_directories( - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) - -add_executable(${EXE_NAME} ${SOURCE_FILES}) - target_link_libraries(${EXE_NAME} ShaderConductor) add_dependencies(${EXE_NAME} ShaderConductor)