Commit fa18c4dd authored by jannick.wolters's avatar jannick.wolters
Browse files

added unity builds and new/changed cmake options

parent 48647056
Pipeline #138879 passed with stage
in 16 minutes and 10 seconds
......@@ -8,7 +8,7 @@ unit_tests:
script:
- git submodule update --init --recursive
- cd code/build/debug
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON ../../
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DCODE_COV=ON ../../
- ninja
- OMP_NUM_THREADS=1 ./unit_tests -r junit > unit_tests_report.xml
- gcovr -e ../../ext/ -e ../../tests/ -r ../../
......
......@@ -2,9 +2,11 @@ cmake_minimum_required( VERSION 3.12.4 )
project( KiT-RT VERSION 0.1.0 LANGUAGES CXX )
### OPTIONS #####################################
option( BUILD_TESTS "builds all available unit tests" OFF )
option( BUILD_TESTING "builds all available unit tests" OFF )
option( BUILD_GUI "additionally builds a user interface" OFF )
option( BUILD_DOC "builds Doxygen and Sphinx documentation" OFF )
option( BUILD_UNITY "enables unity build for faster compile times" ON )
option( BUILD_CODE_COV "enables compiler option required for code coverage analysis" OFF )
#################################################
......@@ -14,6 +16,10 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( KITRT_RELEASE_OPTIONS -march=native -w )
set( KITRT_RELWITHDEBINFO_OPTIONS -march=native -pg -no-pie )
set( KITRT_DEBUG_OPTIONS -Wall -Wextra -Wpedantic )
if( BUILD_UNITY AND NOT CODE_COV )
set( CMAKE_UNITY_BUILD ON )
set( CMAKE_UNITY_BUILD_BATCH_SIZE 10 )
endif()
#################################################
......@@ -87,7 +93,7 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR
### BUILD UNIT TESTS ############################
if( BUILD_TESTS )
if( BUILD_TESTING )
include( CTest )
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} )
include( Catch )
......@@ -103,10 +109,14 @@ if( BUILD_TESTS )
target_compile_definitions( unit_tests PUBLIC TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" )
target_link_libraries( unit_tests Catch ${CORE_LIBRARIES} )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" )
if( CMAKE_COMPILER_IS_GNUCXX )
set( CODE_COVERAGE_OPTIONS --coverage -g -O0 -w )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${CODE_COVERAGE_OPTIONS}>" )
target_link_libraries( unit_tests Catch gcov )
if( BUILD_CODE_COV )
if( CMAKE_COMPILER_IS_GNUCXX )
set( CODE_COVERAGE_OPTIONS --coverage -g -O0 -w )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${CODE_COVERAGE_OPTIONS}>" )
target_link_libraries( unit_tests Catch gcov )
else()
message( FATAL_ERROR "Code coverage is currently only supported for gcc!" )
endif()
endif()
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
......
......@@ -24,7 +24,7 @@ class DataGeneratorBase
* the options file.
* @param settings config class with global information*/
DataGeneratorBase( Config* settings );
~DataGeneratorBase();
virtual ~DataGeneratorBase();
/*! @brief Create a datagenerator (1D or 3D)
* @param settings Pointer to the config file
......
......@@ -22,7 +22,6 @@
#include <vtkCellDataToPointData.h>
#include <vtkDoubleArray.h>
#include <vtkPointData.h>
//#include <vtkPointDataToCellData.h>
#include <vtkQuad.h>
#include <vtkSmartPointer.h>
#include <vtkTriangle.h>
......@@ -31,7 +30,6 @@
#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_IO_ARRAY_API
#include <numpy/arrayobject.h>
using vtkPointsSP = vtkSmartPointer<vtkPoints>;
......@@ -41,7 +39,6 @@ using vtkCellArraySP = vtkSmartPointer<vtkCellArray>;
using vtkDoubleArraySP = vtkSmartPointer<vtkDoubleArray>;
using vtkUnstructuredGridWriterSP = vtkSmartPointer<vtkUnstructuredGridWriter>;
using vtkCellDataToPointDataSP = vtkSmartPointer<vtkCellDataToPointData>;
// using vtkPointDataToCellDataSP = vtkSmartPointer<vtkPointDataToCellData>;
void ExportVTK( const std::string fileName,
const std::vector<std::vector<std::vector<double>>>& outputFields,
......
......@@ -5,6 +5,7 @@
*/
#include <Python.h>
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_ARRAY_API
#include <mpi.h>
#include <string>
......
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_MLOPT_ARRAY_API
#include <numpy/arrayobject.h>
#include "common/config.h"
......
......@@ -2,6 +2,7 @@
#include "catch.hpp"
#include <Python.h>
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_ARRAY_API
#include <filesystem>
#include <mpi.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment