BlueGeneP-base.cmake 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #=============================================================================
  2. # Copyright 2010 Kitware, Inc.
  3. # Copyright 2010 Todd Gamblin <[email protected]>
  4. #
  5. # Distributed under the OSI-approved BSD License (the "License");
  6. # see accompanying file Copyright.txt for details.
  7. #
  8. # This software is distributed WITHOUT ANY WARRANTY; without even the
  9. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. # See the License for more information.
  11. #=============================================================================
  12. # (To distribute this file outside of CMake, substitute the full
  13. # License text for the above reference.)
  14. #
  15. # BlueGeneP base platform file.
  16. #
  17. # NOTE: Do not set your platform to "BlueGeneP-base". This file is included
  18. # by the real platform files. Use one of these two platforms instead:
  19. #
  20. # BlueGeneP-dynamic For dynamically linked builds
  21. # BlueGeneP-static For statically linked builds
  22. #
  23. # This platform file tries its best to adhere to the behavior of the MPI
  24. # compiler wrappers included with the latest BG/P drivers.
  25. #
  26. #
  27. # For BGP builds, we're cross compiling, but we don't want to re-root things
  28. # (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on
  29. # the shared filesystems, and this may lie outside the root. Instead, we set the
  30. # system directories so that the various system BGP CNK library locations are
  31. # searched first. This is not the clearest thing in the world, given IBM's driver
  32. # layout, but this should cover all the standard ones.
  33. #
  34. set(CMAKE_SYSTEM_LIBRARY_PATH
  35. /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers)
  36. /bgsys/drivers/ppcfloor/comm/sys/lib # DCMF, other lower-level comm libraries
  37. /bgsys/drivers/ppcfloor/runtime/SPI # other low-level stuff
  38. /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory
  39. /bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc.
  40. )
  41. #
  42. # This adds directories that find commands should specifically ignore for cross compiles.
  43. # Most of these directories are the includeand lib directories for the frontend on BG/P systems.
  44. # Not ignoring these can cause things like FindX11 to find a frontend PPC version mistakenly.
  45. # We use this on BG instead of re-rooting because backend libraries are typically strewn about
  46. # the filesystem, and we can't re-root ALL backend libraries to a single place.
  47. #
  48. set(CMAKE_SYSTEM_IGNORE_PATH
  49. /lib /lib64 /include
  50. /usr/lib /usr/lib64 /usr/include
  51. /usr/local/lib /usr/local/lib64 /usr/local/include
  52. /usr/X11/lib /usr/X11/lib64 /usr/X11/include
  53. /usr/lib/X11 /usr/lib64/X11 /usr/include/X11
  54. /usr/X11R6/lib /usr/X11R6/lib64 /usr/X11R6/include
  55. /usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include
  56. )
  57. #
  58. # Indicate that this is a unix-like system
  59. #
  60. set(UNIX 1)
  61. #
  62. # Library prefixes, suffixes, extra libs.
  63. #
  64. set(CMAKE_LINK_LIBRARY_SUFFIX "")
  65. set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # lib
  66. set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") # .a
  67. set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
  68. set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
  69. set(CMAKE_EXECUTABLE_SUFFIX "") # .exe
  70. set(CMAKE_DL_LIBS "dl")
  71. #
  72. # This macro needs to be called for dynamic library support. Unfortunately on BGP,
  73. # We can't support both static and dynamic links in the same platform file. The
  74. # dynamic link platform file needs to call this explicitly to set up dynamic linking.
  75. #
  76. macro(__BlueGeneP_set_dynamic_flags compiler_id lang)
  77. if (${compiler_id} STREQUAL XL)
  78. # Flags for XL compilers if we explicitly detected XL
  79. set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic") # -pic
  80. set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink") # -shared
  81. set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") # -rpath
  82. set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc")
  83. else()
  84. # Assume flags for GNU compilers (if the ID is GNU *or* anything else).
  85. set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") # -pic
  86. set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") # -shared
  87. set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") # -rpath
  88. set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-dynamic")
  89. endif()
  90. set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "") # +s, flag for exe link to use shared lib
  91. set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") # : or empty
  92. set(BGP_${lang}_DEFAULT_EXE_FLAGS
  93. "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
  94. set(CMAKE_${lang}_LINK_EXECUTABLE
  95. "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DYNAMIC_EXE_FLAGS} ${BGP_${lang}_DEFAULT_EXE_FLAGS}")
  96. endmacro()
  97. #
  98. # This macro needs to be called for static builds. Right now it just adds -Wl,-relax
  99. # to the link line.
  100. #
  101. macro(__BlueGeneP_set_static_flags compiler_id lang)
  102. set(BGP_${lang}_DEFAULT_EXE_FLAGS
  103. "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
  104. set(CMAKE_${lang}_LINK_EXECUTABLE
  105. "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DEFAULT_EXE_FLAGS}")
  106. endmacro()