Skip to content

Commit

Permalink
fully remove catkin dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Winkler committed Jul 2, 2018
1 parent 1bb70ec commit 4df1470
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 45 deletions.
53 changes: 12 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,13 @@
# Copyright (c) 2017, Alexander W. Winkler, ETH Zurich. All rights reserved.
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(ifopt VERSION 2.0.0)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
find_package(Eigen3 REQUIRED)

# predefine library names to export with catkin-package
set(LIB_CORE ifopt_core)
set(ifopt_LIBRARIES ${LIB_CORE})
set(ifopt_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
list(APPEND ifopt_INCLUDE_DIRS ifopt_core/include)

option(BUILD_IPOPT "compile with IPOPT solver" ON)
if (BUILD_IPOPT)
set(LIB_IPOPT ifopt_ipopt)
list(APPEND ifopt_INCLUDE_DIRS ifopt_ipopt/include)
list(APPEND ifopt_LIBRARIES ${LIB_IPOPT})
endif()

option(BUILD_SNOPT "compile with SNOPT solver" OFF)
if (BUILD_SNOPT)
set(LIB_SNOPT ifopt_snopt)
list(APPEND ifopt_INCLUDE_DIRS ifopt_snopt/include)
list(APPEND ifopt_LIBRARIES ${LIB_SNOPT})
endif()



##############################################
## catkin specific configuration (optional) ##
##############################################
if (CATKIN_DEVEL_PREFIX) # set only when building with catkin, not pure cmake
find_package(catkin REQUIRED)
catkin_package(
INCLUDE_DIRS ${ifopt_INCLUDE_DIRS}
LIBRARIES ${ifopt_LIBRARIES}
)
endif()
project(ifopt VERSION 2.0.1)


###########
## Build ##
###########
include(GNUInstallDirs) # for correct library locations across platforms
set(config_package_location ${CMAKE_INSTALL_PREFIX}/share/ifopt/cmake) # for .cmake find-scripts installs
set(config_package_location "share/${PROJECT_NAME}/cmake") # for .cmake find-scripts installs
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # so installed solver libraries link to IFOPT/SNOPT
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) # so installed solver libraries link to libifopt_core.so

Expand All @@ -52,16 +16,20 @@ IF(NOT CMAKE_BUILD_TYPE MATCHES Release)
endif()

enable_testing()
add_subdirectory(${LIB_CORE})
set(LIB_CORE ifopt_core)
add_subdirectory(ifopt_core)

option(BUILD_IPOPT "compile with IPOPT solver" ON)
if (BUILD_IPOPT)
add_subdirectory(${LIB_IPOPT})
add_subdirectory(ifopt_ipopt)
endif()

option(BUILD_SNOPT "compile with SNOPT solver" OFF)
if (BUILD_SNOPT)
add_subdirectory(${LIB_SNOPT})
add_subdirectory(ifopt_snopt)
endif()

message(WARNING "VERSION: ${ifopt_VERSION}")

##################################################
## Install find scripts for find_package(ifopt) ##
Expand All @@ -83,3 +51,6 @@ install(
"${CMAKE_CURRENT_BINARY_DIR}/ifopt-config-version.cmake" # generated
DESTINATION ${config_package_location}
)

# Install a Catkin 'package.xml' file. This is required by REP-136.
install(FILES package.xml DESTINATION share/${PROJECT_NAME})
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
### <img src="https://i.imgur.com/ZOfGZwB.png" height="60" />

<!-- until build server fixed
[![Build Status](https://ci.leggedrobotics.com/buildStatus/icon?job=github_ethz-adrl/ifopt/master)](https://ci.leggedrobotics.com/job/github_ethz-adrl/job/ifopt/job/master/)
-->
[<img height="20" src="https://i.imgur.com/ZqRckbJ.png"/>](http://docs.ros.org/lunar/api/ifopt/html/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1135046.svg)](https://doi.org/10.5281/zenodo.1135046)
<!-- The actual jenkins documentation job can be found here -->
Expand Down
4 changes: 4 additions & 0 deletions ifopt_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
find_package(Eigen3 REQUIRED)


###########
## Build ##
###########
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions ifopt_ipopt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ find_package(IPOPT 3.11.9 REQUIRED)
###########
## Build ##
###########
set(LIB_IPOPT ifopt_ipopt)
# The IPOPT solver interface
add_library(${LIB_IPOPT} SHARED
src/ipopt.cc
Expand Down
1 change: 1 addition & 0 deletions ifopt_snopt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ find_package(SNOPT REQUIRED)
###########
## Build ##
###########
set(LIB_SNOPT ifopt_snopt)
add_library(${LIB_SNOPT} SHARED
src/snopt.cc
src/snopt_adapter.cc
Expand Down
9 changes: 7 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@

<url type="website">https://github.com/ethz-adrl/ifopt</url>

<!-- although pure cmake is also sufficient -->
<buildtool_depend>catkin</buildtool_depend>
<depend>eigen</depend>
<depend>coinor-libipopt-dev</depend>

<!-- The following tags are recommended by REP-136 -->
<exec_depend>catkin</exec_depend>
<buildtool_depend>cmake</buildtool_depend>
<export>
<build_type>cmake</build_type>
</export>

</package>

0 comments on commit 4df1470

Please sign in to comment.