Skip to content

Commit

Permalink
Merge branch 'jgfouca/cmake_minor_cleanups' into master (PR #5948)
Browse files Browse the repository at this point in the history
CMake: Some minor cleanups

Remove OS concept from cmake macros. We can maybe remove it entirely
from config_machines but that will be trickier.

Remove some unneeded or repeated things from CMakeLists.txt.

Remove FMS dependency support.

[BFB]

* jgfouca/cmake_minor_cleanups:
  Remove FMS support
  CMake: Some minor cleanups
  • Loading branch information
jgfouca committed Sep 26, 2023
2 parents 6174a70 + 29a6ea5 commit 13c5352
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 54 deletions.
4 changes: 1 addition & 3 deletions cime_config/machines/cmake_macros/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ set(MACROS_DIR ${CASEROOT}/cmake_macros)

set(UNIVERSAL_MACRO ${MACROS_DIR}/universal.cmake)
set(COMPILER_MACRO ${MACROS_DIR}/${COMPILER}.cmake)
set(OS_MACRO ${MACROS_DIR}/${OS}.cmake)
set(MACHINE_MACRO ${MACROS_DIR}/${MACH}.cmake)
set(COMPILER_OS_MACRO ${MACROS_DIR}/${COMPILER}_${OS}.cmake)
set(COMPILER_MACHINE_MACRO ${MACROS_DIR}/${COMPILER}_${MACH}.cmake)

if (CONVERT_TO_MAKE)
get_cmake_property(VARS_BEFORE_BUILD_INTERNAL_IGNORE VARIABLES)
endif()

# Include order defines precedence
foreach (MACRO_FILE ${UNIVERSAL_MACRO} ${COMPILER_MACRO} ${OS_MACRO} ${MACHINE_MACRO} ${COMPILER_OS_MACRO} ${COMPILER_MACHINE_MACRO})
foreach (MACRO_FILE ${UNIVERSAL_MACRO} ${COMPILER_MACRO} ${MACHINE_MACRO} ${COMPILER_MACHINE_MACRO})
if (EXISTS ${MACRO_FILE})
include(${MACRO_FILE})
else()
Expand Down
5 changes: 0 additions & 5 deletions cime_config/machines/cmake_macros/gnu_linux-generic.cmake

This file was deleted.

3 changes: 0 additions & 3 deletions cime_config/machines/cmake_macros/gnu_mac.cmake

This file was deleted.

24 changes: 0 additions & 24 deletions cime_config/machines/cmake_macros/intel_Darwin.cmake

This file was deleted.

17 changes: 4 additions & 13 deletions components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,17 @@
#
#===============================================================================

# bmpersch
# - Read modern cmake docs, use modern features
# - Use find_package for trilinos and other TPLS

cmake_minimum_required(VERSION 3.9)
cmake_policy(SET CMP0057 NEW)
set(CMAKE_CXX_STANDARD 17)

# Store caseroot in the cache, so that, if cmake re-runs,
# we can still access ${CASEROOT}/Macros.cmake
set (CASEROOT "" CACHE STRING "The case root directory.")

# Turn on wrapper
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "python3 ${CASEROOT}/Tools/e3sm_compile_wrap.py ")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "python3 ${CASEROOT}/Tools/e3sm_compile_wrap.py ")

# We need to set the compilers *before* calling `project`.
# The only way to get the compiler name, is to load Macros.cmake
# However, we do *not* want to pollut the environment with other
# However, we do *not* want to pollute the environment with other
# vars coming from Macros.cmake, so we encapsulate its inclusion
# in a new scope.
# Additionally, we also set CMAKE_BUILD_TYPE=DEBUG if Macros.cmake
Expand Down Expand Up @@ -127,16 +119,14 @@ list(APPEND CMAKE_MODULE_PATH ${CIMEROOT}/CIME/non_py/src/CMake)

set(CMAKE_VERBOSE_MAKEFILE TRUE)

if(USE_CUDA)
enable_language(CUDA)
endif()

# Scream manages its own flags
build_eamxx()

# We do want CMAKE_BUILD_TYPE to be set, but we do NOT want CMake to
# decide what optimization flags to append, based on build type,
# for components who rely on CIME for build flags, so make all the following empty.
# JGF: I think we can remove this once proper CMake names are being used in the
# macros.
set (CMAKE_C_FLAGS_RELEASE "")
set (CMAKE_CXX_FLAGS_RELEASE "")
set (CMAKE_Fortran_FLAGS_RELEASE "")
Expand Down Expand Up @@ -172,4 +162,5 @@ foreach(COMP_NAME IN LISTS COMP_NAMES)
math(EXPR IDX "${IDX} + 1")
endforeach()

# Build the E3SM coupler and exe
add_subdirectory(cmake/cpl)
3 changes: 0 additions & 3 deletions components/cmake/common_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ include(${CASEROOT}/Macros.cmake)
set(CPPDEFS "${CPPDEFS} ${USER_CPPDEFS} -D${OS}")

# SLIBS comes from Macros, so this append must come after Macros are included
if (USE_FMS)
set(SLIBS "${SLIBS} -lfms")
endif()

if (DEBUG)
# e3sm still has components that cannot build with -DDEBUG
Expand Down
3 changes: 0 additions & 3 deletions driver-mct/cime_config/buildexe
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ def _main_func():
gmake_opts = get_standard_makefile_args(case)
blddir = os.path.join(case.get_value("EXEROOT"),"cpl","obj")

if ocn_model == 'mom' or atm_model == "ufsatm":
gmake_opts += "USE_FMS=TRUE"

expect((num_esp is None) or (int(num_esp) == 1), "ESP component restricted to one instance")

with open(os.path.join(blddir,'Filepath'), 'w') as out:
Expand Down

0 comments on commit 13c5352

Please sign in to comment.