vcpkg/ports/glslang/portfile.cmake

64 lines
2.1 KiB
CMake
Raw Normal View History

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
2016-11-26 01:08:06 +08:00
2017-07-28 10:25:07 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/glslang
REF "${VERSION}"
SHA512 e16b01925a657750733a2973dc803fc3910a3a169ae276af205de6cb1bf0536fd2dbb63c5fd4fc10f800ba95f71bce673417121ad640cb9c964f291596c80025
HEAD_REF master
PATCHES
cmake.patch # Remove on next version (Upstream PR #3406 and #3420).
2017-07-28 10:25:07 +08:00
)
2016-11-26 01:08:06 +08:00
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
opt ENABLE_OPT
opt ALLOW_EXTERNAL_SPIRV_TOOLS
tools ENABLE_GLSLANG_BINARIES
rtti ENABLE_RTTI
)
if (ENABLE_GLSLANG_BINARIES)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON_PATH ${PYTHON3} DIRECTORY)
vcpkg_add_to_path("${PYTHON_PATH}")
endif ()
2023-10-27 04:15:55 +08:00
if (VCPKG_TARGET_IS_WINDOWS)
set(PLATFORM_OPTIONS "-DOVERRIDE_MSVCCRT=OFF")
endif ()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_EXTERNAL=OFF
-DENABLE_CTEST=OFF
-DSKIP_GLSLANG_INSTALL=OFF
${FEATURE_OPTIONS}
${PLATFORM_OPTIONS}
2016-11-26 01:08:06 +08:00
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/glslang DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/glslang-config.cmake"
2023-12-23 16:52:06 +08:00
[[${PACKAGE_PREFIX_DIR}/lib/cmake/glslang/glslang-targets.cmake]]
[[${CMAKE_CURRENT_LIST_DIR}/glslang-targets.cmake]]
)
2023-12-23 16:52:06 +08:00
file(REMOVE_RECURSE CONFIG_PATH "${CURRENT_PACKAGES_DIR}/lib/cmake" "${CURRENT_PACKAGES_DIR}/debug/lib/cmake")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/glslang/Public/ShaderLang.h" "ifdef GLSLANG_IS_SHARED_LIBRARY" "if 1")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/glslang/Include/glslang_c_interface.h" "ifdef GLSLANG_IS_SHARED_LIBRARY" "if 1")
endif()
vcpkg_copy_pdbs()
if (ENABLE_GLSLANG_BINARIES)
2023-11-21 04:20:47 +08:00
vcpkg_copy_tools(TOOL_NAMES glslang glslangValidator spirv-remap AUTO_CLEAN)
endif ()
2016-11-26 01:08:06 +08:00
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")