mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-26 07:39:04 +08:00
24b141631e
Use release artifact file for submodules instead of checking them out manually. This prevents future mistakes of bad references of submodules. Future updates will only requires updates to the version and sha.
64 lines
2.0 KiB
CMake
64 lines
2.0 KiB
CMake
vcpkg_download_distfile(
|
|
ARCHIVE_FILE
|
|
URLS https://github.com/bkaradzic/bgfx.cmake/releases/download/v${VERSION}/bgfx.cmake.v${VERSION}.tar.gz
|
|
FILENAME bgfx.cmake.v${VERSION}.tar.gz
|
|
SHA512 369943ce0f8f2b5332d7334247d3a9ef0e28a6b1ff5ee250a01f83d1a0bd865687397da791e4c861d1c1b18ec4285f50153139f3c0e398611c7f3b672d1c751c
|
|
)
|
|
|
|
vcpkg_extract_source_archive(
|
|
SOURCE_PATH
|
|
ARCHIVE ${ARCHIVE_FILE}
|
|
)
|
|
|
|
vcpkg_check_features(
|
|
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
FEATURES tools BGFX_BUILD_TOOLS multithreaded BGFX_CONFIG_MULTITHREADED
|
|
)
|
|
|
|
if (TARGET_TRIPLET MATCHES "(windows|uwp)")
|
|
# bgfx doesn't apply __declspec(dllexport) which prevents dynamic linking
|
|
set(BGFX_LIBRARY_TYPE "STATIC")
|
|
elseif (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
set(BGFX_LIBRARY_TYPE "SHARED")
|
|
else ()
|
|
set(BGFX_LIBRARY_TYPE "STATIC")
|
|
endif ()
|
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-inject-packages.cmake" DESTINATION "${SOURCE_PATH}")
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
OPTIONS -DBGFX_LIBRARY_TYPE=${BGFX_LIBRARY_TYPE}
|
|
-DBX_AMALGAMATED=ON
|
|
-DBGFX_AMALGAMATED=ON
|
|
-DBGFX_BUILD_EXAMPLES=OFF
|
|
-DBGFX_OPENGLES_VERSION=30
|
|
-DBGFX_CMAKE_USER_SCRIPT=vcpkg-inject-packages.cmake
|
|
${FEATURE_OPTIONS}
|
|
)
|
|
|
|
vcpkg_cmake_install()
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
|
|
vcpkg_copy_pdbs()
|
|
|
|
if (BGFX_BUILD_TOOLS)
|
|
vcpkg_copy_tools(
|
|
TOOL_NAMES bin2c shaderc geometryc geometryv texturec texturev AUTO_CLEAN
|
|
)
|
|
endif ()
|
|
|
|
# Handle copyright
|
|
file(
|
|
INSTALL "${CURRENT_PACKAGES_DIR}/share/licences/${PORT}/LICENSE"
|
|
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
|
|
RENAME copyright
|
|
)
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/licences"
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
)
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
|
endif()
|