Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
be0c4df5
Commit
be0c4df5
authored
6 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'project-template/master'
parents
38d707f4
1cf11f00
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmake/Modules/registerTests.cmake
+122
-0
122 additions, 0 deletions
cmake/Modules/registerTests.cmake
cmake/add_dependency.cmake
+1
-1
1 addition, 1 deletion
cmake/add_dependency.cmake
cmake/make_coverage.sh.in
+1
-1
1 addition, 1 deletion
cmake/make_coverage.sh.in
with
124 additions
and
2 deletions
cmake/Modules/registerTests.cmake
0 → 100644
+
122
−
0
View file @
be0c4df5
include
(
CMakeParseArguments
)
#
# usage:
# register_tests(SOURCES
# ${list_of_source_files}
# "test_src.cc"
# ${concatenated_string_of_source_files}
# NAMESPACE
# "test_namespace"
# LINK_LIBRARIES
# ${list_of_targets}
# INCLUDE_DIRECTORIES
# ${list_of_include_directories}
# COMPILE_OPTIONS
# ${list_of_compile_options})
#
# Function registers tests defined as a list of souce files. Test
# defined by file source_name.cc in the SOURCES list is registered under
# the name
# test_namespace.source_name
#
# Provided list of dependent link targets and include directories are
# used as PRIVATE dependencies during compilation of test executable.
#
# Function implicitly adds a dependency on the boost unit test framework
# to each generated test executable.
function
(
register_tests
)
find_package
(
Boost COMPONENTS unit_test_framework REQUIRED
)
list
(
APPEND single_parmeter_keywords NAMESPACE
)
list
(
APPEND multi_parmeter_keywords SOURCES
LINK_LIBRARIES
INCLUDE_DIRECTORIES
COMPILE_OPTIONS
)
cmake_parse_arguments
(
"arg"
""
"
${
single_parmeter_keywords
}
"
"
${
multi_parmeter_keywords
}
"
"
${
ARGN
}
"
)
register_exe
(
SOURCES
"
${
arg_SOURCES
}
"
NAMESPACE
"
${
arg_NAMESPACE
}
"
)
get_test_targets
(
list_of_targets
"
${
arg_SOURCES
}
"
)
add_target_includes_private
(
TARGETS
"
${
list_of_targets
}
"
LINK_LIBRARIES
"
${
arg_INCLUDE_DIRECTORIES
}
"
"
${
Boost_INCLUDE_DIR
}
"
)
add_target_link_libraries_private
(
TARGETS
"
${
list_of_targets
}
"
LINK_LIBRARIES
"
${
Boost_UNIT_TEST_FRAMEWORK_LIBRARY
}
"
"
${
arg_LINK_LIBRARIES
}
"
)
add_target_compile_options_private
(
TARGETS
"
${
list_of_targets
}
"
COMPILE_OPTIONS
"
${
arg_COMPILE_OPTIONS
}
"
)
endfunction
()
#
# Private functions: Do not use directly
######################################################################
function
(
add_target_compile_options_private
)
list
(
APPEND list_of_multivalue_keywords TARGETS COMPILE_OPTIONS
)
cmake_parse_arguments
(
"arg"
""
""
"
${
list_of_multivalue_keywords
}
"
"
${
ARGN
}
"
)
foreach
(
target IN LISTS arg_TARGETS
)
target_compile_options
(
${
target
}
PRIVATE
${
arg_COMPILE_OPTIONS
}
)
endforeach
()
endfunction
()
function
(
add_target_includes_private
)
list
(
APPEND multi_value_keywords TARGETS LINK_LIBRARIES
)
cmake_parse_arguments
(
"arg"
""
""
"
${
multi_value_keywords
}
"
"
${
ARGN
}
"
)
foreach
(
target_name IN LISTS arg_TARGETS
)
target_include_directories
(
"
${
target_name
}
"
PRIVATE
"
${
arg_LINK_LIBRARIES
}
"
)
endforeach
()
endfunction
()
######################################
function
(
add_target_link_libraries_private
)
list
(
APPEND multi_value_keywords TARGETS LINK_LIBRARIES
)
cmake_parse_arguments
(
"arg"
""
""
"
${
multi_value_keywords
}
"
"
${
ARGN
}
"
)
foreach
(
target_name IN LISTS arg_TARGETS
)
target_link_libraries
(
"
${
target_name
}
"
PRIVATE
"
${
arg_LINK_LIBRARIES
}
"
)
endforeach
()
endfunction
()
######################################
function
(
register_exe
)
list
(
APPEND single_value_keywords NAMESPACE
)
list
(
APPEND multi_value_keywords SOURCES
)
cmake_parse_arguments
(
"arg"
""
"
${
single_value_keywords
}
"
"
${
multi_value_keywords
}
"
"
${
ARGN
}
"
)
foreach
(
source_name IN LISTS arg_SOURCES
)
get_filename_component
(
target_name
${
source_name
}
NAME_WE
)
add_executable
(
${
target_name
}
${
source_name
}
)
# Fixme: The thing below doesnt work for some reason
#add_test(NAME ${test_namespace}.${target_name}
# COMMAND ${target_name}
# WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests)
#
add_test
(
${
arg_NAMESPACE
}
.
${
target_name
}
${
target_name
}
WORKING_DIRECTORY
${
CMAKE_RUNTIME_OUTPUT_DIRECTORY
}
/tests
)
endforeach
()
endfunction
()
######################################
function
(
get_test_targets list_of_targets list_of_source_files
)
foreach
(
source_name IN LISTS list_of_source_files
)
get_filename_component
(
target_name
${
source_name
}
NAME_WE
)
list
(
APPEND list_of_targets_
${
target_name
}
)
endforeach
()
set
(
${
list_of_targets
}
${
list_of_targets_
}
PARENT_SCOPE
)
endfunction
()
######################################################################
This diff is collapsed.
Click to expand it.
cmake/add_dependency.cmake
+
1
−
1
View file @
be0c4df5
...
...
@@ -5,7 +5,7 @@
# project-template!
#
# The macro is called "add_dependency" and takes 3 arguments:
# - name of the dependency project as passed to FIND_PACKAGE (e.g. "
mtca4u-d
evice
a
ccess")
# - name of the dependency project as passed to FIND_PACKAGE (e.g. "
ChimeraTK-D
evice
A
ccess")
# - required version as passed to FIND_PACKAGE
# - a list of components used by this project including the REQUIRED keyword etc.
#
...
...
This diff is collapsed.
Click to expand it.
cmake/make_coverage.sh.in
+
1
−
1
View file @
be0c4df5
...
...
@@ -29,7 +29,7 @@ lcov --capture --directory . --output-file coverage_all.info
#lcov capture also includes external stuff like glibc, boost etc.
#only extract the reports for this project
lcov
--extract
coverage_all.info
"@CMAKE_SOURCE_DIR@*"
-o
coverage_only_source_tree.info
lcov
--extract
coverage_all.info
"@CMAKE_SOURCE_DIR@*"
-o
coverage_only_source_tree.info
--ignore-errors
gcov
#Some parts of the source code might be excluded. Set EXCLUDE_FROM_COVERAGE to contain
# a list of directories to be excluded from the coverage report.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment