From 00935daffc62134e1706de6dd2777b9ab3e27857 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 28 Nov 2017 13:08:17 -0500 Subject: [PATCH] Use shaderc_shared and don't build unnecessary targets This should speed up compilation on Travis a little bit. --- .appveyor.yml | 2 +- .travis.yml | 2 +- CMakeLists.txt | 4 ++++ src/utils/CMakeLists.txt | 2 +- third_party/CMakeLists.txt | 21 +++++++++++++++++++++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 3997fd230f..a4110dfcb6 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,4 +17,4 @@ build_script: - cmake --build . # TODO(cwallez@chromium.org) test on more than Debug. - - src\tests\Debug\nxt_unittests.exe + - Debug\nxt_unittests.exe diff --git a/.travis.yml b/.travis.yml index bc3cb3ba04..b6535328a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,7 @@ script: - cmake --build . # Test - - ./src/tests/nxt_unittests + - ./nxt_unittests # Get out of the build dir - cd .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 2980bc1d24..83bea7193e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,10 @@ endfunction() # Enable the creation of folders for Visual Studio projects set_property(GLOBAL PROPERTY USE_FOLDERS ON) +# Output shared libs and executables directly in the build directory +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + ################################################################################ # Generate the C and C++ NXT APIs ################################################################################ diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 6ee868e717..8a96bbd907 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -55,7 +55,7 @@ if (NXT_ENABLE_VULKAN) endif() add_library(utils STATIC ${UTILS_SOURCES}) -target_link_libraries(utils nxt_backend shaderc nxtcpp nxt) +target_link_libraries(utils nxt_backend shaderc_shared nxtcpp nxt) target_include_directories(utils PUBLIC ${SRC_DIR}) NXTInternalTarget("" utils) if(NOT MSVC) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 1ca16b4cb7..1a3f6871f7 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -44,6 +44,14 @@ NXTExternalTarget("third_party" glad) set(SPIRV_WERROR OFF CACHE BOOL "" FORCE) # Don't add unnecessary shaderc targets set(SHADERC_SKIP_TESTS ON) +set(SHADERC_SKIP_INSTALL ON) +# Remove unused glslang and spirv-tools parts +# set(ENABLE_HLSL OFF CACHE BOOL "") +set(ENABLE_OPT OFF CACHE BOOL "") +set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "") +set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "") +set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "") +set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "") # Help shaderc find the non-standard paths for its dependencies set(SHADERC_GOOGLE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest CACHE STRING "Location of googletest source") set(SHADERC_GLSLANG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/glslang" CACHE STRING "Location of glslang source") @@ -64,6 +72,7 @@ set_target_properties( glslc_exe install-headers shaderc + shaderc_shared shaderc_util shaderc_combined_genfile shaderc-online-compile testdata @@ -71,6 +80,18 @@ set_target_properties( SPIRV-Headers-example-1.1 PROPERTIES FOLDER "third_party/shaderc" ) +# Remove a bunch of targets we don't need that are pulled by shaderc and glslang +set_target_properties( + SPIRV-Headers-example-1.1 + SPIRV-Headers-example + glslc_exe + SPIRV-Tools-link + SPVRemapper + shaderc + shaderc-online-compile + shaderc_combined_genfile + PROPERTIES EXCLUDE_FROM_ALL true +) # SPIRV-Cross set(SPIRV_CROSS_SOURCES