[physfs] Cleanup, fix linkage and usage issues (#28787)

* [physfs] cleanup

* Fix symbol names

* Add usage doc

* [cmake-user] Test PhysFS

* Add wrapper

* Restore msbuild for uwp
This commit is contained in:
Kai Pastor 2023-01-09 10:19:59 +01:00 committed by GitHub
parent 94e7b38824
commit a72a3d5459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 7 deletions

View File

@ -1,24 +1,27 @@
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO icculus/physfs
REF eb3383b532c5f74bfeb42ec306ba2cf80eed988c # release-3.2.0
SHA512 4231b379107a8dbacad18d98c0800bad4a3aae1bdd1db0bd4cf0c89c69bb7590ed14422c77671c28bd7556f606d3ff155ad8432940ce6222340f647f9e73ae8e
REF "release-${VERSION}"
SHA512 e0d84d6ac6bd8f0973149a5add54ed5ed890b5fabb4592ba61b59a3b3e01c05e05f1754f18d7a1c8d72e68777a23cda0c50dc0512cf57a8310a950bf908f54b1
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PHYSFS_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PHYSFS_SHARED)
set(generator_param "")
if(VCPKG_TARGET_IS_UWP)
set(configure_opts WINDOWS_USE_MSBUILD)
set(generator_param WINDOWS_USE_MSBUILD)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
${configure_opts}
${generator_param}
OPTIONS
-DPHYSFS_BUILD_STATIC=${PHYSFS_STATIC}
-DPHYSFS_BUILD_SHARED=${PHYSFS_SHARED}
-DPHYSFS_BUILD_TEST=OFF
-DPHYSFS_BUILD_DOCS=OFF
)
vcpkg_cmake_install()
@ -27,6 +30,14 @@ vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/PhysFS)
vcpkg_fixup_pkgconfig()
if(PHYSFS_STATIC)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/physfs.h" "defined(PHYSFS_STATIC)" "1")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/physfs.h" "dllexport" "dllimport")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

10
ports/physfs/usage Normal file
View File

@ -0,0 +1,10 @@
physfs provides CMake targets:
find_package(PhysFS CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:PhysFS::PhysFS>,PhysFS::PhysFS,PhysFS::PhysFS-static>)
physfs is compatible with built-in CMake targets:
find_package(PhysFS REQUIRED)
target_include_directories(main PRIVATE ${PHYSFS_INCLUDE_DIR})
target_link_libraries(main PRIVATE ${PHYSFS_LIBRARY})

View File

@ -0,0 +1,6 @@
find_library(PHYSFS_LIBRARY_RELEASE NAMES physfs physfs-static NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
find_library(PHYSFS_LIBRARY_DEBUG NAMES physfs physfs-static NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
include(SelectLibraryConfigurations)
select_library_configurations(PHYSFS)
unset(PHYSFS_FOUND)
_find_package(${ARGS})

View File

@ -1,6 +1,7 @@
{
"name": "physfs",
"version-semver": "3.2.0",
"port-version": 1,
"description": "a library to provide abstract access to various archives",
"homepage": "https://icculus.org/physfs/",
"license": "Zlib",
@ -12,7 +13,6 @@
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
}
]
}

View File

@ -125,6 +125,10 @@
"default-features": false,
"platform": "!uwp & !mingw"
},
{
"$package": "PhysFS",
"name": "physfs"
},
{
"$package": "SQLite3",
"$since": "3.14",

View File

@ -5850,7 +5850,7 @@
},
"physfs": {
"baseline": "3.2.0",
"port-version": 0
"port-version": 1
},
"physx": {
"baseline": "4.1.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "09bfe04124fab72544d0a7c27efcccb4005dc784",
"version-semver": "3.2.0",
"port-version": 1
},
{
"git-tree": "7d594baf908325d64c1223954daf61842e7be1db",
"version-semver": "3.2.0",