Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Dmitri Naumov
ogs
Commits
b250b7a3
Commit
b250b7a3
authored
13 years ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
Introduced Find cmake script and enabled OGS_PROFILE option.
parent
ebcc27f4
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
CMakeLists.txt
+12
-7
12 additions, 7 deletions
CMakeLists.txt
scripts/cmake/CompilerSetup.cmake
+16
-11
16 additions, 11 deletions
scripts/cmake/CompilerSetup.cmake
scripts/cmake/Find.cmake
+26
-0
26 additions, 0 deletions
scripts/cmake/Find.cmake
with
54 additions
and
18 deletions
CMakeLists.txt
+
12
−
7
View file @
b250b7a3
#####################
### OGS-6 Project ###
#####################
# Specify minimum CMake version
cmake_minimum_required
(
VERSION 2.6
)
...
...
@@ -7,15 +11,16 @@ project( OGS-6 )
### CMake includes ###
INCLUDE
(
scripts/cmake/CMakeSetup.cmake
)
INCLUDE
(
scripts/cmake/CompilerSetup.cmake
)
INCLUDE
(
scripts/cmake/Find.cmake
)
# Finds
FIND_PACKAGE
(
OpenMP
)
IF
(
OPENMP_FOUND
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
OpenMP_C_FLAGS
}
"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
OpenMP_CXX_FLAGS
}
"
)
ENDIF
()
###############
### Options ###
###############
# Profiling
IF
((
CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC
)
AND GPROF_PATH
)
OPTION
(
OGS_PROFILE
"Enables compiling with flags set for profiling with gprof."
OFF
)
ENDIF
()
# GCC AND GPROF_PATH
# Set build directories
SET
(
EXECUTABLE_OUTPUT_PATH
${
PROJECT_BINARY_DIR
}
/bin
)
...
...
This diff is collapsed.
Click to expand it.
scripts/cmake/CompilerSetup.cmake
+
16
−
11
View file @
b250b7a3
...
...
@@ -3,7 +3,7 @@ INCLUDE(SetDefaultBuildType)
SET_DEFAULT_BUILD_TYPE
(
Debug
)
INCLUDE
(
MSVCMultipleProcessCompile
)
# /MP switch (multi processor) for VS
### GNU C/CXX
### GNU C/CXX
compiler
IF
(
CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC
)
get_gcc_version
(
GCC_VERSION
)
IF
(
NOT CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
...
...
@@ -19,16 +19,9 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
# -g
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wall -Wextra -fno-nonansi-builtins"
)
ADD_DEFINITIONS
(
-DGCC
)
IF
(
OGS_PROFILE
)
IF
(
NOT CMAKE_BUILD_TYPE STREQUAL
"Release"
)
MESSAGE
(
Warning
"When using profiling you should set CMAKE_BUILD_TYPE to Release."
)
ENDIF
()
SET
(
PROFILE_FLAGS
"-pg -fno-omit-frame-pointer -O2 -DNDEBUG -fno-inline-functions-called-once -fno-optimize-sibling-calls"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
PROFILE_FLAGS
}
"
)
ENDIF
(
OGS_PROFILE
)
ENDIF
(
CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC
)
### Intel
### Intel
compiler
IF
(
${
CMAKE_C_COMPILER
}
MATCHES
"icc.*$"
OR
${
CMAKE_CXX_COMPILER
}
MATCHES
"icpc.*$"
)
IF
(
NOT CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
MESSAGE
(
STATUS
"Set Intel release flags"
)
...
...
@@ -39,6 +32,19 @@ IF (${CMAKE_C_COMPILER} MATCHES "icc.*$" OR ${CMAKE_CXX_COMPILER} MATCHES "icpc.
ENDIF
(
${
CMAKE_C_COMPILER
}
MATCHES
"icc.*$"
OR
${
CMAKE_CXX_COMPILER
}
MATCHES
"icpc.*$"
)
# Profiling
IF
(
OGS_PROFILE
)
IF
(
NOT CMAKE_BUILD_TYPE STREQUAL
"Release"
)
MESSAGE
(
STATUS
"When using profiling you should set CMAKE_BUILD_TYPE to Release."
)
ENDIF
()
SET
(
PROFILE_FLAGS
"-pg -fno-omit-frame-pointer -O2 -DNDEBUG"
)
# clang compiler does not know the following flags
IF
(
CMAKE_CXX_COMPILER MATCHES
"!clang"
)
SET
(
PROFILE_FLAGS
"
${
PROFILE_FLAGS
}
-fno-inline-functions-called-once -fno-optimize-sibling-calls"
)
ENDIF
()
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
PROFILE_FLAGS
}
"
)
ENDIF
(
OGS_PROFILE
)
### Windows
IF
(
WIN32
)
## For Visual Studio compiler
...
...
@@ -47,10 +53,9 @@ IF (WIN32)
-D_CRT_XNONSTDC_NO_WARNINGS
)
# Sets warning level 3 and ignores some warnings
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/W3 /wd4290 /wd4267"
)
SET
(
GCC OFF
)
# cygwin
ELSE
(
MSVC
)
MESSAGE
(
STATUS
"Might be GCC under cygwin."
)
SET
(
GCC
ON
)
ADD_DEFINITIONS
(
-D
GCC
)
ENDIF
(
MSVC
)
ENDIF
(
WIN32
)
This diff is collapsed.
Click to expand it.
scripts/cmake/Find.cmake
0 → 100644
+
26
−
0
View file @
b250b7a3
######################
### Find tools ###
######################
# Find dot tool from graphviz
FIND_PROGRAM
(
DOT_TOOL_PATH dot DOC
"Dot tool from graphviz"
)
# Find doxygen
FIND_PACKAGE
(
Doxygen
)
# Find gnu profiler gprof
FIND_PROGRAM
(
GPROF_PATH gprof DOC
"GNU profiler gprof"
)
FIND_PACKAGE
(
cppcheck
)
######################
### Find libraries ###
######################
FIND_PACKAGE
(
OpenMP
)
IF
(
OPENMP_FOUND
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
OpenMP_C_FLAGS
}
"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
OpenMP_CXX_FLAGS
}
"
)
ENDIF
()
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