Skip to content

Commit

Permalink
Merge pull request #27 from NTD-Modelling-Consortium/option-to-disabl…
Browse files Browse the repository at this point in the history
…e-testing

Option to disable testing
  • Loading branch information
igorclark authored Aug 23, 2024
2 parents 56a0267 + bc36b63 commit 84a1d10
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/check-compilation-across-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ jobs:
uses: actions/checkout@v4
- name: Build
run: |
# install catch2
git clone https://github.com/catchorg/Catch2.git
cd Catch2
cmake -B build -S . -DBUILD_TESTING=OFF
sudo cmake --build build/ --target install
cd ..
mkdir build && cd build/
cmake ..
cmake .. -DBUILD_TESTS=OFF
cmake --build .
Macos-latest:
Expand All @@ -32,14 +25,7 @@ jobs:
uses: actions/checkout@v4
- name: Build
run: |
# install catch2
git clone https://github.com/catchorg/Catch2.git
cd Catch2
cmake -B build -S . -DBUILD_TESTING=OFF
sudo cmake --build build/ --target install
cd ..
brew install gsl
mkdir build && cd build/
cmake ..
cmake --build .
cmake .. -DBUILD_TESTS=OFF
cmake --build .
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.9)
# set the project name and version
project(LF VERSION 1.0)

option(BUILD_TESTS "Build the tests for the project" ON)

# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
Expand All @@ -14,4 +16,6 @@ add_subdirectory(lib/tinyxml)
add_subdirectory(src)

# add tests
add_subdirectory(tests)
if(BUILD_TESTS)
add_subdirectory(tests)
endif(BUILD_TESTS)
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# LF

Along with files included in the `src` folder, the gsl library is used so will need to be installed. The installation process for gsl is described [here](https://coral.ise.lehigh.edu/jild13/2016/07/11/hello/).
## Dependencies

- Alternatively on macOS you can install gsl using homebrew: `brew install gsl`
- Or on Debian/Ubuntu Linux you can install packages `gsl-bin libgsl-dev` using apt/aptitude
- [GSL](https://coral.ise.lehigh.edu/jild13/2016/07/11/hello/)
- `brew install gsl`
- `apt install gsl-bin libgsl-dev`
- [CMake](https://cmake.org/download/)
- `brew install cmake`
- `apt install cmake`
- [Catch](https://github.com/catchorg/Catch2) (optional - use `-DBUILD_TESTS=OFF` to disable building tests)
- [Installation instructions](https://github.com/catchorg/Catch2/blob/devel/docs/cmake-integration.md#installing-catch2-from-git-repository)

## Compiling

Expand All @@ -18,6 +24,20 @@ On subsequent builds usually only `cmake --build .` needs to be run from the `bu

If you need to clean the CMake files (perhaps after modifying CMake or directory structure), then run `cmake --build .. --clean-first`

### Compile Options

| Option | Effect | Default |
| ------ | ------ | ------- |
| BUILD_TESTS | Compiles the unit tests | ON

To set an option, you change the initial cmake command:

```
cmake .. -DBUILD_TESTS=OFF
```

For example, to not compile the tests.

### Debug build
If you need a build for debugging, build this into a separate folder `build_debug` and instead of the above run from the root directory
```
Expand Down

0 comments on commit 84a1d10

Please sign in to comment.