-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathCMakeLists.txt
66 lines (50 loc) · 1.53 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
# CMake file for build HelloWorld tutorial.
#
# Step 1: Create and enter a build directory:
#
# mkdir build
# cd build
#
# Step 2: Configure with CMake from inside the build directory:
#
# cmake <compile options> .. #if AMReX not installed
#
# or:
#
# cmake -DAMReX_ROOT=/path/to/installdir <compile options> .. #if AMReX already installed
#
# Step 3: Build the configuration:
#
# cmake --build . -j4
#
# Done! You should now see an executable called "HelloWorld". To run:
#
# mpiexec -n 4 ./HelloWorld
#
# For additional CMake compile options see
# https://amrex-codes.github.io/amrex/docs_html/BuildingAMReX.html#building-with-cmake
cmake_minimum_required(VERSION 3.24)
# Project name and source file language
project(HelloWorld
LANGUAGES C CXX)
add_executable(HelloWorld main.cpp)
# To use a pre-installed AMReX build, run:
# cmake -DAMReX_ROOT=/path/to/installdir
# Otherwise cmake will download AMReX from GitHub
if(NOT DEFINED AMReX_ROOT)
message("-- Download and configure AMReX from GitHub")
#Download AMReX from GitHub
include(FetchContent)
set(FETCHCONTENT_QUIET OFF)
FetchContent_Declare(
amrex_code
GIT_REPOSITORY https://github.com/AMReX-Codes/amrex.git/
GIT_TAG origin/development
)
FetchContent_MakeAvailable(amrex_code)
else()
# Add AMReX
message("-- Searching for AMReX install directory at ${AMReX_ROOT}")
find_package(AMReX PATHS ${AMReX_ROOT}/lib/cmake/AMReX/AMReXConfig.cmake)
endif()
target_link_libraries(HelloWorld PRIVATE AMReX::amrex)