Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VirtualFluids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
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
iRMB
VirtualFluids
Commits
8569fa41
Commit
8569fa41
authored
4 years ago
by
Soeren Peters
Browse files
Options
Downloads
Patches
Plain Diff
Small clean ups for the test executable.
parent
8fcf5ed3
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/3rd/gmock.cmake
+3
-0
3 additions, 0 deletions
CMake/3rd/gmock.cmake
CMake/FileUtilities.cmake
+28
-29
28 additions, 29 deletions
CMake/FileUtilities.cmake
CMake/VirtualFluidsMacros.cmake
+10
-9
10 additions, 9 deletions
CMake/VirtualFluidsMacros.cmake
with
41 additions
and
38 deletions
CMake/3rd/gmock.cmake
+
3
−
0
View file @
8569fa41
...
...
@@ -10,3 +10,6 @@
target_link_directories
(
${
library_name
}
PRIVATE
${
GMOCK_ROOT
}
/build/lib
)
target_link_libraries
(
${
library_name
}
PRIVATE gtest gmock gmock_main
)
#add_compile_options (-std=c++11)
add_definitions
(
"-std=c++11"
)
#TODO: Really necessary?
This diff is collapsed.
Click to expand it.
CMake/FileUtilities.cmake
+
28
−
29
View file @
8569fa41
#################################################################################
## Helper functions for building source groups
## and extracting test/production files.
##
## After function call the files are stored in: MY_SRCS
#################################################################################
macro
(
includeAllFiles targetName file_path
)
set
(
collectTestFiles ON
)
set
(
collectProductionFiles ON
)
...
...
@@ -6,7 +13,6 @@ macro(includeAllFiles targetName file_path)
endmacro
(
includeAllFiles
)
macro
(
includeProductionFiles targetName file_path
)
set
(
collectTestFiles OFF
)
set
(
collectProductionFiles ON
)
...
...
@@ -16,35 +22,31 @@ endmacro(includeProductionFiles)
macro
(
includeTestFiles targetName file_path
)
macro
(
includeTestFiles targetName file_path
s
)
set
(
collectTestFiles ON
)
set
(
collectProductionFiles OFF
)
includeFiles
(
${
targetName
}
"
${
file_path
}
"
)
includeFiles
(
${
targetName
}
"
${
file_path
s
}
"
)
endmacro
(
includeTestFiles
)
macro
(
includeFiles targetName file_path
)
foreach
(
file
${
file_path
}
)
#message("File: " ${file})
get_filename_component
(
package_dir
${
file
}
DIRECTORY
)
macro
(
includeFiles targetName file_paths
)
foreach
(
file
${
file_paths
}
)
get_filename_component
(
package_dir
${
file
}
DIRECTORY
)
#message("File: " ${file})
#message("package_dir: " ${package_dir})
collectFilesFrom
(
${
file
}
)
collectFilesFrom
(
${
file
}
)
if
(
package_dir
)
#setSourceGroupForFilesIn(${package_dir} ${targetName})
buildSourceGroup
(
${
targetName
}
${
package_dir
}
)
if
(
isAllTestSuite
)
source_group
(
${
targetName
}
\\
${
SOURCE_GROUP
}
FILES
${
MY_SRCS
}
)
else
()
source_group
(
${
SOURCE_GROUP
}
FILES
${
file
}
)
endif
()
setSourceGroupForFilesIn
(
${
package_dir
}
${
targetName
}
)
endif
()
endforeach
()
endmacro
(
includeFiles
)
...
...
@@ -52,23 +54,20 @@ endmacro(includeFiles)
macro
(
collectFilesFrom path
)
#input: path from files to collect
#foreach(_file ${path})
get_filename_component
(
fileName
${
path
}
NAME
)
if
(
collectTestFiles
)
if
(
${
fileName
}
MATCHES
"Test"
OR
${
fileName
}
MATCHES
"Mock"
)
set
(
MY_SRCS
${
MY_SRCS
}
${
path
}
)
endif
()
get_filename_component
(
fileName
${
path
}
NAME
)
if
(
collectTestFiles
)
if
(
${
fileName
}
MATCHES
"Test"
OR
${
fileName
}
MATCHES
"Mock"
)
set
(
MY_SRCS
${
MY_SRCS
}
${
path
}
)
endif
()
if
(
collectProductionFiles
)
if
(
NOT
${
fileName
}
MATCHES
"Test"
AND NOT
${
fileName
}
MATCHES
"Mock"
)
set
(
MY_SRCS
${
MY_SRCS
}
${
path
}
)
endif
(
)
endif
(
)
if
(
collectProductionFiles
)
if
(
NOT
${
fileName
}
MATCHES
"Test"
AND NOT
${
fileName
}
MATCHES
"Mock"
)
set
(
MY_SRCS
${
MY_SRCS
}
${
path
}
)
endif
()
#endforeach()
#set(MY_SRCS ${MY_SRCS} ${COLLECTED_FILES_IN_PATH})
endif
()
#output: MY_SRCS
endmacro
(
collectFilesFrom
)
endmacro
()
...
...
This diff is collapsed.
Click to expand it.
CMake/VirtualFluidsMacros.cmake
+
10
−
9
View file @
8569fa41
...
...
@@ -8,7 +8,7 @@
#################################################################################
function
(
status msg
)
message
(
STATUS
" VF
-
-
${
msg
}
"
)
message
(
STATUS
"
VF -
${
msg
}
"
)
endfunction
()
#################################################################################
...
...
@@ -231,32 +231,33 @@ endfunction()
## Precondition: BUILD_VF_UNIT_TESTS needs to be ON
#################################################################################
function
(
vf_add_tests
)
if
(
NOT BUILD_VF_UNIT_TESTS
)
return
()
endif
()
# get the test library name
vf_get_library_test_name
(
library_test_name
)
vf_get_library_name
(
folder_name
)
status
(
"Add test executable:
${
library_test_name
}
"
)
# set test files to MY_SRCS
file
(
GLOB_RECURSE all_files
${
VIRTUAL_FLUIDS_GLOB_FILES
}
)
includeTestFiles
(
${
folder_name
}
"
${
all_files
}
"
)
set
(
sourceFiles
${
sourceFiles
}
${
all_files
}
)
includeTestFiles
(
${
folder_name
}
"
${
sourceFiles
}
"
)
cmake_print_variables
(
MY_SRCS
)
# add the target
add_executable
(
${
library_test_name
}
${
MY_SRCS
}
)
# link tested library
target_link_libraries
(
${
library_test_name
}
PRIVATE
${
folder_name
}
)
# link tested library
target_include_directories
(
${
library_test_name
}
PRIVATE
${
CMAKE_BINARY_DIR
}
)
target_include_directories
(
${
library_test_name
}
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
)
target_include_directories
(
${
library_test_name
}
PRIVATE
${
CMAKE_SOURCE_DIR
}
/src
)
# link googlemock
include
(
${
CMAKE_PATH
}
/3rd/gmock.cmake
)
#add_compile_options (-std=c++11)
add_definitions
(
"-std=c++11"
)
endfunction
()
\ No newline at end of file
endfunction
()
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