Use shaderc_shared and don't build unnecessary targets

This should speed up compilation on Travis a little bit.
This commit is contained in:
Corentin Wallez 2017-11-28 13:08:17 -05:00 committed by Corentin Wallez
parent b6fb5f3149
commit 00935daffc
5 changed files with 28 additions and 3 deletions

View File

@ -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

View File

@ -64,7 +64,7 @@ script:
- cmake --build .
# Test
- ./src/tests/nxt_unittests
- ./nxt_unittests
# Get out of the build dir
- cd ..

View File

@ -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
################################################################################

View File

@ -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)

View File

@ -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