[allergo5] Export cmake targets, disable install pdbs to lib (#19493)

* [allergo5] Export cmake targets, disable install pdbs to lib

* version

* apply suggestions

* version

* Re-generate targets

* version

* Apply suggestions

* version
This commit is contained in:
Jack·Boos·Yu 2021-11-24 03:15:44 +08:00 committed by GitHub
parent 3a2ce6d1d1
commit d8b9ae5c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 17 deletions

View File

@ -0,0 +1,13 @@
diff --git a/cmake/Common.cmake b/cmake/Common.cmake
index 86c194f..74edef8 100644
--- a/cmake/Common.cmake
+++ b/cmake/Common.cmake
@@ -227,7 +227,7 @@ function(install_our_library target filename)
# Doesn't work, see below.
# PUBLIC_HEADER DESTINATION "include"
)
- if(MSVC AND BUILD_SHARED_LIBS)
+ if(0)
install(FILES ${CMAKE_BINARY_DIR}/lib/${filename}.pdb
DESTINATION lib
CONFIGURATIONS Debug RelWithDebInfo

View File

@ -0,0 +1,52 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7c5720b..72880c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1156,6 +1156,24 @@ if(INSTALL_PKG_CONFIG_FILES)
endforeach(versuffix)
endif(INSTALL_PKG_CONFIG_FILES)
+file(WRITE "${CMAKE_INSTALL_PREFIX}/share/unofficial-allegro5/unofficial-allegro5-config.cmake"
+[[
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegroTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_audioTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_videoTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_primitivesTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_fontTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_ttfTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_memfileTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_physfsTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_imageTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_mainTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_dialogTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_colorTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-allegro_acodecTargets.cmake")
+
+]])
+
#-----------------------------------------------------------------------------#
#
# Documentation
diff --git a/cmake/Common.cmake b/cmake/Common.cmake
index 74edef8..0cf1edb 100644
--- a/cmake/Common.cmake
+++ b/cmake/Common.cmake
@@ -220,6 +220,7 @@ endfunction(set_our_framework_properties)
function(install_our_library target filename)
install(TARGETS ${target}
+ EXPORT unofficial-${target}Targets
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
FRAMEWORK DESTINATION "${FRAMEWORK_INSTALL_PREFIX}"
@@ -227,6 +228,10 @@ function(install_our_library target filename)
# Doesn't work, see below.
# PUBLIC_HEADER DESTINATION "include"
)
+ install(EXPORT unofficial-${target}Targets
+ NAMESPACE unofficial-allegro5::
+ DESTINATION share/unofficial-allegro5
+ )
if(0)
install(FILES ${CMAKE_BINARY_DIR}/lib/${filename}.pdb
DESTINATION lib

View File

@ -6,17 +6,15 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix-pdb-install.patch
do-not-copy-pdbs-to-lib.patch
export-targets.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(VCPKG_BUILD_SHARED_LIBS ON)
else()
set(VCPKG_BUILD_SHARED_LIBS OFF)
endif()
vcpkg_configure_cmake(
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" VCPKG_BUILD_SHARED_LIBS)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DWANT_DOCS=OFF
-DALLEGRO_SDL=OFF
@ -62,14 +60,13 @@ vcpkg_configure_cmake(
OPTIONS_DEBUG -DWANT_ALLOW_SSE=OFF
)
vcpkg_install_cmake()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(GLOB PDB_GLOB ${CURRENT_BUILDTREES_DIR}-dbg/lib/*.pdb)
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}-dbg/lib/Debug)
file(COPY ${PDB_GLOB} DESTINATION ${CURRENT_BUILDTREES_DIR}-dbg/lib/Debug)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/allegro5 RENAME copyright)
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-allegro5 CONFIG_PATH share/unofficial-allegro5)
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,7 +1,7 @@
{
"name": "allegro5",
"version": "5.2.6.0",
"port-version": 1,
"port-version": 2,
"description": "Allegro is a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such as creating windows, accepting user input, loading data, drawing images, playing sounds, etc. and generally abstracting away the underlying platform. However, Allegro is not a game engine: you are free to design and structure your program as you like.",
"homepage": "https://github.com/liballeg/allegro5",
"dependencies": [
@ -17,6 +17,14 @@
"opus",
"opusfile",
"physfs",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
]
}

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "47c415593bf3de3c28afc1d476d5eab92aa8efb2",
"version": "5.2.6.0",
"port-version": 2
},
{
"git-tree": "b851d9d0babf00bdd273eec402aea26e826cb517",
"version": "5.2.6.0",

View File

@ -58,7 +58,7 @@
},
"allegro5": {
"baseline": "5.2.6.0",
"port-version": 1
"port-version": 2
},
"alsa": {
"baseline": "1.2.5.1",