зеркало из https://github.com/microsoft/vcpkg.git
[gz-cmake3] Fix export of static deps (#34667)
* [gz-cmake3] Fix export of static deps * [gz-cmake3,gz-common5] Revise package import * [gz-common5] Disable tests by config * [gz-cmake3,gz-common5] Revise deps patching * [gz-common5] Take care of pkg-config * [gz-common5] Check installed components * Finish
This commit is contained in:
Родитель
5db545950d
Коммит
73408b1769
|
@ -1,22 +1,110 @@
|
|||
diff --git a/cmake/FindGzBullet.cmake b/cmake/FindGzBullet.cmake
|
||||
--- a/cmake/FindGzBullet.cmake
|
||||
+++ b/cmake/FindGzBullet.cmake
|
||||
@@ -30,16 +30,17 @@
|
||||
|
||||
# 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 CONFIG REQUIRED)
|
||||
|
||||
set(GzBullet_FOUND false)
|
||||
# create Bullet target
|
||||
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/FindFreeImage.cmake b/cmake/FindFreeImage.cmake
|
||||
index 8a5836e..7f926cc 100644
|
||||
--- a/cmake/FindFreeImage.cmake
|
||||
+++ b/cmake/FindFreeImage.cmake
|
||||
@@ -23,7 +23,17 @@ 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(freeimage_FOUND)
|
||||
+ set(FreeImage_FOUND 1)
|
||||
+ set(FreeImage_LIBRARIES freeimage::FreeImage)
|
||||
+ include(GzImportTarget)
|
||||
+ gz_import_target(FreeImage INTERFACE)
|
||||
+ 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
|
||||
--- 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 798d239..e7ee87c 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 CONFIG REQUIRED)
|
||||
|
||||
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/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 4eb7a0d..11dae8a 100644
|
||||
--- a/cmake/GzFindPackage.cmake
|
||||
+++ b/cmake/GzFindPackage.cmake
|
||||
@@ -178,6 +178,7 @@ macro(gz_find_package PACKAGE_NAME_)
|
||||
_gz_cmake_parse_arguments(gz_find_package "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
endif()
|
||||
|
||||
+ 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})
|
||||
@@ -192,6 +193,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)
|
||||
@@ -388,7 +391,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()
|
||||
|
|
|
@ -9,5 +9,5 @@ ignition_modular_library(
|
|||
dependencies.patch
|
||||
)
|
||||
|
||||
# Install custom usage
|
||||
file(COPY "${CURRENT_PORT_DIR}/vcpkg" DESTINATION "${CURRENT_PACKAGES_DIR}/share/cmake/gz-cmake3/cmake3")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "gz-cmake3",
|
||||
"version": "3.4.1",
|
||||
"port-version": 1,
|
||||
"port-version": 2,
|
||||
"description": "CMake helper functions for building robotic applications",
|
||||
"homepage": "https://ignitionrobotics.org/libs/cmake",
|
||||
"license": null,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
if(NOT gz_find_package_PKGCONFIG)
|
||||
set(gz_find_package_PKGCONFIG gts)
|
||||
endif()
|
|
@ -0,0 +1,3 @@
|
|||
if(NOT gz_find_package_PKGCONFIG)
|
||||
set(gz_find_package_PKGCONFIG tinyxml2)
|
||||
endif()
|
|
@ -1,89 +0,0 @@
|
|||
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)
|
||||
- gz_find_package(TINYXML2 PRETTY tinyxml2
|
||||
+ gz_find_package(tinyxml2 EXTRA_ARGS CONFIG
|
||||
REQUIRED_BY graphics
|
||||
PRIVATE_FOR graphics)
|
||||
else()
|
||||
@@ -70,13 +70,13 @@ if(NOT MSVC)
|
||||
|
||||
#------------------------------------
|
||||
# Find uuid
|
||||
- gz_find_package(UUID REQUIRED PRETTY uuid)
|
||||
+ gz_find_package(UUID REQUIRED PRETTY uuid REQUIRED_BY graphics)
|
||||
|
||||
endif()
|
||||
|
||||
#------------------------------------
|
||||
# Find Freeimage
|
||||
-gz_find_package(FreeImage VERSION 3.9
|
||||
+gz_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
|
||||
gz_find_package(
|
||||
GTS PRETTY gts PURPOSE "GNU Triangulation Surface library"
|
||||
+ BY_PKGCONFIG gts
|
||||
REQUIRED_BY graphics
|
||||
PRIVATE_FOR graphics)
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
#------------------------------------
|
||||
# Find GDAL
|
||||
-gz_find_package(GDAL VERSION 3.0
|
||||
+gz_find_package(GDAL
|
||||
PKGCONFIG gdal
|
||||
PRIVATE_FOR geospatial
|
||||
REQUIRED_BY geospatial)
|
||||
|
||||
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
|
||||
@@ -14,8 +14,10 @@ target_link_libraries(${graphics_target}
|
||||
PUBLIC
|
||||
gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER}
|
||||
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
|
||||
PRIVATE
|
||||
${GzAssimp_LIBRARIES}
|
||||
GTS::GTS
|
||||
- FreeImage::FreeImage)
|
||||
+ freeimage::FreeImage)
|
||||
+
|
||||
+target_include_directories(${graphics_target} PRIVATE ${GTS_INCLUDE_DIRS})
|
||||
|
||||
@@ -42,14 +44,14 @@ 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()
|
||||
@@ -79,7 +81,7 @@
|
||||
# define of tinxml2 major version >= 6
|
||||
# https://github.com/gazebosim/gz-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()
|
|
@ -6,9 +6,20 @@ ignition_modular_library(
|
|||
VERSION ${VERSION}
|
||||
SHA512 40db4747db743005d7c43ca25cfe93cf68ee19201abcb165e72de37708b92fd88553b11520c420db33b37f4cab7e01e4d79c91c5dc0485146b7156284b8baaee
|
||||
OPTIONS
|
||||
-DBUILD_TESTING=OFF
|
||||
-DUSE_EXTERNAL_TINYXML2=ON
|
||||
"-DPKG_CONFIG_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
||||
PATCHES
|
||||
fix_dependencies.patch
|
||||
remove_tests.patch
|
||||
gz_remotery_vis.patch
|
||||
)
|
||||
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/gz-common5-graphics/gz-common5-graphics-config.cmake" "find_package(GTS "
|
||||
"# Ensure that consumers get a pkg-config tool which is needed for GTS
|
||||
set(PKG_CONFIG_EXECUTABLE \"\${CMAKE_CURRENT_LIST_DIR}/../../../${HOST_TRIPLET}/tools/pkgconf/pkgconf${VCPKG_HOST_EXECUTABLE_SUFFIX}\" CACHE STRING vcpkg)
|
||||
find_package(GTS ")
|
||||
|
||||
foreach(component IN ITEMS av events geospatial graphics io profiler testing)
|
||||
if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/share/${PORT}-${component}/${PORT}-${component}-config.cmake")
|
||||
message(FATAL_ERROR "Failed to install component ${component}. Check configuration logs for missing dependencies.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -41,4 +41,5 @@
|
||||
+if(0)
|
||||
# Build the unit tests
|
||||
gz_build_tests(
|
||||
TYPE UNIT
|
||||
SOURCES ${gtest_sources}
|
||||
@@ -77,4 +78,5 @@
|
||||
message(STATUS "")
|
||||
target_compile_definitions(UNIT_Filesystem_TEST PRIVATE GZ_BUILD_SYMLINK_TESTS_ON_WINDOWS)
|
||||
endif()
|
||||
endif()
|
||||
+endif(0)
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "gz-common5",
|
||||
"version": "5.4.1",
|
||||
"port-version": 1,
|
||||
"description": "Common libraries for robotics applications",
|
||||
"homepage": "https://ignitionrobotics.org/libs/common",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -22,7 +23,12 @@
|
|||
},
|
||||
{
|
||||
"name": "libuuid",
|
||||
"platform": "!windows & !uwp & !osx"
|
||||
"platform": "!windows & !osx"
|
||||
},
|
||||
{
|
||||
"name": "pkgconf",
|
||||
"host": true,
|
||||
"default-features": false
|
||||
},
|
||||
"tinyxml2"
|
||||
]
|
||||
|
|
|
@ -3154,11 +3154,11 @@
|
|||
},
|
||||
"gz-cmake3": {
|
||||
"baseline": "3.4.1",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"gz-common5": {
|
||||
"baseline": "5.4.1",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"gz-fuel-tools8": {
|
||||
"baseline": "8.1.0",
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f0b0d35ac8f99280de71a64494d8597f09986362",
|
||||
"version": "3.4.1",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "8d7ac07eb757d7a69f1df27ad7a1ef71c26957d4",
|
||||
"version": "3.4.1",
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "15fd6996514765a386996566e63fd0fff58c3db4",
|
||||
"version": "5.4.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "ecb88cbb8c52027d083348a8d28705ef7fe861ca",
|
||||
"version": "5.4.1",
|
||||
|
|
Загрузка…
Ссылка в новой задаче