Skip to content

Commit

Permalink
Attemp to fix #3909
Browse files Browse the repository at this point in the history
- Try to fix the point (1).
  - Build static unconditionally. but is only used for link all `spirv-foo` programs. because all of them (or partial) need all symbols which is only provided by static libs (until the point 4 get fixed)(*). for install it. see below
    This can increase the size a bit.
  - Now exist two defines witch control what type of library is installed/builded*:
     - `BUILD_SHARED_LIBS`         -> This control if you want build shared libs. and if is builded, install it when invoke `make install`
     - `SPIRV_INSTALL_STATIC_LIBS` -> This not control the build static library (because is ON unconditionality), but can control the installation when invoke `make install`
     -- I do this because some distros needs only static libs, other only shared libs, other both, or other simply what install only the programs
     --- Table of individual use:

        `BUILD_SHARED_LIBS=OFF` or not set          -> Disable build and installation of shared libraries
        `BUILD_SHARED_LIBS=ON'                      -> Enable build and install shared libs
        `SPIRV_INSTALL_STATIC_LIBS=OFF`             -> Disable the installation the libraries when invoke `make install`
        `SPIRV_INSTALL_STATIC_LIBS=ON` or not set   -> Option ON by default. Enable the installation when invoke `make install`

    --- Table of conjuntion use:

        `BUILD_SHARED_LIBS=ON'  and `SPIRV_INSTALL_STATIC_LIBS=ON`  -> Build and install the wrole project. include programs, static and shared libs
        `BUILD_SHARED_LIBS=OFF' and `SPIRV_INSTALL_STATIC_LIBS=ON`  -> Build the programs and static libs, and install the static libs and the programs when invoke `make install` (Default)
        `BUILD_SHARED_LIBS=ON'  and `SPIRV_INSTALL_STATIC_LIBS=OFF` -> build the programs, shared and static libs, and only install the programs and the shared libs when invoke `make install`
        `BUILD_SHARED_LIBS=OFF' and `SPIRV_INSTALL_STATIC_LIBS=OFF` -> build the programs and the static libs, but not install when invoke `make install`

       * In all cases, always install the headers

  - The generation of the `.cmake` only make one flavor, but depend of the options is used, include shared, static, or both. when enable only static lib, the `.cmake` files point to `static` libs, when build only shared libs, points to `shared' libs,
    in this case, static and shared uses the both cases, uses the same TARGET (`libSPIRV-Tools>foo<`)
    If enabled both, the TARGET of the static libs is untouched (`libSPIRV-Tools>foo<`), but the shared libs add the surfix `-shared` (`libSPIRV-Tools>foo<-shared`)
    -- This need HARD test. this need a CMakeLists.txt test case wich can get the info when use static libs or use shared libs. and test if can linked with other things.
       I have tested with GLSLANG, and seems work as expected. in a VKD3D project (uses pkg-config), i need remove the `-shared` in the configure.am file for found the correct library.. build ok and linked the libraries as expected (*)
  - The files `libSPIRV-Tools-shared.so` and `SPIRV-Tools-shared.pc` is completely gone. no need anymore.
  - By design, the common `SPIRV-Tools.pc` can be used in both build modes. the `pkg-config` stack can handle the information of static libs with `--static` flag when exist static libs in the library path, and normal use when is used as shared lib.
    Maybe need ajust for include this information (if exist in the project) into `SPIRV-Tools.pc.in` and setup in the `CMakeFiles.txt`.
  - (*)The visiblility of the shared/static modules is untouched. BUT the `libSPIRV-Tools.so` (static `libSPIRV-Tools.a` is always visible) is turn to visible. needs a internal rework (point 4). i can't link with any library (tested with GLSLANG or VKD3D). Always fails to link about missing symbols.
    Needs fix by dev.

TODO:
  - Fix point (2) and point (3)

- Point (4) is out of my scope. i'm not coder
  • Loading branch information
sl1pkn07 committed Oct 18, 2021
1 parent 35fd0e1 commit 2a2f902
Show file tree
Hide file tree
Showing 10 changed files with 335 additions and 242 deletions.
68 changes: 11 additions & 57 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,45 +139,10 @@ if (DEFINED SPIRV_TOOLS_EXTRA_DEFINITIONS)
add_definitions(${SPIRV_TOOLS_EXTRA_DEFINITIONS})
endif()

# Library build setting definitions:
#
# * SPIRV_TOOLS_BUILD_STATIC - ON or OFF - Defaults to ON.
# If enabled the following targets will be created:
# ${SPIRV_TOOLS}-static - STATIC library.
# Has full public symbol visibility.
# ${SPIRV_TOOLS}-shared - SHARED library.
# Has default-hidden symbol visibility.
# ${SPIRV_TOOLS} - will alias to one of above, based on BUILD_SHARED_LIBS.
# If disabled the following targets will be created:
# ${SPIRV_TOOLS} - either STATIC or SHARED based on SPIRV_TOOLS_LIBRARY_TYPE.
# Has full public symbol visibility.
# ${SPIRV_TOOLS}-shared - SHARED library.
# Has default-hidden symbol visibility.
#
# * SPIRV_TOOLS_LIBRARY_TYPE - SHARED or STATIC.
# Specifies the library type used for building SPIRV-Tools libraries.
# Defaults to SHARED when BUILD_SHARED_LIBS=1, otherwise STATIC.
#
# * SPIRV_TOOLS_FULL_VISIBILITY - "${SPIRV_TOOLS}-static" or "${SPIRV_TOOLS}"
# Evaluates to the SPIRV_TOOLS target library name that has no hidden symbols.
# This is used by internal targets for accessing symbols that are non-public.
# Note this target provides no API stability guarantees.
#
# Ideally, all of these will go away - see https://github.com/KhronosGroup/SPIRV-Tools/issues/3909.
option(SPIRV_TOOLS_BUILD_STATIC "Build ${SPIRV_TOOLS}-static target. ${SPIRV_TOOLS} will alias to ${SPIRV_TOOLS}-static or ${SPIRV_TOOLS}-shared based on BUILD_SHARED_LIBS" ON)
if(SPIRV_TOOLS_BUILD_STATIC)
set(SPIRV_TOOLS_FULL_VISIBILITY ${SPIRV_TOOLS}-static)
set(SPIRV_TOOLS_LIBRARY_TYPE "STATIC")
else(SPIRV_TOOLS_BUILD_STATIC)
set(SPIRV_TOOLS_FULL_VISIBILITY ${SPIRV_TOOLS})
if (NOT DEFINED SPIRV_TOOLS_LIBRARY_TYPE)
if(BUILD_SHARED_LIBS)
set(SPIRV_TOOLS_LIBRARY_TYPE "SHARED")
else()
set(SPIRV_TOOLS_LIBRARY_TYPE "STATIC")
endif()
endif()
endif(SPIRV_TOOLS_BUILD_STATIC)
option(SPIRV_INSTALL_STATIC_LIBS "Enable static libs" ON)
option(BUILD_SHARED_LIBS "Enable shared libs" OFF)

set(SPIRV_TOOLS_FULL_VISIBILITY ${SPIRV_TOOLS})

function(spvtools_default_compile_options TARGET)
target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS})
Expand Down Expand Up @@ -353,7 +318,6 @@ if (NOT "${SPIRV_SKIP_TESTS}")
endif()

set(SPIRV_LIBRARIES "-lSPIRV-Tools-opt -lSPIRV-Tools -lSPIRV-Tools-link")
set(SPIRV_SHARED_LIBRARIES "-lSPIRV-Tools-shared")

# Build pkg-config file
# Use a first-class target so it's regenerated when relevant files are updated.
Expand All @@ -368,24 +332,14 @@ add_custom_target(spirv-tools-pkg-config ALL
-DSPIRV_LIBRARIES=${SPIRV_LIBRARIES}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake
DEPENDS "CHANGES" "cmake/SPIRV-Tools.pc.in" "cmake/write_pkg_config.cmake")
add_custom_target(spirv-tools-shared-pkg-config ALL
COMMAND ${CMAKE_COMMAND}
-DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES
-DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools-shared.pc.in
-DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DSPIRV_SHARED_LIBRARIES=${SPIRV_SHARED_LIBRARIES}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake
DEPENDS "CHANGES" "cmake/SPIRV-Tools-shared.pc.in" "cmake/write_pkg_config.cmake")

# Install pkg-config file
if (ENABLE_SPIRV_TOOLS_INSTALL)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc
${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if(BUILD_SHARED_LIBS OR SPIRV_TOOLS_INSTALL_STATIC_LIBS)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
endif()
12 changes: 0 additions & 12 deletions cmake/SPIRV-Tools-shared.pc.in

This file was deleted.

13 changes: 10 additions & 3 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ if (NOT ${SPIRV_SKIP_TESTS})
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
ON)
endif()
# gtest requires special defines for building as a shared
# Gtest requires special defines for building as a shared
# library, simply always build as static.
push_variable(BUILD_SHARED_LIBS 0)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Disable build shared libs")
add_subdirectory(${GMOCK_DIR} EXCLUDE_FROM_ALL)
pop_variable(BUILD_SHARED_LIBS)
endif()
Expand All @@ -102,7 +103,10 @@ if (NOT ${SPIRV_SKIP_TESTS})
# If we are configuring RE2, then turn off its testing. It takes a long time and
# does not add much value for us. If an enclosing project configured RE2, then it
# has already chosen whether to enable RE2 testing.
set(RE2_BUILD_TESTING OFF CACHE STRING "Run RE2 Tests")
set(RE2_BUILD_TESTING OFF CACHE BOOL "Run RE2 Tests")
# Build static RE2. do less problems if run the test when you have already RE2
# in the system and have different library version.
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Disable build shared libs")
if (NOT RE2_SOURCE_DIR)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/re2)
set(RE2_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/re2" CACHE STRING "RE2 source dir" )
Expand All @@ -125,7 +129,10 @@ if (NOT ${SPIRV_SKIP_TESTS})
if (NOT TARGET effcee)
set(EFFCEE_BUILD_TESTING OFF CACHE BOOL "Do not build Effcee test suite")
endif()
push_variable(BUILD_SHARED_LIBS 0) # effcee does not export any symbols for building as a DLL. Always build as static.
# Effcee does not export any symbols for building as a DLL. Always build as static.
push_variable(BUILD_SHARED_LIBS 0)
# Expands this if include RE2 in the effcee third_party folder
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Disable build shared libs")
add_subdirectory(effcee EXCLUDE_FROM_ALL)
pop_variable(BUILD_SHARED_LIBS)
set_property(TARGET effcee PROPERTY FOLDER Effcee)
Expand Down
96 changes: 48 additions & 48 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp
PROPERTIES OBJECT_DEPENDS "${SPIRV_TOOLS_BUILD_VERSION_INC}")

if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")))
# Enable parallel builds across four cores for this lib
add_definitions(/MP4)
endif()

spvtools_pch(SPIRV_SOURCES pch_source)

# spirv_tools_default_target_options() sets the target options that are common
Expand All @@ -369,37 +374,27 @@ function(spirv_tools_default_target_options target)
add_dependencies(${target} spirv-tools-build-version core_tables enum_string_mapping extinst_tables)
endfunction()

# Always build ${SPIRV_TOOLS}-shared. This is expected distro packages, and
# unlike the other SPIRV_TOOLS target, defaults to hidden symbol visibility.
add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES})
spirv_tools_default_target_options(${SPIRV_TOOLS}-shared)
set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${SPIRV_TOOLS}-shared
PRIVATE SPIRV_TOOLS_IMPLEMENTATION
PUBLIC SPIRV_TOOLS_SHAREDLIB
)

if(SPIRV_TOOLS_BUILD_STATIC)
add_library(${SPIRV_TOOLS}-static STATIC ${SPIRV_SOURCES})
spirv_tools_default_target_options(${SPIRV_TOOLS}-static)
# The static target does not have the '-static' suffix.
set_target_properties(${SPIRV_TOOLS}-static PROPERTIES OUTPUT_NAME "${SPIRV_TOOLS}")

# Create the "${SPIRV_TOOLS}" target as an alias to either "${SPIRV_TOOLS}-static"
# or "${SPIRV_TOOLS}-shared" depending on the value of BUILD_SHARED_LIBS.
if(BUILD_SHARED_LIBS)
add_library(${SPIRV_TOOLS} ALIAS ${SPIRV_TOOLS}-shared)
else()
add_library(${SPIRV_TOOLS} ALIAS ${SPIRV_TOOLS}-static)
endif()
add_library(${SPIRV_TOOLS} STATIC ${SPIRV_SOURCES})
if(SPIRV_INSTALL_STATIC_LIBS)
set(SPIRV_TOOLS_STATIC ${SPIRV_TOOLS})
endif()

set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS}-static ${SPIRV_TOOLS}-shared)
else()
add_library(${SPIRV_TOOLS} ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_SOURCES})
spirv_tools_default_target_options(${SPIRV_TOOLS})
set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared)
if(BUILD_SHARED_LIBS)
add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES})
#set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden)
#target_compile_definitions(${SPIRV_TOOLS}-shared
#PRIVATE SPIRV_TOOLS_IMPLEMENTATION
#PUBLIC SPIRV_TOOLS_SHAREDLIB
#)
set(SPIRV_TOOLS_SHARED ${SPIRV_TOOLS}-shared)
endif()

set(SPIRV_TOOLS_DEFAUL_TARGET_OPTIONS ${SPIRV_TOOLS} ${SPIRV_TOOLS_SHARED})

foreach(target ${SPIRV_TOOLS_DEFAUL_TARGET_OPTIONS})
spirv_tools_default_target_options(${target})
endforeach()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
find_library(LIBRT rt)
if(LIBRT)
Expand All @@ -415,25 +410,30 @@ if (ANDROID)
endforeach()
endif()

set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS_SHARED})

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS ${SPIRV_TOOLS_TARGETS} EXPORT ${SPIRV_TOOLS}Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
export(EXPORT ${SPIRV_TOOLS}Targets FILE ${SPIRV_TOOLS}Target.cmake)

spvtools_config_package_dir(${SPIRV_TOOLS} PACKAGE_DIR)
install(EXPORT ${SPIRV_TOOLS}Targets FILE ${SPIRV_TOOLS}Target.cmake DESTINATION ${PACKAGE_DIR})

# Special config file for root library compared to other libs.
file(WRITE ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${SPIRV_TOOLS}Target.cmake)\n"
"set(${SPIRV_TOOLS}_LIBRARIES ${SPIRV_TOOLS})\n"
"get_target_property(${SPIRV_TOOLS}_INCLUDE_DIRS ${SPIRV_TOOLS} INTERFACE_INCLUDE_DIRECTORIES)\n")
install(FILES ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake DESTINATION ${PACKAGE_DIR})
if(BUILD_SHARED_LIBS OR SPIRV_INSTALL_STATIC_LIBS)
if(BUILD_SHARED_LIBS)
set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES OUTPUT_NAME ${SPIRV_TOOLS})
endif()
if(NOT SPIRV_INSTALL_STATIC_LIBS)
set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES EXPORT_NAME ${SPIRV_TOOLS})
endif()
install(TARGETS ${SPIRV_TOOLS_STATIC} ${SPIRV_TOOLS_SHARED} EXPORT ${SPIRV_TOOLS}-Target
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
export(EXPORT ${SPIRV_TOOLS}-Target FILE ${SPIRV_TOOLS}Targets.cmake)

spvtools_config_package_dir(${SPIRV_TOOLS} PACKAGE_DIR)
install(EXPORT ${SPIRV_TOOLS}-Target FILE ${SPIRV_TOOLS}Targets.cmake DESTINATION ${PACKAGE_DIR})

# Special config file for root library compared to other libs.
file(WRITE ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${SPIRV_TOOLS}Targets.cmake)\n"
"set(${SPIRV_TOOLS}_LIBRARIES ${SPIRV_TOOLS})\n"
"get_target_property(${SPIRV_TOOLS}_INCLUDE_DIRS ${SPIRV_TOOLS} INTERFACE_INCLUDE_DIRECTORIES)\n")
install(FILES ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake DESTINATION ${PACKAGE_DIR})
endif()
endif(ENABLE_SPIRV_TOOLS_INSTALL)

if(MSVC AND (NOT ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")))
# Enable parallel builds across four cores for this lib
add_definitions(/MP4)
endif()
72 changes: 50 additions & 22 deletions source/fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,17 @@ if(SPIRV_BUILD_FUZZER)

spvtools_pch(SPIRV_TOOLS_FUZZ_SOURCES pch_source_fuzz)

add_library(SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SOURCES})
add_library(SPIRV-Tools-fuzz STATIC ${SPIRV_TOOLS_FUZZ_SOURCES})
if(SPIRV_INSTALL_STATIC_LIBS)
set(SPIRV_TOOLS_FUZZ_STATIC SPIRV-Tools-fuzz)
endif()

if(BUILD_SHARED_LIBS)
add_library(SPIRV-Tools-fuzz-shared SHARED ${SPIRV_TOOLS_FUZZ_SOURCES})
set(SPIRV_TOOLS_FUZZ_SHARED SPIRV-Tools-fuzz-shared)
endif()

spvtools_default_compile_options(SPIRV-Tools-fuzz)
spvtools_default_compile_options(SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SHARED})

# Compilation of the auto-generated protobuf source file will yield warnings,
# which we have no control over and thus wish to ignore.
Expand All @@ -451,37 +459,57 @@ if(SPIRV_BUILD_FUZZER)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/protobufs/spvtoolsfuzz.pb.cc PROPERTIES COMPILE_FLAGS /w)
endif()

target_include_directories(SPIRV-Tools-fuzz
PUBLIC
$<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE ${spirv-tools_BINARY_DIR}
PRIVATE ${CMAKE_BINARY_DIR})
set(SPIRV_TOOLS_LINK_TARGET SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SHARED})

foreach(target ${SPIRV_TOOLS_FUZZ_TARGET})
target_include_directories(${target}
PUBLIC
$<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${SPIRV_HEADER_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE ${spirv-tools_BINARY_DIR}
PRIVATE ${CMAKE_BINARY_DIR})
endforeach()

# The fuzzer reuses a lot of functionality from the SPIRV-Tools library.
target_link_libraries(SPIRV-Tools-fuzz
PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}
PUBLIC SPIRV-Tools-opt
PUBLIC SPIRV-Tools-reduce
PUBLIC protobuf::libprotobuf)
PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}
PUBLIC SPIRV-Tools-opt
PUBLIC SPIRV-Tools-reduce
PUBLIC protobuf::libprotobuf)

if(BUILD_SHARED_LIBS)
target_link_libraries(SPIRV-Tools-fuzz-shared
PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}-shared
PUBLIC SPIRV-Tools-opt-shared
PUBLIC SPIRV-Tools-reduce-shared
PUBLIC protobuf::libprotobuf)
endif()

set_property(TARGET SPIRV-Tools-fuzz PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-fuzz)
set_property(TARGET SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SHARED} PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SHARED})

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS SPIRV-Tools-fuzz EXPORT SPIRV-Tools-fuzzTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
export(EXPORT SPIRV-Tools-fuzzTargets FILE SPIRV-Tools-fuzzTarget.cmake)
if(BUILD_SHARED_LIBS OR SPIRV_INSTALL_STATIC_LIBS)
if(BUILD_SHARED_LIBS)
set_target_properties(SPIRV-Tools-fuzz-shared PROPERTIES OUTPUT_NAME SPIRV-Tools-fuzz)
endif()
if(NOT SPIRV_INSTALL_STATIC_LIBS)
set_target_properties(SPIRV-Tools-fuzz-shared PROPERTIES EXPORT_NAME SPIRV-Tools-fuzz)
endif()
install(TARGETS ${SPIRV_TOOLS_FUZZ_STATIC} ${SPIRV_TOOLS_FUZZ_SHARED} EXPORT SPIRV-Tools-fuzzTarget
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
export(EXPORT SPIRV-Tools-fuzzTarget FILE SPIRV-Tools-fuzzTargets.cmake)

spvtools_config_package_dir(SPIRV-Tools-fuzz PACKAGE_DIR)
install(EXPORT SPIRV-Tools-fuzzTargets FILE SPIRV-Tools-fuzzTarget.cmake
DESTINATION ${PACKAGE_DIR})
install(EXPORT SPIRV-Tools-fuzzTarget FILE SPIRV-Tools-fuzzTargets.cmake
DESTINATION ${PACKAGE_DIR})

spvtools_generate_config_file(SPIRV-Tools-fuzz)
install(FILES ${CMAKE_BINARY_DIR}/SPIRV-Tools-fuzzConfig.cmake DESTINATION ${PACKAGE_DIR})
endif()
endif(ENABLE_SPIRV_TOOLS_INSTALL)

endif(SPIRV_BUILD_FUZZER)
Loading

0 comments on commit 2a2f902

Please sign in to comment.