mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
CrayPrgEnv:
- add a new function __cmake_craype_linktype() that determines what
link mode the Cray compiler wrapper will use in a more sophisticated
way than just MATCHing for static/dynamic on the command line.
- add a new function __cmake_craype_setupenv() that does a
once-per-cmake-run setup that does the following:
1. does a basic check of the wrapper's configuration. Running
cmake and then changing module and/or linktype configuration
may cause build problems (since the data in the cmake cache
may no longer be correct after the change). We look for this
and warn the user about it.
2. uses the "module" provided PKG_CONFIG_PATH environment variable
to add additional prefixes to the system prefix path. This
function used to be done by CrayLinuxEnvironment using the
compiler implicit include/link paths but that is intended
only for cross-compiling on Cray front-end nodes. Since
CrayPrgEnv runs on both front-end and compute nodes, we
migrate this function here.
CrayLinuxEnvironment:
- No need to set variables like CMAKE_SHARED_LIBRARY_PREFIX to values
that have already been properly established by CMakeGenericSystem.cmake.
Remove redundant sets of CMAKE_SHARED_LIBRARY_PREFIX,
CMAKE_SHARED_LIBRARY_SUFFIX, CMAKE_STATIC_LIBRARY_PREFIX,
CMAKE_STATIC_LIBRARY_SUFFIX, CMAKE_FIND_LIBRARY_PREFIXES, and
CMAKE_DL_LIBS.
- No need to add $ENV{SYSROOT_DIR}/usr/include to CMAKE_SYSTEM_INCLUDE_PATH
when we already added $ENV{SYSROOT_DIR}/usr to CMAKE_SYSTEM_PREFIX_PATH.
- Remove __cray_list_intersect(), __list_clean_dupes(), and buggy
code that adds compiler implicit includes/libs to
CMAKE_SYSTEM_INCLUDE_PATH and CMAKE_SYSTEM_LIBRARY_PATH. This
function has migrated to CrayPrgEnv.cmake, as noted above.
See discussion in issue #17413 for additional details.
88 lines
3.1 KiB
CMake
88 lines
3.1 KiB
CMake
# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end
|
|
# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake
|
|
|
|
set(UNIX 1)
|
|
|
|
if(DEFINED ENV{CRAYOS_VERSION})
|
|
set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}")
|
|
elseif(DEFINED ENV{XTOS_VERSION})
|
|
set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}")
|
|
elseif(EXISTS /etc/opt/cray/release/cle-release)
|
|
file(STRINGS /etc/opt/cray/release/cle-release release REGEX "^RELEASE=.*")
|
|
string(REGEX REPLACE "^RELEASE=(.*)$" "\\1" CMAKE_SYSTEM_VERSION "${release}")
|
|
unset(release)
|
|
elseif(EXISTS /etc/opt/cray/release/clerelease)
|
|
file(READ /etc/opt/cray/release/clerelease CMAKE_SYSTEM_VERSION)
|
|
endif()
|
|
|
|
# Guard against multiple messages
|
|
if(NOT __CrayLinuxEnvironment_message)
|
|
set(__CrayLinuxEnvironment_message 1 CACHE INTERNAL "")
|
|
if(NOT CMAKE_SYSTEM_VERSION)
|
|
message(STATUS "CrayLinuxEnvironment: Unable to determine CLE version. This platform file should only be used from inside the Cray Linux Environment for targeting compute nodes (NIDs).")
|
|
else()
|
|
message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}")
|
|
endif()
|
|
endif()
|
|
|
|
# All cray systems are x86 CPUs and have been for quite some time
|
|
# Note: this may need to change in the future with 64-bit ARM
|
|
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
|
|
|
# Don't override shared lib support if it's already been set and possibly
|
|
# overridden elsewhere by the CrayPrgEnv module
|
|
if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
|
|
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
|
|
endif()
|
|
|
|
# The rest of this file is based on UnixPaths.cmake, adjusted for Cray
|
|
|
|
# add the install directory of the running cmake to the search directories
|
|
# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up
|
|
get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH)
|
|
get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH)
|
|
|
|
# Note: Some Cray's have the SYSROOT_DIR variable defined, pointing to a copy
|
|
# of the NIDs userland. If so, then we'll use it. Otherwise, just assume
|
|
# the userland from the login node is ok
|
|
|
|
# List common installation prefixes. These will be used for all
|
|
# search types.
|
|
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
|
# Standard
|
|
$ENV{SYSROOT_DIR}/usr/local $ENV{SYSROOT_DIR}/usr $ENV{SYSROOT_DIR}/
|
|
|
|
# CMake install location
|
|
"${__cmake_install_dir}"
|
|
)
|
|
if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
|
|
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
|
# Project install destination.
|
|
"${CMAKE_INSTALL_PREFIX}"
|
|
)
|
|
if(CMAKE_STAGING_PREFIX)
|
|
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
|
# User-supplied staging prefix.
|
|
"${CMAKE_STAGING_PREFIX}"
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
|
|
$ENV{SYSROOT_DIR}/usr/include/X11
|
|
)
|
|
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
|
|
$ENV{SYSROOT_DIR}/usr/local/lib64
|
|
$ENV{SYSROOT_DIR}/usr/lib64
|
|
$ENV{SYSROOT_DIR}/lib64
|
|
)
|
|
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
|
|
$ENV{SYSROOT_DIR}/usr/local/lib64
|
|
$ENV{SYSROOT_DIR}/usr/lib64
|
|
$ENV{SYSROOT_DIR}/lib64
|
|
)
|
|
|
|
# Enable use of lib64 search path variants by default.
|
|
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
|