Skip to content

Commit

Permalink
Fix External AMReX Builds
Browse files Browse the repository at this point in the history
- print version
- make AMReX external if pyAMReX is external
- new AMReX 23.11+ installed CMake module paths for CMake scripts
  • Loading branch information
ax3l committed Oct 26, 2023
1 parent d02caf0 commit f3ed8f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions cmake/dependencies/ABLASTR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ macro(find_ablastr)
include(FetchContent)
endif()

# if pyAMReX is external, AMReX must be as well
if(NOT ImpactX_pyamrex_internal)
set(ImpactX_amrex_internal OFF CACHE BOOL
"Download & build AMReX" FORCE)
endif()

# transitive control for AMReX superbuild
set(WarpX_amrex_internal ${ImpactX_amrex_internal} CACHE BOOL
"Download & build AMReX" FORCE)
Expand Down Expand Up @@ -91,7 +97,7 @@ macro(find_ablastr)
add_subdirectory(${ImpactX_ablastr_src} _deps/localablastr-build/)
# TODO: this is a bit hacky, check if we find a variable like
# fetchedamrex_SOURCE_DIR or FETCHCONTENT_SOURCE_DIR_FETCHEDAMREX
# that we could use for the named path instead
# or AMReX_DIR or AMReX_MODULE_PATH that we could use for the named path instead
list(APPEND CMAKE_MODULE_PATH "${FETCHCONTENT_BASE_DIR}/fetchedamrex-src/Tools/CMake")
else()
FetchContent_Declare(fetchedablastr
Expand All @@ -114,7 +120,7 @@ macro(find_ablastr)
add_subdirectory(${fetchedablastr_SOURCE_DIR} ${fetchedablastr_BINARY_DIR})
# TODO: this is a bit hacky, check if we find a variable like
# fetchedamrex_SOURCE_DIR or FETCHCONTENT_SOURCE_DIR_FETCHEDAMREX
# that we could use for the named path instead
# or AMReX_DIR or AMReX_MODULE_PATH that we could use for the named path instead
list(APPEND CMAKE_MODULE_PATH "${FETCHCONTENT_BASE_DIR}/fetchedamrex-src/Tools/CMake")
endif()

Expand Down Expand Up @@ -142,6 +148,9 @@ macro(find_ablastr)
message(STATUS "ABLASTR: Found version '${ABLASTR_VERSION}'")
endif()

# AMReX CMake helper scripts
list(APPEND CMAKE_MODULE_PATH "${AMReX_DIR}/AMReXCMakeModules")

# transitive control for openPMD external
if(NOT ImpactX_openpmd_src AND NOT ImpactX_openpmd_internal)
if(ImpactX_MPI)
Expand Down Expand Up @@ -177,7 +186,7 @@ set(ImpactX_ablastr_branch "23.10"
set(ImpactX_amrex_repo "https://github.com/AMReX-Codes/amrex.git"
CACHE STRING
"Repository URI to pull and build AMReX from if(ImpactX_amrex_internal)")
set(ImpactX_amrex_branch "23.10"
set(ImpactX_amrex_branch "da79aff8053058371a78d4bf85488384242368ee"
CACHE STRING
"Repository branch for ImpactX_amrex_repo if(ImpactX_amrex_internal)")

Expand Down
2 changes: 1 addition & 1 deletion cmake/dependencies/pyAMReX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function(find_pyamrex)
elseif(NOT ImpactX_pyamrex_internal)
# TODO: MPI control
find_package(pyAMReX 23.10 CONFIG REQUIRED)
message(STATUS "pyAMReX: Found version '${pyamrex_VERSION}'")
message(STATUS "pyAMReX: Found version '${pyAMReX_VERSION}'")
endif()
endfunction()

Expand Down

0 comments on commit f3ed8f7

Please sign in to comment.