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
e56f52d3
Commit
e56f52d3
authored
Dec 01, 2020
by
Steffen Schotthöfer
Browse files
Merge branch 'compile_speedup' of
https://git.scc.kit.edu/rtsn/rtsn
into compile_speedup
Former-commit-id:
47cf001f
parents
20273d0b
42cb7fd9
Changes
1
Show whitespace changes
Inline
Side-by-side
code/CMakeLists.txt
View file @
e56f52d3
cmake_minimum_required
(
VERSION 3.12.4
)
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 #####################################
option
(
build_tests
"enables compiling of unit_tests"
OFF
)
#################################################
### COMPILER ####################################
### COMPILER ####################################
set
(
CMAKE_CXX_STANDARD 17
)
set
(
CMAKE_CXX_STANDARD 17
)
...
@@ -81,26 +84,27 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR
...
@@ -81,26 +84,27 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR
### BUILD UNIT TESTS ############################
### BUILD UNIT TESTS ############################
include
(
CTest
)
if
(
build_tests
)
set
(
CMAKE_MODULE_PATH
${
PROJECT_SOURCE_DIR
}
/ext/Catch2/contrib
${
CMAKE_MODULE_PATH
}
)
include
(
CTest
)
include
(
Catch
)
set
(
CMAKE_MODULE_PATH
${
PROJECT_SOURCE_DIR
}
/ext/Catch2/contrib
${
CMAKE_MODULE_PATH
}
)
set
(
CATCH_INCLUDE_DIR
${
CMAKE_SOURCE_DIR
}
/ext/Catch2/single_include/catch2
)
include
(
Catch
)
add_compile_definitions
(
BUILD_TESTING
)
set
(
CATCH_INCLUDE_DIR
${
CMAKE_SOURCE_DIR
}
/ext/Catch2/single_include/catch2
)
add_compile_definitions
(
TESTS_PATH=
"
${
CMAKE_SOURCE_DIR
}
/tests/"
)
add_compile_definitions
(
BUILD_TESTING
)
add_library
(
Catch INTERFACE
)
add_compile_definitions
(
TESTS_PATH=
"
${
CMAKE_SOURCE_DIR
}
/tests/"
)
target_include_directories
(
Catch INTERFACE
${
CATCH_INCLUDE_DIR
}
)
add_library
(
Catch INTERFACE
)
file
(
GLOB_RECURSE TEST_SRCS RELATIVE
${
CMAKE_SOURCE_DIR
}
"tests/*.cpp"
)
target_include_directories
(
Catch INTERFACE
${
CATCH_INCLUDE_DIR
}
)
list
(
REMOVE_ITEM SRCS
"src/main.cpp"
)
file
(
GLOB_RECURSE TEST_SRCS RELATIVE
${
CMAKE_SOURCE_DIR
}
"tests/*.cpp"
)
add_executable
(
unit_tests
${
TEST_SRCS
}
${
SRCS
}
${
EXT_SRCS
}
)
list
(
REMOVE_ITEM SRCS
"src/main.cpp"
)
target_link_libraries
(
unit_tests Catch
${
CORE_LIBRARIES
}
)
add_executable
(
unit_tests
${
TEST_SRCS
}
${
SRCS
}
${
EXT_SRCS
}
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:DEBUG>:
${
KITRT_DEBUG_OPTIONS
}
>"
)
target_link_libraries
(
unit_tests Catch
${
CORE_LIBRARIES
}
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:DEBUG>:
${
KITRT_DEBUG_OPTIONS
}
>"
)
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
)
endif
()
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:RELWITHDEBINFO>:
${
KITRT_RELWITHDEBINFO_OPTIONS
}
>"
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:RELEASE>:
${
KITRT_RELEASE_OPTIONS
}
>"
)
catch_discover_tests
(
unit_tests
)
endif
()
endif
()
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:RELWITHDEBINFO>:
${
KITRT_RELWITHDEBINFO_OPTIONS
}
>"
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:RELEASE>:
${
KITRT_RELEASE_OPTIONS
}
>"
)
catch_discover_tests
(
unit_tests
)
enable_testing
()
#################################################
#################################################
Write
Preview
Supports
Markdown
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