Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ompl] Fix linking using ${OMPL_LIBRARIES} #18908

Merged
merged 12 commits into from
Jul 22, 2021
Merged
1 change: 1 addition & 0 deletions ports/ccd/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Source: ccd
Version: 2.1-4
Port-Version: 1
Homepage: https://github.com/danfis/libccd
Description: Library for collision detection between two convex shapes
13 changes: 13 additions & 0 deletions ports/ccd/fix-static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/ccd/ccd_export.h b/src/ccd/ccd_export.h
index e898d41..c6aa5fb 100644
--- a/src/ccd/ccd_export.h
+++ b/src/ccd/ccd_export.h
@@ -1,7 +1,7 @@
#ifndef CCD_EXPORT_H
#define CCD_EXPORT_H

-#ifdef CCD_STATIC_DEFINE
+#if 1
# define CCD_EXPORT
#else
# ifdef _MSC_VER
8 changes: 7 additions & 1 deletion ports/ccd/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(STATIC_PATCH fix-static.patch)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO danfis/libccd
REF v2.1
SHA512 ff037d9c4df50f09600cf9b3514b259b2850ff43f74817853f5665d22812891168f70bd3cc3969b2c9e3c706f6254991a65421476349607fbd04d894b217456d
HEAD_REF master
# Backport https://github.com/danfis/libccd/pull/70 to support Emscripten
PATCHES "support-emscripten.patch"
PATCHES
"support-emscripten.patch"
${STATIC_PATCH}
)

vcpkg_configure_cmake(
Expand Down
27 changes: 27 additions & 0 deletions ports/ompl/0001_Export_targets.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a9bb05f..31fab8c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -215,6 +215,10 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/omplConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/omplConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ompl/cmake
COMPONENT ompl)
+install(EXPORT ompl
+ DESTINATION "share/ompl"
+ FILE ompl-targets.cmake
+)

# script to install ompl on Ubuntu
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/install-ompl-ubuntu.sh.in"
diff --git a/src/ompl/CMakeLists.txt b/src/ompl/CMakeLists.txt
index 9ea130e..6dda4df 100644
--- a/src/ompl/CMakeLists.txt
+++ b/src/ompl/CMakeLists.txt
@@ -83,6 +83,7 @@ endif (MSVC)

# install the library
install(TARGETS ompl
+ EXPORT ompl
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ompl)
if (NOT MSVC)
39 changes: 39 additions & 0 deletions ports/ompl/0002_Fix_config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/omplConfig.cmake.in b/omplConfig.cmake.in
index 465de25..ad373fa 100644
--- a/omplConfig.cmake.in
+++ b/omplConfig.cmake.in
@@ -18,8 +18,10 @@ set(OMPL_MAJOR_VERSION @PROJECT_VERSION_MAJOR@)
set(OMPL_MINOR_VERSION @PROJECT_VERSION_MINOR@)
set(OMPL_PATCH_VERSION @PROJECT_VERSION_PATCH@)

+find_dependency(Boost 1.58 COMPONENTS serialization filesystem system program_options)
+find_dependency(Eigen3)
set_and_check(OMPL_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
-set(OMPL_INCLUDE_DIRS "${OMPL_INCLUDE_DIR};@Boost_INCLUDE_DIR@;@EIGEN3_INCLUDE_DIR@")
+set(OMPL_INCLUDE_DIRS "${OMPL_INCLUDE_DIR};${Boost_INCLUDE_DIR};${EIGEN3_INCLUDE_DIR}")
foreach(_dir @FLANN_INCLUDE_DIRS@;@ODE_INCLUDE_DIRS@;@SPOT_INCLUDE_DIRS@;@TRIANGLE_INCLUDE_DIR@;@FCL_INCLUDE_DIRS@;@PQP_INCLUDE_DIR@;@ASSIMP_INCLUDE_DIRS@;@OPENGL_INCLUDE_DIR@)
if(_dir)
list(APPEND OMPL_INCLUDE_DIRS "${_dir}")
@@ -29,7 +31,7 @@ list(REMOVE_DUPLICATES OMPL_INCLUDE_DIRS)
set(OMPL_INCLUDE_DIRS "${OMPL_INCLUDE_DIRS}" CACHE STRING "Include path for OMPL and its dependencies")

set_and_check(OMPL_LIBRARY_DIR @PACKAGE_LIB_INSTALL_DIR@)
-set(OMPL_LIBRARY_DIRS "${OMPL_LIBRARY_DIR};@Boost_LIBRARY_DIRS@")
+set(OMPL_LIBRARY_DIRS "${OMPL_LIBRARY_DIR};${Boost_LIBRARY_DIRS}")
foreach(_dir @FLANN_LIBRARY_DIRS@;@ODE_LIBRARY_DIRS@;@SPOT_LIBRARY_DIRS@;@FCL_LIBRARY_DIRS@;@ASSIMP_LIBRARY_DIRS@)
if(_dir)
list(APPEND OMPL_LIBRARY_DIRS "${_dir}")
@@ -40,7 +42,7 @@ set(OMPL_LIBRARY_DIRS "${OMPL_LIBRARY_DIRS}" CACHE STRING "Library path for OMPL

find_library(OMPL_LIBRARIES NAMES ompl.${OMPL_VERSION} ompl
PATHS ${OMPL_LIBRARY_DIR} NO_DEFAULT_PATH)
-foreach(_lib @Boost_SERIALIZATION_LIBRARY@;@Boost_FILESYSTEM_LIBRARY@;@Boost_SYSTEM_LIBRARY@;@ODE_LIBRARIES@;@SPOT_LIBRARIES@)
+foreach(_lib ${Boost_SERIALIZATION_LIBRARY};${Boost_FILESYSTEM_LIBRARY};${Boost_SYSTEM_LIBRARY};@ODE_LIBRARIES@;@SPOT_LIBRARIES@)
if(_lib)
list(APPEND OMPL_LIBRARIES "${_lib}")
endif()
@@ -61,3 +63,4 @@ endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ompl DEFAULT_MSG OMPL_INCLUDE_DIRS OMPL_LIBRARY_DIRS OMPL_LIBRARIES)
+include(${CMAKE_CURRENT_LIST_DIR}/ompl-targets.cmake)
6 changes: 1 addition & 5 deletions ports/ompl/CONTROL
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Source: ompl
Version: 1.5.1
Port-Version: 0
Port-Version: 1
Homepage: https://ompl.kavrakilab.org/
Description: The Open Motion Planning Library, consists of many state-of-the-art sampling-based motion planning algorithms
Build-Depends: boost-dynamic-bitset, boost-filesystem, boost-graph, boost-odeint, boost-program-options, boost-serialization, boost-system, boost-test, boost-ublas, boost-timer, eigen3

Feature: app
Description: Add support for reading meshes and performing collision checking
Build-Depends: assimp, fcl
36 changes: 8 additions & 28 deletions ports/ompl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,19 @@ vcpkg_buildpath_length_warning(37)

set(OMPL_VERSION 1.5.1)

set(FEATURE_PATCHES)

if("app" IN_LIST FEATURES)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/ompl/omplapp/releases/download/1.5.1/omplapp-1.5.1-Source.tar.gz"
FILENAME "omplapp-${OMPL_VERSION}.tar.gz"
SHA512 83b1b09d6be776f7e15a748402f0c2f072459921de61a92731daf5171bd1f91a829fbeb6e10a489b92fba0297f6272e7bb6b8f07830c387bb29ccdbc7b3731f3
)
list(APPEND FEATURE_PATCHES fix_dependency.patch)
else()
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/ompl/ompl/archive/1.5.1.tar.gz"
FILENAME "ompl-${OMPL_VERSION}.tar.gz"
SHA512 2f28d29f32f3bb03e67b29ce251e4786364847a25e3c4cf66d7663ed38dca4da71d4e03cf9ce647710d9524a3907c76c09795e77f041cb8822f695d28f5ca570
)
endif()
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/ompl/ompl/archive/1.5.1.tar.gz"
FILENAME "ompl-${OMPL_VERSION}.tar.gz"
SHA512 2f28d29f32f3bb03e67b29ce251e4786364847a25e3c4cf66d7663ed38dca4da71d4e03cf9ce647710d9524a3907c76c09795e77f041cb8822f695d28f5ca570
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${OMPL_VERSION}
PATCHES ${FEATURE_PATCHES}
PATCHES
0001_Export_targets.patch
0002_Fix_config.patch
)

# Based on selected features different files get downloaded, so use the following command instead of patch.
Expand Down Expand Up @@ -58,17 +49,6 @@ file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/share/ompl/ompl.conf
${CURRENT_PACKAGES_DIR}/share/ompl/plannerarena
)
if ("app" IN_LIST FEATURES)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/ompl)
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/ompl_benchmark.exe ${CURRENT_PACKAGES_DIR}/tools/ompl/ompl_benchmark.exe)
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/bin
${CURRENT_PACKAGES_DIR}/debug/bin
${CURRENT_PACKAGES_DIR}/include/omplapp/CMakeFiles
${CURRENT_PACKAGES_DIR}/share/ompl/resources
${CURRENT_PACKAGES_DIR}/share/ompl/webapp
)
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
Expand Down
17 changes: 17 additions & 0 deletions ports/omplapp/fix_boost_static_link.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5c3c88..3a4a7d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,10 +36,10 @@ set(OMPL_DEMO_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/ompl/demos"
set(OMPL_CMAKE_UTIL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ompl/CMakeModules"
CACHE FILEPATH "Path to directory with auxiliary CMake scripts for OMPL")

-if(MSVC)
+if(false)
add_definitions(-DBOOST_ALL_NO_LIB)
add_definitions(-DBOOST_PROGRAM_OPTIONS_DYN_LINK)
-endif(MSVC)
+endif(false)
# Ensure dynamic linking with boost unit_test_framework
add_definitions(-DBOOST_TEST_DYN_LINK)
# Avoid valgrind error due to overflow error, cf. https://bitbucket.org/ompl/ompl/issues/543
File renamed without changes.
67 changes: 67 additions & 0 deletions ports/omplapp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
vcpkg_buildpath_length_warning(37)

set(OMPL_VERSION 1.5.1)

vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/ompl/omplapp/releases/download/1.5.1/omplapp-1.5.1-Source.tar.gz"
FILENAME "omplapp-${OMPL_VERSION}.tar.gz"
SHA512 83b1b09d6be776f7e15a748402f0c2f072459921de61a92731daf5171bd1f91a829fbeb6e10a489b92fba0297f6272e7bb6b8f07830c387bb29ccdbc7b3731f3
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(STATIC_PATCH fix_boost_static_link.patch)
endif()

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${OMPL_VERSION}
PATCHES
fix_dependency.patch
${STATIC_PATCH}
)

# Based on selected features different files get downloaded, so use the following command instead of patch.
file(READ ${SOURCE_PATH}/CMakeLists.txt _contents)
string(REPLACE "find_package(Eigen3 REQUIRED)" "find_package(Eigen3 REQUIRED CONFIG)" _contents "${_contents}")
string(REPLACE "find_package(ccd REQUIRED)" "find_package(ccd REQUIRED CONFIG)" _contents "${_contents}")
file(WRITE ${SOURCE_PATH}/CMakeLists.txt "${_contents}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DOMPL_VERSIONED_INSTALL=OFF
-DOMPL_REGISTRATION=OFF
-DOMPL_BUILD_DEMOS=OFF
-DOMPL_BUILD_TESTS=OFF
-DOMPL_BUILD_PYBINDINGS=OFF
-DOMPL_BUILD_PYTESTS=OFF
)

vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH share/ompl/cmake)

# Remove debug distribution and other, move ompl_benchmark to tools/ dir
vcpkg_copy_tools(TOOL_NAMES ompl_benchmark AUTO_CLEAN)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/include/ompl"
"${CURRENT_PACKAGES_DIR}/bin"
"${CURRENT_PACKAGES_DIR}/include/omplapp/CMakeFiles"
"${CURRENT_PACKAGES_DIR}/lib/ompl.lib"
"${CURRENT_PACKAGES_DIR}/share/ompl"
"${CURRENT_PACKAGES_DIR}/share/man"
"${CURRENT_PACKAGES_DIR}/debug/bin"
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/lib/ompl.lib"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
11 changes: 11 additions & 0 deletions ports/omplapp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "omplapp",
"version-string": "1.5.1",
"description": "Use OMPL for reading meshes and performing collision checking",
"homepage": "https://ompl.kavrakilab.org/",
"dependencies": [
"assimp",
"fcl",
"ompl"
]
}
6 changes: 5 additions & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@
},
"ccd": {
"baseline": "2.1-4",
"port-version": 0
"port-version": 1
},
"ccfits": {
"baseline": "2.5",
Expand Down Expand Up @@ -4489,6 +4489,10 @@
"port-version": 2
},
"ompl": {
"baseline": "1.5.1",
"port-version": 1
},
"omplapp": {
"baseline": "1.5.1",
"port-version": 0
},
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/ccd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a720cc123c190c6b68e57e356c4937685eeb2faa",
"version-string": "2.1-4",
"port-version": 1
},
{
"git-tree": "c5315a631ffcea9c2a158578e73c53d8455808de",
"version-string": "2.1-4",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/ompl.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f3812117c1ed1d4080155284f12908236dd797f5",
"version-string": "1.5.1",
"port-version": 1
},
{
"git-tree": "2dc123683ef75002bd7252b252cc220a7a643066",
"version-string": "1.5.1",
Expand Down
9 changes: 9 additions & 0 deletions versions/o-/omplapp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "590eb9956381e7ef47b780fbd9aee2c6e8da323c",
"version-string": "1.5.1",
"port-version": 0
}
]
}