Skip to content

Commit

Permalink
Refactor on cmake files
Browse files Browse the repository at this point in the history
  • Loading branch information
Minmin Gong committed Nov 18, 2018
1 parent a068a65 commit c893be1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 38 deletions.
13 changes: 0 additions & 13 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
20 changes: 10 additions & 10 deletions Source/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
)

Expand Down
13 changes: 6 additions & 7 deletions Source/Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 3 additions & 8 deletions Source/Tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c893be1

Please sign in to comment.