forked from AMReX-Codes/amrex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
129 lines (104 loc) · 3.76 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
cmake_minimum_required (VERSION 3.6)
project (CCSE)
# Define the languages used by the project
enable_language (C)
enable_language (CXX)
enable_language (Fortran)
#
# Require C++11 standard
#
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
#
# Always verbose output during make
#
set ( CMAKE_VERBOSE_MAKEFILE on )
#
# Set the search path for cmake modules
#
set ( AMREX_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Tools )
set ( CMAKE_MODULE_PATH ${AMREX_TOOLS_DIR}/CMake )
#
# Initialize all the global variables
#
include ( AMReX_CMakeVariables )
#
# Include modules with custom macros and functions
#
include ( AMReX_Utils )
########## Load CMake tools directory ##########
# Useful variables pointing to directories in the source tree
set(CCSE_TOOLS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Tools")
set(CCSE_PERL_DIR "${CCSE_TOOLS_DIR}/C_scripts")
set(CCSE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
# Set the module search path so find_package and include commands
# can locate files in <root source tree>/tools/cmake
set(CCSE_MODULE_PATH "${CCSE_TOOLS_DIR}/CMake")
# Additional build options
include ( AMReX_Version )
include ( AMReX_Options )
include ( AMReX_Config )
#
# Usage:
#
# Typically cmake is used to support an "out-of-source-tree" build. To this with default
# settings (see below):
#
# #> export bdir=`pwd`
# #> mkdir <new_build_dir>
# #> cd <new_build_dir>
# #> cmake -DCMAKE_INSTALL_PREFIX:PATH=<some_install_prefix_for_amrex> $bdir
# #> make
# #> make install
#
# The install target will place all C++/Fortran header and mod files in an include folder,
# the CCSE libraries in a lib folder, plus some stuff in perl and cmake folders.
#
# An example cmake input file to build an app that links to the libs built as above:
#
# ./Tutorials/MultiGrid_C/CMakeLists.txt
#
# To build this tutorial with cmake, follow instructions similar to the above for building
# AMReX:
#
# #> mkdir <new_build_dir>
# #> cd <new_build_dir>
# #> cmake -DAMREX_INSTALL_PREFIX:PATH=<some_install_prefix_for_amrex> $bdir/Tutorials/MultiGrid_C
# #> make
# #> mpiexec -np 4 ./mgc_tutorial inputs.3d
#
# Define the project name
# This command will define
# CCSE_SOURCE_DIR
# CCSE_BINARY_DIR
# None, Debug, Release, RelWithDebInfo, MinSizeRel
#set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Type of CMake build")
set(CMAKE_INSTALL_PREFIX "${CURRENT_CMAKE_BINDARY_DIR}" CACHE STRING "Root dir where AMReX files installed")
# Enable testing, ctest needs this
# all add_test commands are ignored unless this is called!
enable_testing()
# A property for accumulating the a global CCSE link line.
set_property(GLOBAL PROPERTY CCSE_LINK_LINE "-L${CMAKE_INSTALL_PREFIX}/lib")
# A property for accumulating CCSE library targets
set_property(GLOBAL PROPERTY CCSE_LIBRARY_TARGETS)
include(InstallManager)
# Source files for all binaries and libraries found under src
add_subdirectory(Src)
# Source file for postprocess exes
add_subdirectory(Tools/Postprocessing/F_Src)
# Make the exports only _after_ doing the build
create_exports()
ADD_INSTALL_INCLUDE_FILE(${CCSE_PERL_DIR}/AMReX_buildInfo.H)
ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/CCSEOptions.cmake)
ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/FindCCSE.cmake)
ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/CCSEConfigVersion-install.cmake.in)
option(ENABLE_Config_Report "Print out detailed information at the end of a configuration")
set(CCSE_CONFIG_LOG "${CCSE_BINARY_DIR}/ccse-config.log"
CACHE string "CCSE configuration log file")
include(CCSEConfigReport)
if (ENABLE_Config_Report)
execute_process(COMMAND "${cat_exec}" "${CCSE_CONFIG_LOG}" OUTPUT_VARIABLE config_output)
message(STATUS "contents of: ${CCSE_CONFIG_LOG}")
message(STATUS "${config_output}")
endif()