Skip to content

Commit

Permalink
Fix: AMReXBuildInfo & AMReXTypecheck Paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Oct 19, 2023
1 parent a1accf5 commit 69b7a2f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
29 changes: 22 additions & 7 deletions Tools/CMake/AMReXBuildInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,30 @@ include(AMReXTargetHelpers)
#
# Set paths
#
string(REPLACE "/Tools/CMake" "" AMREX_TOP_DIR ${CMAKE_CURRENT_LIST_DIR})
set( AMREX_TOP_DIR ${AMREX_TOP_DIR} CACHE INTERNAL "Top level AMReX directory")

set( AMREX_BUILDINFO_IFILE ${CMAKE_CURRENT_LIST_DIR}/AMReX_buildInfo.cpp.in
if (AMReX_FOUND)
# AMReX is pre-installed and used as a library
string(REPLACE "/lib/cmake/AMReX/AMReXCMakeModules" "" AMREX_TOP_DIR_DEFAULT
${CMAKE_CURRENT_LIST_DIR})
else ()
# this is a superbuild
string(REPLACE "/Tools/CMake" "" AMREX_TOP_DIR_DEFAULT
${CMAKE_CURRENT_LIST_DIR})
endif ()
set(AMREX_TOP_DIR "${AMREX_TOP_DIR_DEFAULT}" CACHE INTERNAL "Top level AMReX directory")

if (AMReX_FOUND)
# AMReX is pre-installed and used as a library
set(AMREX_C_SCRIPTS_DIR "${AMREX_TOP_DIR}/share/amrex/C_scripts"
CACHE INTERNAL "Path to AMReX' C_scripts dir")
else ()
# this is a superbuild
set(AMREX_C_SCRIPTS_DIR "${AMREX_TOP_DIR}/Tools/C_scripts"
CACHE INTERNAL "Path to AMReX' C_scripts dir")
endif ()

set(AMREX_BUILDINFO_IFILE ${CMAKE_CURRENT_LIST_DIR}/AMReX_buildInfo.cpp.in
CACHE INTERNAL "Full path and name of AMReX_buildInfo.cpp.in")

set( AMREX_C_SCRIPTS_DIR "${AMREX_TOP_DIR}/Tools/C_scripts"
CACHE INTERNAL "Path to AMReX' C_scripts dir")

set(AMREX_BUILD_DATETIME "" CACHE STRING
"User defined build date and time. Set ONLY for reproducibly built binary distributions")

Expand Down
6 changes: 5 additions & 1 deletion Tools/CMake/AMReXTypecheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ function( add_typecheck_target _target)

# Find typechecker
find_file(_typechecker "typechecker.py"
HINTS ${AMReX_SOURCE_DIR} ${AMReX_ROOT} ENV AMReX_ROOT PATH_SUFFIXES Tools/typechecker)
HINTS ${AMReX_SOURCE_DIR} ${AMReX_ROOT} ENV AMReX_ROOT
PATH_SUFFIXES
Tools/typechecker # in-source
share/amrex/typechecker # installed
)

add_custom_target( typecheck_${_target}
COMMAND python3 ${_typechecker}
Expand Down

0 comments on commit 69b7a2f

Please sign in to comment.