Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loadbalancing
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
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SLMS
loadbalancing
Commits
6117386c
Commit
6117386c
authored
4 years ago
by
Stephan Schulz
Browse files
Options
Downloads
Patches
Plain Diff
use compile_definitions and create preprocessed header file
parent
035b37c2
Branches
Issue_63
No related tags found
1 merge request
!15
CMake projectconfig
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+5
-5
5 additions, 5 deletions
CMakeLists.txt
misc/preprocess.sh
+21
-6
21 additions, 6 deletions
misc/preprocess.sh
src/CMakeLists.txt
+10
-4
10 additions, 4 deletions
src/CMakeLists.txt
with
36 additions
and
15 deletions
CMakeLists.txt
+
5
−
5
View file @
6117386c
...
@@ -76,20 +76,20 @@ if(CM_ALL_VTK_OUTPUT)
...
@@ -76,20 +76,20 @@ if(CM_ALL_VTK_OUTPUT)
message
(
FATAL_ERROR
"VTK not found, help CMake to find it by setting VTK_LIBRARY and VTK_INCLUDE_DIR"
)
message
(
FATAL_ERROR
"VTK not found, help CMake to find it by setting VTK_LIBRARY and VTK_INCLUDE_DIR"
)
endif
()
endif
()
# todo(s.schulz): this can be replaced from 3.12 onwards with add_compile_definitions
# todo(s.schulz): this can be replaced from 3.12 onwards with add_compile_definitions
add_compile_
op
tions
(
"
-D
ALL_VTK_OUTPUT"
)
add_compile_
defini
tions
(
"ALL_VTK_OUTPUT"
)
endif
(
CM_ALL_VTK_OUTPUT
)
endif
(
CM_ALL_VTK_OUTPUT
)
if
(
CM_ALL_DEBUG
)
if
(
CM_ALL_DEBUG
)
message
(
"Using ALL debug information"
)
message
(
"Using ALL debug information"
)
add_compile_
op
tions
(
"
-D
ALL_DEBUG_ENABLED"
)
add_compile_
defini
tions
(
"ALL_DEBUG_ENABLED"
)
endif
(
CM_ALL_DEBUG
)
endif
(
CM_ALL_DEBUG
)
if
(
CM_ALL_FORTRAN_ERROR_ABORT
)
if
(
CM_ALL_FORTRAN_ERROR_ABORT
)
add_compile_
op
tions
(
"
-D
ALL_FORTRAN_ERROR_ABORT"
)
add_compile_
defini
tions
(
"ALL_FORTRAN_ERROR_ABORT"
)
endif
()
endif
()
if
(
CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE
)
if
(
CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE
)
add_compile_
op
tions
(
"
-
DALL_USE_F08"
)
add_compile_
defini
tions
(
"DALL_USE_F08"
)
elseif
(
CM_ALL_USE_F08 AND NOT MPI_Fortran_HAVE_F08_MODULE
)
elseif
(
CM_ALL_USE_F08 AND NOT MPI_Fortran_HAVE_F08_MODULE
)
message
(
FATAL_ERROR
"Fortran 2008 MPI chosen, but MPI installation does not support the Fortran 2008 modules"
)
message
(
FATAL_ERROR
"Fortran 2008 MPI chosen, but MPI installation does not support the Fortran 2008 modules"
)
endif
(
CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE
)
endif
(
CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE
)
...
@@ -97,7 +97,7 @@ endif(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE)
...
@@ -97,7 +97,7 @@ endif(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE)
if
(
CM_ALL_VORONOI
)
if
(
CM_ALL_VORONOI
)
message
(
STATUS
"compiling voro++ version in contrib/voro++"
)
message
(
STATUS
"compiling voro++ version in contrib/voro++"
)
add_subdirectory
(
contrib/voro++
)
add_subdirectory
(
contrib/voro++
)
add_compile_
op
tions
(
"
-D
ALL_VORONOI_ACTIVE"
)
add_compile_
defini
tions
(
"ALL_VORONOI_ACTIVE"
)
endif
()
endif
()
set
(
STB_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/contrib/stb
)
set
(
STB_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/contrib/stb
)
...
...
This diff is collapsed.
Click to expand it.
misc/preprocess.sh
+
21
−
6
View file @
6117386c
...
@@ -2,14 +2,15 @@
...
@@ -2,14 +2,15 @@
# Usage:
# Usage:
# $1: path to include directory
# $1: path to include directory
# $2..: additional flags to gcc
# $2: output file
# $3..: additional defines (without -D)
# Either run this script in the include directory, or pass the include
# Either run this script in the include directory, or pass the include
# directory as an additional argument ($1).
# directory as an additional argument ($1).
set
-euo
pipefail
set
-euo
pipefail
#
set -x
set
-x
HEADERS
=
"ALL_CustomExceptions.hpp
HEADERS
=
"ALL_CustomExceptions.hpp
ALL_Defines.h
ALL_Defines.h
...
@@ -25,9 +26,16 @@ ALL_Voronoi.hpp"
...
@@ -25,9 +26,16 @@ ALL_Voronoi.hpp"
PROCESSED_DIR
=
`
mktemp
-d
`
PROCESSED_DIR
=
`
mktemp
-d
`
CWD
=
"
$1
"
CWD
=
`
pwd
`
cd
"
$1
"
if
[[
${
2
:0:1
}
==
/
]]
then
OUTFILE
=
"
$2
"
else
OUTFILE
=
"
$CWD
/
$2
"
fi
shift
shift
shift
for
f
in
$HEADERS
for
f
in
$HEADERS
do
do
...
@@ -36,8 +44,15 @@ done
...
@@ -36,8 +44,15 @@ done
cd
"
$PROCESSED_DIR
"
cd
"
$PROCESSED_DIR
"
gcc
-E
-fdirectives-only
"
$@
"
-o
ALL.ii ALL.hpp
DEFINES
=
for
d
in
"
$@
"
do
DEFINES
=
"
$DEFINES
-D
$d
"
done
gcc
-E
-fdirectives-only
$DEFINES
-o
ALL.ii ALL.hpp
cat
ALL.ii |
sed
-e
's!// PPIGNORE <!#include <!'
>
"
$CWD
/ALL_pp.hpp"
mkdir
-p
"
${
OUTFILE
%/*
}
"
cat
ALL.ii |
sed
-e
's!// PPIGNORE <!#include <!'
>
"
$OUTFILE
"
rm
-rf
$PROCESSED_DIR
rm
-rf
$PROCESSED_DIR
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
10
−
4
View file @
6117386c
...
@@ -33,8 +33,6 @@ target_include_directories (ALL
...
@@ -33,8 +33,6 @@ target_include_directories (ALL
# library is necessary.
# library is necessary.
target_link_libraries
(
ALL INTERFACE stdc++
)
target_link_libraries
(
ALL INTERFACE stdc++
)
install
(
TARGETS ALL
install
(
TARGETS ALL
EXPORT ALLTargets
EXPORT ALLTargets
RUNTIME DESTINATION bin
RUNTIME DESTINATION bin
...
@@ -42,8 +40,16 @@ install(TARGETS ALL
...
@@ -42,8 +40,16 @@ install(TARGETS ALL
ARCHIVE DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
)
INCLUDES DESTINATION include
)
install
(
FILES
${
ALL_HEADER_FILES
}
get_property
(
_glob_comp_def DIRECTORY PROPERTY COMPILE_DEFINITIONS
)
DESTINATION include
)
add_custom_command
(
TARGET ALL
PRE_BUILD
COMMAND
${
CMAKE_CURRENT_SOURCE_DIR
}
/../misc/preprocess.sh
${
ALL_INCLUDE_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
/../include/ALL.hpp
${
_glob_comp_def
}
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/../include/ALL.hpp DESTINATION include
)
#install(FILES ${ALL_HEADER_FILES}
# DESTINATION include)
if
(
CM_ALL_FORTRAN
)
if
(
CM_ALL_FORTRAN
)
set
(
CMAKE_Fortran_MODULE_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/../modules
)
set
(
CMAKE_Fortran_MODULE_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/../modules
)
...
...
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