mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
[ignition-cmake2/ignition-modularscripts/ignition-common3] Add options, support pkgconfig and fix usage for common3-graph (#25021)
* [ignition-common3] Fix usage for graph * version * Apply suggestion * version * Add option OPTIONS, add pkgconfig support, refactor function option declarations * Remove cmake find module installation, add pkgconfig support and fix PRIVATE_FOR limit * Apply suggestions, fix dependency libxml2 * version
This commit is contained in:
parent
ca8bde3748
commit
91393faf12
@ -0,0 +1,48 @@
|
||||
diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake
|
||||
index bc6dbdc..1e8adbb 100644
|
||||
--- a/cmake/IgnUtils.cmake
|
||||
+++ b/cmake/IgnUtils.cmake
|
||||
@@ -138,7 +138,7 @@ macro(ign_find_package PACKAGE_NAME)
|
||||
#------------------------------------
|
||||
# Define the expected arguments
|
||||
set(options REQUIRED PRIVATE EXACT QUIET BUILD_ONLY PKGCONFIG_IGNORE)
|
||||
- set(oneValueArgs VERSION PRETTY PURPOSE EXTRA_ARGS PKGCONFIG PKGCONFIG_LIB PKGCONFIG_VER_COMPARISON)
|
||||
+ set(oneValueArgs VERSION PRETTY PURPOSE EXTRA_ARGS PKGCONFIG PKGCONFIG_LIB PKGCONFIG_VER_COMPARISON BY_PKGCONFIG)
|
||||
set(multiValueArgs REQUIRED_BY PRIVATE_FOR COMPONENTS OPTIONAL_COMPONENTS)
|
||||
|
||||
#------------------------------------
|
||||
@@ -183,9 +183,15 @@ macro(ign_find_package PACKAGE_NAME)
|
||||
endif()
|
||||
|
||||
|
||||
+ if (NOT ign_find_package_BY_PKGCONFIG)
|
||||
#------------------------------------
|
||||
# Call find_package with the provided arguments
|
||||
find_package(${${PACKAGE_NAME}_find_package_args})
|
||||
+ else()
|
||||
+ find_package(PkgConfig REQUIRED)
|
||||
+ include(FindPkgConfig)
|
||||
+ pkg_check_modules(${PACKAGE_NAME} ${ign_find_package_BY_PKGCONFIG})
|
||||
+ endif()
|
||||
|
||||
if(${PACKAGE_NAME}_FOUND)
|
||||
|
||||
@@ -300,17 +306,11 @@ macro(ign_find_package PACKAGE_NAME)
|
||||
endif()
|
||||
|
||||
if(ign_find_package_REQUIRED_BY)
|
||||
-
|
||||
- # Identify which components are privately requiring this package
|
||||
- foreach(component ${ign_find_package_PRIVATE_FOR})
|
||||
- set(${component}_${PACKAGE_NAME}_PRIVATE true)
|
||||
- endforeach()
|
||||
-
|
||||
# If this is required by some components, add it to the
|
||||
# ${component}_CMAKE_DEPENDENCIES variables that are specific to those
|
||||
# componenets
|
||||
foreach(component ${ign_find_package_REQUIRED_BY})
|
||||
- if(NOT ${component}_${PACKAGE_NAME}_PRIVATE)
|
||||
+ if(NOT ign_find_package_BY_PKGCONFIG)
|
||||
ign_string_append(${component}_CMAKE_DEPENDENCIES "${${PACKAGE_NAME}_find_dependency}" DELIM "\n")
|
||||
endif()
|
||||
endforeach()
|
@ -3,7 +3,9 @@ set(PACKAGE_VERSION "2.5.0")
|
||||
ignition_modular_library(NAME cmake
|
||||
VERSION ${PACKAGE_VERSION}
|
||||
SHA512 e39ed44ae6f7ccc338412f466f1257f88989e0818bee801ddbe09350e906cd9ce709be24356310fdbfde22d1b5b5846fed0aa794c06dcf7caf82748a07b428d6
|
||||
PATCHES FindGTS.patch)
|
||||
PATCHES
|
||||
FindGTS.patch
|
||||
add-pkgconfig-and-remove-privatefor-limit.patch)
|
||||
|
||||
# Install custom usage
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ignition-cmake2",
|
||||
"version": "2.5.0",
|
||||
"port-version": 2,
|
||||
"port-version": 3,
|
||||
"description": "CMake helper functions for building robotic applications",
|
||||
"homepage": "https://ignitionrobotics.org/libs/cmake",
|
||||
"license": null,
|
||||
|
81
ports/ignition-common3/fix-dependencies.patch
Normal file
81
ports/ignition-common3/fix-dependencies.patch
Normal file
@ -0,0 +1,81 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 73920fe..8bee7fe 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -52,7 +52,7 @@ set(IGN_MATH_VER ${ignition-math6_VERSION_MAJOR})
|
||||
#--------------------------------------
|
||||
# Find Tinyxml2
|
||||
if(USE_EXTERNAL_TINYXML2)
|
||||
- ign_find_package(TINYXML2 PRETTY tinyxml2
|
||||
+ ign_find_package(tinyxml2 EXTRA_ARGS CONFIG
|
||||
REQUIRED_BY graphics
|
||||
PRIVATE_FOR graphics)
|
||||
else()
|
||||
@@ -70,13 +70,13 @@ if(NOT MSVC)
|
||||
|
||||
#------------------------------------
|
||||
# Find uuid
|
||||
- ign_find_package(UUID REQUIRED PRETTY uuid)
|
||||
+ ign_find_package(UUID REQUIRED PRETTY uuid REQUIRED_BY graphics)
|
||||
|
||||
endif()
|
||||
|
||||
#------------------------------------
|
||||
# Find Freeimage
|
||||
-ign_find_package(FreeImage VERSION 3.9
|
||||
+ign_find_package(freeimage EXTRA_ARGS CONFIG
|
||||
REQUIRED_BY graphics
|
||||
PRIVATE_FOR graphics)
|
||||
|
||||
@@ -84,6 +84,7 @@ ign_find_package(FreeImage VERSION 3.9
|
||||
# Find GNU Triangulation Surface Library
|
||||
ign_find_package(
|
||||
GTS PRETTY gts PURPOSE "GNU Triangulation Surface library"
|
||||
+ BY_PKGCONFIG gts
|
||||
REQUIRED_BY graphics
|
||||
PRIVATE_FOR graphics)
|
||||
|
||||
diff --git a/graphics/src/CMakeLists.txt b/graphics/src/CMakeLists.txt
|
||||
index 000a0ce..f6e1831 100644
|
||||
--- a/graphics/src/CMakeLists.txt
|
||||
+++ b/graphics/src/CMakeLists.txt
|
||||
@@ -16,8 +16,10 @@ target_link_libraries(${graphics_target}
|
||||
PUBLIC
|
||||
ignition-math${IGN_MATH_VER}::ignition-math${IGN_MATH_VER}
|
||||
PRIVATE
|
||||
- GTS::GTS
|
||||
- FreeImage::FreeImage)
|
||||
+ ${GTS_LINK_LIBRARIES}
|
||||
+ freeimage::FreeImage)
|
||||
+
|
||||
+target_include_directories(${graphics_target} PRIVATE ${GTS_INCLUDE_DIRS})
|
||||
|
||||
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}
|
||||
LIB_DEPS ${graphics_target})
|
||||
@@ -28,13 +30,13 @@ if(USE_EXTERNAL_TINYXML2)
|
||||
# If we are using an external copy of tinyxml2, add its imported target
|
||||
target_link_libraries(${graphics_target}
|
||||
PRIVATE
|
||||
- TINYXML2::TINYXML2)
|
||||
+ tinyxml2::tinyxml2)
|
||||
|
||||
# The collada exporter test uses tinyxml2, so we must link it if we're using
|
||||
# an external copy. The graphics target considers tinyxml2 to be a private
|
||||
# dependency, so it will not automatically get linked to this test.
|
||||
if(TARGET UNIT_ColladaExporter_TEST)
|
||||
- target_link_libraries(UNIT_ColladaExporter_TEST TINYXML2::TINYXML2)
|
||||
+ target_link_libraries(UNIT_ColladaExporter_TEST tinyxml2::tinyxml2)
|
||||
endif()
|
||||
|
||||
else()
|
||||
@@ -62,8 +64,8 @@ endif()
|
||||
|
||||
# define of tinxml2 major version >= 6
|
||||
# https://github.com/ignitionrobotics/ign-common/issues/28
|
||||
-if (NOT TINYXML2_VERSION VERSION_LESS "6.0.0")
|
||||
- message(STATUS "TINYXML2_VERSION ${TINYXML2_VERSION} >= 6.0.0")
|
||||
+if (NOT tinyxml2_VERSION VERSION_LESS "6.0.0")
|
||||
+ message(STATUS "TINYXML2_VERSION ${tinyxml2_VERSION} >= 6.0.0")
|
||||
target_compile_definitions(${graphics_target}
|
||||
PRIVATE "TINYXML2_MAJOR_VERSION_GE_6")
|
||||
endif()
|
@ -1,6 +1,8 @@
|
||||
ignition_modular_library(NAME common
|
||||
VERSION "3.9.0"
|
||||
SHA512 1bae86efd7da10ac517d67a75ad1b612ea2046128eb75e0f0a134ffff7cc76431e850a9b46fdb7dc6603e2acb044f4204fdedaf38fc7bff82883db3f36830fb9)
|
||||
SHA512 1bae86efd7da10ac517d67a75ad1b612ea2046128eb75e0f0a134ffff7cc76431e850a9b46fdb7dc6603e2acb044f4204fdedaf38fc7bff82883db3f36830fb9
|
||||
OPTIONS -DUSE_EXTERNAL_TINYXML2=ON
|
||||
PATCHES fix-dependencies.patch)
|
||||
|
||||
# Remove non-relocatable helper scripts (see https://github.com/ignitionrobotics/ign-common/issues/82)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin/ign_remotery_vis" "${CURRENT_PACKAGES_DIR}/debug/bin/ign_remotery_vis")
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ignition-common3",
|
||||
"version": "3.9.0",
|
||||
"port-version": 3,
|
||||
"port-version": 4,
|
||||
"description": "Common libraries for robotics applications",
|
||||
"homepage": "https://ignitionrobotics.org/libs/common",
|
||||
"license": null,
|
||||
|
@ -1,10 +1,18 @@
|
||||
|
||||
function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PACKAGE_NAME DEFAULT_CMAKE_PACKAGE_NAME IML_DISABLE_PKGCONFIG_INSTALL)
|
||||
function(ignition_modular_build_library)
|
||||
set(options DISABLE_PKGCONFIG_INSTALL)
|
||||
set(oneValueArgs NAME MAJOR_VERSION SOURCE_PATH CMAKE_PACKAGE_NAME DEFAULT_CMAKE_PACKAGE_NAME)
|
||||
set(multiValueArgs OPTIONS)
|
||||
cmake_parse_arguments(IML "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
SOURCE_PATH ${IML_SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
DISABLE_PARALLEL_CONFIGURE
|
||||
OPTIONS -DBUILD_TESTING=OFF
|
||||
OPTIONS
|
||||
-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}
|
||||
-DBUILD_TESTING=OFF
|
||||
${IML_OPTIONS}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake(ADD_BIN_TO_PATH)
|
||||
@ -12,7 +20,7 @@ function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PAC
|
||||
# If necessary, move the CMake config files
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake")
|
||||
# Some ignition libraries install library subcomponents, that are effectively additional cmake packages
|
||||
# with name ${CMAKE_PACKAGE_NAME}-${COMPONENT_NAME}, so it is needed to call vcpkg_fixup_cmake_targets for them as well
|
||||
# with name ${IML_CMAKE_PACKAGE_NAME}-${COMPONENT_NAME}, so it is needed to call vcpkg_fixup_cmake_targets for them as well
|
||||
file(GLOB COMPONENTS_CMAKE_PACKAGE_NAMES
|
||||
LIST_DIRECTORIES TRUE
|
||||
RELATIVE "${CURRENT_PACKAGES_DIR}/lib/cmake/"
|
||||
@ -25,10 +33,10 @@ function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PAC
|
||||
endforeach()
|
||||
|
||||
file(GLOB_RECURSE CMAKE_RELEASE_FILES
|
||||
"${CURRENT_PACKAGES_DIR}/lib/cmake/${CMAKE_PACKAGE_NAME}/*")
|
||||
"${CURRENT_PACKAGES_DIR}/lib/cmake/${IML_CMAKE_PACKAGE_NAME}/*")
|
||||
|
||||
file(COPY ${CMAKE_RELEASE_FILES} DESTINATION
|
||||
"${CURRENT_PACKAGES_DIR}/share/${CMAKE_PACKAGE_NAME}/")
|
||||
"${CURRENT_PACKAGES_DIR}/share/${IML_CMAKE_PACKAGE_NAME}/")
|
||||
endif()
|
||||
|
||||
# Remove unused files files
|
||||
@ -111,7 +119,7 @@ endfunction()
|
||||
function(ignition_modular_library)
|
||||
set(options DISABLE_PKGCONFIG_INSTALL)
|
||||
set(oneValueArgs NAME VERSION SHA512 REF HEAD_REF CMAKE_PACKAGE_NAME)
|
||||
set(multiValueArgs PATCHES)
|
||||
set(multiValueArgs PATCHES OPTIONS)
|
||||
cmake_parse_arguments(IML "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
string(REPLACE "." ";" IML_VERSION_LIST ${IML_VERSION})
|
||||
@ -144,6 +152,18 @@ function(ignition_modular_library)
|
||||
FILE_DISAMBIGUATOR 1
|
||||
)
|
||||
|
||||
if (IML_DISABLE_PKGCONFIG_INSTALL)
|
||||
set(EXTRA_OPTIONS DISABLE_PKGCONFIG_INSTALL)
|
||||
endif()
|
||||
|
||||
# Build library
|
||||
ignition_modular_build_library(${IML_NAME} ${IML_MAJOR_VERSION} ${SOURCE_PATH} ${IML_CMAKE_PACKAGE_NAME} ${DEFAULT_CMAKE_PACKAGE_NAME} ${IML_DISABLE_PKGCONFIG_INSTALL})
|
||||
ignition_modular_build_library(
|
||||
NAME ${IML_NAME}
|
||||
MAJOR_VERSION ${IML_MAJOR_VERSION}
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
CMAKE_PACKAGE_NAME ${IML_CMAKE_PACKAGE_NAME}
|
||||
DEFAULT_CMAKE_PACKAGE_NAME ${DEFAULT_CMAKE_PACKAGE_NAME}
|
||||
${EXTRA_OPTIONS}
|
||||
OPTIONS ${IML_OPTIONS}
|
||||
)
|
||||
endfunction()
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "ignition-modularscripts",
|
||||
"version-date": "2022-05-11",
|
||||
"port-version": 1,
|
||||
"description": "Vcpkg helpers to package ignition libraries",
|
||||
"license": null
|
||||
}
|
||||
|
@ -2874,7 +2874,7 @@
|
||||
},
|
||||
"ignition-cmake2": {
|
||||
"baseline": "2.5.0",
|
||||
"port-version": 2
|
||||
"port-version": 3
|
||||
},
|
||||
"ignition-common1": {
|
||||
"baseline": "1.1.1",
|
||||
@ -2882,7 +2882,7 @@
|
||||
},
|
||||
"ignition-common3": {
|
||||
"baseline": "3.9.0",
|
||||
"port-version": 3
|
||||
"port-version": 4
|
||||
},
|
||||
"ignition-fuel-tools1": {
|
||||
"baseline": "1.2.0",
|
||||
@ -2902,7 +2902,7 @@
|
||||
},
|
||||
"ignition-modularscripts": {
|
||||
"baseline": "2022-05-11",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"ignition-msgs1": {
|
||||
"baseline": "1.0.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "04ad74fe00ed7c2030aec3e27fc0beaaf2c90bf8",
|
||||
"version": "2.5.0",
|
||||
"port-version": 3
|
||||
},
|
||||
{
|
||||
"git-tree": "d146d55be3a48e481af0a87660c44ce2a7b5cb11",
|
||||
"version": "2.5.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "6dc33f01d43ba86ec811a09138434f76815a40c8",
|
||||
"version": "3.9.0",
|
||||
"port-version": 4
|
||||
},
|
||||
{
|
||||
"git-tree": "929c84951a63b65c9dd48f73a4a7147ae5a1779b",
|
||||
"version": "3.9.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "ae302700b77870b26543f2df7764304d848c198a",
|
||||
"version-date": "2022-05-11",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "d834091edb40475a3e9f55455ff532f3ac629142",
|
||||
"version-date": "2022-05-11",
|
||||
|
Loading…
x
Reference in New Issue
Block a user