forked from AMReX-Codes/amrex-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
93 lines (72 loc) · 2.38 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
cmake_minimum_required(VERSION 3.14)
project( AMReX-Tutorials
DESCRIPTION "Tutorials for the AMReX adaptive mesh refinement framework"
#VERSION ${AMREX_PKG_VERSION}
# Check that the line below points to the correct repo
HOMEPAGE_URL "https://amrex-codes.github.io/amrex/tutorials_html/index.html"
)
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake )
#
# Fetch amrex repo
#
set(AMReX_GIT_BRANCH "development" CACHE STRING "The AMReX branch to checkout")
set(AMReX_INSTALL "NO" CACHE INTERNAL "Disable install target for amrex")
include(FetchContent)
set(FETCHCONTENT_QUIET OFF) # Verbose ON
FetchContent_Declare(
amrex
GIT_REPOSITORY https://github.com/AMReX-Codes/amrex.git/
GIT_TAG ${AMReX_GIT_BRANCH}
)
if(NOT ${amrex}_POPULATED)
FetchContent_Populate(amrex)
list(APPEND CMAKE_MODULE_PATH ${amrex_SOURCE_DIR}/Tools/CMake)
# Load amrex options here so that they are
# available to the entire project
include(AMReXOptions)
if (AMReX_FORTRAN)
enable_language(Fortran)
endif ()
if (AMReX_GPU_BACKEND STREQUAL "CUDA")
enable_language(CUDA)
include(AMReX_SetupCUDA)
endif ()
# Bring the populated content into the build
add_subdirectory(${amrex_SOURCE_DIR} ${amrex_BINARY_DIR})
endif()
#
# List of subdirectories to search for CMakeLists.
# For now, we do not include MUI, SDC, SWFFT
#
set( AMREX_TUTORIALS_SUBDIRS Amr Basic ForkJoin)
if (AMReX_ASCENT)
list(APPEND AMREX_TUTORIALS_SUBDIRS Blueprint)
endif ()
if (AMReX_EB)
list(APPEND AMREX_TUTORIALS_SUBDIRS EB)
endif ()
if (AMReX_LINEAR_SOLVERS)
list(APPEND AMREX_TUTORIALS_SUBDIRS LinearSolvers)
endif ()
if (AMReX_PARTICLES)
list(APPEND AMREX_TUTORIALS_SUBDIRS Particles)
endif ()
if (AMReX_FORTRAN_INTERFACES)
list(APPEND AMREX_TUTORIALS_SUBDIRS FortranInterface)
endif ()
if (NOT (AMReX_GPU_BACKEND STREQUAL "NONE") )
list(APPEND AMREX_TUTORIALS_SUBDIRS GPU)
endif ()
list(TRANSFORM AMREX_TUTORIALS_SUBDIRS PREPEND "${CMAKE_CURRENT_LIST_DIR}/")
#
# Search for CMakelists.txt in the subdirectories defined in the list above
# and include those that contain one into the build
#
include(SetupTutorials)
foreach (_subdir IN LISTS AMREX_TUTORIALS_SUBDIRS)
file( GLOB_RECURSE _tests "${_subdir}/*CMakeLists.txt" )
foreach ( _item IN LISTS _tests)
get_filename_component(_dir ${_item} DIRECTORY )
add_subdirectory(${_dir})
endforeach ()
endforeach ()