-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66dbcb9
commit c763d5a
Showing
4 changed files
with
329 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,5 @@ lvr2: | |
add: [libgdal-dev] | ||
rtabmap: | ||
add: ["REQUIRE_OPENGL"] | ||
image_view2: | ||
add: ["REQUIRE_OPENGL"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,293 @@ | ||
diff --git a/ifopt_ipopt/CMakeLists.txt b/ifopt_ipopt/CMakeLists.txt | ||
index eb6b21a..fd8b48b 100644 | ||
--- a/ifopt_ipopt/CMakeLists.txt | ||
+++ b/ifopt_ipopt/CMakeLists.txt | ||
@@ -1,5 +1,5 @@ | ||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) | ||
-find_package(IPOPT 3.11.9 REQUIRED) | ||
+find_package(IPOPT REQUIRED) | ||
# previous IPOPT versions have a bug which causes mumps segfault: | ||
# https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/1167585 | ||
|
||
@@ -39,6 +39,7 @@ target_compile_definitions(${LIB_IPOPT} | ||
add_executable(${LIB_IPOPT}-example test/ex_test_ipopt.cc) | ||
target_link_libraries(${LIB_IPOPT}-example | ||
PRIVATE | ||
+ ${IPOPT_LIBRARIES} | ||
${LIB_IPOPT} | ||
) | ||
add_test(${LIB_IPOPT}-example ${LIB_IPOPT}-example) | ||
diff --git a/ifopt_ipopt/cmake/FindIPOPT.cmake b/ifopt_ipopt/cmake/FindIPOPT.cmake | ||
index 912f20d..483e16d 100644 | ||
--- a/ifopt_ipopt/cmake/FindIPOPT.cmake | ||
+++ b/ifopt_ipopt/cmake/FindIPOPT.cmake | ||
@@ -1,233 +1,49 @@ | ||
-#.rst: | ||
-# FindIPOPT | ||
-# --------- | ||
+# Copyright (c) 2011-2021, The DART development contributors | ||
+# All rights reserved. | ||
# | ||
-# Try to locate the IPOPT library | ||
+# The list of contributors can be found at: | ||
+# https://github.com/dartsim/dart/blob/master/LICENSE | ||
# | ||
-# First tries to find the library in the standard search path. If this fails | ||
-# it searches where the environmental varialbe IPOPT_DIR is pointing. | ||
-# Set this to the folder in which you built IPOPT, e.g, in your ~/.bashrc: | ||
+# This file is provided under the "BSD-style" License | ||
|
||
-# export IPOPT_DIR=/home/winklera/Ipopt-3.12.8/build | ||
+# Find IPOPT | ||
# | ||
-# Result variables | ||
-# ^^^^^^^^^^^^^^^^ | ||
+# This sets the following variables: | ||
+# IPOPT_FOUND | ||
+# IPOPT_INCLUDE_DIRS | ||
+# IPOPT_LIBRARIES | ||
+# IPOPT_DEFINITIONS | ||
+# IPOPT_VERSION | ||
# | ||
-# Create the following variables:: | ||
-# | ||
-# IPOPT_INCLUDE_DIRS - Directories to include to use IPOPT | ||
-# IPOPT_LIBRARIES - Default library to link against to use IPOPT | ||
-# IPOPT_DEFINITIONS - Flags to be added to linker's options | ||
-# IPOPT_LINK_FLAGS - Flags to be added to linker's options | ||
-# IPOPT_FOUND - If false, don't try to use IPOPT | ||
-# | ||
-#============================================================================= | ||
-# This find script is copied from https://github.com/robotology/idyntree. | ||
-# Original copyright notice can be seen below: | ||
-#============================================================================= | ||
-# Copyright (C) 2008-2010 RobotCub Consortium | ||
-# Copyright (C) 2016 iCub Facility - Istituto Italiano di Tecnologia | ||
-# Authors: Ugo Pattacini <[email protected]> | ||
-# Authors: Daniele E. Domenichelli <[email protected]> | ||
-# | ||
-# Distributed under the OSI-approved BSD License (the "License"); | ||
-# see accompanying file Copyright.txt for details. | ||
-# | ||
-# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
-# See the License for more information. | ||
-#============================================================================= | ||
-# (To distribute this file outside of YCM, substitute the full | ||
-# License text for the above reference.) | ||
- | ||
-if(NOT WIN32) | ||
- | ||
- # First priority is finding the package using IPOPT_DIR if set | ||
- if(DEFINED ENV{IPOPT_DIR}) | ||
- set(IPOPT_DIR $ENV{IPOPT_DIR} CACHE PATH "Path to IPOPT build directory") | ||
- | ||
- set(IPOPT_INCLUDE_DIRS ${IPOPT_DIR}/include/coin) | ||
- find_library(IPOPT_LIBRARIES ipopt ${IPOPT_DIR}/lib | ||
- ${IPOPT_DIR}/lib/coin | ||
- NO_DEFAULT_PATH) | ||
- | ||
- if(IPOPT_LIBRARIES) | ||
- find_file(IPOPT_DEP_FILE ipopt_addlibs_cpp.txt ${IPOPT_DIR}/share/doc/coin/Ipopt | ||
- ${IPOPT_DIR}/share/coin/doc/Ipopt | ||
- NO_DEFAULT_PATH) | ||
- mark_as_advanced(IPOPT_DEP_FILE) | ||
- | ||
- if(IPOPT_DEP_FILE) | ||
- # parse the file and acquire the dependencies | ||
- file(READ ${IPOPT_DEP_FILE} IPOPT_DEP) | ||
- string(REGEX REPLACE "-[^l][^ ]* " "" IPOPT_DEP ${IPOPT_DEP}) | ||
- string(REPLACE "-l" "" IPOPT_DEP ${IPOPT_DEP}) | ||
- string(REPLACE "\n" "" IPOPT_DEP ${IPOPT_DEP}) | ||
- string(REPLACE "ipopt" "" IPOPT_DEP ${IPOPT_DEP}) # remove any possible auto-dependency | ||
- separate_arguments(IPOPT_DEP) | ||
- | ||
- # use the find_library command in order to prepare rpath correctly | ||
- foreach(LIB ${IPOPT_DEP}) | ||
- find_library(IPOPT_SEARCH_FOR_${LIB} ${LIB} ${IPOPT_DIR}/lib | ||
- ${IPOPT_DIR}/lib/coin | ||
- ${IPOPT_DIR}/lib/coin/ThirdParty | ||
- NO_DEFAULT_PATH) | ||
- if(IPOPT_SEARCH_FOR_${LIB}) | ||
- # handle non-system libraries (e.g. coinblas) | ||
- set(IPOPT_LIBRARIES ${IPOPT_LIBRARIES} ${IPOPT_SEARCH_FOR_${LIB}}) | ||
- else() | ||
- # handle system libraries (e.g. gfortran) | ||
- set(IPOPT_LIBRARIES ${IPOPT_LIBRARIES} ${LIB}) | ||
- endif() | ||
- mark_as_advanced(IPOPT_SEARCH_FOR_${LIB}) | ||
- endforeach() | ||
- endif() | ||
- endif() | ||
- | ||
- set(IPOPT_DEFINITIONS "") | ||
- | ||
- | ||
- # if IPOPT_DIR not set, try finding IPOPT through package manager | ||
- else() | ||
- find_package(PkgConfig QUIET) | ||
- if(PKG_CONFIG_FOUND) | ||
- | ||
- if(IPOPT_FIND_VERSION) | ||
- if(IPOPT_FIND_VERSION_EXACT) | ||
- pkg_check_modules(_PC_IPOPT REQUIRED ipopt=${IPOPT_FIND_VERSION}) | ||
- else() | ||
- pkg_check_modules(_PC_IPOPT REQUIRED ipopt>=${IPOPT_FIND_VERSION}) | ||
- endif() | ||
- else() | ||
- pkg_check_modules(_PC_IPOPT REQUIRED ipopt) | ||
- endif() | ||
- | ||
- | ||
- if(_PC_IPOPT_FOUND) | ||
- set(IPOPT_INCLUDE_DIRS ${_PC_IPOPT_INCLUDE_DIRS} CACHE PATH "IPOPT include directory") | ||
- set(IPOPT_DEFINITIONS ${_PC_IPOPT_CFLAGS_OTHER} CACHE STRING "Additional compiler flags for IPOPT") | ||
- set(IPOPT_LIBRARIES "" CACHE STRING "IPOPT libraries" FORCE) | ||
- foreach(_LIBRARY IN ITEMS ${_PC_IPOPT_LIBRARIES}) | ||
- find_library(${_LIBRARY}_PATH | ||
- NAMES ${_LIBRARY} | ||
- PATHS ${_PC_IPOPT_LIBRARY_DIRS}) | ||
- # Workaround for https://github.com/robotology/icub-main/issues/418 | ||
- if(${_LIBRARY}_PATH) | ||
- list(APPEND IPOPT_LIBRARIES ${${_LIBRARY}_PATH}) | ||
- endif() | ||
- endforeach() | ||
- else() | ||
- set(IPOPT_DEFINITIONS "") | ||
- endif() | ||
- endif() | ||
- endif() | ||
- | ||
- set(IPOPT_LINK_FLAGS "") | ||
+# and the following targets: | ||
+# IPOPT::ipopt | ||
|
||
-# Windows platforms | ||
-else() | ||
- include(SelectLibraryConfigurations) | ||
+find_package(PkgConfig QUIET) | ||
|
||
- set(IPOPT_DIR $ENV{IPOPT_DIR} CACHE PATH "Path to IPOPT build directory") | ||
+# Check to see if pkgconfig is installed. | ||
+pkg_check_modules(PC_IPOPT ipopt QUIET) | ||
|
||
- set(IPOPT_INCLUDE_DIRS ${IPOPT_DIR}/include/coin) | ||
- find_library(IPOPT_IPOPT_LIBRARY_RELEASE libipopt ${IPOPT_DIR}/lib | ||
- ${IPOPT_DIR}/lib/coin | ||
- NO_DEFAULT_PATH) | ||
- find_library(IPOPT_IPOPT_LIBRARY_DEBUG libipoptD ${IPOPT_DIR}/lib | ||
- ${IPOPT_DIR}/lib/coin | ||
- NO_DEFAULT_PATH) | ||
+# Definitions | ||
+set(IPOPT_DEFINITIONS ${PC_IPOPT_CFLAGS_OTHER}) | ||
|
||
- select_library_configurations(IPOPT_IPOPT) | ||
- set(IPOPT_LIBRARIES ${IPOPT_IPOPT_LIBRARY}) | ||
+# Include directories | ||
+find_path(IPOPT_INCLUDE_DIRS | ||
+ NAMES IpIpoptNLP.hpp | ||
+ HINTS ${PC_IPOPT_INCLUDEDIR} | ||
+ PATHS "${CMAKE_INSTALL_PREFIX}/include") | ||
|
||
- # Some old version of binary releases of IPOPT have Intel fortran | ||
- # libraries embedded in the library, newer releases require them to | ||
- # be explicitly linked. | ||
- if(IPOPT_IPOPT_LIBRARY) | ||
- get_filename_component(_MSVC_DIR "${CMAKE_LINKER}" DIRECTORY) | ||
+# Libraries | ||
+find_library(IPOPT_LIBRARIES | ||
+ NAMES ipopt | ||
+ HINTS ${PC_IPOPT_LIBDIR}) | ||
|
||
- # Find the lib.exe executable | ||
- find_program(LIB_EXECUTABLE | ||
- NAMES lib.exe | ||
- HINTS "${_MSVC_BINDIR}" | ||
- "C:/Program Files/Microsoft Visual Studio 10.0/VC/bin" | ||
- "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin" | ||
- "C:/Program Files/Microsoft Visual Studio 11.0/VC/bin" | ||
- "C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin" | ||
- "C:/Program Files/Microsoft Visual Studio 12.0/VC/bin" | ||
- "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin" | ||
- "C:/Program Files/Microsoft Visual Studio 14.0/VC/bin" | ||
- "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin" | ||
- DOC "Path to the lib.exe executable") | ||
- mark_as_advanced(LIB_EXECUTABLE) | ||
- | ||
- # backup PATH environment variable | ||
- set(_path $ENV{PATH}) | ||
- | ||
- # Add th MSVC "Common7/IDE" dir containing the dlls in the PATH when needed. | ||
- get_filename_component(_MSVC_LIBDIR "${_MSVC_BINDIR}/../../Common7/IDE" ABSOLUTE) | ||
- if(NOT EXISTS "${_MSVC_LIBDIR}") | ||
- get_filename_component(_MSVC_LIBDIR "${_MSVC_BINDIR}/../../../Common7/IDE" ABSOLUTE) | ||
- endif() | ||
- | ||
- if(EXISTS "${_MSVC_LIBDIR}") | ||
- set(_MSVC_LIBDIR_FOUND 0) | ||
- file(TO_CMAKE_PATH "$ENV{PATH}" _env_path) | ||
- foreach(_dir ${_env_path}) | ||
- if("${_dir}" STREQUAL ${_MSVC_LIBDIR}) | ||
- set(_MSVC_LIBDIR_FOUND 1) | ||
- endif() | ||
- endforeach() | ||
- if(NOT _MSVC_LIBDIR_FOUND) | ||
- file(TO_NATIVE_PATH "${_MSVC_LIBDIR}" _MSVC_LIBDIR) | ||
- set(ENV{PATH} "$ENV{PATH};${_MSVC_LIBDIR}") | ||
- endif() | ||
- endif() | ||
- | ||
- if(IPOPT_IPOPT_LIBRARY_RELEASE) | ||
- set(_IPOPT_LIB ${IPOPT_IPOPT_LIBRARY_RELEASE}) | ||
- else() | ||
- set(_IPOPT_LIB ${IPOPT_IPOPT_LIBRARY_DEBUG}) | ||
- endif() | ||
- | ||
- execute_process(COMMAND ${LIB_EXECUTABLE} /list "${_IPOPT_LIB}" | ||
- OUTPUT_VARIABLE _lib_output) | ||
- | ||
- set(ENV{PATH} "${_path}") | ||
- unset(_path) | ||
- | ||
- if(NOT "${_lib_output}" MATCHES "libifcoremd.dll") | ||
- get_filename_component(_IPOPT_IPOPT_LIBRARY_DIR "${_IPOPT_LIB}" DIRECTORY) | ||
- | ||
- foreach(_lib ifconsol | ||
- libifcoremd | ||
- libifportmd | ||
- libmmd | ||
- libirc | ||
- svml_dispmd) | ||
- string(TOUPPER "${_lib}" _LIB) | ||
- find_library(IPOPT_${_LIB}_LIBRARY_RELEASE ${_lib} ${_IPOPT_IPOPT_LIBRARY_DIR}) | ||
- find_library(IPOPT_${_LIB}_LIBRARY_DEBUG ${_lib}d ${_IPOPT_IPOPT_LIBRARY_DIR}) | ||
- select_library_configurations(IPOPT_${_LIB}) | ||
- list(APPEND IPOPT_LIBRARIES ${IPOPT_${_LIB}_LIBRARY}) | ||
- endforeach() | ||
- endif() | ||
- endif() | ||
- | ||
- set(IPOPT_DEFINITIONS "") | ||
- if(MSVC) | ||
- set(IPOPT_LINK_FLAGS "/NODEFAULTLIB:libcmt.lib;libcmtd.lib") | ||
- else() | ||
- set(IPOPT_LINK_FLAGS "") | ||
- endif() | ||
- | ||
-endif() | ||
- | ||
-mark_as_advanced(IPOPT_INCLUDE_DIRS | ||
- IPOPT_LIBRARIES | ||
- IPOPT_DEFINITIONS | ||
- IPOPT_LINK_FLAGS) | ||
+# Version | ||
+set(IPOPT_VERSION ${PC_IPOPT_VERSION}) | ||
|
||
+# Set (NAME)_FOUND if all the variables and the version are satisfied. | ||
include(FindPackageHandleStandardArgs) | ||
-find_package_handle_standard_args(IPOPT DEFAULT_MSG IPOPT_LIBRARIES) | ||
+find_package_handle_standard_args(IPOPT | ||
+ FAIL_MESSAGE DEFAULT_MSG | ||
+ REQUIRED_VARS IPOPT_INCLUDE_DIRS IPOPT_LIBRARIES | ||
+ VERSION_VAR IPOPT_VERSION) | ||
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 9c0785e..65a7867 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -4,6 +4,9 @@ project(lusb) | ||
find_package(catkin REQUIRED) | ||
find_package(Boost REQUIRED COMPONENTS thread system) | ||
|
||
+find_package(PkgConfig) | ||
+pkg_check_modules(LibUSB libusb-1.0) | ||
+ | ||
catkin_package( | ||
INCLUDE_DIRS include ${Boost_INCLUDE_DIRS} | ||
LIBRARIES ${PROJECT_NAME} ${Boost_LIBRARIES} | ||
@@ -12,6 +15,7 @@ include_directories( | ||
include | ||
${catkin_INCLUDE_DIRS} | ||
${Boost_INCLUDE_DIRS} | ||
+ ${LibUSB_INCLUDE_DIRS} | ||
) | ||
|
||
add_library(${PROJECT_NAME} | ||
@@ -20,7 +24,7 @@ add_library(${PROJECT_NAME} | ||
target_link_libraries(${PROJECT_NAME} | ||
${catkin_LIBRARIES} | ||
${Boost_LIBRARIES} | ||
- usb-1.0 | ||
+ ${LibUSB_LIBRARIES} | ||
) | ||
|
||
install(TARGETS ${PROJECT_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters