Skip to content

Commit

Permalink
[eigen3] [ignition-modularscripts] Fix installed pkgconfig files (mic…
Browse files Browse the repository at this point in the history
…rosoft#11270)

* [eigen3] Fix generated pkgconfig files

* [ignition-cmake2] Update to C++ library

Now ignition-cmake also installs a C++ library, so
it is possible to remove code specific for CMake-only ports.

* [ignition-modularscripts] Fix pkgconfig files installed by ignition libraries

Use the new function vcpkg_fixup_pkgconfig to fix the installed .pc pkgconfig files
of the ignition libraries.

As ignition-fuel-tools1 depends on curl that has a broken pkg-config file, disable
installation of its pkg-config files.
  • Loading branch information
traversaro authored May 11, 2020
1 parent a64cf52 commit 09b769b
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ports/eigen3/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: eigen3
Version: 3.3.7-4
Version: 3.3.7-5
Homepage: http://eigen.tuxfamily.org
Description: C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
7 changes: 6 additions & 1 deletion ports/eigen3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ vcpkg_configure_cmake(
PREFER_NINJA
OPTIONS
-DBUILD_TESTING=OFF
-DEIGEN_BUILD_PKGCONFIG=ON
OPTIONS_RELEASE
-DCMAKEPACKAGE_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/share/eigen3
-DPKGCONFIG_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/lib/pkgconfig
OPTIONS_DEBUG
-DCMAKEPACKAGE_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/share/eigen3
-DPKGCONFIG_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig
)

vcpkg_install_cmake()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)

file(READ "${CURRENT_PACKAGES_DIR}/share/eigen3/Eigen3Targets.cmake" EIGEN_TARGETS)
string(REPLACE "set(_IMPORT_PREFIX " "get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_DIR}/../..\" ABSOLUTE) #" EIGEN_TARGETS "${EIGEN_TARGETS}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/eigen3/Eigen3Targets.cmake" "${EIGEN_TARGETS}")

vcpkg_fixup_pkgconfig()

file(GLOB INCLUDES ${CURRENT_PACKAGES_DIR}/include/eigen3/*)
# Copy the eigen header files to conventional location for user-wide MSBuild integration
file(COPY ${INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include)
Expand Down
2 changes: 1 addition & 1 deletion ports/ignition-cmake2/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: ignition-cmake2
Version: 2.2.0
Version: 2.2.0-1
Homepage: https://ignitionrobotics.org/libs/cmake
Description: CMake helper functions for building robotic applications
Build-Depends: ignition-modularscripts
6 changes: 0 additions & 6 deletions ports/ignition-cmake2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,5 @@ ignition_modular_library(NAME cmake
VERSION ${PACKAGE_VERSION}
SHA512 079b6d0cc5e2de83cf01f5731dd4e2e55e18e46c7506b6267a19a230fbbaa7b89053be4b42ca21584cf7fdd64de1d6305c7bc16fa3e0c5751b098fd0e5b98149)

# Permit empty include folder
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

# Remove unneccessary directory, as ignition-cmake is a pure CMake package
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib ${CURRENT_PACKAGES_DIR}/debug)

# Install custom usage
configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
2 changes: 1 addition & 1 deletion ports/ignition-fuel-tools1/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: ignition-fuel-tools1
Version: 1.2.0-1
Version: 1.2.0-2
Build-Depends: curl, ignition-cmake0, ignition-common1, libyaml, libzip, jsoncpp
Description: Tools for using fuel API to download robot models
7 changes: 4 additions & 3 deletions ports/ignition-fuel-tools1/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
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 a656fed74fb2138b3bcf7d35b25ad06da95cfb9a3ad7ded2c9c54db385f55ea310fd1a72dcf6400b0a6199e376c1ba2d11ee2a08c66e3c2cc8b2ee1b25406986
# 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)
PATCHES link-correct-yaml-target.patch
# This can be removed when the pc file of curl is fixed
DISABLE_PKGCONFIG_INSTALL
)
2 changes: 1 addition & 1 deletion ports/ignition-modularscripts/CONTROL
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Source: ignition-modularscripts
Version: 2020-04-16
Version: 2020-05-09
Description: Vcpkg helpers to package ignition libraries
35 changes: 25 additions & 10 deletions ports/ignition-modularscripts/ignition_modular_library.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PACKAGE_NAME DEFAULT_CMAKE_PACKAGE_NAME)
function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PACKAGE_NAME DEFAULT_CMAKE_PACKAGE_NAME IML_DISABLE_PKGCONFIG_INSTALL)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
Expand All @@ -17,11 +17,19 @@ function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PAC

file(COPY ${CMAKE_RELEASE_FILES} DESTINATION
"${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)
endif()

# Remove debug files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/lib/cmake
${CURRENT_PACKAGES_DIR}/debug/share)

# Make pkg-config files relocatable
if(NOT IML_DISABLE_PKGCONFIG_INSTALL)
vcpkg_fixup_pkgconfig()
else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig
${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
endif()

# Find the relevant license file and install it
Expand All @@ -44,7 +52,9 @@ endfunction()
## SHA512 <sha512>
## [REF <ref>]
## [HEAD_REF <head_ref>]
## [PATCHES <patches>])
## [PATCHES <patches>]
## [CMAKE_PACKAGE_NAME <cmake_package_name>]
## [DISABLE_PKGCONFIG_INSTALL])
## ```
##
## ## Parameters:
Expand Down Expand Up @@ -72,16 +82,21 @@ endfunction()
## ### CMAKE_PACKAGE_NAME
## The name of the CMake package for the port.
## If not specified, defaults to `ignition-${NAME}${MAJOR_VERSION}`.
##
## ### DISABLE_PKGCONFIG_INSTALL
## If present, disable installation of .pc pkg-config configuration files.
##
##
## ## 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(options DISABLE_PKGCONFIG_INSTALL)
set(oneValueArgs NAME VERSION SHA512 REF HEAD_REF CMAKE_PACKAGE_NAME)
set(multiValueArgs PATCHES)
cmake_parse_arguments(IML "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(IML "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

string(REPLACE "." ";" IML_VERSION_LIST ${IML_VERSION})
list(GET IML_VERSION_LIST 0 IML_MAJOR_VERSION)
Expand All @@ -101,7 +116,7 @@ function(ignition_modular_library)
if(NOT DEFINED IML_CMAKE_PACKAGE_NAME)
set(IML_CMAKE_PACKAGE_NAME ${DEFAULT_CMAKE_PACKAGE_NAME})
endif()

# Download library from github, to support also the --head option
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -113,5 +128,5 @@ function(ignition_modular_library)
)

# Build library
ignition_modular_build_library(${IML_NAME} ${IML_MAJOR_VERSION} ${SOURCE_PATH} ${IML_CMAKE_PACKAGE_NAME} ${DEFAULT_CMAKE_PACKAGE_NAME})
ignition_modular_build_library(${IML_NAME} ${IML_MAJOR_VERSION} ${SOURCE_PATH} ${IML_CMAKE_PACKAGE_NAME} ${DEFAULT_CMAKE_PACKAGE_NAME} ${IML_DISABLE_PKGCONFIG_INSTALL})
endfunction()
4 changes: 2 additions & 2 deletions ports/ignition-transport4/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: ignition-transport4
Version: 4.0.0-1
Build-Depends: cppzmq, ignition-cmake0, ignition-msgs1, libuuid (!windows&!uwp), protobuf, zeromq
Version: 4.0.0-2
Build-Depends: cppzmq, ignition-cmake0, ignition-modularscripts, ignition-msgs1, libuuid (!windows&!uwp), protobuf, zeromq
Description: Transport middleware for robotics
6 changes: 3 additions & 3 deletions ports/ignition-transport4/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include(vcpkg_common_functions)

include(${CURRENT_INSTALLED_DIR}/share/ignitionmodularscripts/ignition_modular_library.cmake)

ignition_modular_library(NAME transport
VERSION "4.0.0"
SHA512 d4125044c21fdd6754f3b8b06f372df3f858080d5d33e97ed7a8ef8f6fb9857d562082aad41c89ea9146a33b1c3814305d33c5c8f8bcde66a16477b4a01655b4)
SHA512 d4125044c21fdd6754f3b8b06f372df3f858080d5d33e97ed7a8ef8f6fb9857d562082aad41c89ea9146a33b1c3814305d33c5c8f8bcde66a16477b4a01655b4
# This can be removed when the pc file of libuuid on Windows is fixed
DISABLE_PKGCONFIG_INSTALL)

0 comments on commit 09b769b

Please sign in to comment.