forked from AMReX-Codes/amrex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
90 lines (74 loc) · 2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
cmake_minimum_required(VERSION 3.14)
project(AMReX)
enable_language(C) # needed for find_package(MPI REQUIRED "C")
enable_language(CXX)
enable_language(Fortran)
#
# Load required modules
#
set( AMREX_CMAKE_MODULES_PATH "${CMAKE_CURRENT_LIST_DIR}/Tools/CMake" CACHE INTERNAL "" )
set( CMAKE_MODULE_PATH ${AMREX_CMAKE_MODULES_PATH} )
#
# Provide a default install directory
#
if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
set ( CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/installdir"
CACHE PATH "AMReX installation directory" FORCE)
endif ()
#
# Include options, utilities and other stuff we need
#
include( AMReX_Utils )
include( AMReX_Options )
include( AMReX_Machines )
#
# Enable CUDA if requested
#
if (ENABLE_CUDA)
include(AMReX_SetupCUDA)
endif ()
#
# Set CMAKE_<LANG>_FLAGS_<CONFIG> if not already defined
#
set_default_config_flags ()
#
# Set variable for AMReX versioning
#
find_package (Git QUIET)
set ( TMP "" )
if ( EXISTS ${CMAKE_SOURCE_DIR}/.git AND ${GIT_FOUND} )
execute_process ( COMMAND git describe --abbrev=12 --dirty --always --tags
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE TMP )
string ( STRIP ${TMP} TMP )
else ()
# Grep first line from file CHANGES if AMREX_GIT_VERSION is not
# provided
file(STRINGS ${PROJECT_SOURCE_DIR}/CHANGES ALL_VERSIONS REGEX "#")
list(GET ALL_VERSIONS 0 TMP)
string(REPLACE "#" "" TMP "${TMP}")
string (STRIP "${TMP}" TMP )
set (TMP "${TMP}.0")
endif ()
set ( AMREX_GIT_VERSION "${TMP}" CACHE INTERNAL "" )
unset (TMP)
#
# Source files for all binaries and libraries found under src
#
add_subdirectory(Src)
#
# Tutorials and "test_install" target
#
option(ENABLE_TUTORIALS "Enable Tutorials" NO)
if (ENABLE_TUTORIALS)
add_subdirectory(Tutorials)
endif ()
#
# Plotfile tools
#
option(ENABLE_PLOTFILE_TOOLS "Enable Plotfile tools" NO)
if (ENABLE_PLOTFILE_TOOLS)
# If this get executed, it cannot be EXCLUDED_FROM_ALL
# because it needs to get installed
add_subdirectory(Tools/Plotfile)
endif ()