-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from ohearnk/ambertools-2024-build-system-upd…
…ates Build system updates from AmberTools 2024 RC
- Loading branch information
Showing
55 changed files
with
6,113 additions
and
2,427 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
Oops, something went wrong.