Skip to content

Commit e2eee06

Browse files
Merge pull request opensim-org#3278 from opensim-org/fix_ipopt_with_casadi
Fix IPOPT library install with only OPENSIM_WITH_CASADI flag
2 parents 156763a + eee631c commit e2eee06

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ v4.4.1
1111

1212
- Made `Component::getSocketNames` a `const` member method (previously: non-const)
1313
- Modifed the swig interface files to make OpenSim::PathPointSet adopt new PathPoints inserted into it. (Issue #3276)
14+
- Fixed an issue with IPOPT libraries when building OpenSim with `OPENSIM_WITH_CASADI = ON` but `OPENSIM_WITH_TROPTER = OFF` (Issue #3267).
1415

1516
v4.4
1617
====

CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,32 @@ if(OPENSIM_WITH_CASADI)
851851
endif()
852852
endif()
853853

854+
# IPOPT
855+
# -----
856+
857+
# Avoid using pkg-config on Windows as it's not easy to get
858+
# on Windows. On UNIX, the pkg-config file for Ipopt provides
859+
# a flag that we must use.
860+
if(UNIX)
861+
find_package(PkgConfig REQUIRED)
862+
endif()
863+
864+
if (OPENSIM_WITH_CASADI OR OPENSIM_WITH_TROPTER)
865+
if(UNIX)
866+
pkg_check_modules(IPOPT REQUIRED ipopt IMPORTED_TARGET)
867+
else()
868+
find_package(Ipopt REQUIRED CONFIG)
869+
set_package_properties(IPOPT PROPERTIES
870+
URL https://projects.coin-or.org/Ipopt
871+
TYPE REQUIRED
872+
PURPOSE "Nonlinear optimization")
873+
# Flags to use when building a shared library.
874+
# TODO move these flags to a specific target.
875+
# TODO set(CMAKE_SHARED_LINKER_FLAGS
876+
# TODO "${CMAKE_SHARED_LINKER_FLAGS} ${IPOPT_LINK_FLAGS}")
877+
OpenSimCopyDependencyDLLsForWin(DEP_NAME IPOPT DEP_BIN_DIR "${Ipopt_ROOT_DIR}/bin")
878+
endif()
879+
endif()
854880

855881
# Installing dependencies into OpenSim's installation.
856882
# ----------------------------------------------------

Vendors/tropter/CMakeLists.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ set_package_properties(Eigen3 PROPERTIES
6363
TYPE REQUIRED
6464
PURPOSE "Matrix library")
6565

66-
# Avoid using pkg-config on Windows as it's not easy to get
67-
# on Windows. On UNIX, the pkg-config file for Ipopt provides
68-
# a flag that we must use.
69-
if(UNIX)
70-
find_package(PkgConfig REQUIRED)
71-
endif()
72-
7366
# ColPack can now use CMake to be built.
7467
find_package(ColPack 1.0.10 REQUIRED HINTS "${OPENSIM_DEPENDENCIES_DIR}/colpack")
7568
set_package_properties(ColPack PROPERTIES
@@ -84,21 +77,6 @@ set_package_properties(ADOLC PROPERTIES
8477
PURPOSE "Computing derivatives for optimization")
8578
tropter_copy_dlls(DEP_NAME ADOLC DEP_INSTALL_DIR "${ADOLC_DIR}/bin")
8679

87-
if(UNIX)
88-
pkg_check_modules(IPOPT REQUIRED ipopt IMPORTED_TARGET)
89-
else()
90-
find_package(Ipopt REQUIRED CONFIG)
91-
set_package_properties(IPOPT PROPERTIES
92-
URL https://projects.coin-or.org/Ipopt
93-
TYPE REQUIRED
94-
PURPOSE "Nonlinear optimization")
95-
# Flags to use when building a shared library.
96-
# TODO move these flags to a specific target.
97-
# TODO set(CMAKE_SHARED_LINKER_FLAGS
98-
# TODO "${CMAKE_SHARED_LINKER_FLAGS} ${IPOPT_LINK_FLAGS}")
99-
tropter_copy_dlls(DEP_NAME IPOPT DEP_INSTALL_DIR "${Ipopt_ROOT_DIR}/bin")
100-
endif()
101-
10280
# OpenMP allows parallelization (of evaluating dynamics and path constraints
10381
# across tropter points) and is usually a feature of a compiler. It's fine if
10482
# the compiler does not support OpenMP.

Vendors/tropter/cmake/FindIPOPT.cmake renamed to cmake/FindIPOPT.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
# Additional support to YCM was received from the FP7 EU project
8484
# WALK-MAN (http://walk-man.eu/)
8585

86-
8786
if(NOT WIN32)
8887
# On non Windows systems we use PkgConfig to find IPOPT
8988
find_package(PkgConfig QUIET)

0 commit comments

Comments
 (0)