Skip to content

Commit

Permalink
Rename test executable and restructure Build section in README
Browse files Browse the repository at this point in the history
  • Loading branch information
hedtke committed Jul 26, 2023
1 parent 7f12da5 commit 36034a0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 27 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
57 changes: 41 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<T>` objects which
Expand Down
6 changes: 3 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 36034a0

Please sign in to comment.