Re-organize BlueGene toolchain files
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 18 Dec 2012 23:19:38 +0000 (00:19 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Sun, 13 Jan 2013 15:14:47 +0000 (16:14 +0100)
Rename /L and /P toolchain files. Add /Q files from
http://www.cmake.org/Bug/view.php?id=13512

Refs #1064

Change-Id: I7492737be936e59dce6217c41986316b88ec1e06

cmake/Platform/BlueGeneL-static-XL-C.cmake [moved from cmake/Toolchain-BlueGeneL-xlc.cmake with 100% similarity]
cmake/Platform/BlueGeneP-static-XL-C.cmake [moved from cmake/Toolchain-BlueGeneP.cmake with 100% similarity]
cmake/Platform/BlueGeneQ-base.cmake [new file with mode: 0644]
cmake/Platform/BlueGeneQ-static-XL-C.cmake [new file with mode: 0644]
cmake/Platform/BlueGeneQ-static-XL-CXX.cmake [new file with mode: 0644]
cmake/Platform/BlueGeneQ-static.cmake [new file with mode: 0644]

diff --git a/cmake/Platform/BlueGeneQ-base.cmake b/cmake/Platform/BlueGeneQ-base.cmake
new file mode 100644 (file)
index 0000000..dd17ab6
--- /dev/null
@@ -0,0 +1,120 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+# Copyright 2012 Julien Bigot <julien.bigot@cea.fr>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+#
+# BlueGeneQ base platform file.
+#
+# NOTE: Do not set your platform to "BlueGeneQ-base".  This file is included
+# by the real platform files.  Use one of these two platforms instead:
+#
+#     BlueGeneQ-dynamic  For dynamically linked builds
+#     BlueGeneQ-static   For statically linked builds
+#
+# This platform file tries its best to adhere to the behavior of the MPI
+# compiler wrappers included with the latest BG/Q drivers.
+#
+
+
+#
+# For BG/Q builds, we're cross compiling, but we don't want to re-root things
+# (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on
+# the shared filesystems, and this may lie outside the root.  Instead, we set the
+# system directories so that the various system BG/Q CNK library locations are
+# searched first.  This is not the clearest thing in the world, given IBM's driver
+# layout, but this should cover all the standard ones.
+#
+set(CMAKE_SYSTEM_LIBRARY_PATH
+  /bgsys/drivers/ppcfloor/comm/xl/lib                       # default comm layer (used by mpi compiler wrappers)
+  /bgsys/drivers/ppcfloor/spi/lib/                          # other low-level stuff
+  /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc.
+)
+
+#
+# This adds directories that find commands should specifically ignore for cross compiles.
+# Most of these directories are the includeand lib directories for the frontend on BG/Q systems.
+# Not ignoring these can cause things like FindX11 to find a frontend PPC version mistakenly.
+# We use this on BG instead of re-rooting because backend libraries are typically strewn about
+# the filesystem, and we can't re-root ALL backend libraries to a single place.
+#
+set(CMAKE_SYSTEM_IGNORE_PATH
+  /lib             /lib64             /include
+  /usr/lib         /usr/lib64         /usr/include
+  /usr/local/lib   /usr/local/lib64   /usr/local/include
+  /usr/X11/lib     /usr/X11/lib64     /usr/X11/include
+  /usr/lib/X11     /usr/lib64/X11     /usr/include/X11
+  /usr/X11R6/lib   /usr/X11R6/lib64   /usr/X11R6/include
+  /usr/X11R7/lib   /usr/X11R7/lib64   /usr/X11R7/include
+)
+
+#
+# Indicate that this is a unix-like system
+#
+set(UNIX 1)
+
+#
+# Library prefixes, suffixes, extra libs.
+#
+set(CMAKE_LINK_LIBRARY_SUFFIX "")
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib")     # lib
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")      # .a
+
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib")     # lib
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")     # .so
+set(CMAKE_EXECUTABLE_SUFFIX "")            # .exe
+set(CMAKE_DL_LIBS "dl")
+
+#
+# This macro needs to be called for dynamic library support.  Unfortunately on BG/Q,
+# We can't support both static and dynamic links in the same platform file.  The
+# dynamic link platform file needs to call this explicitly to set up dynamic linking.
+#
+macro(__BlueGeneQ_set_dynamic_flags compiler_id lang)
+  if (${compiler_id} STREQUAL XL)
+    # Flags for XL compilers if we explicitly detected XL
+    set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS           "-qpic")
+    set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS    "-qmkshrobj -qnostaticlink")
+    set(BG/Q_${lang}_DYNAMIC_EXE_FLAGS                "-qnostaticlink -qnostaticlink=libgcc")
+  else()
+    # Assume flags for GNU compilers (if the ID is GNU *or* anything else).
+    set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS           "-fPIC")
+    set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS    "-shared")
+    set(BG/Q_${lang}_DYNAMIC_EXE_FLAGS                "-dynamic")
+  endif()
+
+  # Both toolchains use the GNU linker on BG/Q, so these options are shared.
+  set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG      "-Wl,-rpath,")
+  set(CMAKE_SHARED_LIBRARY_RPATH_LINK_${lang}_FLAG   "-Wl,-rpath-link,")
+  set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG       "-Wl,-soname,")
+  set(CMAKE_EXE_EXPORTS_${lang}_FLAG                 "-Wl,--export-dynamic")
+  set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS        "")  # +s, flag for exe link to use shared lib
+  set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP  ":") # : or empty
+
+  set(BG/Q_${lang}_DEFAULT_EXE_FLAGS
+    "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+  set(CMAKE_${lang}_LINK_EXECUTABLE
+    "<CMAKE_${lang}_COMPILER> ${BG/Q_${lang}_DYNAMIC_EXE_FLAGS} ${BG/Q_${lang}_DEFAULT_EXE_FLAGS}")
+endmacro()
+
+#
+# This macro needs to be called for static builds.  Right now it just adds -Wl,-relax
+# to the link line.
+#
+macro(__BlueGeneQ_set_static_flags compiler_id lang)
+  set(BG/Q_${lang}_DEFAULT_EXE_FLAGS
+    "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+  set(CMAKE_${lang}_LINK_EXECUTABLE
+    "<CMAKE_${lang}_COMPILER> ${BG/Q_${lang}_DEFAULT_EXE_FLAGS}")
+endmacro()
diff --git a/cmake/Platform/BlueGeneQ-static-XL-C.cmake b/cmake/Platform/BlueGeneQ-static-XL-C.cmake
new file mode 100644 (file)
index 0000000..6de14a0
--- /dev/null
@@ -0,0 +1,26 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+# Copyright 2012 Julien Bigot <julien.bigot@cea.fr>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+include(BlueGeneQ-static)
+__BlueGeneQ_set_static_flags(XL C)
+
+set(CMAKE_SYSTEM_NAME BlueGeneQ-static CACHE STRING "Cross-compiling for BlueGene/Q" FORCE)
+# xl.ndebug is appropriate for production calculations. For debugging,
+# use xl to add back error checks and assertions
+set(CMAKE_C_COMPILER /bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpicc)
+set(CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" CACHE STRING "Compiler optimization flags")
+
+mark_as_advanced(CMAKE_XL_CreateExportList) # No idea what spams this
diff --git a/cmake/Platform/BlueGeneQ-static-XL-CXX.cmake b/cmake/Platform/BlueGeneQ-static-XL-CXX.cmake
new file mode 100644 (file)
index 0000000..d43ccb3
--- /dev/null
@@ -0,0 +1,26 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+# Copyright 2012 Julien Bigot <julien.bigot@cea.fr>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+include(BlueGeneQ-static)
+__BlueGeneQ_set_static_flags(XL CXX)
+
+set(CMAKE_SYSTEM_NAME BlueGeneQ-static CACHE STRING "Cross-compiling for BlueGene/Q" FORCE)
+# xl.ndebug is appropriate for production calculations. For debugging,
+# use xl to add back error checks and assertions
+set(CMAKE_CXX_COMPILER /bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpicxx)
+set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG" CACHE STRING "Compiler optimization flags")
+
+mark_as_advanced(CMAKE_XL_CreateExportList) # No idea what spams this
diff --git a/cmake/Platform/BlueGeneQ-static.cmake b/cmake/Platform/BlueGeneQ-static.cmake
new file mode 100644 (file)
index 0000000..f5bd5b4
--- /dev/null
@@ -0,0 +1,20 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+# Copyright 2012 Julien Bigot <julien.bigot@cea.fr>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+include(BlueGeneQ-base)
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")