diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/gz-cmake | |
Diffstat (limited to 'vcpkg/ports/gz-cmake')
| -rw-r--r-- | vcpkg/ports/gz-cmake/find-modules.diff | 158 | ||||
| -rw-r--r-- | vcpkg/ports/gz-cmake/gz-find-package.diff | 22 | ||||
| -rw-r--r-- | vcpkg/ports/gz-cmake/gz-import-target.diff | 20 | ||||
| -rw-r--r-- | vcpkg/ports/gz-cmake/lock-dependencies.diff | 18 | ||||
| -rw-r--r-- | vcpkg/ports/gz-cmake/pkg-check-modules.diff | 35 | ||||
| -rw-r--r-- | vcpkg/ports/gz-cmake/portfile.cmake | 18 | ||||
| -rw-r--r-- | vcpkg/ports/gz-cmake/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/gz-cmake/vcpkg.json | 14 |
8 files changed, 289 insertions, 0 deletions
diff --git a/vcpkg/ports/gz-cmake/find-modules.diff b/vcpkg/ports/gz-cmake/find-modules.diff new file mode 100644 index 0000000..3017d31 --- /dev/null +++ b/vcpkg/ports/gz-cmake/find-modules.diff @@ -0,0 +1,158 @@ +diff --git a/cmake/FindFreeImage.cmake b/cmake/FindFreeImage.cmake +index 8a5836e..d7e41d2 100644 +--- a/cmake/FindFreeImage.cmake ++++ b/cmake/FindFreeImage.cmake +@@ -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(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..48cf9f7 100644 +--- a/cmake/FindGTS.cmake ++++ b/cmake/FindGTS.cmake +@@ -16,7 +16,7 @@ + ######################################## + # Find GNU Triangulation Surface Library + +-if (NOT WIN32) ++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..e39a3fd 100644 +--- a/cmake/FindGzBullet.cmake ++++ b/cmake/FindGzBullet.cmake +@@ -31,7 +31,7 @@ endif() + # Bullet. Force MODULE mode to use the FindBullet.cmake file distributed with + # 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 NAMES Bullet ${gz_quiet_arg}) + + set(GzBullet_FOUND false) + # create Bullet target +diff --git a/cmake/FindGzOGRE2.cmake b/cmake/FindGzOGRE2.cmake +index 2decd84..dd2c2c2 100644 +--- a/cmake/FindGzOGRE2.cmake ++++ b/cmake/FindGzOGRE2.cmake +@@ -146,7 +146,7 @@ endmacro() + find_package(PkgConfig QUIET) + 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") + message(STATUS "Looking for OGRE using the name: ${GZ_OGRE2_PROJECT_NAME}") + if (GZ_OGRE2_PROJECT_NAME STREQUAL "OGRE2") + set(OGRE2_INSTALL_PATH "OGRE-2.${GzOGRE2_FIND_VERSION_MINOR}") +@@ -173,6 +173,7 @@ if (PkgConfig_FOUND) + set(GZ_PKG_NAME ${OGRE2_INSTALL_PATH}) + set(OGRE2_FOUND ${${GZ_OGRE2_PROJECT_NAME}_FOUND}) # sync possible OGRE-Next to OGRE2 + fix_pkgconfig_prefix_jammy_bug("${${GZ_OGRE2_PROJECT_NAME}_LIBRARY_DIRS}" OGRE2_LIBRARY_DIRS) ++ set(OGRE2_LIBRARY_DIRS ${${GZ_OGRE2_PROJECT_NAME}_LIBRARY_DIRS}) + set(OGRE2_LIBRARIES ${${GZ_OGRE2_PROJECT_NAME}_LIBRARIES}) # sync possible Ogre-Next ot OGRE2 + else() + # look for OGRE2 installed from source +@@ -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" ++ NAMES_PER_DIR + HINTS ${OGRE2_LIBRARY_DIRS}) + if (NOT "${OGRE2-${component}}" STREQUAL "OGRE2-${component}-NOTFOUND") + message(STATUS " + component ${component}: 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_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 ++ "OgreNextMain" ++ "OgreNextMainStatic" ++ "OgreNextMain_d" ++ "OgreNextMainStatic_d" ++ NAMES_PER_DIR + HINTS ${OGRE2_PATHS} + NO_DEFAULT_PATH) + +@@ -450,8 +459,11 @@ else() #PkgConfig_FOUND + + find_library(${PREFIX}_LIBRARY + NAMES +- "Ogre${COMPONENT}" +- "Ogre${COMPONENT}_d" ++ "OgreNext${COMPONENT}" ++ "OgreNext${COMPONENT}_d" ++ "OgreNext${COMPONENT}Static" ++ "OgreNext${COMPONENT}Static_d" ++ NAMES_PER_DIR + HINTS + ${OGRE2_LIBRARY_DIRS} + NO_DEFAULT_PATH) +@@ -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) + + 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) +- if ("${dir_name}" STREQUAL "OGRE-${OGRE2_VERSION_MAJOR}.${OGRE2_VERSION_MINOR}") ++ if ("${dir_name}" STREQUAL "OGRE-Next") + set(dir_include "${dir}/Hlms/Common") + if (EXISTS ${dir_include}) + list(APPEND component_INCLUDE_DIRS ${dir_include}) diff --git a/vcpkg/ports/gz-cmake/gz-find-package.diff b/vcpkg/ports/gz-cmake/gz-find-package.diff new file mode 100644 index 0000000..856863b --- /dev/null +++ b/vcpkg/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/vcpkg/ports/gz-cmake/gz-import-target.diff b/vcpkg/ports/gz-cmake/gz-import-target.diff new file mode 100644 index 0000000..a6f1f79 --- /dev/null +++ b/vcpkg/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 <Pkg>_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/vcpkg/ports/gz-cmake/lock-dependencies.diff b/vcpkg/ports/gz-cmake/lock-dependencies.diff new file mode 100644 index 0000000..1c6c4cd --- /dev/null +++ b/vcpkg/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/vcpkg/ports/gz-cmake/pkg-check-modules.diff b/vcpkg/ports/gz-cmake/pkg-check-modules.diff new file mode 100644 index 0000000..7249074 --- /dev/null +++ b/vcpkg/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/vcpkg/ports/gz-cmake/portfile.cmake b/vcpkg/ports/gz-cmake/portfile.cmake new file mode 100644 index 0000000..259e108 --- /dev/null +++ b/vcpkg/ports/gz-cmake/portfile.cmake @@ -0,0 +1,18 @@ +string(REGEX MATCH "^[0-9]+" VERSION_MAJOR ${VERSION})
+string(REGEX MATCH "^gz-([a-z-]+)" MATCHED_VALUE ${PORT})
+set(PACKAGE_NAME ${CMAKE_MATCH_1})
+
+ignition_modular_library(
+ NAME ${PACKAGE_NAME}
+ REF ${PORT}${VERSION_MAJOR}_${VERSION}
+ VERSION ${VERSION}
+ SHA512 d761aba28fc79af6bbb021215367e48e1b7449885d0410a0cabd09674a59b17132810ebb796fe0e1ddefc1510aba832fb192cc908156d8eae15e35c1afe464c7
+ PATCHES
+ 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/vcpkg/ports/gz-cmake/usage b/vcpkg/ports/gz-cmake/usage new file mode 100644 index 0000000..4f3b4c6 --- /dev/null +++ b/vcpkg/ports/gz-cmake/usage @@ -0,0 +1,4 @@ +gz-cmake provides CMake integration: + + find_package(gz-cmake@VERSION_MAJOR@ REQUIRED) + gz_configure_project(...) diff --git a/vcpkg/ports/gz-cmake/vcpkg.json b/vcpkg/ports/gz-cmake/vcpkg.json new file mode 100644 index 0000000..a2eeddb --- /dev/null +++ b/vcpkg/ports/gz-cmake/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "gz-cmake", + "version": "4.1.1", + "port-version": 1, + "description": "CMake helper functions for building robotic applications", + "homepage": "https://gazebosim.org/libs/cmake/", + "license": null, + "dependencies": [ + { + "name": "ignition-modularscripts", + "host": true + } + ] +} |