vcpkg/ports/bgfx/portfile.cmake

87 lines
2.8 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO "bkaradzic/bgfx.cmake"
HEAD_REF master
REF v${VERSION}
SHA512 b1f3c46d0f4985df3a09c74f627f1d0c426f204a8c680a91a65099c146cd41215e9af1c5cdf4a0a559d020f93455b71a6bc1412628cfd818467fd59996542377
)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH_BX
REPO "bkaradzic/bx"
HEAD_REF master
REF fa1411e4aa111c8b004c97660ab31ba1a5287835
SHA512 0c6bd7e41c6dd3263c01d761aefdd55d2ed527ca694b52f563c6ded3ba5569df1492c8d04e5f76de3b1bdf7c5ca2978b8ec394d48ea29593535979f204d3ad0c
)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH_BIMG
REPO "bkaradzic/bimg"
HEAD_REF master
REF 7afa2419254fd466c013a51bdeb0bee3022619c4
SHA512 514deed00f8bc4106f67b777dca72d0ed0accb1ae057ad37d22a21c83ad3a85ad23d220ac0cf40b6a8006d43c308b1acfad464b51e64075aa01598731a1557df
)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH_BGFX
REPO "bkaradzic/bgfx"
HEAD_REF master
REF 6f36b4fb3a0d76090eb2727ecf11abac46eef8aa
SHA512 cb88fcba51184611ecf969e5ec391eabd43227d3e17071c70c75eed79e86da7fe9b3c07c01e88d2230a8245ec0c3d192b1694c289019bb4f9c1c4973b0b11314
)
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES tools BGFX_BUILD_TOOLS multithreaded BGFX_CONFIG_MULTITHREADED
)
if (BGFX_BUILD_TOOLS AND TARGET_TRIPLET MATCHES "(windows|uwp)")
# bgfx doesn't apply __declspec(dllexport) which prevents dynamic linking for tools
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 -DBX_DIR=${SOURCE_PATH_BX}
-DBIMG_DIR=${SOURCE_PATH_BIMG}
-DBGFX_DIR=${SOURCE_PATH_BGFX}
-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()