From 4afc873253cbcf46c4418dde3d017cf1cfdfdd71 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 26 Sep 2019 21:03:56 +0200 Subject: [PATCH] [ignition-fuel-tools1] Add new port (#8136) Add new port for the ignition-fuel-tools version 1, part of the Ignition Robotics Libraries (https://ignitionrobotics.org/). --- ports/ignition-cmake0/CONTROL | 2 +- ports/ignition-cmake0/fix-find-ign-curl.patch | 16 ++++++++++ ports/ignition-cmake0/portfile.cmake | 2 ++ ports/ignition-fuel-tools1/CONTROL | 4 +++ .../link-correct-yaml-target.patch | 24 ++++++++++++++ ports/ignition-fuel-tools1/portfile.cmake | 10 ++++++ ports/ignition-modularscripts/CONTROL | 2 +- .../ignition_modular_library.cmake | 31 +++++++++++++------ 8 files changed, 80 insertions(+), 11 deletions(-) create mode 100644 ports/ignition-cmake0/fix-find-ign-curl.patch create mode 100644 ports/ignition-fuel-tools1/CONTROL create mode 100644 ports/ignition-fuel-tools1/link-correct-yaml-target.patch create mode 100644 ports/ignition-fuel-tools1/portfile.cmake diff --git a/ports/ignition-cmake0/CONTROL b/ports/ignition-cmake0/CONTROL index 5f427ffef643e6..f4eea840b73364 100644 --- a/ports/ignition-cmake0/CONTROL +++ b/ports/ignition-cmake0/CONTROL @@ -1,5 +1,5 @@ Source: ignition-cmake0 -Version: 0.6.2 +Version: 0.6.2-1 Homepage: https://ignitionrobotics.org/libs/cmake Description: CMake helper functions for building robotic applications Build-Depends: ignition-modularscripts diff --git a/ports/ignition-cmake0/fix-find-ign-curl.patch b/ports/ignition-cmake0/fix-find-ign-curl.patch new file mode 100644 index 00000000000000..9189712d278f83 --- /dev/null +++ b/ports/ignition-cmake0/fix-find-ign-curl.patch @@ -0,0 +1,16 @@ +diff -r 3276aecbcbb4 -r 33b5d95affd2 cmake/FindIgnCURL.cmake +--- a/cmake/FindIgnCURL.cmake ++++ b/cmake/FindIgnCURL.cmake +@@ -46,6 +46,12 @@ + + # Older versions of curl don't create imported targets, so we will create + # them here if they have not been provided. ++ if(TARGET CURL::libcurl AND NOT TARGET curl::curl) ++ add_library(curl::curl INTERFACE IMPORTED) ++ set_target_properties(curl::curl PROPERTIES ++ INTERFACE_LINK_LIBRARIES CURL::libcurl) ++ endif() ++ + include(IgnImportTarget) + + if(NOT TARGET curl::curl) diff --git a/ports/ignition-cmake0/portfile.cmake b/ports/ignition-cmake0/portfile.cmake index fc85e8335db553..c835238df7058e 100644 --- a/ports/ignition-cmake0/portfile.cmake +++ b/ports/ignition-cmake0/portfile.cmake @@ -14,6 +14,8 @@ ignition_modular_library(NAME cmake support-arm64.patch # Do not depend on pkg-config installed to find uuid uuid-do-not-require-pkg-config.patch + # Fix FindIgnCURL.cmake (backport of https://bitbucket.org/ignitionrobotics/ign-cmake/pull-requests/175) + fix-find-ign-curl.patch ) # Permit empty include folder diff --git a/ports/ignition-fuel-tools1/CONTROL b/ports/ignition-fuel-tools1/CONTROL new file mode 100644 index 00000000000000..96f12a5af834f1 --- /dev/null +++ b/ports/ignition-fuel-tools1/CONTROL @@ -0,0 +1,4 @@ +Source: ignition-fuel-tools1 +Version: 1.2.0 +Build-Depends: curl, ignition-cmake0, ignition-common1, libyaml, libzip, jsoncpp +Description: Tools for using fuel API to download robot models diff --git a/ports/ignition-fuel-tools1/link-correct-yaml-target.patch b/ports/ignition-fuel-tools1/link-correct-yaml-target.patch new file mode 100644 index 00000000000000..0ceab340670a51 --- /dev/null +++ b/ports/ignition-fuel-tools1/link-correct-yaml-target.patch @@ -0,0 +1,24 @@ +diff -r 29939b8a25be -r 8a0a85e63950 CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,7 +9,7 @@ + # Find ignition-cmake + #============================================================================ + # If you get an error at this line, you need to install ignition-cmake +-find_package(ignition-cmake0 REQUIRED) ++find_package(ignition-cmake0 0.4.1 REQUIRED) + + #============================================================================ + # Configure the project +diff -r 29939b8a25be -r 8a0a85e63950 src/CMakeLists.txt +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -52,7 +52,7 @@ + curl::curl + ignition-common${IGN_COMMON_MAJOR_VER}::ignition-common${IGN_COMMON_MAJOR_VER} + ${JSONCPP_TARGET} +- YAML::YAML ++ ${YAML_TARGET} + ZIP::ZIP + ) + diff --git a/ports/ignition-fuel-tools1/portfile.cmake b/ports/ignition-fuel-tools1/portfile.cmake new file mode 100644 index 00000000000000..3b809779f50ed0 --- /dev/null +++ b/ports/ignition-fuel-tools1/portfile.cmake @@ -0,0 +1,10 @@ +include(vcpkg_common_functions) + +include(${CURRENT_INSTALLED_DIR}/share/ignitionmodularscripts/ignition_modular_library.cmake) + +ignition_modular_library(NAME fuel-tools + VERSION "1.2.0" + CMAKE_PACKAGE_NAME ignition-fuel_tools1 + SHA512 5ed8d1429e1f5c0716e06840a4163f7e79a614cf7b6ff326adb69d35639e3ec5f1862edc41c6dc0bd21b16db6d13bee509831a66b10ca2ae3999649f1554a68e + # Ensure yaml is correctly linked (backport of https://bitbucket.org/ignitionrobotics/ign-fuel-tools/pull-requests/103/use-yaml_target-instead-of-yaml-yaml/diff) + PATCHES link-correct-yaml-target.patch) diff --git a/ports/ignition-modularscripts/CONTROL b/ports/ignition-modularscripts/CONTROL index fa8a222cd87131..796056b10e45c4 100644 --- a/ports/ignition-modularscripts/CONTROL +++ b/ports/ignition-modularscripts/CONTROL @@ -1,3 +1,3 @@ Source: ignition-modularscripts -Version: 2019-08-20 +Version: 2019-09-11 Description: Vcpkg helpers to package ignition libraries diff --git a/ports/ignition-modularscripts/ignition_modular_library.cmake b/ports/ignition-modularscripts/ignition_modular_library.cmake index 8800353d1bb615..5672ab8f421c8c 100644 --- a/ports/ignition-modularscripts/ignition_modular_library.cmake +++ b/ports/ignition-modularscripts/ignition_modular_library.cmake @@ -1,5 +1,5 @@ -function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH) +function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PACKAGE_NAME DEFAULT_CMAKE_PACKAGE_NAME) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -8,21 +8,23 @@ function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH) vcpkg_install_cmake() - vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/ignition-${NAME}${MAJOR_VERSION}") + vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/${CMAKE_PACKAGE_NAME}" TARGET_PATH "share/${CMAKE_PACKAGE_NAME}") file(GLOB_RECURSE CMAKE_RELEASE_FILES - "${CURRENT_PACKAGES_DIR}/lib/cmake/ignition-${NAME}${MAJOR_VERSION}/*") + "${CURRENT_PACKAGES_DIR}/lib/cmake/${CMAKE_PACKAGE_NAME}/*") file(COPY ${CMAKE_RELEASE_FILES} DESTINATION - "${CURRENT_PACKAGES_DIR}/share/ignition-${NAME}${MAJOR_VERSION}/") + "${CURRENT_PACKAGES_DIR}/share/${CMAKE_PACKAGE_NAME}/") # Remove debug files file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/lib/cmake ${CURRENT_PACKAGES_DIR}/debug/share) + + # Post-build test for cmake libraries - vcpkg_test_cmake(PACKAGE_NAME ignition-${NAME}${MAJOR_VERSION}) + vcpkg_test_cmake(PACKAGE_NAME ${CMAKE_PACKAGE_NAME}) # Find the relevant license file and install it if(EXISTS "${SOURCE_PATH}/LICENSE") @@ -67,20 +69,25 @@ endfunction() ## ## ### PATCHES ## A list of patches to be applied to the extracted sources. -## This is forwarded to the `vcpkg_from_bitbucket` command. +## This is forwarded to the `vcpkg_from_bitbucket` command. +## +## ### CMAKE_PACKAGE_NAME +## The name of the CMake package for the port. +## If not specified, defaults to `ignition-${NAME}${MAJOR_VERSION}`. ## ## ## Examples: ## ## * [ignition-cmake0](https://github.com/Microsoft/vcpkg/blob/master/ports/ignition-cmake0/portfile.cmake) ## * [ignition-math4](https://github.com/Microsoft/vcpkg/blob/master/ports/ignition-math4/portfile.cmake) +## * [ignition-fuel-tools1](https://github.com/Microsoft/vcpkg/blob/master/ports/ignition-fuel-tools1/portfile.cmake) function(ignition_modular_library) - set(oneValueArgs NAME VERSION SHA512 REF HEAD_REF) + set(oneValueArgs NAME VERSION SHA512 REF HEAD_REF CMAKE_PACKAGE_NAME) set(multiValueArgs PATCHES) cmake_parse_arguments(IML "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) string(REPLACE "." ";" IML_VERSION_LIST ${IML_VERSION}) list(GET IML_VERSION_LIST 0 IML_MAJOR_VERSION) - + # If the REF option is omitted, use the canonical one if(NOT DEFINED IML_REF) set(IML_REF "ignition-${IML_NAME}${IML_MAJOR_VERSION}_${IML_VERSION}") @@ -90,6 +97,12 @@ function(ignition_modular_library) if(NOT DEFINED IML_HEAD_REF) set(IML_HEAD_REF "ign-${IML_NAME}${IML_MAJOR_VERSION}") endif() + + # If the CMAKE_PACKAGE_NAME option is omitted, use the canonical one + set(DEFAULT_CMAKE_PACKAGE_NAME "ignition-${IML_NAME}${IML_MAJOR_VERSION}") + if(NOT DEFINED IML_CMAKE_PACKAGE_NAME) + set(IML_CMAKE_PACKAGE_NAME ${DEFAULT_CMAKE_PACKAGE_NAME}) + endif() # Download library from bitbucket, to support also the --head option vcpkg_from_bitbucket( @@ -102,5 +115,5 @@ function(ignition_modular_library) ) # Build library - ignition_modular_build_library(${IML_NAME} ${IML_MAJOR_VERSION} ${SOURCE_PATH}) + ignition_modular_build_library(${IML_NAME} ${IML_MAJOR_VERSION} ${SOURCE_PATH} ${IML_CMAKE_PACKAGE_NAME} ${DEFAULT_CMAKE_PACKAGE_NAME}) endfunction()