Path: blob/main/libshaderc_util/CMakeLists.txt
1560 views
# Copyright 2020 The Shaderc Authors. All rights reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License");3# you may not use this file except in compliance with the License.4# You may obtain a copy of the License at5#6# http://www.apache.org/licenses/LICENSE-2.07#8# Unless required by applicable law or agreed to in writing, software9# distributed under the License is distributed on an "AS IS" BASIS,10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11# See the License for the specific language governing permissions and12# limitations under the License.1314project(libshaderc_util)1516add_library(shaderc_util STATIC17include/libshaderc_util/counting_includer.h18include/libshaderc_util/file_finder.h19include/libshaderc_util/format.h20include/libshaderc_util/io_shaderc.h21include/libshaderc_util/mutex.h22include/libshaderc_util/message.h23include/libshaderc_util/resources.h24include/libshaderc_util/spirv_tools_wrapper.h25include/libshaderc_util/string_piece.h26include/libshaderc_util/universal_unistd.h27include/libshaderc_util/version_profile.h28src/args.cc29src/compiler.cc30src/file_finder.cc31src/io_shaderc.cc32src/message.cc33src/resources.cc34src/shader_stage.cc35src/spirv_tools_wrapper.cc36src/version_profile.cc37)3839shaderc_default_compile_options(shaderc_util)40target_include_directories(shaderc_util41PUBLIC include PRIVATE ${glslang_SOURCE_DIR})42# We use parts of Glslang's HLSL compilation interface, which43# now requires this preprocessor definition.44add_definitions(-DENABLE_HLSL)4546find_package(Threads)47target_link_libraries(shaderc_util PRIVATE48glslang SPIRV49SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT})5051shaderc_add_tests(52TEST_PREFIX shaderc_util53LINK_LIBS shaderc_util54TEST_NAMES55counting_includer56string_piece57format58file_finder59io_shaderc60message61mutex62version_profile)6364if(${SHADERC_ENABLE_TESTS})65target_include_directories(shaderc_util_counting_includer_test66PRIVATE ${glslang_SOURCE_DIR})67target_include_directories(shaderc_util_version_profile_test68PRIVATE ${glslang_SOURCE_DIR})69endif()7071shaderc_add_tests(72TEST_PREFIX shaderc_util73LINK_LIBS shaderc_util74INCLUDE_DIRS75${glslang_SOURCE_DIR}76${spirv-tools_SOURCE_DIR}/include77TEST_NAMES78compiler)7980# This target copies content of testdata into the build directory.81add_custom_target(testdata COMMAND82${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake83COMMENT "Copy testdata into build directory")8485if(${SHADERC_ENABLE_TESTS})86add_dependencies(shaderc_util_file_finder_test testdata)87add_dependencies(shaderc_util_io_shaderc_test testdata)88endif()899091