Skip to content

Commit

Permalink
Merge branch 'master' into hip-f-func-porting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohearnk committed Apr 19, 2024
2 parents 534ea10 + 83e7538 commit 43e5ad9
Show file tree
Hide file tree
Showing 55 changed files with 6,113 additions and 2,427 deletions.
534 changes: 390 additions & 144 deletions cmake/3rdPartyTools.cmake

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions cmake/AmberBuildSystem2ndInit.cmake
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# This script handles the parts of the Amber CMake init that must happen AFTER the enable_language() command,
# because files included by this use compile tests

# standard library and should-be-in-the-standard-library includes
# --------------------------------------------------------------------

include(TargetArch)
include(ExternalProject)
include(CheckFunctionExists)
include(CheckFortranFunctionExists)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckCSourceRuns)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
include(CheckFortranSourceRuns)
include(CheckSymbolExists)
include(CheckConstantExists)
include(CheckLibraryExists)
include(CheckPythonPackage)
include(CheckTypeSize)
include(CMakePushCheckState)
include(TryLinkLibrary)

# Amber include files
# --------------------------------------------------------------------

include(CheckBoostWorks)
include(VerifyCompilerConfig)
include(InstallWrapped)
include(LibraryTracking)
include(DownloadHttps)
include(Replace)
include(BuildReport)
include(ConfigModuleDirs)
include(ApplyOptimizationDeclarations)
include(CompilationOptions)
include(RPATHConfig)
include(CopyTarget)
include(LibraryUtils)
# This script handles the parts of the Amber CMake init that must happen AFTER the enable_language() command,
# because files included by this use compile tests

# standard library and should-be-in-the-standard-library includes
# --------------------------------------------------------------------

include(TargetArch)
include(ExternalProject)
include(CheckFunctionExists)
include(CheckFortranFunctionExists)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckCSourceRuns)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
include(CheckFortranSourceRuns)
include(CheckSymbolExists)
include(CheckConstantExists)
include(CheckLibraryExists)
include(CheckPythonPackage)
include(CheckTypeSize)
include(CMakePushCheckState)
include(TryLinkLibrary)

# Amber include files
# --------------------------------------------------------------------

include(CheckBoostWorks)
include(VerifyCompilerConfig)
include(InstallWrapped)
include(LibraryTracking)
include(DownloadHttps)
include(Replace)
include(BuildReport)
include(ConfigModuleDirs)
include(ApplyOptimizationDeclarations)
include(CompilationOptions)
include(RPATHConfig)
include(CopyTarget)
include(LibraryUtils)
146 changes: 73 additions & 73 deletions cmake/AmberBuildSystemInit.cmake
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
# This file contains code which must run to start up the build system, and includes files that are common to Amber and every submodule.
# This file must run AFTER a project() command without any languages, but BEFORE the enable_language() command


if(NOT DEFINED FIRST_RUN)

# create a cache variable which is shadowed by a local variable
set(FIRST_RUN FALSE CACHE INTERNAL "Variable to track if it is currently the first time the build system is run" FORCE)
set(FIRST_RUN TRUE)

endif()


# print header
# --------------------------------------------------------------------
message(STATUS "**************************************************************************")
message(STATUS "Starting configuration of ${PROJECT_NAME} version ${${PROJECT_NAME}_VERSION}...")

# print CMake version at the start so we can use it to diagnose issues even if the configure fails
message(STATUS "CMake Version: ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
message(STATUS "For how to use this build system, please read this wiki:")
message(STATUS " http://ambermd.org/pmwiki/pmwiki.php/Main/CMake")
message(STATUS "For a list of important CMake variables, check here:")
message(STATUS " http://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Common-Options")
message(STATUS "**************************************************************************")

# fix search path so that libraries from the install tree are not used
# --------------------------------------------------------------------
list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")

# eliminate extraneous install messages
# --------------------------------------------------------------------
set(CMAKE_INSTALL_MESSAGE LAZY)

# configure module path
# --------------------------------------------------------------------

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}
"${CMAKE_CURRENT_LIST_DIR}/jedbrown"
"${CMAKE_CURRENT_LIST_DIR}/hanjianwei"
"${CMAKE_CURRENT_LIST_DIR}/rpavlik"
"${CMAKE_CURRENT_LIST_DIR}/patched-cmake-modules")

# prevent obliteration of the old build system's makefiles
# --------------------------------------------------------------------

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "You are building in the source directory. ${PROJECT_NAME} does not support this, since it would obliterate the Makefile build system.")
endif()

# includes
# --------------------------------------------------------------------

#Basic utilities. These files CANNOT use any sort of compile checks or system introspection because no languages are enabled yet
include(CMakeParseArguments)
include(Policies NO_POLICY_SCOPE)
include(Utils)
include(Shorthand)
include(ColorMessage)

# get install directories
include(InstallDirs)

#run manual compiler setter, if it is enabled
include(AmberCompilerConfig)

#control default build type.
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------

set(CMAKE_CONFIGURATION_TYPES "DEBUG;RELEASE" CACHE STRING "Allowed build types for Amber. This only controls debugging flags, set the OPTIMIZE variable to control compiler optimizations." FORCE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "Type of build. Controls debugging information and optimizations." FORCE)
endif()
# This file contains code which must run to start up the build system, and includes files that are common to Amber and every submodule.
# This file must run AFTER a project() command without any languages, but BEFORE the enable_language() command


if(NOT DEFINED FIRST_RUN)

# create a cache variable which is shadowed by a local variable
set(FIRST_RUN FALSE CACHE INTERNAL "Variable to track if it is currently the first time the build system is run" FORCE)
set(FIRST_RUN TRUE)

endif()


# print header
# --------------------------------------------------------------------
message(STATUS "**************************************************************************")
message(STATUS "Starting configuration of ${PROJECT_NAME} version ${${PROJECT_NAME}_VERSION}...")

# print CMake version at the start so we can use it to diagnose issues even if the configure fails
message(STATUS "CMake Version: ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
message(STATUS "For how to use this build system, please read this wiki:")
message(STATUS " http://ambermd.org/pmwiki/pmwiki.php/Main/CMake")
message(STATUS "For a list of important CMake variables, check here:")
message(STATUS " http://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Common-Options")
message(STATUS "**************************************************************************")

# fix search path so that libraries from the install tree are not used
# --------------------------------------------------------------------
list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")

# eliminate extraneous install messages
# --------------------------------------------------------------------
set(CMAKE_INSTALL_MESSAGE LAZY)

# configure module path
# --------------------------------------------------------------------

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}
"${CMAKE_CURRENT_LIST_DIR}/jedbrown"
"${CMAKE_CURRENT_LIST_DIR}/hanjianwei"
"${CMAKE_CURRENT_LIST_DIR}/rpavlik"
"${CMAKE_CURRENT_LIST_DIR}/patched-cmake-modules")

# prevent obliteration of the old build system's makefiles
# --------------------------------------------------------------------

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "You are building in the source directory. ${PROJECT_NAME} does not support this, since it would obliterate the Makefile build system.")
endif()

# includes
# --------------------------------------------------------------------

#Basic utilities. These files CANNOT use any sort of compile checks or system introspection because no languages are enabled yet
include(CMakeParseArguments)
include(Policies NO_POLICY_SCOPE)
include(Utils)
include(Shorthand)
include(ColorMessage)

# get install directories
include(InstallDirs)

#run manual compiler setter, if it is enabled
include(AmberCompilerConfig)

#control default build type.
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------

set(CMAKE_CONFIGURATION_TYPES "DEBUG;RELEASE" CACHE STRING "Allowed build types for Amber. This only controls debugging flags, set the OPTIMIZE variable to control compiler optimizations." FORCE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "Type of build. Controls debugging information and optimizations." FORCE)
endif()
1 change: 1 addition & 0 deletions cmake/AmberCompilerConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ if(FIRST_RUN)
set_compiler(Fortran gfortran)

endif()

elseif(${COMPILER} STREQUAL CLANG)
set_compiler(C clang)
set_compiler(CXX "clang++")
Expand Down
114 changes: 57 additions & 57 deletions cmake/AmberUpdater.cmake
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
# CMake script that calls the Amber update script. BAsed on the user's choice,
# it either checks for updates or installs them.
# Must be included after PythonConfig.cmake

# The updater requires python. Python builds don't have to be enabled, we just need to have the interpereter
if(NOT HAS_PYTHON)
return()
endif()

# we can skip updates if this is a developer version
option(CHECK_UPDATES "Use the updater script to check for updates to Amber and AmberTools. This can take a few seconds." ${AMBER_RELEASE})
option(APPLY_UPDATES "On the next run of CMake, apply all available updates for Amber and AmberTools. This option resets to false after it is used." FALSE)

if(CHECK_UPDATES OR APPLY_UPDATES)
if(APPLY_UPDATES)
set(UPDATER_ARG --check-updates)
colormsg(HIBLUE "Checking for updates...")
else()
set(UPDATER_ARG --update)
colormsg(HIBLUE "Running updater...")
endif()

# --------------------------------------------------------------------
# Run script

execute_process(COMMAND ${CMAKE_COMMAND} -E env AMBERHOME=${CMAKE_SOURCE_DIR} ${PYTHON_EXECUTABLE} update_amber ${UPDATER_ARG}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE UPDATE_COMMAND_RESULT
OUTPUT_VARIABLE UPDATE_COMMAND_OUTPUT)

# --------------------------------------------------------------------
# print the output of the updater with a prefix so the people know it's not coming from the build script

string(REPLACE "\n" ";" UPDATE_COMMAND_OUTPUT "${UPDATE_COMMAND_OUTPUT}")

foreach(LINE ${UPDATE_COMMAND_OUTPUT})
colormsg(">>> ${LINE}")
endforeach()

# --------------------------------------------------------------------
# Print conclusion message

if(APPLY_UPDATES)
if(${UPDATE_COMMAND_RESULT} EQUAL 0)
set(APPLY_UPDATES FALSE CACHE BOOL "" FORCE)
colormsg(HIBLUE "Updating succeeded! APPLY_UPDATES has been disabled.")
else()
colormsg(HIBLUE "Updating failed! If you need to supply additional arguments to the updater you can call the ${CMAKE_SOURCE_DIR}/update_amber script directly.")
endif()
else()
if(${UPDATE_COMMAND_RESULT} EQUAL 0)
colormsg(HIBLUE "Updater done. If you want to install updates, then set the APPLY_UPDATES variable to true.")
else()
colormsg(HIBLUE "Failed to check for updates! If you need to supply additional arguments to the updater you can call the ${CMAKE_SOURCE_DIR}/update_amber script directly.")
endif()
endif()
endif()
# CMake script that calls the Amber update script. BAsed on the user's choice,
# it either checks for updates or installs them.
# Must be included after PythonConfig.cmake

# The updater requires python. Python builds don't have to be enabled, we just need to have the interpereter
if(NOT HAS_PYTHON)
return()
endif()

# we can skip updates if this is a developer version
option(CHECK_UPDATES "Use the updater script to check for updates to Amber and AmberTools. This can take a few seconds." ${AMBER_RELEASE})
option(APPLY_UPDATES "On the next run of CMake, apply all available updates for Amber and AmberTools. This option resets to false after it is used." FALSE)

if(CHECK_UPDATES OR APPLY_UPDATES)
if(APPLY_UPDATES)
set(UPDATER_ARG --check-updates)
colormsg(HIBLUE "Checking for updates...")
else()
set(UPDATER_ARG --update)
colormsg(HIBLUE "Running updater...")
endif()

# --------------------------------------------------------------------
# Run script

execute_process(COMMAND ${CMAKE_COMMAND} -E env AMBERHOME=${CMAKE_SOURCE_DIR} ${PYTHON_EXECUTABLE} update_amber ${UPDATER_ARG}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE UPDATE_COMMAND_RESULT
OUTPUT_VARIABLE UPDATE_COMMAND_OUTPUT)

# --------------------------------------------------------------------
# print the output of the updater with a prefix so the people know it's not coming from the build script

string(REPLACE "\n" ";" UPDATE_COMMAND_OUTPUT "${UPDATE_COMMAND_OUTPUT}")

foreach(LINE ${UPDATE_COMMAND_OUTPUT})
colormsg(">>> ${LINE}")
endforeach()

# --------------------------------------------------------------------
# Print conclusion message

if(APPLY_UPDATES)
if(${UPDATE_COMMAND_RESULT} EQUAL 0)
set(APPLY_UPDATES FALSE CACHE BOOL "" FORCE)
colormsg(HIBLUE "Updating succeeded! APPLY_UPDATES has been disabled.")
else()
colormsg(HIBLUE "Updating failed! If you need to supply additional arguments to the updater you can call the ${CMAKE_SOURCE_DIR}/update_amber script directly.")
endif()
else()
if(${UPDATE_COMMAND_RESULT} EQUAL 0)
colormsg(HIBLUE "Updater done. If you want to install updates, then set the APPLY_UPDATES variable to true.")
else()
colormsg(HIBLUE "Failed to check for updates! If you need to supply additional arguments to the updater you can call the ${CMAKE_SOURCE_DIR}/update_amber script directly.")
endif()
endif()
endif()

Loading

0 comments on commit 43e5ad9

Please sign in to comment.