Skip to content

Commit

Permalink
[allergo5] Export cmake targets, disable install pdbs to lib (#19493)
Browse files Browse the repository at this point in the history
* [allergo5] Export cmake targets, disable install pdbs to lib

* version

* apply suggestions

* version

* Re-generate targets

* version

* Apply suggestions

* version
  • Loading branch information
JackBoosY committed Nov 23, 2021
1 parent 3a2ce6d commit d8b9ae5
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 17 deletions.
13 changes: 13 additions & 0 deletions ports/allegro5/do-not-copy-pdbs-to-lib.patch
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions ports/allegro5/export-targets.patch
Original file line number Diff line number Diff line change
@@ -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
27 changes: 12 additions & 15 deletions ports/allegro5/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
10 changes: 9 additions & 1 deletion ports/allegro5/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -17,6 +17,14 @@
"opus",
"opusfile",
"physfs",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
]
}
5 changes: 5 additions & 0 deletions versions/a-/allegro5.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "47c415593bf3de3c28afc1d476d5eab92aa8efb2",
"version": "5.2.6.0",
"port-version": 2
},
{
"git-tree": "b851d9d0babf00bdd273eec402aea26e826cb517",
"version": "5.2.6.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"allegro5": {
"baseline": "5.2.6.0",
"port-version": 1
"port-version": 2
},
"alsa": {
"baseline": "1.2.5.1",
Expand Down

0 comments on commit d8b9ae5

Please sign in to comment.