Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KiT-RT
KiT-RT
Commits
fec51eef
Commit
fec51eef
authored
Mar 03, 2021
by
jannick.wolters
Browse files
added unity builds and new/changed cmake options
Former-commit-id:
fa18c4dd
parent
8d5648d7
Changes
7
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
fec51eef
...
@@ -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_TEST
S
=ON ../../
-
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TEST
ING=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 ../../
...
...
code/CMakeLists.txt
View file @
fec51eef
...
@@ -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_TEST
S
"builds all available unit tests"
OFF
)
option
(
BUILD_TEST
ING
"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_TEST
S
)
if
(
BUILD_TEST
ING
)
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
(
CMAKE_COMPILER_IS_GNUCXX
)
if
(
BUILD_CODE_COV
)
set
(
CODE_COVERAGE_OPTIONS --coverage -g -O0 -w
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:DEBUG>:
${
CODE_COVERAGE_OPTIONS
}
>"
)
set
(
CODE_COVERAGE_OPTIONS --coverage -g -O0 -w
)
target_link_libraries
(
unit_tests Catch gcov
)
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
()
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
}
>"
)
...
...
code/include/toolboxes/datageneratorbase.h
View file @
fec51eef
...
@@ -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
...
...
code/src/common/io.cpp
View file @
fec51eef
...
@@ -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
,
...
...
code/src/main.cpp
View file @
fec51eef
...
@@ -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>
...
...
code/src/optimizers/mloptimizer.cpp
View file @
fec51eef
#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"
...
...
code/tests/catch2_main.cpp
View file @
fec51eef
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment