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

added unity builds and new/changed cmake options


Former-commit-id: fa18c4dd
parent 8d5648d7
...@@ -8,7 +8,7 @@ unit_tests: ...@@ -8,7 +8,7 @@ unit_tests:
script: script:
- git submodule update --init --recursive - git submodule update --init --recursive
- cd code/build/debug - 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 - ninja
- OMP_NUM_THREADS=1 ./unit_tests -r junit > unit_tests_report.xml - OMP_NUM_THREADS=1 ./unit_tests -r junit > unit_tests_report.xml
- gcovr -e ../../ext/ -e ../../tests/ -r ../../ - gcovr -e ../../ext/ -e ../../tests/ -r ../../
......
...@@ -2,9 +2,11 @@ cmake_minimum_required( VERSION 3.12.4 ) ...@@ -2,9 +2,11 @@ cmake_minimum_required( VERSION 3.12.4 )
project( KiT-RT VERSION 0.1.0 LANGUAGES CXX ) project( KiT-RT VERSION 0.1.0 LANGUAGES CXX )
### OPTIONS ##################################### ### 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_GUI "additionally builds a user interface" OFF )
option( BUILD_DOC "builds Doxygen and Sphinx documentation" 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 ) ...@@ -14,6 +16,10 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( KITRT_RELEASE_OPTIONS -march=native -w ) set( KITRT_RELEASE_OPTIONS -march=native -w )
set( KITRT_RELWITHDEBINFO_OPTIONS -march=native -pg -no-pie ) set( KITRT_RELWITHDEBINFO_OPTIONS -march=native -pg -no-pie )
set( KITRT_DEBUG_OPTIONS -Wall -Wextra -Wpedantic ) 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 ...@@ -87,7 +93,7 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR
### BUILD UNIT TESTS ############################ ### BUILD UNIT TESTS ############################
if( BUILD_TESTS ) if( BUILD_TESTING )
include( CTest ) include( CTest )
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} ) set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} )
include( Catch ) include( Catch )
...@@ -103,10 +109,14 @@ if( BUILD_TESTS ) ...@@ -103,10 +109,14 @@ if( BUILD_TESTS )
target_compile_definitions( unit_tests PUBLIC TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" ) target_compile_definitions( unit_tests PUBLIC TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" )
target_link_libraries( unit_tests Catch ${CORE_LIBRARIES} ) target_link_libraries( unit_tests Catch ${CORE_LIBRARIES} )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" ) target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" )
if( BUILD_CODE_COV )
if( CMAKE_COMPILER_IS_GNUCXX ) if( CMAKE_COMPILER_IS_GNUCXX )
set( CODE_COVERAGE_OPTIONS --coverage -g -O0 -w ) set( CODE_COVERAGE_OPTIONS --coverage -g -O0 -w )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${CODE_COVERAGE_OPTIONS}>" ) target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${CODE_COVERAGE_OPTIONS}>" )
target_link_libraries( unit_tests Catch gcov ) target_link_libraries( unit_tests Catch gcov )
else()
message( FATAL_ERROR "Code coverage is currently only supported for gcc!" )
endif()
endif() endif()
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" ) target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" ) target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
......
...@@ -24,7 +24,7 @@ class DataGeneratorBase ...@@ -24,7 +24,7 @@ class DataGeneratorBase
* the options file. * the options file.
* @param settings config class with global information*/ * @param settings config class with global information*/
DataGeneratorBase( Config* settings ); DataGeneratorBase( Config* settings );
~DataGeneratorBase(); virtual ~DataGeneratorBase();
/*! @brief Create a datagenerator (1D or 3D) /*! @brief Create a datagenerator (1D or 3D)
* @param settings Pointer to the config file * @param settings Pointer to the config file
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <vtkCellDataToPointData.h> #include <vtkCellDataToPointData.h>
#include <vtkDoubleArray.h> #include <vtkDoubleArray.h>
#include <vtkPointData.h> #include <vtkPointData.h>
//#include <vtkPointDataToCellData.h>
#include <vtkQuad.h> #include <vtkQuad.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
#include <vtkTriangle.h> #include <vtkTriangle.h>
...@@ -31,7 +30,6 @@ ...@@ -31,7 +30,6 @@
#include <Python.h> #include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_IO_ARRAY_API
#include <numpy/arrayobject.h> #include <numpy/arrayobject.h>
using vtkPointsSP = vtkSmartPointer<vtkPoints>; using vtkPointsSP = vtkSmartPointer<vtkPoints>;
...@@ -41,7 +39,6 @@ using vtkCellArraySP = vtkSmartPointer<vtkCellArray>; ...@@ -41,7 +39,6 @@ using vtkCellArraySP = vtkSmartPointer<vtkCellArray>;
using vtkDoubleArraySP = vtkSmartPointer<vtkDoubleArray>; using vtkDoubleArraySP = vtkSmartPointer<vtkDoubleArray>;
using vtkUnstructuredGridWriterSP = vtkSmartPointer<vtkUnstructuredGridWriter>; using vtkUnstructuredGridWriterSP = vtkSmartPointer<vtkUnstructuredGridWriter>;
using vtkCellDataToPointDataSP = vtkSmartPointer<vtkCellDataToPointData>; using vtkCellDataToPointDataSP = vtkSmartPointer<vtkCellDataToPointData>;
// using vtkPointDataToCellDataSP = vtkSmartPointer<vtkPointDataToCellData>;
void ExportVTK( const std::string fileName, void ExportVTK( const std::string fileName,
const std::vector<std::vector<std::vector<double>>>& outputFields, const std::vector<std::vector<std::vector<double>>>& outputFields,
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <Python.h> #include <Python.h>
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_ARRAY_API
#include <mpi.h> #include <mpi.h>
#include <string> #include <string>
......
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include <Python.h> #include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_MLOPT_ARRAY_API
#include <numpy/arrayobject.h> #include <numpy/arrayobject.h>
#include "common/config.h" #include "common/config.h"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "catch.hpp" #include "catch.hpp"
#include <Python.h> #include <Python.h>
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_ARRAY_API
#include <filesystem> #include <filesystem>
#include <mpi.h> #include <mpi.h>
......
Supports Markdown
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