From 16f700e5dbd5e8bec6324b07cf309d509b8195d2 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 24 Mar 2025 18:28:31 +0100 Subject: [PATCH] [vcpkg-ci-gz-common, gz-*,spdlog] New test port, fixes (#44389) --- ports/gz-cmake/ffempg_depends_interface.patch | 70 -------- .../{dependencies.patch => find-modules.diff} | 152 +++++++----------- ports/gz-cmake/gz-find-package.diff | 22 +++ ports/gz-cmake/gz-import-target.diff | 20 +++ ports/gz-cmake/lock-dependencies.diff | 18 +++ ports/gz-cmake/pkg-check-modules.diff | 35 ++++ ports/gz-cmake/portfile.cmake | 7 +- ports/gz-cmake/usage | 5 +- ports/gz-cmake/vcpkg.json | 3 +- ports/gz-common/detect_tinyxml.patch | 13 -- ports/gz-common/gz-utils3-log.diff | 12 ++ ports/gz-common/portfile.cmake | 12 +- ports/gz-common/pthread.diff | 15 ++ ports/gz-common/vcpkg.json | 24 ++- ports/gz-physics/dependencies.patch | 32 ++-- ports/gz-physics/portfile.cmake | 1 - ports/gz-physics/vcpkg.json | 1 + ports/spdlog/portfile.cmake | 4 + ports/spdlog/vcpkg.json | 1 + .../vcpkg-ci-gz-common/portfile.cmake | 10 ++ .../vcpkg-ci-gz-common/project/CMakeLists.txt | 16 ++ .../vcpkg-ci-gz-common/project/main.cpp | 9 ++ .../test_ports/vcpkg-ci-gz-common/vcpkg.json | 17 ++ versions/baseline.json | 8 +- versions/g-/gz-cmake.json | 5 + versions/g-/gz-common.json | 5 + versions/g-/gz-physics.json | 5 + versions/s-/spdlog.json | 5 + 28 files changed, 307 insertions(+), 220 deletions(-) delete mode 100644 ports/gz-cmake/ffempg_depends_interface.patch rename ports/gz-cmake/{dependencies.patch => find-modules.diff} (53%) create mode 100644 ports/gz-cmake/gz-find-package.diff create mode 100644 ports/gz-cmake/gz-import-target.diff create mode 100644 ports/gz-cmake/lock-dependencies.diff create mode 100644 ports/gz-cmake/pkg-check-modules.diff delete mode 100644 ports/gz-common/detect_tinyxml.patch create mode 100644 ports/gz-common/gz-utils3-log.diff create mode 100644 ports/gz-common/pthread.diff create mode 100644 scripts/test_ports/vcpkg-ci-gz-common/portfile.cmake create mode 100644 scripts/test_ports/vcpkg-ci-gz-common/project/CMakeLists.txt create mode 100644 scripts/test_ports/vcpkg-ci-gz-common/project/main.cpp create mode 100644 scripts/test_ports/vcpkg-ci-gz-common/vcpkg.json diff --git a/ports/gz-cmake/ffempg_depends_interface.patch b/ports/gz-cmake/ffempg_depends_interface.patch deleted file mode 100644 index 093465e9fb..0000000000 --- a/ports/gz-cmake/ffempg_depends_interface.patch +++ /dev/null @@ -1,70 +0,0 @@ -diff --git a/cmake/FindAVCODEC.cmake b/cmake/FindAVCODEC.cmake ---- a/cmake/FindAVCODEC.cmake -+++ b/cmake/FindAVCODEC.cmake -@@ -15,9 +15,9 @@ - # - ######################################## - # Find avcodec - include(GzPkgConfig) --gz_pkg_check_modules_quiet(AVCODEC libavcodec) -+gz_pkg_check_modules_quiet(AVCODEC libavcodec INTERFACE) - - if(NOT AVCODEC_FOUND) - include(GzManualSearch) - gz_manual_search(AVCODEC -diff --git a/cmake/FindAVDEVICE.cmake b/cmake/FindAVDEVICE.cmake ---- a/cmake/FindAVDEVICE.cmake -+++ b/cmake/FindAVDEVICE.cmake -@@ -19,9 +19,9 @@ - set(av_minor ${AVDEVICE_FIND_VERSION_MINOR}) - set(av_patch ${AVDEVICE_FIND_VERSION_PATCH}) - - include(GzPkgConfig) --gz_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${av_patch}") -+gz_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${av_patch}" INTERFACE) - - if(NOT AVDEVICE_FOUND) - include(GzManualSearch) - gz_manual_search(AVDEVICE -diff --git a/cmake/FindAVFORMAT.cmake b/cmake/FindAVFORMAT.cmake ---- a/cmake/FindAVFORMAT.cmake -+++ b/cmake/FindAVFORMAT.cmake -@@ -15,9 +15,9 @@ - # - ######################################## - # Find AV format - include(GzPkgConfig) --gz_pkg_check_modules_quiet(AVFORMAT libavformat) -+gz_pkg_check_modules_quiet(AVFORMAT libavformat INTERFACE) - - if(NOT AVFORMAT_FOUND) - include(GzManualSearch) - gz_manual_search(AVFORMAT -diff --git a/cmake/FindAVUTIL.cmake b/cmake/FindAVUTIL.cmake ---- a/cmake/FindAVUTIL.cmake -+++ b/cmake/FindAVUTIL.cmake -@@ -15,9 +15,9 @@ - # - ######################################## - # Find avutil - include(GzPkgConfig) --gz_pkg_check_modules_quiet(AVUTIL libavutil) -+gz_pkg_check_modules_quiet(AVUTIL libavutil INTERFACE) - - if(NOT AVUTIL_FOUND) - include(GzManualSearch) - gz_manual_search(AVUTIL -diff --git a/cmake/FindSWSCALE.cmake b/cmake/FindSWSCALE.cmake ---- a/cmake/FindSWSCALE.cmake -+++ b/cmake/FindSWSCALE.cmake -@@ -15,9 +15,9 @@ - # - ######################################## - # Find libswscale format - include(GzPkgConfig) --gz_pkg_check_modules_quiet(SWSCALE libswscale) -+gz_pkg_check_modules_quiet(SWSCALE libswscale INTERFACE) - - if(NOT SWSCALE_FOUND) - include(GzManualSearch) - gz_manual_search(SWSCALE diff --git a/ports/gz-cmake/dependencies.patch b/ports/gz-cmake/find-modules.diff similarity index 53% rename from ports/gz-cmake/dependencies.patch rename to ports/gz-cmake/find-modules.diff index 1c0bf48d09..3017d318c4 100644 --- a/ports/gz-cmake/dependencies.patch +++ b/ports/gz-cmake/find-modules.diff @@ -1,28 +1,34 @@ diff --git a/cmake/FindFreeImage.cmake b/cmake/FindFreeImage.cmake -index 8a5836e..7f926cc 100644 +index 8a5836e..d7e41d2 100644 --- a/cmake/FindFreeImage.cmake +++ b/cmake/FindFreeImage.cmake -@@ -23,7 +23,17 @@ set(minor_version ${FreeImage_FIND_VERSION_MINOR}) +@@ -23,7 +23,23 @@ set(minor_version ${FreeImage_FIND_VERSION_MINOR}) # Set the full version number set(full_version ${major_version}.${minor_version}) -if (NOT WIN32) -+if(FreeImage_FOUND) -+ # done -+elseif(1) -+ find_package(freeimage CONFIG) ++if(1) ++ find_package(freeimage CONFIG) # not using NAMES to avoid version check + if(freeimage_FOUND) + set(FreeImage_FOUND 1) + set(FreeImage_LIBRARIES freeimage::FreeImage) + include(GzImportTarget) + gz_import_target(FreeImage INTERFACE) ++ # sorry, no transitive link libs for pkgconfig ++ include(GzPkgConfig) ++ find_library(FreeImage_LIBRARY NAMES FreeImage FreeImaged NAMES_PER_DIR) ++ if(FreeImage_LIBRARY MATCHES "FreeImaged[^/]*\$") ++ gz_pkg_config_library_entry(FreeImage "FreeImaged") ++ else() ++ gz_pkg_config_library_entry(FreeImage "FreeImage") ++ endif() + endif() +elseif(0) include(GzPkgConfig) gz_pkg_config_library_entry(FreeImage freeimage) diff --git a/cmake/FindGTS.cmake b/cmake/FindGTS.cmake -index b400483..77f1247 100644 +index b400483..48cf9f7 100644 --- a/cmake/FindGTS.cmake +++ b/cmake/FindGTS.cmake @@ -16,7 +16,7 @@ @@ -30,12 +36,12 @@ index b400483..77f1247 100644 # Find GNU Triangulation Surface Library -if (NOT WIN32) -+if (1) ++if(1) # Configuration using pkg-config modules include(GzPkgConfig) gz_pkg_check_modules(GTS gts) diff --git a/cmake/FindGzBullet.cmake b/cmake/FindGzBullet.cmake -index 70f7a76..4a334d9 100644 +index 70f7a76..e39a3fd 100644 --- a/cmake/FindGzBullet.cmake +++ b/cmake/FindGzBullet.cmake @@ -31,7 +31,7 @@ endif() @@ -43,28 +49,17 @@ index 70f7a76..4a334d9 100644 # CMake. Otherwise, we may end up using the BulletConfig.cmake file distributed # with Bullet, which uses relative paths and may break transitive dependencies. -find_package(Bullet MODULE ${gz_quiet_arg}) -+find_package(Bullet CONFIG REQUIRED) ++find_package(BULLET NAMES Bullet ${gz_quiet_arg}) set(GzBullet_FOUND false) # create Bullet target -@@ -39,6 +39,7 @@ if(BULLET_FOUND) - set(GzBullet_FOUND true) - - gz_import_target(GzBullet -+ INTERFACE - TARGET_NAME GzBullet::GzBullet - LIB_VAR BULLET_LIBRARIES - INCLUDE_VAR BULLET_INCLUDE_DIRS diff --git a/cmake/FindGzOGRE2.cmake b/cmake/FindGzOGRE2.cmake -index 2decd84..3b71698 100644 +index 2decd84..dd2c2c2 100644 --- a/cmake/FindGzOGRE2.cmake +++ b/cmake/FindGzOGRE2.cmake -@@ -144,9 +144,9 @@ macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE) - endmacro() - +@@ -146,7 +146,7 @@ endmacro() find_package(PkgConfig QUIET) --if (PkgConfig_FOUND) -+if (UNIX AND NOT APPLE) + if (PkgConfig_FOUND) set(PKG_CONFIG_PATH_ORIGINAL $ENV{PKG_CONFIG_PATH}) - foreach (GZ_OGRE2_PROJECT_NAME "OGRE2" "OGRE-Next") + foreach (GZ_OGRE2_PROJECT_NAME "OGRE-Next") @@ -79,33 +74,49 @@ index 2decd84..3b71698 100644 set(OGRE2_LIBRARIES ${${GZ_OGRE2_PROJECT_NAME}_LIBRARIES}) # sync possible Ogre-Next ot OGRE2 else() # look for OGRE2 installed from source -@@ -309,6 +310,8 @@ if (PkgConfig_FOUND) +@@ -264,10 +265,10 @@ if (PkgConfig_FOUND) + get_filename_component(dir_name "${dir}" NAME) + if ("${dir_name}" STREQUAL ${GZ_PKG_NAME}) + set(dir_include "${dir}/RenderSystems/GL3Plus") +- else() +- set(dir_include "${dir}") ++ if(EXISTS "${dir_include}") ++ list(APPEND OGRE2_INCLUDE_DIRS "${dir_include}") ++ endif() + endif() +- list(APPEND OGRE2_INCLUDE_DIRS ${dir_include}) + endforeach() + + file(READ ${OGRE2_INCLUDE}/OgrePrerequisites.h OGRE_TEMP_VERSION_CONTENT) +@@ -309,6 +310,9 @@ if (PkgConfig_FOUND) "${OGRE2LIBNAME}${component}_d" "${OGRE2LIBNAME}${component}.${OGRE2_VERSION}" "${OGRE2LIBNAME}${component}" + "${OGRE2LIBNAME}${component}Static" -+ "${OGRE2LIBNAME}${component}Static_d" ++ "${OGRE2LIBNAME}${component}Static_d" ++ NAMES_PER_DIR HINTS ${OGRE2_LIBRARY_DIRS}) if (NOT "${OGRE2-${component}}" STREQUAL "OGRE2-${component}-NOTFOUND") message(STATUS " + component ${component}: found") -@@ -404,13 +407,21 @@ else() #PkgConfig_FOUND +@@ -400,17 +404,22 @@ else() #PkgConfig_FOUND + set(OGRE2_VERSION_MINOR "") + set(OGRE2_RESOURCE_PATH "") + +- set(OGRE2_SEARCH_VER "OGRE-${GzOGRE2_FIND_VERSION_MAJOR}.${GzOGRE2_FIND_VERSION_MINOR}") ++ set(OGRE2_SEARCH_VER "OGRE-Next") set(OGRE2_PATHS "") set(OGRE2_INC_PATHS "") foreach(_rootPath ${VCPKG_CMAKE_FIND_ROOT_PATH}) - list(APPEND OGRE2_PATHS "${_rootPath}/lib/${OGRE2_SEARCH_VER}/") - list(APPEND OGRE2_PATHS "${_rootPath}/lib/${OGRE2_SEARCH_VER}/manual-link/") -- list(APPEND OGRE2_INC_PATHS "${_rootPath}/include/${OGRE2_SEARCH_VER}") -+ get_filename_component(debug_dir "${_rootPath}" NAME) -+ if(debug_dir MATCHES "debug" AND CMAKE_BUILD_TYPE MATCHES Debug OR NOT debug_dir MATCHES "debug" AND CMAKE_BUILD_TYPE MATCHES Release) -+ list(APPEND OGRE2_PATHS "${_rootPath}/lib/") -+ list(APPEND OGRE2_PATHS "${_rootPath}/lib/manual-link/") -+ endif() -+ list(APPEND OGRE2_INC_PATHS "${_rootPath}/include/OGRE-Next") ++ list(APPEND OGRE2_PATHS "${_rootPath}/lib") ++ list(APPEND OGRE2_PATHS "${_rootPath}/lib/manual-link") + list(APPEND OGRE2_INC_PATHS "${_rootPath}/include/${OGRE2_SEARCH_VER}") endforeach() find_library(OGRE2_LIBRARY - NAMES "OgreMain" -+ NAMES ++ NAMES + "OgreNextMain" + "OgreNextMainStatic" + "OgreNextMain_d" @@ -114,7 +125,7 @@ index 2decd84..3b71698 100644 HINTS ${OGRE2_PATHS} NO_DEFAULT_PATH) -@@ -450,8 +461,11 @@ else() #PkgConfig_FOUND +@@ -450,8 +459,11 @@ else() #PkgConfig_FOUND find_library(${PREFIX}_LIBRARY NAMES @@ -124,19 +135,19 @@ index 2decd84..3b71698 100644 + "OgreNext${COMPONENT}_d" + "OgreNext${COMPONENT}Static" + "OgreNext${COMPONENT}Static_d" -+ NAMES_PER_DIR ++ NAMES_PER_DIR HINTS ${OGRE2_LIBRARY_DIRS} NO_DEFAULT_PATH) -@@ -510,6 +524,7 @@ else() #PkgConfig_FOUND - ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include) - ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus/include) - ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include) +@@ -506,6 +518,7 @@ else() #PkgConfig_FOUND + ogre_find_component(Overlay OgreOverlaySystem.h "Overlay") + ogre_find_component(HlmsPbs OgreHlmsPbs.h Hlms/Pbs/) + ogre_find_component(HlmsUnlit OgreHlmsUnlit.h Hlms/Unlit) + ogre_find_component(PlanarReflections OgrePlanarReflections.h PlanarReflections) - foreach(component ${GzOGRE2_FIND_COMPONENTS}) - set(PREFIX OGRE2_${component}) -@@ -521,7 +536,7 @@ else() #PkgConfig_FOUND + ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include) + ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus/include) +@@ -521,7 +534,7 @@ else() #PkgConfig_FOUND if(${HLMS_POS} GREATER -1) foreach (dir ${OGRE2_INCLUDE_DIRS}) get_filename_component(dir_name "${dir}" NAME) @@ -145,56 +156,3 @@ index 2decd84..3b71698 100644 set(dir_include "${dir}/Hlms/Common") if (EXISTS ${dir_include}) list(APPEND component_INCLUDE_DIRS ${dir_include}) -diff --git a/cmake/FindTINYXML2.cmake b/cmake/FindTINYXML2.cmake -index 5a5a147..68ba2a3 100644 ---- a/cmake/FindTINYXML2.cmake -+++ b/cmake/FindTINYXML2.cmake -@@ -18,11 +18,16 @@ - - include(GzPkgConfig) - --# Use pkg_check_modules to start --gz_pkg_check_modules_quiet(TINYXML2 tinyxml2) - - # If that failed, then fall back to manual detection (necessary for MacOS) - if(NOT TINYXML2_FOUND) -+ find_package(TINYXML2 NAMES tinyxml2) -+ if(TINYXML2_FOUND) -+ set(TINYXML2_LIBRARIES tinyxml2::tinyxml2) -+ include(GzImportTarget) -+ gz_import_target(TINYXML2 INTERFACE) -+ endif() -+elseif(0) - - if(NOT TINYXML2_FIND_QUIETLY) - message(STATUS "Attempting manual search for tinyxml2") -diff --git a/cmake/GzFindPackage.cmake b/cmake/GzFindPackage.cmake -index 93da803..22fdec8 100644 ---- a/cmake/GzFindPackage.cmake -+++ b/cmake/GzFindPackage.cmake -@@ -163,6 +163,7 @@ macro(gz_find_package PACKAGE_NAME_) - # Parse the arguments - _gz_cmake_parse_arguments(gz_find_package "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - -+ include("${CMAKE_CURRENT_LIST_DIR}/vcpkg/${PACKAGE_NAME}.cmake" OPTIONAL) - #------------------------------------ - # Construct the arguments to pass to find_package - set(${PACKAGE_NAME}_find_package_args ${PACKAGE_NAME}) -@@ -177,6 +178,8 @@ macro(gz_find_package PACKAGE_NAME_) - - if(gz_find_package_EXACT) - list(APPEND ${PACKAGE_NAME}_find_package_args EXACT) -+ elseif(gz_find_package_VERSION AND NOT gz_find_package_PKGCONFIG_VER_COMPARISON) -+ set(gz_find_package_PKGCONFIG_VER_COMPARISON >=) - endif() - - if(gz_find_package_CONFIG) -@@ -344,7 +347,7 @@ macro(gz_find_package PACKAGE_NAME_) - # ${component}_CMAKE_DEPENDENCIES variables that are specific to those - # componenets - foreach(component ${gz_find_package_REQUIRED_BY}) -- if(NOT ${component}_${PACKAGE_NAME}_PRIVATE) -+ if(NOT ${component}_${PACKAGE_NAME}_PRIVATE OR NOT BUILD_SHARED_LIBS) - gz_string_append(${component}_CMAKE_DEPENDENCIES "${${PACKAGE_NAME}_find_dependency}" DELIM "\n") - endif() - endforeach() diff --git a/ports/gz-cmake/gz-find-package.diff b/ports/gz-cmake/gz-find-package.diff new file mode 100644 index 0000000000..856863bc05 --- /dev/null +++ b/ports/gz-cmake/gz-find-package.diff @@ -0,0 +1,22 @@ +diff --git a/cmake/GzFindPackage.cmake b/cmake/GzFindPackage.cmake +index 93da803..c16e3ba 100644 +--- a/cmake/GzFindPackage.cmake ++++ b/cmake/GzFindPackage.cmake +@@ -177,6 +177,8 @@ macro(gz_find_package PACKAGE_NAME_) + + if(gz_find_package_EXACT) + list(APPEND ${PACKAGE_NAME}_find_package_args EXACT) ++ elseif(gz_find_package_VERSION AND NOT gz_find_package_PKGCONFIG_VER_COMPARISON) ++ set(gz_find_package_PKGCONFIG_VER_COMPARISON >=) + endif() + + if(gz_find_package_CONFIG) +@@ -344,7 +346,7 @@ macro(gz_find_package PACKAGE_NAME_) + # ${component}_CMAKE_DEPENDENCIES variables that are specific to those + # componenets + foreach(component ${gz_find_package_REQUIRED_BY}) +- if(NOT ${component}_${PACKAGE_NAME}_PRIVATE) ++ if(NOT ${component}_${PACKAGE_NAME}_PRIVATE OR NOT BUILD_SHARED_LIBS) + gz_string_append(${component}_CMAKE_DEPENDENCIES "${${PACKAGE_NAME}_find_dependency}" DELIM "\n") + endif() + endforeach() diff --git a/ports/gz-cmake/gz-import-target.diff b/ports/gz-cmake/gz-import-target.diff new file mode 100644 index 0000000000..a6f1f790cb --- /dev/null +++ b/ports/gz-cmake/gz-import-target.diff @@ -0,0 +1,20 @@ +diff --git a/cmake/GzImportTarget.cmake b/cmake/GzImportTarget.cmake +index 934df6d..aba4129 100644 +--- a/cmake/GzImportTarget.cmake ++++ b/cmake/GzImportTarget.cmake +@@ -83,6 +83,15 @@ macro(gz_import_target package) + set(gz_import_target_CFLAGS_VAR ${package}_CFLAGS) + endif() + ++ # In vcpkg, some _LIBRARIES carry targets. Example: BULLET_LIBRARIES ++ # Targets must not be used for IMPORTED_LOCATION or IMPORTED_IMPLIB. ++ if(NOT gz_import_target_INTERFACE) ++ list(GET "${gz_import_target_LIB_VAR}" 0 gz_import_target_first_item) ++ if(TARGET "${gz_import_target_first_item}") ++ set(gz_import_target_INTERFACE TRUE) ++ endif() ++ endif() ++ + #------------------------------------ + # Link against this "imported" target by saying + # target_link_libraries(mytarget package::package), instead of linking diff --git a/ports/gz-cmake/lock-dependencies.diff b/ports/gz-cmake/lock-dependencies.diff new file mode 100644 index 0000000000..1c6c4cdf0f --- /dev/null +++ b/ports/gz-cmake/lock-dependencies.diff @@ -0,0 +1,18 @@ +diff --git a/cmake/GzConfigureBuild.cmake b/cmake/GzConfigureBuild.cmake +index 3122c15..f64d695 100644 +--- a/cmake/GzConfigureBuild.cmake ++++ b/cmake/GzConfigureBuild.cmake +@@ -265,6 +265,13 @@ macro(gz_configure_build) + gz_string_append(skip_msg "by user request") + elseif(${component}_MISSING_DEPS) + gz_string_append(skip_msg "because the following packages are missing: ${${component}_MISSING_DEPS}") ++ if(NOT DEFINED GZ_LOCK_DEPENDENCIES OR "${GZ_LOCK_DEPENDENCIES}") ++ message(SEND_ERROR "Vcpkg ports must lock dependencies." ++ " To enable ${component}, provide missing dependencies." ++ " To disable ${component}, pass -DSKIP_${component}=true." ++ " To disable this check, pass -DGZ_LOCK_DEPENDENCIES=OFF." ++ ) ++ endif() + endif() + + message(STATUS "${skip_msg}") diff --git a/ports/gz-cmake/pkg-check-modules.diff b/ports/gz-cmake/pkg-check-modules.diff new file mode 100644 index 0000000000..72490741c3 --- /dev/null +++ b/ports/gz-cmake/pkg-check-modules.diff @@ -0,0 +1,35 @@ +diff --git a/cmake/GzPkgConfig.cmake b/cmake/GzPkgConfig.cmake +index 5fcdb76..9ff169c 100644 +--- a/cmake/GzPkgConfig.cmake ++++ b/cmake/GzPkgConfig.cmake +@@ -105,6 +105,7 @@ macro(gz_pkg_check_modules_quiet package signature) + unset(${package}_LIBRARIES) + + pkg_check_modules(${package} ++ IMPORTED_TARGET + ${gz_pkg_check_modules_quiet_arg} + ${gz_pkg_check_modules_no_cmake_environment_path_arg} + ${signature}) +@@ -155,15 +156,13 @@ macro(gz_pkg_check_modules_quiet package signature) + # + # TODO: How would we deal with multiple modules that are in different + # directories? How does cmake-3.6+ handle that situation? +- _gz_pkgconfig_find_libraries( +- ${package}_LIBRARIES +- ${package} +- "${${package}_LIBRARIES}" +- "${${package}_LIBRARY_DIRS}") +- +- include(GzImportTarget) +- gz_import_target(${package} ${_gz_pkg_check_modules_interface_option} +- TARGET_NAME ${gz_pkg_check_modules_TARGET_NAME}) ++ ++ if(NOT TARGET ${gz_pkg_check_modules_TARGET_NAME}) ++ add_library(${gz_pkg_check_modules_TARGET_NAME} INTERFACE IMPORTED) ++ set_target_properties(${gz_pkg_check_modules_TARGET_NAME} PROPERTIES ++ INTERFACE_LINK_LIBRARIES PkgConfig::${package} ++ ) ++ endif() + + endif() + diff --git a/ports/gz-cmake/portfile.cmake b/ports/gz-cmake/portfile.cmake index 91c42a1e9a..259e108143 100644 --- a/ports/gz-cmake/portfile.cmake +++ b/ports/gz-cmake/portfile.cmake @@ -8,8 +8,11 @@ ignition_modular_library( VERSION ${VERSION} SHA512 d761aba28fc79af6bbb021215367e48e1b7449885d0410a0cabd09674a59b17132810ebb796fe0e1ddefc1510aba832fb192cc908156d8eae15e35c1afe464c7 PATCHES - dependencies.patch - ffempg_depends_interface.patch + find-modules.diff + gz-find-package.diff + gz-import-target.diff + lock-dependencies.diff + pkg-check-modules.diff ) configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY) diff --git a/ports/gz-cmake/usage b/ports/gz-cmake/usage index aef7e08a93..4f3b4c68ed 100644 --- a/ports/gz-cmake/usage +++ b/ports/gz-cmake/usage @@ -1,3 +1,4 @@ -The package @PORT@@VERSION_MAJOR@ provides CMake integration: +gz-cmake provides CMake integration: - find_package(@PORT@@VERSION_MAJOR@ CONFIG REQUIRED) + find_package(gz-cmake@VERSION_MAJOR@ REQUIRED) + gz_configure_project(...) diff --git a/ports/gz-cmake/vcpkg.json b/ports/gz-cmake/vcpkg.json index ad510a668e..a2eeddb045 100644 --- a/ports/gz-cmake/vcpkg.json +++ b/ports/gz-cmake/vcpkg.json @@ -1,8 +1,9 @@ { "name": "gz-cmake", "version": "4.1.1", + "port-version": 1, "description": "CMake helper functions for building robotic applications", - "homepage": "https://ignitionrobotics.org/libs/cmake", + "homepage": "https://gazebosim.org/libs/cmake/", "license": null, "dependencies": [ { diff --git a/ports/gz-common/detect_tinyxml.patch b/ports/gz-common/detect_tinyxml.patch deleted file mode 100644 index ada05c511f..0000000000 --- a/ports/gz-common/detect_tinyxml.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -49,9 +49,8 @@ - - #-------------------------------------- - # Find Tinyxml2 - gz_find_package(TINYXML2 PRETTY tinyxml2 -- VERSION 6.0 - REQUIRED_BY graphics - PRIVATE_FOR graphics) - - #-------------------------------------- diff --git a/ports/gz-common/gz-utils3-log.diff b/ports/gz-common/gz-utils3-log.diff new file mode 100644 index 0000000000..9f762acc74 --- /dev/null +++ b/ports/gz-common/gz-utils3-log.diff @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ae68cb7..9c5f952 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,6 +45,7 @@ set(GZ_MATH_VER ${gz-math8_VERSION_MAJOR}) + #-------------------------------------- + # Find gz-utils + gz_find_package(gz-utils3 REQUIRED COMPONENTS log) ++list(APPEND PROJECT_PKGCONFIG_REQUIRES_PRIVATE gz-utils3-log) + set(GZ_UTILS_VER ${gz-utils3_VERSION_MAJOR}) + + #-------------------------------------- diff --git a/ports/gz-common/portfile.cmake b/ports/gz-common/portfile.cmake index 6838ec1cc6..19af0acbaa 100644 --- a/ports/gz-common/portfile.cmake +++ b/ports/gz-common/portfile.cmake @@ -7,17 +7,9 @@ ignition_modular_library( REF ${PORT}${VERSION_MAJOR}_${VERSION} VERSION ${VERSION} SHA512 0c652285b32d2d2f781595416fd80d6e52a6b765ba968d0018accc3688f4ee9d6ce62dbea74b98fa43ea40641c47020246e13645eac7940aa483057c958d3807 - OPTIONS - -DBUILD_TESTING=OFF - "-DPKG_CONFIG_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf${VCPKG_HOST_EXECUTABLE_SUFFIX}" PATCHES + gz-utils3-log.diff gz_remotery_vis.patch + pthread.diff 003-include-chrono.patch - detect_tinyxml.patch ) - -foreach(component IN ITEMS av events geospatial graphics io profiler testing) - if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/share/${PORT}${VERSION_MAJOR}-${component}/${PORT}${VERSION_MAJOR}-${component}-config.cmake") - message(FATAL_ERROR "Failed to install component ${component}. Check configuration logs for missing dependencies.") - endif() -endforeach() diff --git a/ports/gz-common/pthread.diff b/ports/gz-common/pthread.diff new file mode 100644 index 0000000000..14ef278755 --- /dev/null +++ b/ports/gz-common/pthread.diff @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9c5f952..d44132e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -37,6 +37,10 @@ endif() + #============================================================================ + message(STATUS "\n\n-- ====== Finding Dependencies ======") + ++gz_find_package(Threads REQUIRED IGNORE_PKGCONFIG) ++add_library(pthread ALIAS Threads::Threads) ++list(APPEND PROJECT_PKGCONFIG_LIBS_PRIVATE "${CMAKE_THREAD_LIBS_INIT}") ++ + #-------------------------------------- + # Find gz-math + gz_find_package(gz-math8 REQUIRED_BY geospatial graphics events) diff --git a/ports/gz-common/vcpkg.json b/ports/gz-common/vcpkg.json index ef8a6091f7..f228c4dbf5 100644 --- a/ports/gz-common/vcpkg.json +++ b/ports/gz-common/vcpkg.json @@ -1,8 +1,9 @@ { "name": "gz-common", "version": "6.0.2", + "port-version": 1, "description": "Common libraries for robotics applications", - "homepage": "https://ignitionrobotics.org/libs/common", + "homepage": "https://gazebosim.org/libs/common/", "license": "Apache-2.0", "dependencies": [ "assimp", @@ -10,9 +11,21 @@ "name": "dlfcn-win32", "platform": "windows | uwp" }, - "ffmpeg", + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "avcodec", + "avdevice", + "avformat", + "swscale" + ] + }, "freeimage", - "gdal", + { + "name": "gdal", + "default-features": false + }, "gz-cmake", "gz-math", "gz-utils", @@ -24,11 +37,6 @@ "name": "libuuid", "platform": "!windows & !osx" }, - { - "name": "pkgconf", - "host": true, - "default-features": false - }, "tinyxml2" ] } diff --git a/ports/gz-physics/dependencies.patch b/ports/gz-physics/dependencies.patch index 1739f5de88..2ae4a817a8 100644 --- a/ports/gz-physics/dependencies.patch +++ b/ports/gz-physics/dependencies.patch @@ -1,12 +1,20 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b16b4dd1..0f5e2771 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -88,7 +88,6 @@ gz_find_package(DART - gz_find_package(GzBullet - VERSION 2.87 - REQUIRED_BY bullet bullet-featherstone -- PKGCONFIG bullet - PKGCONFIG_VER_COMPARISON >=) - - message(STATUS "-------------------------------------------\n") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b16b4dd..3c44e8d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -85,10 +85,14 @@ gz_find_package(DART + + #-------------------------------------- + # Find bullet for the bullet plugin wrapper ++set(bullet_pkgconfig PKGCONFIG bullet) ++if(WIN32) ++ set(bullet_pkgconfig PKGCONFIG_IGNORE) ++endif() + gz_find_package(GzBullet + VERSION 2.87 + REQUIRED_BY bullet bullet-featherstone +- PKGCONFIG bullet ++ ${bullet_pkgconfig} + PKGCONFIG_VER_COMPARISON >=) + + message(STATUS "-------------------------------------------\n") diff --git a/ports/gz-physics/portfile.cmake b/ports/gz-physics/portfile.cmake index 739c12e4a5..65842a8acc 100644 --- a/ports/gz-physics/portfile.cmake +++ b/ports/gz-physics/portfile.cmake @@ -7,7 +7,6 @@ ignition_modular_library( REF ${PORT}${VERSION_MAJOR}_${VERSION} VERSION ${VERSION} SHA512 8f62af3838e9189c3a93fea87991c390ddd4fa0d5c0ecb80f8347bfb2f5892ec73c4bca1ac05d083d2a5adcbbd698e76215d56498bd648834a46af7784e8ce57 - OPTIONS PATCHES dependencies.patch ) diff --git a/ports/gz-physics/vcpkg.json b/ports/gz-physics/vcpkg.json index c24e91ea06..c5fe015199 100644 --- a/ports/gz-physics/vcpkg.json +++ b/ports/gz-physics/vcpkg.json @@ -1,6 +1,7 @@ { "name": "gz-physics", "version": "8.0.0", + "port-version": 1, "description": "component of Gazebo, provides an abstract physics interface designed to support simulation and rapid development of robot applications.", "homepage": "https://gazebosim.org/libs/physics", "license": "Apache-2.0", diff --git a/ports/spdlog/portfile.cmake b/ports/spdlog/portfile.cmake index 5c1b29347d..67b02fe9b7 100644 --- a/ports/spdlog/portfile.cmake +++ b/ports/spdlog/portfile.cmake @@ -38,6 +38,10 @@ vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/spdlog) vcpkg_fixup_pkgconfig() vcpkg_copy_pdbs() +if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/spdlog.pc" " -lspdlog" " -lspdlogd") +endif() + # add support for integration other than cmake vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h "// #define SPDLOG_FMT_EXTERNAL" diff --git a/ports/spdlog/vcpkg.json b/ports/spdlog/vcpkg.json index e434ada65d..0732b40de4 100644 --- a/ports/spdlog/vcpkg.json +++ b/ports/spdlog/vcpkg.json @@ -1,6 +1,7 @@ { "name": "spdlog", "version-semver": "1.15.1", + "port-version": 1, "description": "Very fast, header-only/compiled, C++ logging library.", "homepage": "https://github.com/gabime/spdlog", "license": "MIT", diff --git a/scripts/test_ports/vcpkg-ci-gz-common/portfile.cmake b/scripts/test_ports/vcpkg-ci-gz-common/portfile.cmake new file mode 100644 index 0000000000..dd25706120 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-gz-common/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-gz-common/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-gz-common/project/CMakeLists.txt new file mode 100644 index 0000000000..a7dfd85a34 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-gz-common/project/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.30) +project(gz-common-test) + +find_package(gz-common6 QUIET REQUIRED COMPONENTS av) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE gz-common6::gz-common6-av) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(gz-common_pc gz-common6-av REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.cpp) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::gz-common_pc) +if(MSVC) + target_compile_features(main-pkconfig PRIVATE cxx_std_17) +endif() diff --git a/scripts/test_ports/vcpkg-ci-gz-common/project/main.cpp b/scripts/test_ports/vcpkg-ci-gz-common/project/main.cpp new file mode 100644 index 0000000000..916dda8b76 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-gz-common/project/main.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + gz::common::VideoEncoder v{}; + gzwarn << "Hello vcpkg" << std::endl; + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-gz-common/vcpkg.json b/scripts/test_ports/vcpkg-ci-gz-common/vcpkg.json new file mode 100644 index 0000000000..d08b106dca --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-gz-common/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-gz-common", + "version-string": "ci", + "description": "Port to force features of gz-common within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "gz-common", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index e5fe55cf35..a8e6f6b3a0 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3398,7 +3398,7 @@ }, "gz-cmake": { "baseline": "4.1.1", - "port-version": 0 + "port-version": 1 }, "gz-cmake3": { "baseline": "3.4.1", @@ -3406,7 +3406,7 @@ }, "gz-common": { "baseline": "6.0.2", - "port-version": 0 + "port-version": 1 }, "gz-common5": { "baseline": "5.4.1", @@ -3446,7 +3446,7 @@ }, "gz-physics": { "baseline": "8.0.0", - "port-version": 0 + "port-version": 1 }, "gz-physics6": { "baseline": "6.5.1", @@ -8746,7 +8746,7 @@ }, "spdlog": { "baseline": "1.15.1", - "port-version": 0 + "port-version": 1 }, "spectra": { "baseline": "1.0.1", diff --git a/versions/g-/gz-cmake.json b/versions/g-/gz-cmake.json index 6e65a2b074..a36464ce98 100644 --- a/versions/g-/gz-cmake.json +++ b/versions/g-/gz-cmake.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1eb4fdbb46a9e20c9fe8f4e90d273d8ece5b6ceb", + "version": "4.1.1", + "port-version": 1 + }, { "git-tree": "d24fcae6f5ec151961b1d1c5d51a052ea1a4819a", "version": "4.1.1", diff --git a/versions/g-/gz-common.json b/versions/g-/gz-common.json index f4397a4e8e..55f745d358 100644 --- a/versions/g-/gz-common.json +++ b/versions/g-/gz-common.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "bacea98222ace160cdc057f292b53ab9aedb1d6b", + "version": "6.0.2", + "port-version": 1 + }, { "git-tree": "dae3f816596200c7cf0075dedf823028c0f458a2", "version": "6.0.2", diff --git a/versions/g-/gz-physics.json b/versions/g-/gz-physics.json index 1147869367..3e249a753c 100644 --- a/versions/g-/gz-physics.json +++ b/versions/g-/gz-physics.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "45bbc49168b3dde36bb6b3ab8ea8387505ee3fcb", + "version": "8.0.0", + "port-version": 1 + }, { "git-tree": "d5ca21bcf78d4d0beea10b31b3f96d774b2db7ee", "version": "8.0.0", diff --git a/versions/s-/spdlog.json b/versions/s-/spdlog.json index a2109cb0e2..c51527f312 100644 --- a/versions/s-/spdlog.json +++ b/versions/s-/spdlog.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0897c1cad98251e9bf2b04124d1daf522b2697e5", + "version-semver": "1.15.1", + "port-version": 1 + }, { "git-tree": "7eecd9f58a522cf0ed8f081356617dbd7b4947de", "version-semver": "1.15.1",