vcpkg/ports/spirv-tools/portfile.cmake
Mathis Logemann 611dfc1864
[spirv-tools,spirv-reflect,spirv-headers] update ports (#23822)
* update volk

* spriv

* Revert "update volk"

This reverts commit a478ebc8674c080d98b5eb61afdd1896c6a0d2c2.

* format

* versions

* versions

* update

* versions

* refix includes?

* version

* fix header include on linux,macos

* version

* fix cmake fixup

* fix

* version

* build shared

* version

* fix opt name

* version

* fix name...

* version

* change version to match sdk distribution version

* spirv-header version

* spirv reflect version
2022-04-07 07:52:15 -07:00

89 lines
3.4 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/SPIRV-Tools
REF v2022.1
SHA512 19ff4386c74c15f9b870d5348b76c7d643da5bf1637b1faed153d9ec9f00de941a83a22782f169b4aa5001c715721937c3bb3bc07541a60e503a0455a1d2287e
)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
if(VCPKG_TARGET_IS_IOS)
message(STATUS "Using iOS trplet. Executables won't be created...")
set(TOOLS_INSTALL OFF)
set(SKIP_EXECUTABLES ON)
else()
set(TOOLS_INSTALL ON)
set(SKIP_EXECUTABLES OFF)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSPIRV-Headers_SOURCE_DIR=${CURRENT_INSTALLED_DIR}
-DSPIRV_WERROR=OFF
-DSPIRV_SKIP_TESTS=ON
-DSPIRV_SKIP_EXECUTABLES=${SKIP_EXECUTABLES}
-DENABLE_SPIRV_TOOLS_INSTALL=${TOOLS_INSTALL}
-DSPIRV_TOOLS_BUILD_STATIC=ON
-DENABLE_SPIRV_TOOLS_INSTALL=ON
)
vcpkg_cmake_install()
# the directory name is capitalized as opposed to the port name
if(WIN32)
vcpkg_cmake_config_fixup(CONFIG_PATH SPIRV-Tools/cmake PACKAGE_NAME SPIRV-Tools)
vcpkg_cmake_config_fixup(CONFIG_PATH SPIRV-Tools-link/cmake PACKAGE_NAME SPIRV-Tools-link)
vcpkg_cmake_config_fixup(CONFIG_PATH SPIRV-Tools-lint/cmake PACKAGE_NAME SPIRV-Tools-lint)
vcpkg_cmake_config_fixup(CONFIG_PATH SPIRV-Tools-opt/cmake PACKAGE_NAME SPIRV-Tools-opt)
vcpkg_cmake_config_fixup(CONFIG_PATH SPIRV-Tools-reduce/cmake PACKAGE_NAME SPIRV-Tools-reduce)
else()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools PACKAGE_NAME SPIRV-Tools DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-link PACKAGE_NAME SPIRV-Tools-link DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-lint PACKAGE_NAME SPIRV-Tools-lint DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-opt PACKAGE_NAME SPIRV-Tools-opt DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-reduce PACKAGE_NAME SPIRV-Tools-reduce) # now delete
endif()
vcpkg_fixup_pkgconfig()
if(TOOLS_INSTALL)
vcpkg_copy_tools(
TOOL_NAMES
spirv-as
spirv-cfg
spirv-dis
spirv-link
spirv-lint
spirv-opt
spirv-reduce
spirv-val
AUTO_CLEAN
)
endif()
if(WIN32)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/SPIRV-Tools"
"${CURRENT_PACKAGES_DIR}/debug/SPIRV-Tools-link"
"${CURRENT_PACKAGES_DIR}/debug/SPIRV-Tools-lint"
"${CURRENT_PACKAGES_DIR}/debug/SPIRV-Tools-opt"
"${CURRENT_PACKAGES_DIR}/debug/SPIRV-Tools-reduce"
"${CURRENT_PACKAGES_DIR}/SPIRV-Tools"
"${CURRENT_PACKAGES_DIR}/SPIRV-Tools-link"
"${CURRENT_PACKAGES_DIR}/SPIRV-Tools-lint"
"${CURRENT_PACKAGES_DIR}/SPIRV-Tools-opt"
"${CURRENT_PACKAGES_DIR}/SPIRV-Tools-reduce"
)
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# lesspipe.sh is the only file there
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)