Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/actions/linux-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,22 @@ inputs:
description: "Enable Multithreading with OpenMP (ON or OFF, default OFF). If ON, adds `-omp` to the name of the artifact."
required: false
default: "OFF"
hdf5:
description: "Build with HDF5 (ON or OFF, default ON). If OFF, adds `-nohdf5` to the artifact name. If no optional dependencies are built, HDF5 is also not built, even if this option is set to ON."
required: false
default: "ON"
runs:
using: "composite"
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt-get -qq update
sudo apt-get -qq -y install lcov ccache
if [[ "${{ inputs.optional-dependencies }}" == "ON" ]]; then
sudo apt-get -qq -y install libhdf5-dev
HDF5_PACKAGES=""
if [[ "${{ inputs.optional-dependencies }}" == "ON" && "${{ inputs.hdf5 }}" == "ON" ]]; then
HDF5_PACKAGES="libhdf5-dev"
fi
sudo apt-get -qq -y install lcov ccache $HDF5_PACKAGES
if [[ "${{ inputs.compiler }}" == "gcc" ]]; then
if [[ "${{ inputs.version }}" == "min" ]]; then
sudo apt-get -qq -y install gcc-11
Expand Down Expand Up @@ -97,7 +102,7 @@ runs:
exit 1
fi
mkdir -p build && cd build
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} ..
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} -DMEMILIO_ENABLE_HDF5=${{ inputs.hdf5 }} ..
make -j4
- name: create build dir archive
shell: bash
Expand All @@ -108,6 +113,6 @@ runs:
uses: actions/upload-artifact@v4
with:
#artifacts in one pipeline must have a different name, so options must add a suffix to the artifact name if different values are used in the same pipeline
name: build-cpp-linux-${{ inputs.compiler }}-${{ inputs.version }}-${{ inputs.config }}${{ inputs.optional-dependencies == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}
name: build-cpp-linux-${{ inputs.compiler }}-${{ inputs.version }}-${{ inputs.config }}${{ inputs.optional-dependencies == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}}
path: cpp/build.tar.gz
retention-days: 1
16 changes: 12 additions & 4 deletions .github/actions/linux-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,27 @@ inputs:
description: "Enabled Multithreading with OpenMP (ON or OFF, default OFF). If ON, adds `-omp` to the name of the artifact."
required: false
default: "OFF"
hdf5:
description: "Build with HDF5 (ON or OFF, default ON). If OFF, adds `-nohdf5` to the artifact name. If no optional dependencies are built, HDF5 is also not built, even if this option is set to ON."
required: false
default: "ON"
runs:
using: "composite"
steps:
- name: Install Dependencies
shell: bash
run: |
sudo apt-get -qq update
sudo apt-get -qq -y install libhdf5-10* wget gnupg lcov
HDF5_PACKAGES=""
if [[ "${{ inputs.optional-deps }}" == "ON" && "${{ inputs.hdf5 }}" == "ON" ]]; then
HDF5_PACKAGES="libhdf5-10*"
fi
sudo apt-get -qq -y install wget gnupg lcov $HDF5_PACKAGES
sudo apt-get -qq update
- name: Download built test directory
uses: actions/download-artifact@v4
with:
name: build-cpp-linux-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}
name: build-cpp-linux-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}}
path: cpp
- name: extract build archive
shell: bash
Expand All @@ -58,14 +66,14 @@ runs:
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-cpp-linux-report-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}
name: test-cpp-linux-report-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}}
path: cpp/build/bin/report.xml
if-no-files-found: error
retention-days: 1
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: test-cpp-coverage-reports-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}
name: test-cpp-coverage-reports-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}}
path: |
cpp/build/coverage.info
cpp/build/coverage
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ jobs:
config: Release
optional-dependencies: OFF

build-cpp-gcc-no-hdf5:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-build
with:
compiler: gcc
version: latest
config: Release
hdf5: OFF

build-cpp-gcc-openmp:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
Expand Down Expand Up @@ -162,6 +174,17 @@ jobs:
name: test-py-coverage-reports-surrogatemodel
pattern: test-py-coverage-reports-surrogatemodel-*

test-cpp-gcc-no-hdf5:
if: github.event.pull_request.draft == false
needs: build-cpp-gcc-no-hdf5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-test
with:
artifact-pattern: gcc-latest-Release
hdf5: OFF

test-cpp-gcc-no-optional-deps:
if: github.event.pull_request.draft == false
needs: build-cpp-gcc-no-optional-deps
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ option(MEMILIO_BUILD_SHARED_LIBS "Build memilio as a shared library." ON)
option(MEMILIO_BUILD_STATIC_LIBS "Build memilio as a static library." ON)
option(MEMILIO_ENABLE_MPI "Build memilio with MPI." OFF)
option(MEMILIO_ENABLE_OPENMP "Enable Multithreading with OpenMP." OFF)
option(MEMILIO_ENABLE_HDF5 "Build memilio with HDF5 IO support." ON)
option(MEMILIO_ENABLE_WARNINGS "Build memilio with warnings." ON)
option(MEMILIO_ENABLE_WARNINGS_AS_ERRORS "Build memilio with warnings as errors." ON)
option(MEMILIO_ENABLE_IPOPT "Enable numerical optimization with Ipopt, requires a Fortran compiler." OFF)
Expand Down
1 change: 1 addition & 0 deletions cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Options can be specified with `cmake .. -D<OPTION>=<VALUE>` or by editing the `b
- `MEMILIO_BUILD_SIMULATIONS`: build the simulation applications in the simulations directory, ON or OFF, default ON.
- `MEMILIO_BUILD_SBML_MODELS`: build the SBML importer and imported models, i.e. everythin in the folder `sbml_model_generation`, ON or OFF, default ON.
- `MEMILIO_USE_BUNDLED_SPDLOG/_BOOST/_EIGEN/_JSONCPP`: use the corresponding dependency bundled with this project, ON or OFF, default ON.
- `MEMILIO_ENABLE_HDF5`: build MEmilio with HDF5 IO support, ON or OFF, default ON. If OFF, HDF5 is not searched for and features like `save_result`/`read_result` are disabled.
- `MEMILIO_BUILD_BENCHMARKS`: build the benchmarks for this project, ON or OFF, default OFF.
- `MEMILIO_SANITIZE_ADDRESS/_UNDEFINED`: compile with specified sanitizers to check correctness, ON or OFF, default OFF.
- `MEMILIO_ENABLE_OPENMP`: compile MEmilio with multithreading using OpenMP, ON or OFF, default OFF.
Expand Down
12 changes: 7 additions & 5 deletions cpp/thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ else()
endif()

# ## HDF5
find_package(HDF5 COMPONENTS C)
if(MEMILIO_ENABLE_HDF5)
find_package(HDF5 COMPONENTS C)

if(HDF5_FOUND)
set(MEMILIO_HAS_HDF5 ON)
else()
message(WARNING "HDF5 was not found. Memilio will be built without some IO features. Install HDF5 Libraries and set the HDF5_DIR cmake variable to the directory containing the hdf5-config.cmake file to build with HDF5.")
if(HDF5_FOUND)
set(MEMILIO_HAS_HDF5 ON)
else()
message(WARNING "HDF5 was not found. Memilio will be built without some IO features. Install HDF5 Libraries and set the HDF5_DIR cmake variable to the directory containing the hdf5-config.cmake file to build with HDF5.")
endif()
endif()

# ## JSONCPP
Expand Down
2 changes: 2 additions & 0 deletions docs/source/cpp/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ Additional options can be specified by appending one or more ``-D<OPTION>=<VALUE
- Build the SBML importer and imported models, i.e. everything in the folder ``sbml_model_generation``, ON or OFF, default ON. You may need to set ``sbml_DIR``
* - ``MEMILIO_USE_BUNDLED_SPDLOG/_BOOST/_EIGEN/_JSONCPP``:
- Use the corresponding dependency bundled with this project, ON or OFF, default ON.
* - ``MEMILIO_ENABLE_HDF5``
- Build MEmilio with HDF5 IO support, ON or OFF, default ON. If OFF, HDF5 is not searched for and features like ``save_result``/``read_result`` are disabled.
* - ``MEMILIO_BUILD_BENCHMARKS``
- Build the benchmarks for this project, ON or OFF, default OFF.
* - ``MEMILIO_SANITIZE_ADDRESS/_UNDEFINED``
Expand Down
Loading