Newer
Older

Christian Godenschwager
committed
############################################################################################################################
##
## waLBerla's main cmake file
##
## Contents:
## - definition of build options
## - compiler variables ( c++ standard, warnings etc. )

Christian Godenschwager
committed
## - Finding of service libraries. Required: boost, Optional: MPI, PE, METIS
## the include paths are set, and the libraries are added to variable SERVICE_LIBS
## - Subdirectory cmake lists are called
## -> src/ this folder contains all modules, each module (that contains c or cpp files) is linked to a
## static library. Dependencies between these shared libraries are tracked manually,

Christian Godenschwager
committed
## for more information see waLBerlaModuleDependencySystem.cmake
## -> tests/ Same subdirectories as src/ folder. Contains tests for each module
## - Export of variables into internal cache variables, for usage in applications or projects that use walberla as
## subdirectory. Variables containing the service-libs,

Christian Godenschwager
committed
##
############################################################################################################################
############################################################################################################################
##
## Project name, version, Custom CMake functions
##
############################################################################################################################
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)

Christian Godenschwager
committed
set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${walberla_SOURCE_DIR}/cmake )
include ( waLBerlaFunctions )

Christian Godenschwager
committed
if( CMAKE_VERSION VERSION_LESS 2.8.3 )
include( CMakeParseArgumentsCompat )
else()
include( CMakeParseArguments )
endif()

Christian Godenschwager
committed
# Enable CTest
enable_testing()
include( CTest )

Christian Godenschwager
committed
############################################################################################################################
############################################################################################################################
##
## Definition of build options
##
############################################################################################################################
# Build options
option ( WALBERLA_DOUBLE_ACCURACY "Floating point accuracy, defaults to double" ON )
option ( WALBERLA_ENABLE_GUI "Compile with GUI" )

Christian Godenschwager
committed
option ( WALBERLA_BUILD_TESTS "Build Testcases" )
option ( WALBERLA_BUILD_BENCHMARKS "Build Benchmarks" ON )
option ( WALBERLA_BUILD_TOOLS "Build Tools" )
option ( WALBERLA_BUILD_TUTORIALS "Build Tutorials" ON )

Christian Godenschwager
committed
option ( WALBERLA_BUILD_WITH_MPI "Build with MPI" ON )
option ( WALBERLA_BUILD_WITH_METIS "Build with metis graph partitioner" OFF )
option ( WALBERLA_BUILD_WITH_PARMETIS "Build with ParMetis graph partitioner" OFF )

Christian Godenschwager
committed
option ( WALBERLA_BUILD_WITH_GPROF "Enables gprof" )
option ( WALBERLA_BUILD_WITH_GCOV "Enables gcov" )
option ( WALBERLA_BUILD_WITH_LTO "Enable link time optimizations" )
option ( WALBERLA_BUILD_WITH_OPENMP "Enable OpenMP support" )
option ( WALBERLA_BUILD_WITH_PYTHON "Support for embedding Python" )

Christian Godenschwager
committed
option ( WALBERLA_BUILD_WITH_PYTHON_MODULE "Build waLBerla python module" )
option ( WALBERLA_BUILD_WITH_PYTHON_LBM "Include LBM module into python module" OFF )
option ( WALBERLA_BUILD_WITH_CODEGEN "Enable pystencils code generation" OFF )

Christian Godenschwager
committed
option ( WALBERLA_BUILD_WITH_LIKWID_MARKERS "Compile in markers for likwid-perfctr" )

Christian Godenschwager
committed
option ( WALBERLA_BUILD_WITH_FASTMATH "Fast math" )

Christian Godenschwager
committed
option ( WALBERLA_SIMD_FORCE_SCALAR "Do not use SIMD operations even when available" OFF )

Christian Godenschwager
committed
option ( WALBERLA_BUFFER_DEBUG "Type checking for BufferSystem ( slow )" OFF )
option ( WALBERLA_NO_OUTDATED_FEATURES "Show warning/errors when outdated features "
"(i.e. features that will be deprecated) are used" )
# Profile guided optimization
option ( WALBERLA_PROFILE_GENERATE "Generates Profile for Optimization" )
option ( WALBERLA_PROFILE_USE "Uses Profile to optimize" )
# Compiler Optimization
option ( WALBERLA_OPTIMIZE_FOR_LOCALHOST "Enable compiler optimizations spcific to localhost" )
# Installation Directory
set ( CMAKE_INSTALL_PREFIX /usr/local/waLBerla CACHE STRING "The default installation directory." )
# Default build type
if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE Release CACHE STRING "Build Types: Debug Release DebugOptimized RelWithDebInfo MinSizeRel." FORCE )
endif()
SET_PROPERTY( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release DebugOptimized RelWithDebInfo MinSizeRel )
# Debugging options )
option ( WALBERLA_STL_BOUNDS_CHECKS "Use debug capabilites of libstd++: iterator and bounds checks" )

Christian Godenschwager
committed
# Warning options
option ( WARNING_DISABLE "Disables additional compiler warnings" OFF )
option ( WARNING_PEDANTIC "Enables pedantic compiler warnings" ON )
option ( WARNING_ERROR "Convert warnings to errors compiler warnings" OFF )
option ( WARNING_DEPRECATED "Show warning when deprecated features are used" ON )
# Sanitizer options
option ( WALBERLA_SANITIZE_ADDRESS "Enables address sanitizer in gcc and clang" )
option ( WALBERLA_SANITIZE_UNDEFINED "Enables undefined behavior sanitizer in gcc and clang" )

Christian Godenschwager
committed
# Every folder that is listed here can contain modules or tests
# this can be extended by applications to have own modules
# Here the src/ folder is added to this list, where all modules are located

Christian Godenschwager
committed
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
list( APPEND WALBERLA_MODULE_DIRS "${walberla_SOURCE_DIR}/src" "${walberla_SOURCE_DIR}/tests" )
list( REMOVE_DUPLICATES WALBERLA_MODULE_DIRS )
set ( WALBERLA_MODULE_DIRS ${WALBERLA_MODULE_DIRS} CACHE INTERNAL "All folders that contain modules or tests" )
############################################################################################################################
############################################################################################################################
##
## Compiler detection
##
############################################################################################################################
# Check for intel compiler
if( CMAKE_CXX_COMPILER MATCHES "icpc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpc" )
option ( WALBERLA_CXX_COMPILER_IS_INTEL "Use Intel compiler" ON )
# Intel(R) Compiler has its own library archiver,
# if you build libraries and do not use xiar,
# the Intel compiler will complain about invalid
# archives at the link phase.
# The Intel(R) archiver is "xiar" usually
# located in the same folder as the compiler,
FIND_PROGRAM(XIAR xiar)
IF(XIAR)
SET(CMAKE_AR "${XIAR}")
ENDIF(XIAR)
MARK_AS_ADVANCED(XIAR)
# Intel(R) Compiler also comes with its own linker
# which provides a number of additional benefits when
# linking code compiled with the Intel(R) compiler.
# Again, usually in the same place as icc itself,
FIND_PROGRAM(XILD xild)
IF(XILD)
SET(CMAKE_LINKER "${XILD}")
ENDIF(XILD)
MARK_AS_ADVANCED(XILD)
else()
option ( WALBERLA_CXX_COMPILER_IS_INTEL "Use Intel compiler" OFF )
endif()
mark_as_advanced ( WALBERLA_CXX_COMPILER_IS_INTEL )
# Check for Gnu compiler
if ( CMAKE_COMPILER_IS_GNUCXX AND NOT WALBERLA_CXX_COMPILER_IS_INTEL )
option ( WALBERLA_CXX_COMPILER_IS_GNU "Use gnu compiler" ON )
else()
option ( WALBERLA_CXX_COMPILER_IS_GNU "Use gnu compiler" OFF )
endif()
mark_as_advanced ( WALBERLA_CXX_COMPILER_IS_GNU )

Christian Godenschwager
committed
# Check for Visual Studio
if ( MSVC )
option ( WALBERLA_CXX_COMPILER_IS_MSVC "Use Visual Studio compiler" ON )
else()
option ( WALBERLA_CXX_COMPILER_IS_MSVC "Use Visual Studio compiler" OFF )
endif()
mark_as_advanced ( WALBERLA_CXX_COMPILER_IS_MSVC )
# Check for IBM compiler
if( CMAKE_CXX_COMPILER MATCHES "xlc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "xlc" )
option ( WALBERLA_CXX_COMPILER_IS_IBM "Use IBM compiler" ON )
else()
option ( WALBERLA_CXX_COMPILER_IS_IBM "Use IBM compiler" OFF )
endif()
mark_as_advanced ( WALBERLA_CXX_COMPILER_IS_IBM )
# Check for NEC SX compiler
if( CMAKE_CXX_COMPILER MATCHES "sxc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "sxc" OR CMAKE_CXX_COMPILER MATCHES "sxmpic" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "sxmpic" )
option ( WALBERLA_CXX_COMPILER_IS_NEC "Use NEC compiler" ON )
else()
Loading full blame...