I've been using CMake on Cray's quite a bit lately and some of the cross compilation leaves a bit to be desired. No particular capability is really missing but the "foo" of getting things to build and work seems to be rather dispersed across various individuals and corners of the internet. I'd like to start pooling some of this together to be shipped with CMake.
For starters, I'd like to add a Platform file for the cross compilation target of ComputeNodeLinux. While it's not entirely different from running Linux natively, some assumptions from native host Linux build environments aren't valid and building for it explicitly needs search paths defined by the Cray environment modules. It's also distinctly different from the commonly used Catamount (which is very far removed from the currently used OS). Attached is a patch for a new Platform file that uses information from the loaded environment modules on the login nodes to define it's appropriate path and version info. I've been using this successfully on Garnet (an XE6) and Titan (an XK7). - Chuck
From 980483bbc2e0040273f9c7fa8df3c6bf61bba311 Mon Sep 17 00:00:00 2001 From: Chuck Atkins <[email protected]> Date: Thu, 14 Aug 2014 18:30:01 -0400 Subject: [PATCH] Add a platform file for cross-compiling to Cray Compute Node Linux This platform module is designed t be used with the Cray Programming Environment. Esentially this means that it will get it's various options and settings through variables loaded in "environment modules" used on modern Crays. --- Modules/Platform/ComputeNodeLinux.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Modules/Platform/ComputeNodeLinux.cmake diff --git a/Modules/Platform/ComputeNodeLinux.cmake b/Modules/Platform/ComputeNodeLinux.cmake new file mode 100644 index 0000000..58fbcd5 --- /dev/null +++ b/Modules/Platform/ComputeNodeLinux.cmake @@ -0,0 +1,33 @@ +# Compute Node Linux doesn't quite work the same as native Linux so all of this +# needs to be custom. We use the variables defined through Cray's environment +# modules to set up the right paths for things. + +if(NOT CMAKE_SYSTEM_VERSION) + if(NOT DEFINED ENV{XTOS_VERSION}) + message(FATAL_ERROR "The CMAKE_SYSTEM_VERSION variable is not set and the XTOS_VERSION environment variable is not defined. The ComputeNodeLinux CMake platform module either requires it to be manually set or the XTOS_VERSION environment variable to be available. This usually means that the necessary PrgEnv-* module is not loaded") + else() + set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}") + endif() +endif() + +# Compute Node Linux does support shared libraries, it's just seldom used +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") + +# Make sure we have the appropriate environment loaded +if(NOT DEFINED ENV{SYSROOT_DIR}) + message(FATAL_ERROR "The SYSROOT_DIR environment variable is not defined but the ComputeNodeLinux CMake platform module requires it. This usually means that the necessary PrgEnv-* module is not loaded") +endif() + +# Set up system search paths that CMake will use to look for libraries and +# include files. These will be the standard UNIX search paths but rooted +# in the SYSROOT of the computes nodes. +include(Platform/UnixPaths) +set(CMAKE_FIND_ROOT_PATH "$ENV{SYSROOT_DIR}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -- 1.9.3
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
