Skip to content

Commit

Permalink
Fix for undefined symbols on OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
bchretien committed Aug 27, 2016
1 parent 4c06d6c commit d758f07
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis
Submodule .travis updated 1 files
+4 −0 common.sh
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -27,8 +27,9 @@ branches:
- travis
- coverity_scan
script:
- export LD_LIBRARY_PATH=`pkg-config --variable=plugindir roboptim-core`:$LD_LIBRARY_PATH;
- if [ "${COVERITY_SCAN_BRANCH}" != "1" ]; then ./.travis/run build; fi
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then export LD_LIBRARY_PATH=`pkg-config --variable=plugindir roboptim-core`:$LD_LIBRARY_PATH; fi
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then export DYLD_LIBRARY_PATH=`pkg-config --variable=plugindir roboptim-core`:$DYLD_LIBRARY_PATH; fi
- if [ "${COVERITY_SCAN_BRANCH}" != "1" ]; then ./.travis/run build; fi
after_success:
- ./.travis/run after_success
- codecov --gcov-root=/tmp/_ci/build
Expand Down
12 changes: 8 additions & 4 deletions src/CMakeLists.txt
Expand Up @@ -21,6 +21,11 @@ MACRO(IPOPT_PLUGIN NAME)
ADD_LIBRARY(roboptim-core-plugin-${NAME} MODULE
${NAME}.cc tnlp.cc tnlp.hh tnlp.hxx doc.hh ${HEADERS}
)

IF(APPLE)
SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
ENDIF()

SET_TARGET_PROPERTIES(roboptim-core-plugin-${NAME} PROPERTIES
COMPILE_DEFINITIONS
IPOPT_DEFAULT_LINEAR_SOLVER="${IPOPT_DEFAULT_LINEAR_SOLVER}"
Expand All @@ -36,18 +41,17 @@ MACRO(IPOPT_PLUGIN NAME)
PKG_CONFIG_USE_COMPILE_DEPENDENCY(roboptim-core-plugin-${NAME} roboptim-core)

# Make sure all symbols are defined.
# See:
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=592752
# See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=592752
IF(CMAKE_SYSTEM_NAME MATCHES "Linux"
AND EXISTS "/etc/debian_version"
AND IPOPT_PREFIX MATCHES "/usr")
TARGET_LINK_LIBRARIES(roboptim-core-plugin-${NAME} dmumps_seq)
TARGET_LINK_LIBRARIES(roboptim-core-plugin-${NAME} dmumps_seq)
ENDIF()
ENDMACRO()

# Ipopt plug-in (with only gradient computation).
IPOPT_PLUGIN(ipopt)
# Ipopt plug-in (with only gradient computation and sparse matrices).
IPOPT_PLUGIN(ipopt-sparse)
# Ipopt twice differentiable (td) plug-in (require hessian computation).
# Ipopt twice-differentiable (td) plug-in (requires hessian computation).
IPOPT_PLUGIN(ipopt-td)

0 comments on commit d758f07

Please sign in to comment.