From 90e7eab1a9d81d1174ffc3a8cb9742af5e367305 Mon Sep 17 00:00:00 2001 From: RobbertProost Date: Tue, 8 Aug 2023 20:34:06 +0200 Subject: [PATCH] [ignition-cmake2] fix pkgconfig usage for finding OGRE (#32987) --- .../fix-findogre-pkgconfig.patch | 52 +++++++++++++++++++ ports/ignition-cmake2/portfile.cmake | 3 +- ports/ignition-cmake2/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/i-/ignition-cmake2.json | 5 ++ 5 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 ports/ignition-cmake2/fix-findogre-pkgconfig.patch diff --git a/ports/ignition-cmake2/fix-findogre-pkgconfig.patch b/ports/ignition-cmake2/fix-findogre-pkgconfig.patch new file mode 100644 index 0000000000..ced7b41962 --- /dev/null +++ b/ports/ignition-cmake2/fix-findogre-pkgconfig.patch @@ -0,0 +1,52 @@ +diff --git a/cmake/FindIgnOGRE.cmake b/cmake/FindIgnOGRE.cmake +index e00f619..6825eb2 100644 +--- a/cmake/FindIgnOGRE.cmake ++++ b/cmake/FindIgnOGRE.cmake +@@ -99,15 +99,12 @@ if (NOT WIN32) + set (OGRE_FOUND false) + else () + # set library dirs if the value is empty +- if (NOT ${OGRE_LIBRARY_DIRS} OR ${OGRE_LIBRARY_DIRS} STREQUAL "") +- execute_process(COMMAND pkg-config --variable=libdir OGRE +- OUTPUT_VARIABLE _pkgconfig_invoke_result +- RESULT_VARIABLE _pkgconfig_failed) +- if(_pkgconfig_failed) ++ if (NOT OGRE_LIBRARY_DIRS) ++ pkg_get_variable(OGRE_LIBRARY_DIRS OGRE libdir) ++ if(NOT OGRE_LIBRARY_DIRS) + IGN_BUILD_WARNING ("Failed to find OGRE's library directory. The build will succeed, but there will likely be run-time errors.") + else() +- # set ogre library dir and strip line break +- set(OGRE_LIBRARY_DIRS ${_pkgconfig_invoke_result}) ++ # strip line break + string(REGEX REPLACE "\n$" "" OGRE_LIBRARY_DIRS "${OGRE_LIBRARY_DIRS}") + + string(FIND "${OGRE_LIBRARIES}" "${OGRE_LIBRARY_DIRS}" substr_found) +@@ -147,22 +144,18 @@ if (NOT WIN32) + endif() + endforeach() + +- execute_process(COMMAND pkg-config --variable=plugindir OGRE +- OUTPUT_VARIABLE _pkgconfig_invoke_result +- RESULT_VARIABLE _pkgconfig_failed) +- if(_pkgconfig_failed) ++ pkg_get_variable(OGRE_PLUGINDIR OGRE plugindir) ++ if(NOT OGRE_PLUGINDIR) + IGN_BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but there will likely be run-time errors.") + else() +- # This variable will be substituted into cmake/setup.sh.in +- set(OGRE_PLUGINDIR ${_pkgconfig_invoke_result}) ++ # Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems ++ # when we pass it to the compiler later. ++ string(REPLACE "\n" "" OGRE_PLUGINDIR ${OGRE_PLUGINDIR}) + endif() + + ign_pkg_config_library_entry(IgnOGRE OgreMain) + + set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR}) +- # Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems +- # when we pass it to the compiler later. +- string(REPLACE "\n" "" OGRE_RESOURCE_PATH ${OGRE_RESOURCE_PATH}) + endif() + + #reset pkg config path diff --git a/ports/ignition-cmake2/portfile.cmake b/ports/ignition-cmake2/portfile.cmake index 00fca8f5d3..0ad755ed77 100644 --- a/ports/ignition-cmake2/portfile.cmake +++ b/ports/ignition-cmake2/portfile.cmake @@ -4,7 +4,8 @@ ignition_modular_library(NAME cmake VERSION ${PACKAGE_VERSION} SHA512 6ee64ff6c82c657678188be459c50a4255fd3881d758906d93361425702d04854a13a46124b20e058069f314077ba7e6c15a058153b615b3245084f066d1cbae PATCHES - add-pkgconfig-and-remove-privatefor-limit.patch) + add-pkgconfig-and-remove-privatefor-limit.patch + fix-findogre-pkgconfig.patch) # Install custom usage configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY) diff --git a/ports/ignition-cmake2/vcpkg.json b/ports/ignition-cmake2/vcpkg.json index 597efb06b0..4468f0bb70 100644 --- a/ports/ignition-cmake2/vcpkg.json +++ b/ports/ignition-cmake2/vcpkg.json @@ -1,7 +1,7 @@ { "name": "ignition-cmake2", "version": "2.16.0", - "port-version": 1, + "port-version": 2, "description": "CMake helper functions for building robotic applications", "homepage": "https://ignitionrobotics.org/libs/cmake", "license": null, diff --git a/versions/baseline.json b/versions/baseline.json index be6d0774c7..23a9df820e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3278,7 +3278,7 @@ }, "ignition-cmake2": { "baseline": "2.16.0", - "port-version": 1 + "port-version": 2 }, "ignition-common1": { "baseline": "1.1.1", diff --git a/versions/i-/ignition-cmake2.json b/versions/i-/ignition-cmake2.json index 6841d81aae..86ddc0d2f0 100644 --- a/versions/i-/ignition-cmake2.json +++ b/versions/i-/ignition-cmake2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b27712039b4d79cf56407894ede3681292712649", + "version": "2.16.0", + "port-version": 2 + }, { "git-tree": "fefe057cb14c0f698b0ebb1a717b5bba189ab355", "version": "2.16.0",