2023-11-16 07:19:00 +08:00
|
|
|
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
|
2022-12-14 10:01:39 +08:00
|
|
|
)
|
|
|
|
|
2023-11-16 07:19:00 +08:00
|
|
|
vcpkg_extract_source_archive(
|
|
|
|
SOURCE_PATH
|
|
|
|
ARCHIVE ${ARCHIVE_FILE}
|
2022-12-14 10:01:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_check_features(
|
|
|
|
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
|
|
FEATURES tools BGFX_BUILD_TOOLS multithreaded BGFX_CONFIG_MULTITHREADED
|
|
|
|
)
|
|
|
|
|
2023-07-18 04:10:54 +08:00
|
|
|
if (TARGET_TRIPLET MATCHES "(windows|uwp)")
|
|
|
|
# bgfx doesn't apply __declspec(dllexport) which prevents dynamic linking
|
2022-12-14 10:01:39 +08:00
|
|
|
set(BGFX_LIBRARY_TYPE "STATIC")
|
|
|
|
elseif (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
set(BGFX_LIBRARY_TYPE "SHARED")
|
|
|
|
else ()
|
|
|
|
set(BGFX_LIBRARY_TYPE "STATIC")
|
|
|
|
endif ()
|
|
|
|
|
2023-01-20 09:59:05 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-inject-packages.cmake" DESTINATION "${SOURCE_PATH}")
|
|
|
|
|
2022-12-14 10:01:39 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2023-11-16 07:19:00 +08:00
|
|
|
OPTIONS -DBGFX_LIBRARY_TYPE=${BGFX_LIBRARY_TYPE}
|
2022-12-14 10:01:39 +08:00
|
|
|
-DBX_AMALGAMATED=ON
|
|
|
|
-DBGFX_AMALGAMATED=ON
|
|
|
|
-DBGFX_BUILD_EXAMPLES=OFF
|
|
|
|
-DBGFX_OPENGLES_VERSION=30
|
2023-01-20 09:59:05 +08:00
|
|
|
-DBGFX_CMAKE_USER_SCRIPT=vcpkg-inject-packages.cmake
|
2022-12-14 10:01:39 +08:00
|
|
|
${FEATURE_OPTIONS}
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_cmake_install()
|
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
|
|
|
if (BGFX_BUILD_TOOLS)
|
|
|
|
vcpkg_copy_tools(
|
2023-01-20 09:59:05 +08:00
|
|
|
TOOL_NAMES bin2c shaderc geometryc geometryv texturec texturev AUTO_CLEAN
|
2022-12-14 10:01:39 +08:00
|
|
|
)
|
|
|
|
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()
|