diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3e39a8f..19202937 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,9 +21,9 @@ jobs: - name: Run CMake run: cmake --preset conan-debug -DUSE_COVERAGE=ON . - name: Compile - run: cmake --build build/Debug --target testScipPP + run: cmake --build build/Debug --target tests - name: Run Tests - run: ./build/Debug/test/testScipPP --log_format=JUNIT --log_level=all --log_sink=boosttest.xml + run: ./build/Debug/test/tests --log_format=JUNIT --log_level=all --log_sink=boosttest.xml - name: Install GCovr run: pip install gcovr - name: Extract Coverage @@ -47,9 +47,9 @@ jobs: - name: Run CMake run: cmake --preset conan-default . - name: Compile - run: cmake --build build --preset conan-release --target testScipPP + run: cmake --build build --preset conan-release --target tests - name: Run Tests - run: ./build/test/Release/testScipPP.exe + run: ./build/test/Release/tests.exe test_without_conan: runs-on: ubuntu-latest steps: @@ -67,9 +67,9 @@ jobs: - name: Build SCIP++ run: | CMAKE_PREFIX_PATH=./lib/cmake/scip:./boost/boost/lib/cmake/Boost-1.81.0 cmake -DBUILD_TESTS=ON . - make -j testScipPP + make -j tests - name: Run tests - run: ./test/testScipPP + run: ./test/tests test_release_inx: strategy: matrix: @@ -85,9 +85,9 @@ jobs: - name: Run CMake run: cmake --preset conan-release . - name: Compile - run: cmake --build build/Release --target testScipPP + run: cmake --build build/Release --target tests - name: Run Tests - run: ./build/Release/test/testScipPP + run: ./build/Release/test/tests clang_tidy: runs-on: ubuntu-latest steps: diff --git a/readme.md b/readme.md index a57f5cf7..81cc680e 100644 --- a/readme.md +++ b/readme.md @@ -132,22 +132,47 @@ SCIP* scip = model.scip(); ## Build +### Without Conan + We use [Conan](https://conan.io/center/) as package manager. That is not required! As long as `find_package(scip CONFIG REQUIRED)` (and `find_package(Boost CONFIG REQUIRED)` for the tests) work(s), any kind of dependency management system can be used. -### Build & Install +Build and install: + +```bash +cmake . +make ScipPP +make install +``` + +Build and run tests: + +```bash +cmake -DBUILD_TESTS=ON . +make tests +./test/tests +``` + +### With Conan v2 and CMake v3.19 or later -Assuming you are using Conan v2 and a CMake version that supports presets (v3.19 and above), run: +Build and install: ```bash -conan install -of . . +conan install . cmake --preset conan-release . cmake --build build/Release --target ScipPP cmake --install build/Release ``` -### If pre-compiled dependencies are not available +Build and run tests: + +```bash +conan install -o with_tests=True . +cmake --preset conan-release . +cmake --build build/Release --target tests +build/Release/test/tests +``` If your setting of OS, compiler, C++ or stdlib version is one where conan-center does not host pre-compiled binaries, add `--build=missing` when you run `conan install`. The dependencies will then be built from source (don't worry, they @@ -163,31 +188,31 @@ or try to build locally from sources using the '--build=missing' argument change the install-command to ```bash -conan install -of . --build=missing . +conan install --build=missing . ``` -### If you are using a CMake version without support for presets +### With Conan v2 and CMake v3.18 or earlier + +When CMake presets are not support, use the toolchain file that conan generates. + +Build and install: ```bash -conan install -of . . +conan install . cmake . -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=./build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release make ScipPP make install ``` -### Test - -Using Conan, the option `with_tests` has to be set to true. +Build and run tests: ```bash -conan install -of . -o with_tests=True . -cmake --preset conan-release . -cmake --build build/Release --target testScipPP -./build/Release/test/testScipPP +conan install -o with_tests=True . +cmake . -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=./build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release +make tests +./build/Release/test/tests ``` -When using purely CMake, add `-DBUILD_TESTS=ON`. - ## Utils Use `gen_constexpr_parameters` to transform all SCIP parameters into constexpr `scippp::params::Param` objects which diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0e0d8373..3d98cf46 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,6 +6,6 @@ if (NOT TARGET Boost::unit_test_framework) endif () file(GLOB TEST_SOURCES *.cpp) -add_executable(testScipPP ${TEST_SOURCES}) -target_include_directories(testScipPP SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(testScipPP PRIVATE ScipPP Boost::unit_test_framework) +add_executable(tests ${TEST_SOURCES}) +target_include_directories(tests SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(tests PRIVATE ScipPP Boost::unit_test_framework)