Skip to content

Commit

Permalink
Enable CXX by default
Browse files Browse the repository at this point in the history
It's silly not to provide all algorithms by default,
c++ compiler are easy to find these days, worst case it can still be disabled

Also remove lib suffix
  • Loading branch information
jschueller committed Jul 27, 2018
1 parent ae35eec commit bbea90f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ matrix:
- pip install mkdocs python-markdown-math --user
- PATH=$PATH:~/.local/bin mkdocs build
- mkdir build && pushd build
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_CXX=ON -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF ..
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF ..
- make install -j2 && ctest -j2 --output-on-failure
- rm -rf * ~/.local
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_CXX=ON -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-i686-w64-mingw32.cmake ..
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-i686-w64-mingw32.cmake ..
- make install -j2
- rm -rf * ~/.local
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_CXX=ON -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-x86_64-w64-mingw32.cmake ..
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-x86_64-w64-mingw32.cmake ..
- make install -j2

- os: osx
Expand All @@ -39,5 +39,5 @@ matrix:
- brew install swig octave || echo "nope"
script:
- mkdir build && pushd build
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_CXX=ON -DPYTHON_EXECUTABLE=/usr/bin/python ..
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DPYTHON_EXECUTABLE=/usr/bin/python ..
- make install && ctest --output-on-failure
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(SO_PATCH 0)

list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

option (NLOPT_CXX "enable cxx routines" OFF)
option (NLOPT_CXX "enable cxx routines" ON)
option (BUILD_SHARED_LIBS "Build NLopt as a shared library" ON)
option (NLOPT_PYTHON "build python bindings" ON)
option (NLOPT_OCTAVE "build octave bindings" ON)
Expand All @@ -52,11 +52,6 @@ else ()
option (NLOPT_TESTS "build unit tests" OFF)
endif ()

set (NLOPT_SUFFIX)
if (NLOPT_CXX)
set (NLOPT_SUFFIX _cxx)
endif ()

include (GNUInstallDirs)

# Offer the user the choice of overriding the installation directories
Expand Down Expand Up @@ -226,7 +221,7 @@ endif ()

install (FILES ${NLOPT_HEADERS} DESTINATION ${RELATIVE_INSTALL_INCLUDE_DIR})

set (nlopt_lib nlopt${NLOPT_SUFFIX})
set (nlopt_lib nlopt)
add_library (${nlopt_lib} ${NLOPT_SOURCES})
target_link_libraries (${nlopt_lib} ${M_LIBRARY})

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ install:
build_script:
- echo Running cmake...
- cd c:\projects\nlopt
- cmake -G "%CMAKE_PLATFORM%" -DNLOPT_CXX=ON -DCMAKE_INSTALL_PREFIX="C:\projects\nlopt\install" .
- cmake -G "%CMAKE_PLATFORM%" -DCMAKE_INSTALL_PREFIX="C:\projects\nlopt\install" .
- cmake --build . --config %Configuration% --target install
- ctest -C %Configuration% --output-on-failure --timeout 100
2 changes: 1 addition & 1 deletion nlopt.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: NLopt
Description: nonlinear optimization libary
Version: @NLOPT_VERSION_STRING@
Libs: -L${libdir} -lnlopt@NLOPT_SUFFIX@
Libs: -L${libdir} -lnlopt
Libs.private: -lm
Cflags: -I${includedir}

0 comments on commit bbea90f

Please sign in to comment.