Skip to content

Commit

Permalink
CMake: Disable tests by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Nov 11, 2024
1 parent 6a9fbb0 commit cd0f50f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
pip install mkdocs python-markdown-math --user
PATH=$PATH:~/.local/bin mkdocs build
mkdir build && pushd build
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_FORTRAN=ON -DCMAKE_C_FLAGS='-std=c89 -pedantic -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wshadow' -DCMAKE_CXX_FLAGS='-Wall -Wextra -pedantic -Wshadow' -DSWIG_COMPILE_FLAGS="-Wno-unused-parameter -Wno-missing-field-initializers" ..
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_FORTRAN=ON -DCMAKE_C_FLAGS='-std=c89 -pedantic -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wshadow' -DCMAKE_CXX_FLAGS='-Wall -Wextra -pedantic -Wshadow' -DSWIG_COMPILE_FLAGS="-Wno-shadow -Wno-unused-parameter -Wno-missing-field-initializers" -DNLOPT_TESTS=ON ..
make install -j4 && ctest -j4 --output-on-failure
rm -rf * ~/.local
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF -DNLOPT_GUILE=OFF -DNLOPT_FORTRAN=ON -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_FORTRAN=ON -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-x86_64-w64-mingw32.cmake -DNLOPT_TESTS=ON ..
make install -j4
macos:
Expand All @@ -25,7 +25,7 @@ jobs:
run: |
brew upgrade && brew install swig octave guile
mkdir build && pushd build
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_FORTRAN=OFF ..
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_FORTRAN=OFF -DNLOPT_TESTS=ON ..
make install -j3 && ctest --output-on-failure
windows:
Expand All @@ -36,7 +36,7 @@ jobs:
shell: cmd
run: |
pip install numpy
cmake -DCMAKE_INSTALL_PREFIX=%cd:\=/%/install .
cmake -DCMAKE_INSTALL_PREFIX=%cd:\=/%/install -DNLOPT_TESTS=ON .
cmake --build . --config Release --target install
xcopy %cd%\install\bin\nlopt.dll %cd%\src\swig
xcopy %cd%\install\Lib\site-packages\_nlopt*.pyd %cd%\src\swig
Expand Down
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ option (NLOPT_MATLAB "build matlab bindings" OFF)
option (NLOPT_GUILE "build guile bindings" ON)
option (NLOPT_SWIG "use SWIG to build bindings" ON)
option (NLOPT_LUKSAN "enable LGPL Luksan solvers" ON)

if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
option (NLOPT_TESTS "build unit tests" ON)
else ()
option (NLOPT_TESTS "build unit tests" OFF)
endif ()
option (NLOPT_TESTS "build unit tests" OFF)

if (NLOPT_FORTRAN)
enable_language (Fortran)
Expand Down

0 comments on commit cd0f50f

Please sign in to comment.