diff options
Diffstat (limited to 'Modules/Platform')
202 files changed, 4349 insertions, 0 deletions
diff --git a/Modules/Platform/AIX-GNU-ASM.cmake b/Modules/Platform/AIX-GNU-ASM.cmake new file mode 100644 index 0000000..c256df6 --- /dev/null +++ b/Modules/Platform/AIX-GNU-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(ASM) diff --git a/Modules/Platform/AIX-GNU-C.cmake b/Modules/Platform/AIX-GNU-C.cmake new file mode 100644 index 0000000..f49d528 --- /dev/null +++ b/Modules/Platform/AIX-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(C) diff --git a/Modules/Platform/AIX-GNU-CXX.cmake b/Modules/Platform/AIX-GNU-CXX.cmake new file mode 100644 index 0000000..ec8e83f --- /dev/null +++ b/Modules/Platform/AIX-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(CXX) diff --git a/Modules/Platform/AIX-GNU-Fortran.cmake b/Modules/Platform/AIX-GNU-Fortran.cmake new file mode 100644 index 0000000..07772a7 --- /dev/null +++ b/Modules/Platform/AIX-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(Fortran) diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake new file mode 100644 index 0000000..e5d9434 --- /dev/null +++ b/Modules/Platform/AIX-GNU.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__AIX_COMPILER_GNU) + return() +endif() +set(__AIX_COMPILER_GNU 1) + +macro(__aix_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-bnoipath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1) +endmacro() diff --git a/Modules/Platform/AIX-VisualAge-C.cmake b/Modules/Platform/AIX-VisualAge-C.cmake new file mode 100644 index 0000000..67b3171 --- /dev/null +++ b/Modules/Platform/AIX-VisualAge-C.cmake @@ -0,0 +1 @@ +include(Platform/AIX-XL-C) diff --git a/Modules/Platform/AIX-VisualAge-CXX.cmake b/Modules/Platform/AIX-VisualAge-CXX.cmake new file mode 100644 index 0000000..7894d24 --- /dev/null +++ b/Modules/Platform/AIX-VisualAge-CXX.cmake @@ -0,0 +1 @@ +include(Platform/AIX-XL-CXX) diff --git a/Modules/Platform/AIX-VisualAge-Fortran.cmake b/Modules/Platform/AIX-VisualAge-Fortran.cmake new file mode 100644 index 0000000..19e59d6 --- /dev/null +++ b/Modules/Platform/AIX-VisualAge-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/AIX-XL-Fortran) diff --git a/Modules/Platform/AIX-XL-ASM.cmake b/Modules/Platform/AIX-XL-ASM.cmake new file mode 100644 index 0000000..ea0944b --- /dev/null +++ b/Modules/Platform/AIX-XL-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(ASM) diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake new file mode 100644 index 0000000..5e437fa --- /dev/null +++ b/Modules/Platform/AIX-XL-C.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(C) diff --git a/Modules/Platform/AIX-XL-CXX.cmake b/Modules/Platform/AIX-XL-CXX.cmake new file mode 100644 index 0000000..ef38a5f --- /dev/null +++ b/Modules/Platform/AIX-XL-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(CXX) diff --git a/Modules/Platform/AIX-XL-Fortran.cmake b/Modules/Platform/AIX-XL-Fortran.cmake new file mode 100644 index 0000000..6d4f655 --- /dev/null +++ b/Modules/Platform/AIX-XL-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(Fortran) diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake new file mode 100644 index 0000000..abf3855 --- /dev/null +++ b/Modules/Platform/AIX-XL.cmake @@ -0,0 +1,28 @@ + +#============================================================================= +# Copyright 2002-2011 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__AIX_COMPILER_XL) + return() +endif() +set(__AIX_COMPILER_XL 1) + +macro(__aix_compiler_xl lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # -shared + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") + set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") +endmacro() diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake new file mode 100644 index 0000000..58c6483 --- /dev/null +++ b/Modules/Platform/AIX.cmake @@ -0,0 +1,29 @@ +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +set(CMAKE_DL_LIBS "-lld") + +# RPATH support on AIX is called libpath. By default the runtime +# libpath is paths specified by -L followed by /usr/lib and /lib. In +# order to prevent the -L paths from being used we must force use of +# -Wl,-blibpath:/usr/lib:/lib whether RPATH support is on or not. +# When our own RPATH is to be added it may be inserted before the +# "always" paths. +set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib) + +# Files named "libfoo.a" may actually be shared libraries. +set_property(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1) + +# since .a can be a static or shared library on AIX, we can not do this. +# at some point if we wanted it, we would have to figure out if a .a is +# static or shared, then we could add this back: + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +#foreach(type SHARED_LIBRARY SHARED_MODULE EXE) +# set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-bstatic") +# set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-bdynamic") +#endforeach() + +include(Platform/UnixPaths) diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake new file mode 100644 index 0000000..1bdad04 --- /dev/null +++ b/Modules/Platform/Android.cmake @@ -0,0 +1,15 @@ +include(Platform/Linux) + +# Android has soname, but binary names must end in ".so" so we cannot append +# a version number. Also we cannot portably represent symlinks on the host. +set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1) + +# Android reportedly ignores RPATH, and we cannot predict the install +# location anyway. +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") + +# Nsight Tegra Visual Studio Edition takes care of +# prefixing library names with '-l'. +if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") + set(CMAKE_LINK_LIBRARY_FLAG "") +endif() diff --git a/Modules/Platform/BSDOS.cmake b/Modules/Platform/BSDOS.cmake new file mode 100644 index 0000000..47852f8 --- /dev/null +++ b/Modules/Platform/BSDOS.cmake @@ -0,0 +1,2 @@ +include(Platform/UnixPaths) + diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake new file mode 100644 index 0000000..ef811bd --- /dev/null +++ b/Modules/Platform/BeOS.cmake @@ -0,0 +1,12 @@ +set(BEOS 1) + +set(CMAKE_DL_LIBS root be) +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") + +include(Platform/UnixPaths) diff --git a/Modules/Platform/BlueGeneL.cmake b/Modules/Platform/BlueGeneL.cmake new file mode 100644 index 0000000..082e46c --- /dev/null +++ b/Modules/Platform/BlueGeneL.cmake @@ -0,0 +1,40 @@ +#the compute nodes on BlueGene/L don't support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty + +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe +set(CMAKE_DL_LIBS "" ) + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + + +include(Platform/UnixPaths) + +if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> -Wl,-relax <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lgcc,-lc -lnss_files -lnss_dns -lresolv") +else() + # when using IBM xlc we probably don't want to link to -lgcc + set(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> -Wl,-relax <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lc -lnss_files -lnss_dns -lresolv") +endif() + +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> -Wl,-relax <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lgcc,-lc -lnss_files -lnss_dns -lresolv") +else() + # when using the IBM xlC we probably don't want to link to -lgcc + set(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> -Wl,-relax <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lc -lnss_files -lnss_dns -lresolv") +endif() diff --git a/Modules/Platform/BlueGeneP-base.cmake b/Modules/Platform/BlueGeneP-base.cmake new file mode 100644 index 0000000..c0241e1 --- /dev/null +++ b/Modules/Platform/BlueGeneP-base.cmake @@ -0,0 +1,125 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +# +# BlueGeneP base platform file. +# +# NOTE: Do not set your platform to "BlueGeneP-base". This file is included +# by the real platform files. Use one of these two platforms instead: +# +# BlueGeneP-dynamic For dynamically linked builds +# BlueGeneP-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/P drivers. +# + + +# +# For BGP 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 BGP 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/default/lib # default comm layer (used by mpi compiler wrappers) + /bgsys/drivers/ppcfloor/comm/sys/lib # DCMF, other lower-level comm libraries + /bgsys/drivers/ppcfloor/runtime/SPI # other low-level stuff + /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory + /bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-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/P 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 BGP, +# 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(__BlueGeneP_set_dynamic_flags compiler_id lang) + if (${compiler_id} STREQUAL XL) + # Flags for XL compilers if we explicitly detected XL + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-qpie") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink") + set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc") + else() + # Assume flags for GNU compilers (if the ID is GNU *or* anything else). + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-dynamic") + endif() + + # Both toolchains use the GNU linker on BG/P, 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(BGP_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DYNAMIC_EXE_FLAGS} ${BGP_${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(__BlueGeneP_set_static_flags compiler_id lang) + set(BGP_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake new file mode 100644 index 0000000..bd4696b --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_dynamic_flags(GNU C) diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake new file mode 100644 index 0000000..9c995dc --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_dynamic_flags(GNU CXX) diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake new file mode 100644 index 0000000..19d6be8 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_dynamic_flags(GNU Fortran) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake new file mode 100644 index 0000000..2dbbbc0 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_dynamic_flags(XL C) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake new file mode 100644 index 0000000..2bc5127 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_dynamic_flags(XL CXX) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake new file mode 100644 index 0000000..59da63d --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_dynamic_flags(XL Fortran) diff --git a/Modules/Platform/BlueGeneP-dynamic.cmake b/Modules/Platform/BlueGeneP-dynamic.cmake new file mode 100644 index 0000000..8f96f2f --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic.cmake @@ -0,0 +1,19 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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(Platform/BlueGeneP-base) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") diff --git a/Modules/Platform/BlueGeneP-static-GNU-C.cmake b/Modules/Platform/BlueGeneP-static-GNU-C.cmake new file mode 100644 index 0000000..412a7a3 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_static_flags(GNU C) diff --git a/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake new file mode 100644 index 0000000..418f0d8 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_static_flags(GNU CXX) diff --git a/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake new file mode 100644 index 0000000..119195b --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_static_flags(GNU Fortran) diff --git a/Modules/Platform/BlueGeneP-static-XL-C.cmake b/Modules/Platform/BlueGeneP-static-XL-C.cmake new file mode 100644 index 0000000..1f20959 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_static_flags(XL C) diff --git a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake new file mode 100644 index 0000000..f027a53 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_static_flags(XL CXX) diff --git a/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake new file mode 100644 index 0000000..778d4bd --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +__BlueGeneP_set_static_flags(XL Fortran) diff --git a/Modules/Platform/BlueGeneP-static.cmake b/Modules/Platform/BlueGeneP-static.cmake new file mode 100644 index 0000000..c4f5f21 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static.cmake @@ -0,0 +1,19 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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(Platform/BlueGeneP-base) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake new file mode 100644 index 0000000..9372166 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -0,0 +1,177 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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.) + +# +# Blue Gene/Q 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 executables +# BlueGeneQ-static For statically linked executables +# +# The platform you choose doesn't affect whether or not you can build +# shared or static libraries -- it ONLY changs whether exeuatbles are linked +# statically or dynamically. +# +# This platform file tries its best to adhere to the behavior of the MPI +# compiler wrappers included with the latest BG/P drivers. +# + +# +# 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/P 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") + +# +# BG/Q supports dynamic libraries regardless of whether we're building +# static or dynamic *executables*. +# +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") + +# +# For BGQ 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 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. +# +macro(__BlueGeneQ_common_setup compiler_id lang) + # Need to use the version of the comm lib compiled with the right compiler. + set(__BlueGeneQ_commlib_dir gcc) + if (${compiler_id} STREQUAL XL) + set(__BlueGeneQ_commlib_dir xl) + endif() + + set(CMAKE_SYSTEM_LIBRARY_PATH + /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers) + /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/lib # PAMI, other lower-level comm libraries + /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory + /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc. + ) + + # Add all the system include paths. + set(CMAKE_SYSTEM_INCLUDE_PATH + /bgsys/drivers/ppcfloor/comm/sys/include + /bgsys/drivers/ppcfloor/ + /bgsys/drivers/ppcfloor/spi/include + /bgsys/drivers/ppcfloor/spi/include/kernel/cnk + /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/include + ) + + # Ensure that the system directories are included with the regular compilers, as users will expect this + # to do the same thing as the MPI compilers, which add these flags. + set(BGQ_SYSTEM_INCLUDES "") + foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH}) + set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}") + endforeach() + set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") + set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") + + # + # Code below does setup for shared libraries. That this is done + # regardless of whether the platform is static or dynamic -- you can make + # shared libraries even if you intend to make static executables, you just + # can't make a dynamic executable if you use the static platform file. + # + 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") + 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") + endif() + + # Both toolchains use the GNU linker on BG/P, 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 + +endmacro() + +# +# This macro needs to be called for dynamic library support. Unfortunately on BG, +# 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_setup_dynamic compiler_id lang) + __BlueGeneQ_common_setup(${compiler_id} ${lang}) + + if (${compiler_id} STREQUAL XL) + set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc") + else() + set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-dynamic") + endif() + + # For dynamic executables, need to provide special BG/Q arguments. + set(BGQ_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGQ_${lang}_DYNAMIC_EXE_FLAGS} ${BGQ_${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_setup_static compiler_id lang) + __BlueGeneQ_common_setup(${compiler_id} ${lang}) + + # For static executables, use default link settings. + set(BGQ_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGQ_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake new file mode 100644 index 0000000..102ac80 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_dynamic(GNU C) diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake new file mode 100644 index 0000000..cd8ab24 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_dynamic(GNU CXX) diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake new file mode 100644 index 0000000..c029f0f --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_dynamic(GNU Fortran) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake new file mode 100644 index 0000000..0077313 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_dynamic(XL C) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake new file mode 100644 index 0000000..0f43cb2 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_dynamic(XL CXX) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake new file mode 100644 index 0000000..12e446e --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_dynamic(XL Fortran) diff --git a/Modules/Platform/BlueGeneQ-dynamic.cmake b/Modules/Platform/BlueGeneQ-dynamic.cmake new file mode 100644 index 0000000..0283900 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic.cmake @@ -0,0 +1,17 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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(Platform/BlueGeneQ-base) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") diff --git a/Modules/Platform/BlueGeneQ-static-GNU-C.cmake b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake new file mode 100644 index 0000000..70c84ba --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_static(GNU C) diff --git a/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake new file mode 100644 index 0000000..8f991de --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_static(GNU CXX) diff --git a/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake new file mode 100644 index 0000000..24dd9e7 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_static(GNU Fortran) diff --git a/Modules/Platform/BlueGeneQ-static-XL-C.cmake b/Modules/Platform/BlueGeneQ-static-XL-C.cmake new file mode 100644 index 0000000..5555a68 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_static(XL C) diff --git a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake new file mode 100644 index 0000000..07c3c3d --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_static(XL CXX) diff --git a/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake new file mode 100644 index 0000000..6f99933 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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_setup_static(XL Fortran) diff --git a/Modules/Platform/BlueGeneQ-static.cmake b/Modules/Platform/BlueGeneQ-static.cmake new file mode 100644 index 0000000..30b530d --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static.cmake @@ -0,0 +1,17 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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(Platform/BlueGeneQ-base) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") diff --git a/Modules/Platform/CYGWIN-CXX.cmake b/Modules/Platform/CYGWIN-CXX.cmake new file mode 100644 index 0000000..bf37f79 --- /dev/null +++ b/Modules/Platform/CYGWIN-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/CYGWIN-GNU-C.cmake b/Modules/Platform/CYGWIN-GNU-C.cmake new file mode 100644 index 0000000..9eb0ecf --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(C) diff --git a/Modules/Platform/CYGWIN-GNU-CXX.cmake b/Modules/Platform/CYGWIN-GNU-CXX.cmake new file mode 100644 index 0000000..2603dcd --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(CXX) diff --git a/Modules/Platform/CYGWIN-GNU-Fortran.cmake b/Modules/Platform/CYGWIN-GNU-Fortran.cmake new file mode 100644 index 0000000..d3b49b6 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(Fortran) diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake new file mode 100644 index 0000000..1a46c10 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -0,0 +1,61 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__CYGWIN_COMPILER_GNU) + return() +endif() +set(__CYGWIN_COMPILER_GNU 1) + +# TODO: Is -Wl,--enable-auto-import now always default? +set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import") +set(CMAKE_CREATE_WIN32_EXE "-mwindows") + +set(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") +set(CMAKE_GENERATOR_RC windres) +macro(__cygwin_compiler_gnu lang) + # Binary link rules. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + + # No -fPIC on cygwin + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") + + # Initialize C link type selection flags. These flags are used when + # building a shared library, shared module, or executable that links + # to other libraries to select whether to use the static or shared + # versions of the libraries. + foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + endforeach() + + set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols") + # TODO: Is -Wl,--enable-auto-import now always default? + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") + + if(NOT CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_INIT windres) + endif() + + enable_language(RC) +endmacro() diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake new file mode 100644 index 0000000..7d787dd --- /dev/null +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -0,0 +1 @@ +set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>") diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake new file mode 100644 index 0000000..22816e7 --- /dev/null +++ b/Modules/Platform/CYGWIN.cmake @@ -0,0 +1,64 @@ +if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214") + set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1) +endif() +if(NOT DEFINED WIN32) + set(WIN32 0) + if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32 + AND DEFINED ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + set(CMAKE_LEGACY_CYGWIN_WIN32 $ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + endif() + if(CMAKE_LEGACY_CYGWIN_WIN32) + message(STATUS "Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32") + set(WIN32 1) + elseif("x${CMAKE_LEGACY_CYGWIN_WIN32}" STREQUAL "x") + message(WARNING "CMake no longer defines WIN32 on Cygwin!" + "\n" + "(1) If you are just trying to build this project, ignore this warning " + "or quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or " + "in the CMake cache. " + "If later configuration or build errors occur then this project may " + "have been written under the assumption that Cygwin is WIN32. " + "In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead." + "\n" + "(2) If you are developing this project, add the line\n" + " set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n" + "at the top of your top-level CMakeLists.txt file or set the minimum " + "required version of CMake to 2.8.4 or higher. " + "Then teach your project to build on Cygwin without WIN32.") + endif() + elseif(DEFINED CMAKE_LEGACY_CYGWIN_WIN32) + message(AUTHOR_WARNING "CMAKE_LEGACY_CYGWIN_WIN32 ignored because\n" + " cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n" + "is at least 2.8.4.") + endif() +endif() +if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + # Pass WIN32 legacy setting to scripts. + if(WIN32) + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 1) + else() + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 0) + endif() + unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32) +endif() + +set(CYGWIN 1) + +set(CMAKE_SHARED_LIBRARY_PREFIX "cyg") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") +set(CMAKE_SHARED_MODULE_PREFIX "cyg") +set(CMAKE_SHARED_MODULE_SUFFIX ".dll") +set(CMAKE_IMPORT_LIBRARY_PREFIX "lib") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") +set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +# Modules have a different default prefix that shared libs. +set(CMAKE_MODULE_EXISTS 1) + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") + +# Shared libraries on cygwin can be named with their version number. +set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) + +include(Platform/UnixPaths) diff --git a/Modules/Platform/Catamount.cmake b/Modules/Platform/Catamount.cmake new file mode 100644 index 0000000..7e9e021 --- /dev/null +++ b/Modules/Platform/Catamount.cmake @@ -0,0 +1,26 @@ +#Catamount, which runs on the compute nodes of Cray machines, e.g. RedStorm, doesn't support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty + +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe +set(CMAKE_DL_LIBS "" ) + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +include(Platform/UnixPaths) + +set(CMAKE_CXX_LINK_SHARED_LIBRARY) +set(CMAKE_CXX_LINK_MODULE_LIBRARY) +set(CMAKE_C_LINK_SHARED_LIBRARY) +set(CMAKE_C_LINK_MODULE_LIBRARY) diff --git a/Modules/Platform/Darwin-Absoft-Fortran.cmake b/Modules/Platform/Darwin-Absoft-Fortran.cmake new file mode 100644 index 0000000..dc62b0d --- /dev/null +++ b/Modules/Platform/Darwin-Absoft-Fortran.cmake @@ -0,0 +1,18 @@ +#============================================================================= +# Copyright 2011 Kitware, Inc. +# Copyright 2013 OpenGamma Ltd. <graham@opengamma.com> +# +# 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.) + +set(CMAKE_Fortran_VERBOSE_FLAG "-X -v") # Runs gcc under the hood. + +set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ") diff --git a/Modules/Platform/Darwin-AppleClang-C.cmake b/Modules/Platform/Darwin-AppleClang-C.cmake new file mode 100644 index 0000000..98971bb --- /dev/null +++ b/Modules/Platform/Darwin-AppleClang-C.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-Clang-C) diff --git a/Modules/Platform/Darwin-AppleClang-CXX.cmake b/Modules/Platform/Darwin-AppleClang-CXX.cmake new file mode 100644 index 0000000..4e9e7c1 --- /dev/null +++ b/Modules/Platform/Darwin-AppleClang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-Clang-CXX) diff --git a/Modules/Platform/Darwin-CXX.cmake b/Modules/Platform/Darwin-CXX.cmake new file mode 100644 index 0000000..bf37f79 --- /dev/null +++ b/Modules/Platform/Darwin-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/Darwin-Clang-C.cmake b/Modules/Platform/Darwin-Clang-C.cmake new file mode 100644 index 0000000..0a1502e --- /dev/null +++ b/Modules/Platform/Darwin-Clang-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Clang) +__darwin_compiler_clang(C) diff --git a/Modules/Platform/Darwin-Clang-CXX.cmake b/Modules/Platform/Darwin-Clang-CXX.cmake new file mode 100644 index 0000000..f8e8d88 --- /dev/null +++ b/Modules/Platform/Darwin-Clang-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Clang) +__darwin_compiler_clang(CXX) diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake new file mode 100644 index 0000000..4cded47 --- /dev/null +++ b/Modules/Platform/Darwin-Clang.cmake @@ -0,0 +1,30 @@ + +#============================================================================= +# Copyright 2002-2012 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__DARWIN_COMPILER_CLANG) + return() +endif() +set(__DARWIN_COMPILER_CLANG 1) + +macro(__darwin_compiler_clang lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1) + set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") + endif() +endmacro() diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake new file mode 100644 index 0000000..efdfd00 --- /dev/null +++ b/Modules/Platform/Darwin-GNU-C.cmake @@ -0,0 +1,4 @@ +include(Platform/Darwin-GNU) +__darwin_compiler_gnu(C) +cmake_gnu_set_sysroot_flag(C) +cmake_gnu_set_osx_deployment_target_flag(C) diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake new file mode 100644 index 0000000..e3c2ea7 --- /dev/null +++ b/Modules/Platform/Darwin-GNU-CXX.cmake @@ -0,0 +1,4 @@ +include(Platform/Darwin-GNU) +__darwin_compiler_gnu(CXX) +cmake_gnu_set_sysroot_flag(CXX) +cmake_gnu_set_osx_deployment_target_flag(CXX) diff --git a/Modules/Platform/Darwin-GNU-Fortran.cmake b/Modules/Platform/Darwin-GNU-Fortran.cmake new file mode 100644 index 0000000..6724f9b --- /dev/null +++ b/Modules/Platform/Darwin-GNU-Fortran.cmake @@ -0,0 +1,21 @@ +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2013 OpenGamma Ltd. <graham@opengamma.com> +# +# 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(Platform/Darwin-GNU) +__darwin_compiler_gnu(Fortran) +cmake_gnu_set_sysroot_flag(Fortran) +cmake_gnu_set_osx_deployment_target_flag(Fortran) + +set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ") diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake new file mode 100644 index 0000000..87d1d23 --- /dev/null +++ b/Modules/Platform/Darwin-GNU.cmake @@ -0,0 +1,70 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__DARWIN_COMPILER_GNU) + return() +endif() +set(__DARWIN_COMPILER_GNU 1) + +macro(__darwin_compiler_gnu lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output + # GNU does not have -shared on OS X + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.3) + set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") + endif() +endmacro() + +macro(cmake_gnu_set_sysroot_flag lang) + if(NOT DEFINED CMAKE_${lang}_SYSROOT_FLAG) + set(_doc "${lang} compiler has -isysroot") + message(STATUS "Checking whether ${_doc}") + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help" + OUTPUT_VARIABLE _gcc_help + ERROR_VARIABLE _gcc_help + ) + if("${_gcc_help}" MATCHES "isysroot") + message(STATUS "Checking whether ${_doc} - yes") + set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") + else() + message(STATUS "Checking whether ${_doc} - no") + set(CMAKE_${lang}_SYSROOT_FLAG "") + endif() + set(CMAKE_${lang}_SYSROOT_FLAG_CODE "set(CMAKE_${lang}_SYSROOT_FLAG \"${CMAKE_${lang}_SYSROOT_FLAG}\")") + endif() +endmacro() + +macro(cmake_gnu_set_osx_deployment_target_flag lang) + if(NOT DEFINED CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG) + set(_doc "${lang} compiler supports OSX deployment target flag") + message(STATUS "Checking whether ${_doc}") + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help" + OUTPUT_VARIABLE _gcc_help + ERROR_VARIABLE _gcc_help + ) + if("${_gcc_help}" MATCHES "macosx-version-min") + message(STATUS "Checking whether ${_doc} - yes") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") + else() + message(STATUS "Checking whether ${_doc} - no") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "") + endif() + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")") + endif() +endmacro() diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake new file mode 100644 index 0000000..62fb985 --- /dev/null +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -0,0 +1,151 @@ +# Ask xcode-select where to find /Developer or fall back to ancient location. +execute_process(COMMAND xcode-select -print-path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed) +if(NOT _failed AND IS_DIRECTORY ${_stdout}) + set(OSX_DEVELOPER_ROOT ${_stdout}) +elseif(IS_DIRECTORY "/Developer") + set(OSX_DEVELOPER_ROOT "/Developer") +else() + set(OSX_DEVELOPER_ROOT "") +endif() + +execute_process(COMMAND sw_vers -productVersion + OUTPUT_VARIABLE CURRENT_OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Save CMAKE_OSX_ARCHITECTURES from the environment. +set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING + "Build architectures for OSX") + +#---------------------------------------------------------------------------- +# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... +# +string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" + _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}") + +#---------------------------------------------------------------------------- +# CMAKE_OSX_DEPLOYMENT_TARGET + +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING + "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") +endif() + +#---------------------------------------------------------------------------- +# CMAKE_OSX_SYSROOT + +if(CMAKE_OSX_SYSROOT) + # Use the existing value without further computation to choose a default. + set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}") +elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND + (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}")) + # Use the value of SDKROOT from the environment. + set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}") +elseif("${CMAKE_GENERATOR}" MATCHES Xcode + OR CMAKE_OSX_DEPLOYMENT_TARGET + OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]" + OR NOT EXISTS "/usr/include/sys/types.h") + # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory. + set(_CMAKE_OSX_SDKS_DIR "") + if(OSX_DEVELOPER_ROOT) + foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs) + file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*) + if(_CMAKE_OSX_SDKS) + set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d}) + break() + endif() + endforeach() + endif() + + if(_CMAKE_OSX_SDKS_DIR) + # Select SDK for current OSX version accounting for the known + # specially named SDKs. + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u") + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9") + + # find the latest SDK + set(_CMAKE_OSX_LATEST_SDK_VERSION "0.0") + file(GLOB _CMAKE_OSX_SDKS RELATIVE "${_CMAKE_OSX_SDKS_DIR}" "${_CMAKE_OSX_SDKS_DIR}/MacOSX*.sdk") + foreach(_SDK ${_CMAKE_OSX_SDKS}) + if(_SDK MATCHES "MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk" AND CMAKE_MATCH_1 VERSION_GREATER ${_CMAKE_OSX_LATEST_SDK_VERSION}) + set(_CMAKE_OSX_LATEST_SDK_VERSION "${CMAKE_MATCH_1}") + endif() + endforeach() + + # pick an SDK that works + set(_CMAKE_OSX_SYSROOT_DEFAULT) + foreach(ver ${CMAKE_OSX_DEPLOYMENT_TARGET} + ${_CURRENT_OSX_VERSION} + ${_CMAKE_OSX_LATEST_SDK_VERSION}) + set(_CMAKE_OSX_DEPLOYMENT_TARGET ${ver}) + set(_CMAKE_OSX_SDKS_VER ${_CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CMAKE_OSX_DEPLOYMENT_TARGET}}) + set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") + if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}") + set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SYSROOT_CHECK}") + break() + endif() + endforeach() + + if(CMAKE_OSX_DEPLOYMENT_TARGET AND + NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_EQUAL ${_CMAKE_OSX_DEPLOYMENT_TARGET}) + set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}}) + set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") + message(WARNING + "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " + "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n" + "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"." + ) + endif() + else() + # Assume developer files are in root (such as Xcode 4.5 command-line tools). + set(_CMAKE_OSX_SYSROOT_DEFAULT "") + endif() +endif() + +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +# Choose the type based on the current value. +set(_CMAKE_OSX_SYSROOT_TYPE STRING) +foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT) + if("x${${v}}" MATCHES "/") + set(_CMAKE_OSX_SYSROOT_TYPE PATH) + break() + endif() +endforeach() +set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE} + "The product will be built against the headers and libraries located inside the indicated SDK.") + +# Transform the cached value to something we can use. +set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}") +set(_CMAKE_OSX_SYSROOT_PATH "") +if(CMAKE_OSX_SYSROOT) + if("x${CMAKE_OSX_SYSROOT}" MATCHES "/") + # This is a path to the SDK. Make sure it exists. + if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}") + message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n" + "because the directory does not exist.") + set(CMAKE_OSX_SYSROOT "") + set(_CMAKE_OSX_SYSROOT_ORIG "") + endif() + set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}") + else() + # Transform the sdk name into a path. + execute_process( + COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + if(NOT _failed AND IS_DIRECTORY "${_stdout}") + set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}") + # For non-Xcode generators use the path. + if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}") + endif() + endif() + endif() +endif() diff --git a/Modules/Platform/Darwin-Intel-C.cmake b/Modules/Platform/Darwin-Intel-C.cmake new file mode 100644 index 0000000..81c630f --- /dev/null +++ b/Modules/Platform/Darwin-Intel-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Intel) +__darwin_compiler_intel(C) diff --git a/Modules/Platform/Darwin-Intel-CXX.cmake b/Modules/Platform/Darwin-Intel-CXX.cmake new file mode 100644 index 0000000..90ae53b --- /dev/null +++ b/Modules/Platform/Darwin-Intel-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Intel) +__darwin_compiler_intel(CXX) diff --git a/Modules/Platform/Darwin-Intel-Fortran.cmake b/Modules/Platform/Darwin-Intel-Fortran.cmake new file mode 100644 index 0000000..a604bb6 --- /dev/null +++ b/Modules/Platform/Darwin-Intel-Fortran.cmake @@ -0,0 +1,18 @@ +#============================================================================= +# Copyright 2013 OpenGamma Ltd. <graham@opengamma.com> +# +# 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(Platform/Darwin-Intel) +__darwin_compiler_intel(Fortran) + +set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ") diff --git a/Modules/Platform/Darwin-Intel.cmake b/Modules/Platform/Darwin-Intel.cmake new file mode 100644 index 0000000..42f1154 --- /dev/null +++ b/Modules/Platform/Darwin-Intel.cmake @@ -0,0 +1,29 @@ + +#============================================================================= +# Copyright 2002-2014 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__DARWIN_COMPILER_INTEL) + return() +endif() +set(__DARWIN_COMPILER_INTEL 1) + +macro(__darwin_compiler_intel lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + endif() +endmacro() diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake new file mode 100644 index 0000000..e3ac9b5 --- /dev/null +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -0,0 +1,26 @@ +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2013 OpenGamma Ltd. <graham@opengamma.com> +# +# 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.) + +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need -fpp explicitly on case-insensitive filesystem. +set(CMAKE_Fortran_COMPILE_OBJECT + "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE>") + +set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-Wl,-compatibility_version -Wl,") +set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-Wl,-current_version -Wl,") +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared") +set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-install_name -Wl,") +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG><TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Modules/Platform/Darwin-VisualAge-C.cmake b/Modules/Platform/Darwin-VisualAge-C.cmake new file mode 100644 index 0000000..859914f --- /dev/null +++ b/Modules/Platform/Darwin-VisualAge-C.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-XL-C) diff --git a/Modules/Platform/Darwin-VisualAge-CXX.cmake b/Modules/Platform/Darwin-VisualAge-CXX.cmake new file mode 100644 index 0000000..46c1005 --- /dev/null +++ b/Modules/Platform/Darwin-VisualAge-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-XL-CXX) diff --git a/Modules/Platform/Darwin-XL-C.cmake b/Modules/Platform/Darwin-XL-C.cmake new file mode 100644 index 0000000..42e94a9 --- /dev/null +++ b/Modules/Platform/Darwin-XL-C.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle") + +# Enable shared library versioning. +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name") diff --git a/Modules/Platform/Darwin-XL-CXX.cmake b/Modules/Platform/Darwin-XL-CXX.cmake new file mode 100644 index 0000000..65c76f8 --- /dev/null +++ b/Modules/Platform/Darwin-XL-CXX.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle") + +# Enable shared library versioning. +set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name") diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake new file mode 100644 index 0000000..4e4810a --- /dev/null +++ b/Modules/Platform/Darwin.cmake @@ -0,0 +1,241 @@ +set(APPLE 1) + +# Darwin versions: +# 6.x == Mac OSX 10.2 (Jaguar) +# 7.x == Mac OSX 10.3 (Panther) +# 8.x == Mac OSX 10.4 (Tiger) +# 9.x == Mac OSX 10.5 (Leopard) +# 10.x == Mac OSX 10.6 (Snow Leopard) +# 11.x == Mac OSX 10.7 (Lion) +# 12.x == Mac OSX 10.8 (Mountain Lion) +string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}") +string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}") + +# Do not use the "-Wl,-search_paths_first" flag with the OSX 10.2 compiler. +# Done this way because it is too early to do a TRY_COMPILE. +if(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST) + set(HAVE_FLAG_SEARCH_PATHS_FIRST 0) + if("${DARWIN_MAJOR_VERSION}" GREATER 6) + set(HAVE_FLAG_SEARCH_PATHS_FIRST 1) + endif() +endif() +# More desirable, but does not work: + #include(CheckCXXCompilerFlag) + #CHECK_CXX_COMPILER_FLAG("-Wl,-search_paths_first" HAVE_FLAG_SEARCH_PATHS_FIRST) + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_SHARED_MODULE_SUFFIX ".so") +set(CMAKE_MODULE_EXISTS 1) +set(CMAKE_DL_LIBS "") + +# Enable rpath support for 10.5 and greater where it is known to work. +if("${DARWIN_MAJOR_VERSION}" GREATER 8) + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +endif() + +set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") +set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") +set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") + +set(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") + +if(HAVE_FLAG_SEARCH_PATHS_FIRST) + set(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") + set(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") +endif() + +set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") +set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") + +# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree +# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache +# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) +# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex +if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) + find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool) + mark_as_advanced(CMAKE_INSTALL_NAME_TOOL) +endif() + +# Make sure the combination of SDK and Deployment Target are allowed +if(CMAKE_OSX_DEPLOYMENT_TARGET) + if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk") + set(_sdk_ver "${CMAKE_MATCH_1}") + elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$") + set(_sdk_ver "${CMAKE_MATCH_1}") + elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/") + set(_sdk_ver "${_CURRENT_OSX_VERSION}") + else() + message(FATAL_ERROR + "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " + "but CMAKE_OSX_SYSROOT:\n \"${_CMAKE_OSX_SYSROOT_ORIG}\"\n" + "is not set to a MacOSX SDK with a recognized version. " + "Either set CMAKE_OSX_SYSROOT to a valid SDK or set " + "CMAKE_OSX_DEPLOYMENT_TARGET to empty.") + endif() + if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER "${_sdk_ver}") + message(FATAL_ERROR + "CMAKE_OSX_DEPLOYMENT_TARGET (${CMAKE_OSX_DEPLOYMENT_TARGET}) " + "is greater than CMAKE_OSX_SYSROOT SDK:\n ${_CMAKE_OSX_SYSROOT_ORIG}\n" + "Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${_sdk_ver} or lower.") + endif() +endif() + +# Enable shared library versioning. +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") + +# Xcode does not support -isystem yet. +if(XCODE) + set(CMAKE_INCLUDE_SYSTEM_FLAG_C) + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +endif() + +if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5") + # Need to list dependent shared libraries on link line. When building + # with -isysroot (for universal binaries), the linker always looks for + # dependent libraries under the sysroot. Listing them on the link + # line works around the problem. + set(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1) +endif() + +set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) +set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) +set(CMAKE_C_CREATE_SHARED_LIBRARY + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +set(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") + +set(CMAKE_CXX_CREATE_SHARED_MODULE + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +set(CMAKE_C_CREATE_SHARED_MODULE + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +set(CMAKE_Fortran_CREATE_SHARED_MODULE + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +set(CMAKE_C_CREATE_MACOSX_FRAMEWORK + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +set(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") + +# Set default framework search path flag for languages known to use a +# preprocessor that may find headers in frameworks. +set(CMAKE_C_FRAMEWORK_SEARCH_FLAG -F) +set(CMAKE_CXX_FRAMEWORK_SEARCH_FLAG -F) +set(CMAKE_Fortran_FRAMEWORK_SEARCH_FLAG -F) + +# default to searching for frameworks first +if(NOT DEFINED CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK FIRST) +endif() + +# Older OS X linkers do not report their framework search path +# with -v but "man ld" documents the following locations. +set(CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + ${_CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks + ) +if(_CMAKE_OSX_SYSROOT_PATH) + # Treat some paths as implicit so we do not override the SDK versions. + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + /System/Library/Frameworks) +endif() +if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5") + # Older OS X tools had more implicit paths. + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks) +endif() + +# set up the default search directories for frameworks +set(CMAKE_SYSTEM_FRAMEWORK_PATH + ~/Library/Frameworks + ) +if(_CMAKE_OSX_SYSROOT_PATH) + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH + ${_CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks + ) + # add platform developer framework path if exists + foreach(_path + # Xcode 6 + ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks + # Xcode 5 iOS + ${_CMAKE_OSX_SYSROOT_PATH}/Developer/Library/Frameworks + # Xcode 5 OSX + ${_CMAKE_OSX_SYSROOT_PATH}/../../../../../Library/Frameworks + ) + get_filename_component(_abolute_path "${_path}" ABSOLUTE) + if(EXISTS "${_abolute_path}") + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_abolute_path}") + break() + endif() + endforeach() +endif() +list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH + /Library/Frameworks + /Network/Library/Frameworks + /System/Library/Frameworks) + +# Warn about known system mis-configuration case. +if(CMAKE_OSX_SYSROOT) + get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) + if(NOT _IN_TC AND + NOT IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks" + AND IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks/Frameworks") + message(WARNING "The SDK Library/Frameworks path\n" + " ${CMAKE_OSX_SYSROOT}/Library/Frameworks\n" + "is not set up correctly on this system. " + "This is known to occur when installing Xcode 3.2.6:\n" + " http://bugs.python.org/issue14018\n" + "The problem may cause build errors that report missing system frameworks. " + "Fix your SDK symlinks to resolve this issue and avoid this warning." + ) + endif() +endif() + +# default to searching for application bundles first +if(NOT DEFINED CMAKE_FIND_APPBUNDLE) + set(CMAKE_FIND_APPBUNDLE FIRST) +endif() +# set up the default search directories for application bundles +set(_apps_paths) +foreach(_path + "~/Applications" + "/Applications" + "${OSX_DEVELOPER_ROOT}/../Applications" # Xcode 4.3+ + "${OSX_DEVELOPER_ROOT}/Applications" # pre-4.3 + ) + get_filename_component(_apps "${_path}" ABSOLUTE) + if(EXISTS "${_apps}") + list(APPEND _apps_paths "${_apps}") + endif() +endforeach() +if(_apps_paths) + list(REMOVE_DUPLICATES _apps_paths) +endif() +set(CMAKE_SYSTEM_APPBUNDLE_PATH + ${_apps_paths}) +unset(_apps_paths) + +include(Platform/UnixPaths) +if(_CMAKE_OSX_SYSROOT_PATH AND EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_CMAKE_OSX_SYSROOT_PATH}/usr) + foreach(lang C CXX) + list(APPEND CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES ${_CMAKE_OSX_SYSROOT_PATH}/usr/include) + endforeach() +endif() +list(APPEND CMAKE_SYSTEM_PREFIX_PATH + /sw # Fink + /opt/local # MacPorts + ) diff --git a/Modules/Platform/DragonFly.cmake b/Modules/Platform/DragonFly.cmake new file mode 100644 index 0000000..c22677b --- /dev/null +++ b/Modules/Platform/DragonFly.cmake @@ -0,0 +1,5 @@ +# DragonFly BSD was forked from FreeBSD and is still very close to it +# http://www.dragonflybsd.org +# see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361 + +include(Platform/FreeBSD) diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake new file mode 100644 index 0000000..ce4d3ce --- /dev/null +++ b/Modules/Platform/FreeBSD.cmake @@ -0,0 +1,26 @@ +set(CMAKE_DL_LIBS "") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() + +include(Platform/UnixPaths) diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake new file mode 100644 index 0000000..342ad21 --- /dev/null +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -0,0 +1,29 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola <geoffrey.viola@asirobots.com> +# +# 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.) + +#Setup Greenhills MULTI specific compilation information +find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 + "C:/ghs/int1122" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 + "C:/ghs/int1104" + DOC "Path to integrity directory" + ) +set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") +set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") +set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") +set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") +mark_as_advanced(GHS_CUSTOMIZATION) +set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") +mark_as_advanced(GHS_GPJ_MACROS) diff --git a/Modules/Platform/GHS-MULTI.cmake b/Modules/Platform/GHS-MULTI.cmake new file mode 100644 index 0000000..211cf3e --- /dev/null +++ b/Modules/Platform/GHS-MULTI.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola <geoffrey.viola@asirobots.com> +# +# 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.) + +# This module is shared by multiple languages; use include blocker. + +if(__GHSMULTI) + return() +endif() +set(__GHSMULTI 1) + +set(GHSMULTI 1) + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +include(Platform/WindowsPaths) diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake new file mode 100644 index 0000000..e8c3b65 --- /dev/null +++ b/Modules/Platform/GNU.cmake @@ -0,0 +1,13 @@ +# GCC is the default compiler on GNU/Hurd. +set(CMAKE_DL_LIBS "dl") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*") + +include(Platform/UnixPaths) diff --git a/Modules/Platform/GNUtoMS_lib.bat.in b/Modules/Platform/GNUtoMS_lib.bat.in new file mode 100644 index 0000000..2da920a --- /dev/null +++ b/Modules/Platform/GNUtoMS_lib.bat.in @@ -0,0 +1,3 @@ +@echo off
+call "@CMAKE_GNUtoMS_BAT@"
+lib /machine:"@CMAKE_GNUtoMS_ARCH@" %*
diff --git a/Modules/Platform/GNUtoMS_lib.cmake b/Modules/Platform/GNUtoMS_lib.cmake new file mode 100644 index 0000000..ca9b0f8 --- /dev/null +++ b/Modules/Platform/GNUtoMS_lib.cmake @@ -0,0 +1,10 @@ +# Usage: cmake -Dlib=lib.bat -Ddef=out.def -Ddll=out.dll -Dimp=out.dll.a -P GNUtoMS_lib.cmake +get_filename_component(name ${dll} NAME) # .dll file name +string(REGEX REPLACE "\\.dll\\.a$" ".lib" out "${imp}") # .dll.a -> .lib +execute_process( + COMMAND ${lib} /def:${def} /name:${name} /out:${out} + RESULT_VARIABLE res + ) +if(res) + message(FATAL_ERROR "lib failed: ${res}") +endif() diff --git a/Modules/Platform/Generic-ADSP-ASM.cmake b/Modules/Platform/Generic-ADSP-ASM.cmake new file mode 100644 index 0000000..63a1388 --- /dev/null +++ b/Modules/Platform/Generic-ADSP-ASM.cmake @@ -0,0 +1,7 @@ +include(Platform/Generic-ADSP-Common) + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) +set(CMAKE_ASM_OUTPUT_EXTENSION ".doj" ) +set(CMAKE_ASM_COMPILE_OBJECT + "<CMAKE_ASM_COMPILER> <FLAGS> -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <OBJECT> <SOURCE>") + diff --git a/Modules/Platform/Generic-ADSP-C.cmake b/Modules/Platform/Generic-ADSP-C.cmake new file mode 100644 index 0000000..4b9ed9d --- /dev/null +++ b/Modules/Platform/Generic-ADSP-C.cmake @@ -0,0 +1,20 @@ + +include(Platform/Generic-ADSP-Common) + + +set(CMAKE_C_OUTPUT_EXTENSION ".doj") + +set(CMAKE_C_FLAGS_DEBUG_INIT "-g") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "") +set(CMAKE_C_FLAGS_RELEASE_INIT "") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "") + +set(CMAKE_C_CREATE_STATIC_LIBRARY + "<CMAKE_C_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_C_LINK_FLAGS> <OBJECTS>") + +set(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +set(CMAKE_C_CREATE_SHARED_LIBRARY) +set(CMAKE_C_CREATE_MODULE_LIBRARY) + diff --git a/Modules/Platform/Generic-ADSP-CXX.cmake b/Modules/Platform/Generic-ADSP-CXX.cmake new file mode 100644 index 0000000..9673aef --- /dev/null +++ b/Modules/Platform/Generic-ADSP-CXX.cmake @@ -0,0 +1,18 @@ +include(Platform/Generic-ADSP-Common) + +set(CMAKE_CXX_OUTPUT_EXTENSION ".doj") + +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "") + +set(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>") + +set(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +set(CMAKE_CXX_CREATE_SHARED_LIBRARY) +set(CMAKE_CXX_CREATE_MODULE_LIBRARY) + diff --git a/Modules/Platform/Generic-ADSP-Common.cmake b/Modules/Platform/Generic-ADSP-Common.cmake new file mode 100644 index 0000000..026f83c --- /dev/null +++ b/Modules/Platform/Generic-ADSP-Common.cmake @@ -0,0 +1,120 @@ +# support for the Analog Devices toolchain for their DSPs +# Raphael Cotty" <raphael.cotty (AT) googlemail.com> +# +# it supports three architectures: +# Blackfin +# TS (TigerShark) +# 21k (Sharc 21xxx) + +if(NOT ADSP) + + set(ADSP TRUE) + + set(CMAKE_STATIC_LIBRARY_SUFFIX ".dlb") + set(CMAKE_SHARED_LIBRARY_SUFFIX "") + set(CMAKE_EXECUTABLE_SUFFIX ".dxe") + + # if ADSP_PROCESSOR has not been set, but CMAKE_SYSTEM_PROCESSOR has, + # assume that this is the processor name to use for the compiler + if(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) + endif() + + # if ADSP_PROCESSOR_SILICIUM_REVISION has not been set, use "none" + if(NOT ADSP_PROCESSOR_SILICIUM_REVISION) + set(ADSP_PROCESSOR_SILICIUM_REVISION "none") + endif() + + # this file is included from the C and CXX files, so handle both here + + get_filename_component(_ADSP_DIR "${CMAKE_C_COMPILER}" PATH) + if(NOT _ADSP_DIR) + get_filename_component(_ADSP_DIR "${CMAKE_CXX_COMPILER}" PATH) + endif() + if(NOT _ADSP_DIR) + get_filename_component(_ADSP_DIR "${CMAKE_ASM_COMPILER}" PATH) + endif() + + # detect architecture + + if(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN) + if(NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR "ADSP-BF561") + endif() + set(ADSP_BLACKFIN TRUE) + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/Blackfin") + endif() + + if(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS) + if(NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR "ADSP-TS101") + endif() + set(ADSP_TS TRUE) + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/TS") + endif() + + if(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k) + if(NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR "ADSP-21060") + endif() + set(ADSP_21K TRUE) + + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") # default if nothing matches + if (ADSP_PROCESSOR MATCHES "210..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") + endif() + + if (ADSP_PROCESSOR MATCHES "211..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/211k") + endif() + + if (ADSP_PROCESSOR MATCHES "212..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/212k") + endif() + + if (ADSP_PROCESSOR MATCHES "213..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/213k") + endif() + + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") + endif() + + + link_directories("${_ADSP_FAMILY_DIR}/lib") + + # vdk support + find_program( ADSP_VDKGEN_EXECUTABLE vdkgen "${_ADSP_FAMILY_DIR}/vdk" ) + + macro(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE) + add_custom_command( + OUTPUT ${VDK_GENERATED_HEADER} ${VDK_GENERATED_SOURCE} + COMMAND ${ADSP_VDKGEN_EXECUTABLE} ${VDK_KERNEL_SUPPORT_FILE} -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -MM + DEPENDS ${VDK_KERNEL_SUPPORT_FILE} + ) + endmacro() + + # loader support + find_program( ADSP_ELFLOADER_EXECUTABLE elfloader "${_ADSP_FAMILY_DIR}" ) + + # BOOT_MODE: prom, flash, spi, spislave, UART, TWI, FIFO + # FORMAT: hex, ASCII, binary, include + # WIDTH: 8, 16 + macro(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH) + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr + COMMENT "Building the loader file" + ) + endmacro() + + macro(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE) + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr -init ${INITIALIZATION_FILE} + COMMENT "Building the loader file" + ) + endmacro() + +endif() diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake new file mode 100644 index 0000000..a1ca812 --- /dev/null +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -0,0 +1,54 @@ + +# This file implements basic support for sdcc (http://sdcc.sourceforge.net/) +# a free C compiler for 8 and 16 bit microcontrollers. +# To use it either a toolchain file is required or cmake has to be run like this: +# cmake -DCMAKE_C_COMPILER=sdcc -DCMAKE_SYSTEM_NAME=Generic <dir...> +# Since sdcc doesn't support C++, C++ support should be disabled in the +# CMakeLists.txt using the project() command: +# project(my_project C) + +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") # .so +set(CMAKE_IMPORT_LIBRARY_PREFIX ) +set(CMAKE_IMPORT_LIBRARY_SUFFIX ) +set(CMAKE_EXECUTABLE_SUFFIX ".ihx") # intel hex file +set(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +set(CMAKE_DL_LIBS "") + +set(CMAKE_C_OUTPUT_EXTENSION ".rel") + +# find sdcclib as CMAKE_AR +# since cmake may already have searched for "ar", sdcclib has to +# be searched with a different variable name (SDCCLIB_EXECUTABLE) +# and must then be forced into the cache +get_filename_component(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH) +find_program(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH) +find_program(SDCCLIB_EXECUTABLE sdcclib) +set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE) + +# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file +if(NOT DEFINED CMAKE_C_FLAGS_INIT) + set(CMAKE_C_FLAGS_INIT "-mmcs51 --model-small") +endif() + +if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) + set (CMAKE_EXE_LINKER_FLAGS_INIT --model-small) +endif() + +# compile a C file into an object file +set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") + +# link object files to an executable +set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <OBJECTS> --out-fmt-ihx -o <TARGET> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>") + +# needs sdcc 2.7.0 + sddclib from cvs +set(CMAKE_C_CREATE_STATIC_LIBRARY + "\"${CMAKE_COMMAND}\" -E remove <TARGET>" + "<CMAKE_AR> -a <TARGET> <LINK_FLAGS> <OBJECTS> ") + +# not supported by sdcc +set(CMAKE_C_CREATE_SHARED_LIBRARY "") +set(CMAKE_C_CREATE_MODULE_LIBRARY "") + diff --git a/Modules/Platform/Generic.cmake b/Modules/Platform/Generic.cmake new file mode 100644 index 0000000..fcb2699 --- /dev/null +++ b/Modules/Platform/Generic.cmake @@ -0,0 +1,17 @@ +# This is a platform definition file for platforms without +# operating system, typically embedded platforms. +# It is used when CMAKE_SYSTEM_NAME is set to "Generic" +# +# It is intentionally empty, since nothing is known +# about the platform. So everything has to be specified +# in the system/compiler files ${CMAKE_SYSTEM_NAME}-<compiler_basename>.cmake +# and/or ${CMAKE_SYSTEM_NAME}-<compiler_basename>-${CMAKE_SYSTEM_PROCESSOR}.cmake + +# (embedded) targets without operating system usually don't support shared libraries +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +# To help the find_xxx() commands, set at least the following so CMAKE_FIND_ROOT_PATH +# works at least for some simple cases: +set(CMAKE_SYSTEM_INCLUDE_PATH /include ) +set(CMAKE_SYSTEM_LIBRARY_PATH /lib ) +set(CMAKE_SYSTEM_PROGRAM_PATH /bin ) diff --git a/Modules/Platform/HP-UX-GNU-ASM.cmake b/Modules/Platform/HP-UX-GNU-ASM.cmake new file mode 100644 index 0000000..613b859 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(ASM) diff --git a/Modules/Platform/HP-UX-GNU-C.cmake b/Modules/Platform/HP-UX-GNU-C.cmake new file mode 100644 index 0000000..5f9ac42 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(C) diff --git a/Modules/Platform/HP-UX-GNU-CXX.cmake b/Modules/Platform/HP-UX-GNU-CXX.cmake new file mode 100644 index 0000000..689bed0 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(CXX) diff --git a/Modules/Platform/HP-UX-GNU-Fortran.cmake b/Modules/Platform/HP-UX-GNU-Fortran.cmake new file mode 100644 index 0000000..ee0181f --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(Fortran) diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake new file mode 100644 index 0000000..eb909fe --- /dev/null +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__HPUX_COMPILER_GNU) + return() +endif() +set(__HPUX_COMPILER_GNU 1) + +macro(__hpux_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") +endmacro() diff --git a/Modules/Platform/HP-UX-HP-ASM.cmake b/Modules/Platform/HP-UX-HP-ASM.cmake new file mode 100644 index 0000000..05c69e4 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(ASM) diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake new file mode 100644 index 0000000..7610383 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-C.cmake @@ -0,0 +1,6 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(C) + +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> -Aa -Ae <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake new file mode 100644 index 0000000..6d90191 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-CXX.cmake @@ -0,0 +1,14 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(CXX) + +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o" + ) + +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "+O3 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "+O2 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g") diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake new file mode 100644 index 0000000..12007e4 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-Fortran.cmake @@ -0,0 +1,5 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(Fortran) + +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake new file mode 100644 index 0000000..871ea13 --- /dev/null +++ b/Modules/Platform/HP-UX-HP.cmake @@ -0,0 +1,31 @@ + +#============================================================================= +# Copyright 2002-2011 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__HPUX_COMPILER_HP) + return() +endif() +set(__HPUX_COMPILER_HP 1) + +macro(__hpux_compiler_hp lang) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "+Z") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-Wl,-E,+nodefaultrpath -b -L/usr/lib") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") + + set(CMAKE_${lang}_FLAGS_INIT "") +endmacro() diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake new file mode 100644 index 0000000..65cc731 --- /dev/null +++ b/Modules/Platform/HP-UX.cmake @@ -0,0 +1,50 @@ +set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib) + +set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so +set(CMAKE_DL_LIBS "dld") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") +set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so") + +# The HP linker needs to find transitive shared library dependencies +# in the -L path. Therefore the runtime path must be added to the +# link line with -L flags. +set(CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH 1) +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) + +# set flags for gcc support +include(Platform/UnixPaths) + +# Look in both 32-bit and 64-bit implict link directories, but tell +# CMake not to pass the paths to the linker. The linker will find the +# library for the proper architecture. In the future we should detect +# which path will be used by the linker. Since the pointer type size +# CMAKE_SIZEOF_VOID_P is not set until after this file executes, we +# would need to append to CMAKE_SYSTEM_LIBRARY_PATH at a later point +# (after CMakeTest(LANG)Compiler.cmake runs for at least one language). +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64) +list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /usr/lib/hpux32 /usr/lib/hpux64) + +# Initialize C and CXX link type selection flags. These flags are +# used when building a shared library, shared module, or executable +# that links to other libraries to select whether to use the static or +# shared versions of the libraries. Note that C modules and shared +# libs are built using ld directly so we leave off the "-Wl," portion. +foreach(type SHARED_LIBRARY SHARED_MODULE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default") +endforeach() +foreach(type EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") +endforeach() +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive") + set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default") +endforeach() + diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake new file mode 100644 index 0000000..dfc2664 --- /dev/null +++ b/Modules/Platform/Haiku.cmake @@ -0,0 +1,130 @@ +# process only once +if(HAIKU) + return() +endif() + +set(HAIKU 1) +set(UNIX 1) + +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# Determine, if the C or C++ compiler is configured for a secondary +# architecture. If so, that will change the search paths we set below. We check +# whether the compiler's library search paths contain a +# "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary +# architecture specific subdirectory and extract the name of the architecture +# accordingly. + +# First of all, find a C or C++ compiler we can run. The "arg1" is necessary +# here for compilers such as "distcc gcc-x86" or "ccache gcc-x86" +# TODO See CMakeDetermineCompilerId.cmake for some more things we may want to do. +if(CMAKE_C_COMPILER) + set(__HAIKU_COMPILER ${CMAKE_C_COMPILER}) + string (STRIP "${CMAKE_C_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS) +else() + set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER}) + string (STRIP "${CMAKE_CXX_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS) +endif() + + +execute_process( + COMMAND ${__HAIKU_COMPILER} ${__HAIKU_COMPILER_FLAGS} -print-search-dirs + OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS + RESULT_VARIABLE _HAIKU_SEARCH_DIRS_FOUND + OUTPUT_STRIP_TRAILING_WHITESPACE) + +string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n") +set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}") + +if(NOT CMAKE_HAIKU_SECONDARY_ARCH) + set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "") + unset(CMAKE_HAIKU_SECONDARY_ARCH) +else() + set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "/${CMAKE_HAIKU_SECONDARY_ARCH}") + + # Override CMAKE_*LIBRARY_ARCHITECTURE. This will cause FIND_LIBRARY to search + # the libraries in the correct subdirectory first. It still isn't completely + # correct, since the parent directories shouldn't be searched at all. The + # primary architecture library might still be found, if there isn't one + # installed for the secondary architecture or it is installed in a less + # specific location. + set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) + set(CMAKE_C_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) + set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) +endif() + +list(APPEND CMAKE_SYSTEM_PREFIX_PATH + /boot/system/non-packaged + /boot/system + ) + +LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES + /boot/system/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/system/develop/headers/os + /boot/system/develop/headers/os/app + /boot/system/develop/headers/os/device + /boot/system/develop/headers/os/drivers + /boot/system/develop/headers/os/game + /boot/system/develop/headers/os/interface + /boot/system/develop/headers/os/kernel + /boot/system/develop/headers/os/locale + /boot/system/develop/headers/os/mail + /boot/system/develop/headers/os/media + /boot/system/develop/headers/os/midi + /boot/system/develop/headers/os/midi2 + /boot/system/develop/headers/os/net + /boot/system/develop/headers/os/opengl + /boot/system/develop/headers/os/storage + /boot/system/develop/headers/os/support + /boot/system/develop/headers/os/translation + /boot/system/develop/headers/os/add-ons/graphics + /boot/system/develop/headers/os/add-ons/input_server + /boot/system/develop/headers/os/add-ons/screen_saver + /boot/system/develop/headers/os/add-ons/tracker + /boot/system/develop/headers/os/be_apps/Deskbar + /boot/system/develop/headers/os/be_apps/NetPositive + /boot/system/develop/headers/os/be_apps/Tracker + /boot/system/develop/headers/3rdparty + /boot/system/develop/headers/bsd + /boot/system/develop/headers/glibc + /boot/system/develop/headers/gnu + /boot/system/develop/headers/posix + /boot/system/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + ) +IF (CMAKE_HAIKU_SECONDARY_ARCH) + LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES + /boot/system/develop/headers + ) +ENDIF (CMAKE_HAIKU_SECONDARY_ARCH) + +LIST(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES + ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES} + ) + +LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES + ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES}) + +LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES}) + +LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES + /boot/system/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + ) + +LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES} + ) + +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}) + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH + "Install path prefix, prepended onto install directories." FORCE) +endif() diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake new file mode 100644 index 0000000..12b0f37 --- /dev/null +++ b/Modules/Platform/IRIX.cmake @@ -0,0 +1,53 @@ +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +if(NOT CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") + set (CMAKE_CXX_FLAGS_INIT "") + set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") + set (CMAKE_C_FLAGS_INIT "") +endif() +# set flags for gcc support +include(Platform/UnixPaths) + +if(NOT CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set (CMAKE_C_CREATE_ASSEMBLY_SOURCE + "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +endif() + +if(NOT CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +endif() + +if(NOT CMAKE_COMPILER_IS_GNUG77) + set (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE + "<CMAKE_Fortran_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +endif() + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() + +# The IRIX linker needs to find transitive shared library dependencies +# in the -L path. +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake new file mode 100644 index 0000000..ee9b96e --- /dev/null +++ b/Modules/Platform/IRIX64.cmake @@ -0,0 +1,73 @@ +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +if(NOT CMAKE_COMPILER_IS_GNUCC) + # Set default flags init. + set(CMAKE_C_FLAGS_INIT "") + set(CMAKE_CXX_FLAGS_INIT "") + set(CMAKE_Fortran_FLAGS_INIT "") + set(CMAKE_EXE_LINKER_FLAGS_INIT "") + set(CMAKE_SHARED_LINKER_FLAGS_INIT "") + set(CMAKE_MODULE_LINKER_FLAGS_INIT "") + + # If no -o32, -n32, or -64 flag is given, set a reasonable default. + if("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") + else() + # Check if this is a 64-bit CMake. + if(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") + exec_program(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) + set(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL + "Output of file command on ${CMAKE_COMMAND}.") + endif() + + # Set initial flags to match cmake executable. + if(CMAKE_FILE_SELF MATCHES " 64-bit ") + set(CMAKE_C_FLAGS_INIT "-64") + set(CMAKE_CXX_FLAGS_INIT "-64") + set(CMAKE_Fortran_FLAGS_INIT "-64") + set(CMAKE_EXE_LINKER_FLAGS_INIT "-64") + set(CMAKE_SHARED_LINKER_FLAGS_INIT "-64") + set(CMAKE_MODULE_LINKER_FLAGS_INIT "-64") + endif() + endif() + + # Set remaining defaults. + set(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") + set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") +endif() +include(Platform/UnixPaths) + +if(NOT CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set (CMAKE_C_CREATE_ASSEMBLY_SOURCE + "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +endif() + +if(NOT CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +endif() + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() + +# The IRIX linker needs to find transitive shared library dependencies +# in the -L path. +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/Linux-Absoft-Fortran.cmake b/Modules/Platform/Linux-Absoft-Fortran.cmake new file mode 100644 index 0000000..beb41a3 --- /dev/null +++ b/Modules/Platform/Linux-Absoft-Fortran.cmake @@ -0,0 +1 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-X -v") # Runs gcc under the hood. diff --git a/Modules/Platform/Linux-CCur-Fortran.cmake b/Modules/Platform/Linux-CCur-Fortran.cmake new file mode 100644 index 0000000..ceecc2f --- /dev/null +++ b/Modules/Platform/Linux-CCur-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Linux-GNU-Fortran) diff --git a/Modules/Platform/Linux-CXX.cmake b/Modules/Platform/Linux-CXX.cmake new file mode 100644 index 0000000..b594dae --- /dev/null +++ b/Modules/Platform/Linux-CXX.cmake @@ -0,0 +1,3 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() diff --git a/Modules/Platform/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake new file mode 100644 index 0000000..2a77d27 --- /dev/null +++ b/Modules/Platform/Linux-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/Linux-GNU-C) diff --git a/Modules/Platform/Linux-Clang-CXX.cmake b/Modules/Platform/Linux-Clang-CXX.cmake new file mode 100644 index 0000000..9d9a4df --- /dev/null +++ b/Modules/Platform/Linux-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Linux-GNU-CXX) diff --git a/Modules/Platform/Linux-GNU-C.cmake b/Modules/Platform/Linux-GNU-C.cmake new file mode 100644 index 0000000..84dd492 --- /dev/null +++ b/Modules/Platform/Linux-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-GNU) +__linux_compiler_gnu(C) diff --git a/Modules/Platform/Linux-GNU-CXX.cmake b/Modules/Platform/Linux-GNU-CXX.cmake new file mode 100644 index 0000000..4162335 --- /dev/null +++ b/Modules/Platform/Linux-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-GNU) +__linux_compiler_gnu(CXX) diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake new file mode 100644 index 0000000..85e1226 --- /dev/null +++ b/Modules/Platform/Linux-GNU-Fortran.cmake @@ -0,0 +1,3 @@ +include(Platform/Linux-GNU) +__linux_compiler_gnu(Fortran) +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake new file mode 100644 index 0000000..0e254c6 --- /dev/null +++ b/Modules/Platform/Linux-GNU.cmake @@ -0,0 +1,25 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_GNU) + return() +endif() +set(__LINUX_COMPILER_GNU 1) + +macro(__linux_compiler_gnu lang) + # We pass this for historical reasons. Projects may have + # executables that use dlopen but do not set ENABLE_EXPORTS. + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") +endmacro() diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake new file mode 100644 index 0000000..449493a --- /dev/null +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -0,0 +1,3 @@ +include(Platform/Linux-Intel) +__linux_compiler_intel(C) +set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ") diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake new file mode 100644 index 0000000..142b6cf --- /dev/null +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -0,0 +1,3 @@ +include(Platform/Linux-Intel) +__linux_compiler_intel(CXX) +set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake new file mode 100644 index 0000000..0c9523c --- /dev/null +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -0,0 +1,4 @@ +include(Platform/Linux-Intel) +__linux_compiler_intel(Fortran) +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -nofor_main") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake new file mode 100644 index 0000000..20fddb4 --- /dev/null +++ b/Modules/Platform/Linux-Intel.cmake @@ -0,0 +1,54 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_INTEL) + return() +endif() +set(__LINUX_COMPILER_INTEL 1) + +if(NOT XIAR) + set(_intel_xiar_hints) + foreach(lang C CXX Fortran) + if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}") + get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH) + list(APPEND _intel_xiar_hints ${_hint}) + endif() + endforeach() + find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints}) + mark_as_advanced(XIAR) +endif() + +macro(__linux_compiler_intel lang) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + + # We pass this for historical reasons. Projects may have + # executables that use dlopen but do not set ENABLE_EXPORTS. + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") + + if(XIAR) + # INTERPROCEDURAL_OPTIMIZATION + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -ipo) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY_IPO + "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "${XIAR} -s <TARGET> ") + endif() + + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + endif() +endmacro() diff --git a/Modules/Platform/Linux-NAG-Fortran.cmake b/Modules/Platform/Linux-NAG-Fortran.cmake new file mode 100644 index 0000000..353bae6 --- /dev/null +++ b/Modules/Platform/Linux-NAG-Fortran.cmake @@ -0,0 +1,10 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need one "-Wl," level to send flag through to gcc. +# Use "-Xlinker" to get through gcc to real linker. +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic") diff --git a/Modules/Platform/Linux-PGI-C.cmake b/Modules/Platform/Linux-PGI-C.cmake new file mode 100644 index 0000000..edf4f3f --- /dev/null +++ b/Modules/Platform/Linux-PGI-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PGI) +__linux_compiler_pgi(C) diff --git a/Modules/Platform/Linux-PGI-CXX.cmake b/Modules/Platform/Linux-PGI-CXX.cmake new file mode 100644 index 0000000..d425f88 --- /dev/null +++ b/Modules/Platform/Linux-PGI-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PGI) +__linux_compiler_pgi(CXX) diff --git a/Modules/Platform/Linux-PGI-Fortran.cmake b/Modules/Platform/Linux-PGI-Fortran.cmake new file mode 100644 index 0000000..e8731a3 --- /dev/null +++ b/Modules/Platform/Linux-PGI-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PGI) +__linux_compiler_pgi(Fortran) diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake new file mode 100644 index 0000000..baa2248 --- /dev/null +++ b/Modules/Platform/Linux-PGI.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_PGI) + return() +endif() +set(__LINUX_COMPILER_PGI 1) + +macro(__linux_compiler_pgi lang) + # Shared library compile and link flags. + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") +endmacro() diff --git a/Modules/Platform/Linux-PathScale-C.cmake b/Modules/Platform/Linux-PathScale-C.cmake new file mode 100644 index 0000000..009f398 --- /dev/null +++ b/Modules/Platform/Linux-PathScale-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(C) diff --git a/Modules/Platform/Linux-PathScale-CXX.cmake b/Modules/Platform/Linux-PathScale-CXX.cmake new file mode 100644 index 0000000..b6a5771 --- /dev/null +++ b/Modules/Platform/Linux-PathScale-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(CXX) diff --git a/Modules/Platform/Linux-PathScale-Fortran.cmake b/Modules/Platform/Linux-PathScale-Fortran.cmake new file mode 100644 index 0000000..5662d3d --- /dev/null +++ b/Modules/Platform/Linux-PathScale-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(Fortran) diff --git a/Modules/Platform/Linux-PathScale.cmake b/Modules/Platform/Linux-PathScale.cmake new file mode 100644 index 0000000..d230ab2 --- /dev/null +++ b/Modules/Platform/Linux-PathScale.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2002-2010 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_PATHSCALE) + return() +endif() +set(__LINUX_COMPILER_PATHSCALE 1) + +macro(__linux_compiler_pathscale lang) + # Shared library compile and link flags. + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") +endmacro() diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake new file mode 100644 index 0000000..a07f1ec --- /dev/null +++ b/Modules/Platform/Linux-SunPro-CXX.cmake @@ -0,0 +1,9 @@ +# Sun C++ 5.9 does not support -Wl, but Sun C++ 5.11 does not work without it. +# Query the compiler flags to detect whether to use -Wl. +execute_process(COMMAND ${CMAKE_CXX_COMPILER} -flags OUTPUT_VARIABLE _cxx_flags ERROR_VARIABLE _cxx_error) +if("${_cxx_flags}" MATCHES "\n-W[^\n]*component") + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-Wl,-rpath-link,") +else() + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") +endif() +set(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") diff --git a/Modules/Platform/Linux-TinyCC-C.cmake b/Modules/Platform/Linux-TinyCC-C.cmake new file mode 100644 index 0000000..f78e708 --- /dev/null +++ b/Modules/Platform/Linux-TinyCC-C.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-soname ") diff --git a/Modules/Platform/Linux-VisualAge-C.cmake b/Modules/Platform/Linux-VisualAge-C.cmake new file mode 100644 index 0000000..0622b63 --- /dev/null +++ b/Modules/Platform/Linux-VisualAge-C.cmake @@ -0,0 +1 @@ +include(Platform/Linux-XL-C) diff --git a/Modules/Platform/Linux-VisualAge-CXX.cmake b/Modules/Platform/Linux-VisualAge-CXX.cmake new file mode 100644 index 0000000..b878ba0 --- /dev/null +++ b/Modules/Platform/Linux-VisualAge-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Linux-XL-CXX) diff --git a/Modules/Platform/Linux-VisualAge-Fortran.cmake b/Modules/Platform/Linux-VisualAge-Fortran.cmake new file mode 100644 index 0000000..1939a8a --- /dev/null +++ b/Modules/Platform/Linux-VisualAge-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Linux-XL-Fortran) diff --git a/Modules/Platform/Linux-XL-C.cmake b/Modules/Platform/Linux-XL-C.cmake new file mode 100644 index 0000000..d595e44 --- /dev/null +++ b/Modules/Platform/Linux-XL-C.cmake @@ -0,0 +1,2 @@ +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-export-dynamic") diff --git a/Modules/Platform/Linux-XL-CXX.cmake b/Modules/Platform/Linux-XL-CXX.cmake new file mode 100644 index 0000000..5ceb255 --- /dev/null +++ b/Modules/Platform/Linux-XL-CXX.cmake @@ -0,0 +1,2 @@ +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,-export-dynamic") diff --git a/Modules/Platform/Linux-XL-Fortran.cmake b/Modules/Platform/Linux-XL-Fortran.cmake new file mode 100644 index 0000000..a878991 --- /dev/null +++ b/Modules/Platform/Linux-XL-Fortran.cmake @@ -0,0 +1,2 @@ +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-export-dynamic") diff --git a/Modules/Platform/Linux-como.cmake b/Modules/Platform/Linux-como.cmake new file mode 100644 index 0000000..d1550d2 --- /dev/null +++ b/Modules/Platform/Linux-como.cmake @@ -0,0 +1,17 @@ +# create a shared C++ library +set(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>" + "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +# create a C++ static library +set(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>" + "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "<CMAKE_RANLIB> <TARGET> ") + +set(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>" + "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake new file mode 100644 index 0000000..e40a74f --- /dev/null +++ b/Modules/Platform/Linux.cmake @@ -0,0 +1,57 @@ +set(CMAKE_DL_LIBS "dl") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() + +# Debian policy requires that shared libraries be installed without +# executable permission. Fedora policy requires that shared libraries +# be installed with the executable permission. Since the native tools +# create shared libraries with execute permission in the first place a +# reasonable policy seems to be to install with execute permission by +# default. In order to support debian packages we provide an option +# here. The option default is based on the current distribution, but +# packagers can set it explicitly on the command line. +if(DEFINED CMAKE_INSTALL_SO_NO_EXE) + # Store the decision variable in the cache. This preserves any + # setting the user provides on the command line. + set(CMAKE_INSTALL_SO_NO_EXE "${CMAKE_INSTALL_SO_NO_EXE}" CACHE INTERNAL + "Install .so files without execute permission.") +else() + # Store the decision variable as an internal cache entry to avoid + # checking the platform every time. This option is advanced enough + # that only package maintainers should need to adjust it. They are + # capable of providing a setting on the command line. + if(EXISTS "/etc/debian_version") + set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL + "Install .so files without execute permission.") + else() + set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL + "Install .so files without execute permission.") + endif() +endif() + +# Match multiarch library directory names. +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*") + +include(Platform/UnixPaths) + +# Debian has lib64 paths only for compatibility so they should not be +# searched. +if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version") + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) +endif() diff --git a/Modules/Platform/MP-RAS.cmake b/Modules/Platform/MP-RAS.cmake new file mode 100644 index 0000000..fe8d81a --- /dev/null +++ b/Modules/Platform/MP-RAS.cmake @@ -0,0 +1,14 @@ +if(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") + set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) + set(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE) + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +else() + set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) + set(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE) + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") +endif() + +include(Platform/UnixPaths) + + diff --git a/Modules/Platform/MirBSD.cmake b/Modules/Platform/MirBSD.cmake new file mode 100644 index 0000000..7637f9b --- /dev/null +++ b/Modules/Platform/MirBSD.cmake @@ -0,0 +1 @@ +include(Platform/OpenBSD) diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake new file mode 100644 index 0000000..1004eb3 --- /dev/null +++ b/Modules/Platform/NetBSD.cmake @@ -0,0 +1,13 @@ +set(CMAKE_DL_LIBS "") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +include(Platform/UnixPaths) diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake new file mode 100644 index 0000000..f2ad612 --- /dev/null +++ b/Modules/Platform/OSF1.cmake @@ -0,0 +1,47 @@ +set(CMAKE_DL_LIBS "") + +if(CMAKE_SYSTEM MATCHES "OSF1-1.[012]") +endif() +if(CMAKE_SYSTEM MATCHES "OSF1-1") + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + set(CMAKE_C_COMPILE_OPTIONS_PIC "-fpic") + set(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie") + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic + set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic +endif() + + + +if(CMAKE_SYSTEM MATCHES "OSF1-V") + set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,") + else() + set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-rpath ") + endif() + if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") + else() + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-rpath ") + endif() + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +endif() + +set(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/... + +if(CMAKE_COMPILER_IS_GNUCXX) + # include the gcc flags +else () + # use default OSF compiler flags + set (CMAKE_C_FLAGS_INIT "") + set (CMAKE_C_FLAGS_DEBUG_INIT "-g") + set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") + set (CMAKE_C_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2") + set (CMAKE_CXX_FLAGS_INIT "") + set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") +endif() +include(Platform/UnixPaths) diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake new file mode 100644 index 0000000..7ac6c7e --- /dev/null +++ b/Modules/Platform/OpenBSD.cmake @@ -0,0 +1,38 @@ +include(Platform/NetBSD) + +# On OpenBSD, the compile time linker does not share it's configuration with +# the runtime linker. This will extract the library search paths from the +# system's ld.so.hints file which will allow CMake to set the appropriate +# -rpath-link flags +if(NOT CMAKE_PLATFORM_RUNTIME_PATH) + execute_process(COMMAND /sbin/ldconfig -r + OUTPUT_VARIABLE LDCONFIG_HINTS + ERROR_QUIET) + string(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1" + LDCONFIG_HINTS "${LDCONFIG_HINTS}") + string(REPLACE ":" ";" + CMAKE_PLATFORM_RUNTIME_PATH + "${LDCONFIG_HINTS}") +endif() + +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) + +# OpenBSD has no multilib +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) + +# OpenBSD policy requires that shared libraries be installed without +# executable permission. +set(CMAKE_INSTALL_SO_NO_EXE 1) + +if($ENV{LOCALBASE}) + set(OPENBSD_LOCALBASE $ENV{LOCALBASE}) +else() + set(OPENBSD_LOCALBASE /usr/local) +endif() +if($ENV{X11BASE}) + set(OPENBSD_X11BASE $ENV{X11BASE}) +else() + set(OPENBSD_X11BASE /usr/X11R6) +endif() + +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${OPENBSD_LOCALBASE}) diff --git a/Modules/Platform/OpenVMS.cmake b/Modules/Platform/OpenVMS.cmake new file mode 100644 index 0000000..b10da23 --- /dev/null +++ b/Modules/Platform/OpenVMS.cmake @@ -0,0 +1,8 @@ +include(Platform/UnixPaths) + +set(CMAKE_C_CREATE_STATIC_LIBRARY + "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>" + "<CMAKE_RANLIB> <TARGET>" + ) +set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) +set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake new file mode 100644 index 0000000..ebc4609 --- /dev/null +++ b/Modules/Platform/QNX.cmake @@ -0,0 +1,19 @@ +set(QNXNTO 1) + +include(Platform/GNU) +unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) + +set(CMAKE_DL_LIBS "") + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() diff --git a/Modules/Platform/RISCos.cmake b/Modules/Platform/RISCos.cmake new file mode 100644 index 0000000..570cd7b --- /dev/null +++ b/Modules/Platform/RISCos.cmake @@ -0,0 +1,6 @@ +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") +set(CMAKE_SHARED_LIBRARY_SUFFIX "..o") +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") + +include(Platform/UnixPaths) diff --git a/Modules/Platform/SCO_SV.cmake b/Modules/Platform/SCO_SV.cmake new file mode 100644 index 0000000..ddd9600 --- /dev/null +++ b/Modules/Platform/SCO_SV.cmake @@ -0,0 +1,2 @@ +set(CMAKE_DL_LIBS "") +include(Platform/UnixPaths) diff --git a/Modules/Platform/SINIX.cmake b/Modules/Platform/SINIX.cmake new file mode 100644 index 0000000..c37a113 --- /dev/null +++ b/Modules/Platform/SINIX.cmake @@ -0,0 +1,4 @@ +set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) +set(CMAKE_C_COMPILE_OPTIONS_PIE "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +include(Platform/UnixPaths) diff --git a/Modules/Platform/SunOS-GNU-C.cmake b/Modules/Platform/SunOS-GNU-C.cmake new file mode 100644 index 0000000..6a96c00 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(C) diff --git a/Modules/Platform/SunOS-GNU-CXX.cmake b/Modules/Platform/SunOS-GNU-CXX.cmake new file mode 100644 index 0000000..6b9f6fa --- /dev/null +++ b/Modules/Platform/SunOS-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(CXX) diff --git a/Modules/Platform/SunOS-GNU-Fortran.cmake b/Modules/Platform/SunOS-GNU-Fortran.cmake new file mode 100644 index 0000000..c6b1888 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(Fortran) diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake new file mode 100644 index 0000000..7169056 --- /dev/null +++ b/Modules/Platform/SunOS-GNU.cmake @@ -0,0 +1,34 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__SUNOS_COMPILER_GNU) + return() +endif() +set(__SUNOS_COMPILER_GNU 1) + +macro(__sunos_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-R") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-h") + + # Initialize C link type selection flags. These flags are used when + # building a shared library, shared module, or executable that links + # to other libraries to select whether to use the static or shared + # versions of the libraries. + foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + endforeach() +endmacro() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake new file mode 100644 index 0000000..aaa79c4 --- /dev/null +++ b/Modules/Platform/SunOS.cmake @@ -0,0 +1,32 @@ +if(CMAKE_SYSTEM MATCHES "SunOS-4") + set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC") + set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE") + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC") + set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +endif() + +if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + else() + # Take default rule from CMakeDefaultMakeRuleVariables.cmake. + endif() +endif() +include(Platform/UnixPaths) + +# Add the compiler's implicit link directories. +if("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) +endif() + +# The Sun linker needs to find transitive shared library dependencies +# in the -L path. +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) diff --git a/Modules/Platform/Tru64.cmake b/Modules/Platform/Tru64.cmake new file mode 100644 index 0000000..47852f8 --- /dev/null +++ b/Modules/Platform/Tru64.cmake @@ -0,0 +1,2 @@ +include(Platform/UnixPaths) + diff --git a/Modules/Platform/ULTRIX.cmake b/Modules/Platform/ULTRIX.cmake new file mode 100644 index 0000000..9db4c7c --- /dev/null +++ b/Modules/Platform/ULTRIX.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") +set(CMAKE_SHARED_LIBRARY_SUFFIX "..o") +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") +include(Platform/UnixPaths) diff --git a/Modules/Platform/UNIX_SV.cmake b/Modules/Platform/UNIX_SV.cmake new file mode 100644 index 0000000..1ec96ae --- /dev/null +++ b/Modules/Platform/UNIX_SV.cmake @@ -0,0 +1,5 @@ +set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) +set(CMAKE_C_COMPILE_OPTIONS_PIE "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") +include(Platform/UnixPaths) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake new file mode 100644 index 0000000..20ee1d1 --- /dev/null +++ b/Modules/Platform/UnixPaths.cmake @@ -0,0 +1,97 @@ + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# 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.) + +# Block multiple inclusion because "CMakeCInformation.cmake" includes +# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module +# "CMakeSystemSpecificInformation.cmake" already included it. +# The extra inclusion is a work-around documented next to the include() +# call, so this can be removed when the work-around is removed. +if(__UNIX_PATHS_INCLUDED) + return() +endif() +set(__UNIX_PATHS_INCLUDED 1) + +set(UNIX 1) + +# also 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) + +# List common installation prefixes. These will be used for all +# search types. +list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Standard + /usr/local /usr / + + # 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 common include file locations not under the common prefixes. +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH + # Windows API on Cygwin + /usr/include/w32api + + # X11 + /usr/X11R6/include /usr/include/X11 + + # Other + /usr/pkg/include + /opt/csw/include /opt/include + /usr/openwin/include + ) + +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + # Windows API on Cygwin + /usr/lib/w32api + + # X11 + /usr/X11R6/lib /usr/lib/X11 + + # Other + /usr/pkg/lib + /opt/csw/lib /opt/lib + /usr/openwin/lib + ) + +list(APPEND CMAKE_SYSTEM_PROGRAM_PATH + /usr/pkg/bin + ) + +list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64 + ) + +list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) +list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) + +# Enable use of lib64 search path variants by default. +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Modules/Platform/UnixWare.cmake b/Modules/Platform/UnixWare.cmake new file mode 100644 index 0000000..e649bd2 --- /dev/null +++ b/Modules/Platform/UnixWare.cmake @@ -0,0 +1,5 @@ +set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) +set(CMAKE_C_COMPILE_OPTIONS_PIE "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport") +include(Platform/UnixPaths) diff --git a/Modules/Platform/Windows-Borland-C.cmake b/Modules/Platform/Windows-Borland-C.cmake new file mode 100644 index 0000000..e2f76aa --- /dev/null +++ b/Modules/Platform/Windows-Borland-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Embarcadero-C) diff --git a/Modules/Platform/Windows-Borland-CXX.cmake b/Modules/Platform/Windows-Borland-CXX.cmake new file mode 100644 index 0000000..809490f --- /dev/null +++ b/Modules/Platform/Windows-Borland-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Embarcadero-CXX) diff --git a/Modules/Platform/Windows-CXX.cmake b/Modules/Platform/Windows-CXX.cmake new file mode 100644 index 0000000..bf37f79 --- /dev/null +++ b/Modules/Platform/Windows-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake new file mode 100644 index 0000000..d007105 --- /dev/null +++ b/Modules/Platform/Windows-Clang-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(C) diff --git a/Modules/Platform/Windows-Clang-CXX.cmake b/Modules/Platform/Windows-Clang-CXX.cmake new file mode 100644 index 0000000..2c3688a --- /dev/null +++ b/Modules/Platform/Windows-Clang-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(CXX) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake new file mode 100644 index 0000000..da19a3d --- /dev/null +++ b/Modules/Platform/Windows-Clang.cmake @@ -0,0 +1,32 @@ + +#============================================================================= +# Copyright 2001-2013 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_CLANG) + return() +endif() +set(__WINDOWS_CLANG 1) + +if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + include(Platform/Windows-MSVC) + macro(__windows_compiler_clang lang) + __windows_compiler_msvc(${lang}) + endmacro() +else() + include(Platform/Windows-GNU) + macro(__windows_compiler_clang lang) + __windows_compiler_gnu(${lang}) + endmacro() +endif() diff --git a/Modules/Platform/Windows-Embarcadero-C.cmake b/Modules/Platform/Windows-Embarcadero-C.cmake new file mode 100644 index 0000000..607fd4e --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero-C.cmake @@ -0,0 +1,3 @@ +set(_lang C) +include(Platform/Windows-Embarcadero) +__embarcadero_language(C) diff --git a/Modules/Platform/Windows-Embarcadero-CXX.cmake b/Modules/Platform/Windows-Embarcadero-CXX.cmake new file mode 100644 index 0000000..279a4de --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero-CXX.cmake @@ -0,0 +1,3 @@ +set(_lang CXX) +include(Platform/Windows-Embarcadero) +__embarcadero_language(CXX) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake new file mode 100644 index 0000000..5295a48e --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -0,0 +1,137 @@ + +#============================================================================= +# Copyright 2002-2012 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_EMBARCADERO) + return() +endif() +set(__WINDOWS_EMBARCADERO 1) + +set(BORLAND 1) + +if("${CMAKE_${_lang}_COMPILER_VERSION}" VERSION_LESS 6.30) + # Borland target type flags (bcc32 -h -t): + set(_tW "-tW") # -tW GUI App (implies -U__CONSOLE__) + set(_tC "-tWC") # -tWC Console App (implies -D__CONSOLE__=1) + set(_tD "-tWD") # -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) + set(_tM "-tWM") # -tWM Enable threads (implies -D__MT__=1 -D_MT=1) + set(_tR "-tWR -tW-") # -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) + # Notes: + # - The flags affect linking so we pass them to the linker. + # - The flags affect preprocessing so we pass them to the compiler. + # - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. + # - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. +else() + set(EMBARCADERO 1) + set(_tC "-tC") # Target is a console application + set(_tD "-tD") # Target is a shared library + set(_tM "-tM") # Target is multi-threaded + set(_tR "-tR") # Target uses the dynamic RTL + set(_tW "-tW") # Target is a Windows application +endif() +set(_COMPILE_C "-c") +set(_COMPILE_CXX "-P -c") + +set(CMAKE_LIBRARY_PATH_FLAG "-L") +set(CMAKE_LINK_LIBRARY_FLAG "") + +set(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") + +# uncomment these out to debug makefiles +#set(CMAKE_START_TEMP_FILE "") +#set(CMAKE_END_TEMP_FILE "") +#set(CMAKE_VERBOSE_MAKEFILE 1) + +# Borland cannot handle + in the file name, so mangle object file name +set (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") + +# extra flags for a win32 exe +set(CMAKE_CREATE_WIN32_EXE "${_tW}" ) +# extra flags for a console app +set(CMAKE_CREATE_CONSOLE_EXE "${_tC}" ) + +set (CMAKE_BUILD_TYPE Debug CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") + +set (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192 ") +set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") +set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") +set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + +# The Borland link tool does not support multiple concurrent +# invocations within a single working directory. +if(NOT DEFINED CMAKE_JOB_POOL_LINK) + set(CMAKE_JOB_POOL_LINK BCC32LinkPool) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) +endif() + +macro(__embarcadero_language lang) + set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # ... while this is a space separated string. + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) + + # compile a source file into an object file + # place <DEFINES> outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_COMPILE_OBJECT + "<CMAKE_${lang}_COMPILER> ${_tR} -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<OBJECT> ${_COMPILE_${lang}} <SOURCE>" + ) + + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> ${_tR} -e<TARGET> <LINK_FLAGS> <FLAGS> ${CMAKE_START_TEMP_FILE} <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" + # "implib -c -w <TARGET_IMPLIB> <TARGET>" + ) + + # place <DEFINES> outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "cpp32 -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>" + ) + # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not + + # Create a module library. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_${lang}_COMPILER> ${_tR} ${_tD} ${CMAKE_START_TEMP_FILE}-e<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" + ) + + # Create an import library for another target. + set(CMAKE_${lang}_CREATE_IMPORT_LIBRARY + "implib -c -w <TARGET_IMPLIB> <TARGET>" + ) + + # Create a shared library. + # First create a module and then its import library. + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + ${CMAKE_${lang}_CREATE_SHARED_MODULE} + ${CMAKE_${lang}_CREATE_IMPORT_LIBRARY} + ) + + # create a static library + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + "tlib ${CMAKE_START_TEMP_FILE}/p512 <LINK_FLAGS> /a <TARGET_QUOTED> <OBJECTS>${CMAKE_END_TEMP_FILE}" + ) + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "${_tM}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od") + set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib") +endmacro() diff --git a/Modules/Platform/Windows-G95-Fortran.cmake b/Modules/Platform/Windows-G95-Fortran.cmake new file mode 100644 index 0000000..af08008 --- /dev/null +++ b/Modules/Platform/Windows-G95-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-Fortran) diff --git a/Modules/Platform/Windows-GNU-C-ABI.cmake b/Modules/Platform/Windows-GNU-C-ABI.cmake new file mode 100644 index 0000000..1189263 --- /dev/null +++ b/Modules/Platform/Windows-GNU-C-ABI.cmake @@ -0,0 +1 @@ +__windows_compiler_gnu_abi(C) diff --git a/Modules/Platform/Windows-GNU-C.cmake b/Modules/Platform/Windows-GNU-C.cmake new file mode 100644 index 0000000..ecf89dc --- /dev/null +++ b/Modules/Platform/Windows-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(C) diff --git a/Modules/Platform/Windows-GNU-CXX-ABI.cmake b/Modules/Platform/Windows-GNU-CXX-ABI.cmake new file mode 100644 index 0000000..f3c701c --- /dev/null +++ b/Modules/Platform/Windows-GNU-CXX-ABI.cmake @@ -0,0 +1 @@ +__windows_compiler_gnu_abi(CXX) diff --git a/Modules/Platform/Windows-GNU-CXX.cmake b/Modules/Platform/Windows-GNU-CXX.cmake new file mode 100644 index 0000000..23e6552 --- /dev/null +++ b/Modules/Platform/Windows-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(CXX) diff --git a/Modules/Platform/Windows-GNU-Fortran-ABI.cmake b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake new file mode 100644 index 0000000..179280b --- /dev/null +++ b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake @@ -0,0 +1 @@ +__windows_compiler_gnu_abi(Fortran) diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake new file mode 100644 index 0000000..b81b796 --- /dev/null +++ b/Modules/Platform/Windows-GNU-Fortran.cmake @@ -0,0 +1,5 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(Fortran) + +# gfortran on 64-bit MinGW defines __SIZEOF_POINTER__ +set(CMAKE_Fortran_SIZEOF_DATA_PTR_DEFAULT 4) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake new file mode 100644 index 0000000..b97409c --- /dev/null +++ b/Modules/Platform/Windows-GNU.cmake @@ -0,0 +1,200 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_GNU) + return() +endif() +set(__WINDOWS_GNU 1) + +set(CMAKE_IMPORT_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") + +set(CMAKE_EXECUTABLE_SUFFIX ".exe") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") +set(CMAKE_SHARED_MODULE_SUFFIX ".dll") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") + +if(MSYS OR MINGW) + set(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib +endif() + +if(MINGW) + set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32") + set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") +endif() + +set(CMAKE_DL_LIBS "") +set(CMAKE_LIBRARY_PATH_FLAG "-L") +set(CMAKE_LINK_LIBRARY_FLAG "-l") +set(CMAKE_LINK_DEF_FILE_FLAG "") # Empty string: passing the file is enough +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_CREATE_WIN32_EXE "-mwindows") + +set(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") + +# Check if GNU ld is too old to support @FILE syntax. +set(__WINDOWS_GNU_LD_RESPONSE 1) +execute_process(COMMAND ld -v OUTPUT_VARIABLE _help ERROR_VARIABLE _help) +if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") + set(__WINDOWS_GNU_LD_RESPONSE 0) +endif() + +if(NOT CMAKE_GENERATOR_RC AND CMAKE_GENERATOR MATCHES "Unix Makefiles") + set(CMAKE_GENERATOR_RC windres) +endif() + +macro(__windows_compiler_gnu lang) + + if(MSYS OR MINGW) + # Create archiving rules to support large object file lists for static libraries. + set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") + + # Initialize C link type selection flags. These flags are used when + # building a shared library, shared module, or executable that links + # to other libraries to select whether to use the static or shared + # versions of the libraries. + foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + endforeach() + endif() + + # No -fPIC on Windows + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") + + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE}) + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES ${__WINDOWS_GNU_LD_RESPONSE}) + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) + + # We prefer "@" for response files but it is not supported by gcc 3. + execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE _ver ERROR_VARIABLE _ver) + if("${_ver}" MATCHES "\\(GCC\\) 3\\.") + if("${lang}" STREQUAL "Fortran") + # The GNU Fortran compiler reports an error: + # no input files; unwilling to write output files + # when the response file is passed with "-Wl,@". + set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0) + else() + # Use "-Wl,@" to pass the response file to the linker. + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@") + endif() + # The GNU 3.x compilers do not support response files (only linkers). + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0) + # Link libraries are generated only for the front-end. + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0) + else() + # Use "@" to pass the response file to the front-end. + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") + endif() + + # Binary link rules. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + + list(APPEND CMAKE_${lang}_ABI_FILES "Platform/Windows-GNU-${lang}-ABI") + + # Support very long lists of object files. + # TODO: check for which gcc versions this is still needed, not needed for gcc >= 4.4. + # Ninja generator doesn't support this work around. + if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@" AND NOT CMAKE_GENERATOR MATCHES "Ninja") + foreach(rule CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE) + # The gcc/collect2/ld toolchain does not use response files + # internally so we cannot pass long object lists. Instead pass + # the object file list in a response file to the archiver to put + # them in a temporary archive. Hand the archive to the linker. + string(REPLACE "<OBJECTS>" "-Wl,--whole-archive <OBJECT_DIR>/objects.a -Wl,--no-whole-archive" + CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}") + set(CMAKE_${lang}_${rule} + "<CMAKE_COMMAND> -E remove -f <OBJECT_DIR>/objects.a" + "<CMAKE_AR> cr <OBJECT_DIR>/objects.a <OBJECTS>" + "${CMAKE_${lang}_${rule}}" + ) + endforeach() + endif() + + if(NOT CMAKE_RC_COMPILER_INIT AND NOT CMAKE_GENERATOR_RC) + set(CMAKE_RC_COMPILER_INIT windres) + endif() + + enable_language(RC) +endmacro() + +macro(__windows_compiler_gnu_abi lang) + if(CMAKE_NO_GNUtoMS) + set(CMAKE_GNUtoMS 0) + else() + option(CMAKE_GNUtoMS "Convert GNU import libraries to MS format (requires Visual Studio)" OFF) + endif() + + if(CMAKE_GNUtoMS AND NOT CMAKE_GNUtoMS_LIB) + # Find MS development environment setup script for this architecture. + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) + find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat + DOC "Visual Studio vcvars32.bat" + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++;ProductDir]/bin" + ) + set(CMAKE_GNUtoMS_ARCH x86) + elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars64.bat vcvarsamd64.bat + DOC "Visual Studio vcvarsamd64.bat" + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/amd64" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/amd64" + ) + set(CMAKE_GNUtoMS_ARCH amd64) + endif() + set_property(CACHE CMAKE_GNUtoMS_VCVARS PROPERTY ADVANCED 1) + if(CMAKE_GNUtoMS_VCVARS) + # Create helper script to run lib.exe from MS environment. + string(REPLACE "/" "\\" CMAKE_GNUtoMS_BAT "${CMAKE_GNUtoMS_VCVARS}") + set(CMAKE_GNUtoMS_LIB ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeGNUtoMS_lib.bat) + configure_file(${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.bat.in ${CMAKE_GNUtoMS_LIB}) + else() + message(WARNING "Disabling CMAKE_GNUtoMS option because CMAKE_GNUtoMS_VCVARS is not set.") + set(CMAKE_GNUtoMS 0) + endif() + endif() + + if(CMAKE_GNUtoMS) + # Teach CMake how to create a MS import library at link time. + set(CMAKE_${lang}_GNUtoMS_RULE " -Wl,--output-def,<TARGET_NAME>.def" + "<CMAKE_COMMAND> -Dlib=\"${CMAKE_GNUtoMS_LIB}\" -Ddef=<TARGET_NAME>.def -Ddll=<TARGET> -Dimp=<TARGET_IMPLIB> -P \"${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.cmake\"" + ) + endif() +endmacro() diff --git a/Modules/Platform/Windows-Intel-ASM.cmake b/Modules/Platform/Windows-Intel-ASM.cmake new file mode 100644 index 0000000..31d08c7 --- /dev/null +++ b/Modules/Platform/Windows-Intel-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(ASM) diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake new file mode 100644 index 0000000..767fec5 --- /dev/null +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(C) diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake new file mode 100644 index 0000000..84cd303 --- /dev/null +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -0,0 +1,3 @@ +include(Platform/Windows-Intel) +set(_COMPILE_CXX " /TP") +__windows_compiler_intel(CXX) diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake new file mode 100644 index 0000000..0f9a10a --- /dev/null +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -0,0 +1,11 @@ +include(Platform/Windows-Intel) +set(CMAKE_BUILD_TYPE_INIT Debug) +set(_COMPILE_Fortran " /fpp") +set(CMAKE_Fortran_MODDIR_FLAG "-module:") +set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") +__windows_compiler_intel(Fortran) +set (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") +set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/Od /debug:full /dbglibs") +set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1 /D NDEBUG") +set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /D NDEBUG") +set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /D NDEBUG") diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake new file mode 100644 index 0000000..34e6b37 --- /dev/null +++ b/Modules/Platform/Windows-Intel.cmake @@ -0,0 +1,28 @@ + +#============================================================================= +# Copyright 2002-2010 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_INTEL) + return() +endif() +set(__WINDOWS_INTEL 1) + +include(Platform/Windows-MSVC) +macro(__windows_compiler_intel lang) + __windows_compiler_msvc(${lang}) + string(REPLACE "<CMAKE_LINKER> /lib" "lib" CMAKE_${lang}_CREATE_STATIC_LIBRARY "${CMAKE_${lang}_CREATE_STATIC_LIBRARY}") + foreach(rule CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) + string(REPLACE "<CMAKE_LINKER>" "xilink" CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}") + endforeach() +endmacro() diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake new file mode 100644 index 0000000..cbe1586 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-C.cmake @@ -0,0 +1,5 @@ +include(Platform/Windows-MSVC) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) + set(_FS_C " /FS") +endif() +__windows_compiler_msvc(C) diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake new file mode 100644 index 0000000..0e85005 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-CXX.cmake @@ -0,0 +1,6 @@ +include(Platform/Windows-MSVC) +set(_COMPILE_CXX " /TP") +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) + set(_FS_CXX " /FS") +endif() +__windows_compiler_msvc(CXX) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake new file mode 100644 index 0000000..94470c3 --- /dev/null +++ b/Modules/Platform/Windows-MSVC.cmake @@ -0,0 +1,312 @@ + +#============================================================================= +# Copyright 2001-2012 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_MSVC) + return() +endif() +set(__WINDOWS_MSVC 1) + +set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +set(CMAKE_LINK_LIBRARY_FLAG "") +set(MSVC 1) + +# hack: if a new cmake (which uses CMAKE_LINKER) runs on an old build tree +# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache +# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) +# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex +if(NOT DEFINED CMAKE_LINKER) + set(CMAKE_LINKER link) +endif() + +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_CL_NOLOGO) +else() + set(CMAKE_CL_NOLOGO "/nologo") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") + set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup") + set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup") + set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") +else() + set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") + set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") + set(_PLATFORM_LINK_FLAGS "") +endif() + +set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1) +if(CMAKE_GENERATOR MATCHES "Visual Studio 6") + set (CMAKE_NO_BUILD_TYPE 1) + set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 0) # not implemented for VS6 +endif() +if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + set (CMAKE_NO_BUILD_TYPE 1) +endif() + +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + set(MSVC_IDE 1) +else() + set(MSVC_IDE 0) +endif() + +if(NOT MSVC_VERSION) + if(CMAKE_C_SIMULATE_VERSION) + set(_compiler_version ${CMAKE_C_SIMULATE_VERSION}) + elseif(CMAKE_CXX_SIMULATE_VERSION) + set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION}) + elseif(CMAKE_Fortran_SIMULATE_VERSION) + set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION}) + elseif(CMAKE_C_COMPILER_VERSION) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + else() + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + endif() + if("${_compiler_version}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}") + endif() + + set(MSVC10) + set(MSVC11) + set(MSVC12) + set(MSVC14) + set(MSVC60) + set(MSVC70) + set(MSVC71) + set(MSVC80) + set(MSVC90) + set(CMAKE_COMPILER_2005) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE) + if(NOT "${_compiler_version}" VERSION_LESS 19) + set(MSVC14 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 18) + set(MSVC12 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 17) + set(MSVC11 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 16) + set(MSVC10 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 15) + set(MSVC90 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 14) + set(MSVC80 1) + set(CMAKE_COMPILER_2005 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13.10) + set(MSVC71 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13) + set(MSVC70 1) + else() + set(MSVC60 1) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + endif() +endif() + +if(MSVC_C_ARCHITECTURE_ID MATCHES 64 OR MSVC_CXX_ARCHITECTURE_ID MATCHES 64) + set(CMAKE_CL_64 1) +else() + set(CMAKE_CL_64 0) +endif() +if(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64) + set(CMAKE_CL_64 1) +endif() + +if("${MSVC_VERSION}" GREATER 1599) + set(MSVC_INCREMENTAL_DEFAULT ON) +endif() + +# default to Debug builds +set(CMAKE_BUILD_TYPE_INIT Debug) + +# Compute an architecture family from the architecture id. +foreach(lang C CXX) + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}") + if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM") + elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx") + endif() +endforeach() + +if(WINCE) + foreach(lang C CXX) + string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER) + endforeach() + + if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + elseif("${CMAKE_SYSTEM_VERSION}" STREQUAL "") + set(_CE_VERSION "500") + else() + message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}") + endif() + + set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE /DWINCE") + set(_PLATFORM_DEFINES_C " /D${_MSVC_C_ARCHITECTURE_FAMILY} /D_${_MSVC_C_ARCHITECTURE_FAMILY_UPPER}_") + set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_") + + set(_RTC1 "") + set(_FLAGS_C "") + set(_FLAGS_CXX " /GR /EHsc") + + foreach(lang C CXX) + if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(_PLATFORM_DEFINES_${lang} "${_PLATFORM_DEFINES_${lang}} /D${MSVC_${lang}_ARCHITECTURE_ID}") + if(MSVC_${lang}_ARCHITECTURE_ID MATCHES "^ARMV([45])I$") + set(_FLAGS_${lang} "${_FLAGS_${lang}} /QRarch${CMAKE_MATCH_1}T") + endif() + endif() + endforeach() + + set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib") + set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib") + + if (MSVC_VERSION LESS 1600) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib") + endif () +elseif(WINDOWS_PHONE OR WINDOWS_STORE) + set(_PLATFORM_DEFINES "/DWIN32") + set(_FLAGS_C " /DUNICODE /D_UNICODE") + set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc") + if(WINDOWS_PHONE) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib") + elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") + else() + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() +else() + set(_PLATFORM_DEFINES "/DWIN32") + + if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") + elseif(MSVC_VERSION GREATER 1310) + set(_RTC1 "/RTC1") + set(_FLAGS_CXX " /GR /EHsc") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") + else() + set(_RTC1 "/GZ") + set(_FLAGS_CXX " /GR /GX") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() + + if(MSVC_VERSION LESS 1310) + set(_FLAGS_C " /Zm1000${_FLAGS_C}") + set(_FLAGS_CXX " /Zm1000${_FLAGS_CXX}") + endif() +endif() + +set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +# set the machine type +if(MSVC_C_ARCHITECTURE_ID) + if(MSVC_C_ARCHITECTURE_ID MATCHES "^ARMV.I") + set(_MACHINE_ARCH_FLAG "/machine:THUMB") + elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(_MACHINE_ARCH_FLAG "/machine:ARM") + else() + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") + endif() +elseif(MSVC_CXX_ARCHITECTURE_ID) + if(MSVC_CXX_ARCHITECTURE_ID MATCHES "^ARMV.I") + set(_MACHINE_ARCH_FLAG "/machine:THUMB") + elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(_MACHINE_ARCH_FLAG "/machine:ARM") + else() + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") + endif() +elseif(MSVC_Fortran_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") +endif() +set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") +set(CMAKE_STATIC_LINKER_FLAGS_INIT "${CMAKE_STATIC_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") +unset(_MACHINE_ARCH_FLAG) + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype +# on versions that support it +set( MSVC_INCREMENTAL_YES_FLAG "") +if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE) + if(NOT MSVC_INCREMENTAL_DEFAULT) + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") + else() + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) + endif() +endif() + +if (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") +else () + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") +endif () +# for release and minsize release default to no incremental linking +set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + +macro(__windows_compiler_msvc lang) + if(NOT MSVC_VERSION LESS 1400) + # for 2005 make sure the manifest is put in the dll with mt + set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ") + set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ") + endif() + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") + + set(CMAKE_${lang}_COMPILE_OBJECT + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> /Fo<OBJECT> /Fd<TARGET_COMPILE_PDB>${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_LINK_EXECUTABLE + "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) + + if(NOT CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_INIT rc) + endif() + if(NOT CMAKE_RC_FLAGS_INIT) + set(CMAKE_RC_FLAGS_INIT "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}") + endif() + + enable_language(RC) +endmacro() diff --git a/Modules/Platform/Windows-NMcl.cmake b/Modules/Platform/Windows-NMcl.cmake new file mode 100644 index 0000000..7add0b0 --- /dev/null +++ b/Modules/Platform/Windows-NMcl.cmake @@ -0,0 +1,4 @@ +# this is for the numega compiler which is really a front +# end for visual studio, but adds memory checking code. + +include(Platform/Windows-cl) diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake new file mode 100644 index 0000000..0beba73 --- /dev/null +++ b/Modules/Platform/Windows-df.cmake @@ -0,0 +1,66 @@ +# compiler support for fortran CVF compiler on windows + +set(CMAKE_WINDOWS_OBJECT_PATH 1) +set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +set(CMAKE_LINK_LIBRARY_FLAG "") +set(WIN32 1) +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_CL_NOLOGO) +else() + set(CMAKE_CL_NOLOGO "/nologo") +endif() + +set(CMAKE_Fortran_MODDIR_FLAG "-module:") + +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + +set(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) + +# create a C++ static library +set(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") + +# compile a C++ file into an object file +set(CMAKE_Fortran_COMPILE_OBJECT + "<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /object:<OBJECT> <FLAGS> /compile_only <SOURCE>${CMAKE_END_TEMP_FILE}") + +set(CMAKE_Fortran_LINK_EXECUTABLE + "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + +set(CMAKE_CREATE_WIN32_EXE /winapp) +set(CMAKE_CREATE_CONSOLE_EXE ) + +if(CMAKE_GENERATOR MATCHES "Visual Studio 6") + set (CMAKE_NO_BUILD_TYPE 1) +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") + set (CMAKE_NO_BUILD_TYPE 1) +endif() +# does the compiler support pdbtype and is it the newer compiler + +set(CMAKE_BUILD_TYPE_INIT Debug) +set (CMAKE_Fortran_FLAGS_INIT "") +set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full") +set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/Optimize:2 /Define:NDEBUG") +set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/Optimize:1 /Define:NDEBUG") +set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/Optimize:1 /debug:full /Define:NDEBUG") + +set (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") + +# executable linker flags +set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +set (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES") +if (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") +else () + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") +endif () + +set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake new file mode 100644 index 0000000..3bc5444 --- /dev/null +++ b/Modules/Platform/Windows-wcl386.cmake @@ -0,0 +1,119 @@ +set(CMAKE_LIBRARY_PATH_FLAG "libpath ") +set(CMAKE_LINK_LIBRARY_FLAG "library ") +set(CMAKE_LINK_LIBRARY_FILE_FLAG "library") + +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_WCL_QUIET) + set(CMAKE_WLINK_QUIET) + set(CMAKE_LIB_QUIET) +else() + set(CMAKE_WCL_QUIET "-zq") + set(CMAKE_WLINK_QUIET "option quiet") + set(CMAKE_LIB_QUIET "-q") +endif() + +set(CMAKE_EXE_LINKER_FLAGS_INIT) +set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) +set(CMAKE_CREATE_CONSOLE_EXE "system nt" ) +set(CMAKE_SHARED_LINKER_FLAGS_INIT "system nt_dll") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "system nt_dll") +foreach(type SHARED MODULE EXE) + set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map") + set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map") +endforeach() + +set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string. + +set(CMAKE_RC_COMPILER "rc" ) + +set(CMAKE_BUILD_TYPE_INIT Debug) + +# single/multi-threaded /-bm +# static/DLL run-time libraries /-br +# default is setup for multi-threaded + DLL run-time libraries +set (CMAKE_C_FLAGS_INIT "-bt=nt -w3 -dWIN32 -br -bm") +set (CMAKE_CXX_FLAGS_INIT "-bt=nt -xs -w3 -dWIN32 -br -bm") +foreach(lang C CXX) + set (CMAKE_${lang}_FLAGS_DEBUG_INIT "-d2") + set (CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-s -os -d0 -dNDEBUG") + set (CMAKE_${lang}_FLAGS_RELEASE_INIT "-s -ot -d0 -dNDEBUG") + set (CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-s -ot -d1 -dNDEBUG") +endforeach() + +foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) + set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) + set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1) +endforeach() + +set(CMAKE_C_CREATE_IMPORT_LIBRARY + "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>") +set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) + +set(CMAKE_C_LINK_EXECUTABLE + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + + +set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) + +# compile a C++ file into an object file +set(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") + +# compile a C file into an object file +set(CMAKE_C_COMPILE_OBJECT + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}") + +# preprocess a C source file +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}") + +# preprocess a C++ source file +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") + +set(CMAKE_CXX_CREATE_SHARED_LIBRARY + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") +string(REPLACE " option implib=<TARGET_IMPLIB>" "" + CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + +# create a C shared library +set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) + +# create a C shared module +set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) + +# create a C++ static library +set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b <TARGET_QUOTED> <LINK_FLAGS> <OBJECTS> ") + +# create a C static library +set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) + +if(NOT _CMAKE_WATCOM_VERSION) + set(_CMAKE_WATCOM_VERSION 1) + if(CMAKE_C_COMPILER_VERSION) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + set(_compiler_id ${CMAKE_C_COMPILER_ID}) + else() + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + set(_compiler_id ${CMAKE_CXX_COMPILER_ID}) + endif() + set(WATCOM16) + set(WATCOM17) + set(WATCOM18) + set(WATCOM19) + if("${_compiler_id}" STREQUAL "OpenWatcom") + if("${_compiler_version}" VERSION_LESS 1.7) + set(WATCOM16 1) + endif() + if("${_compiler_version}" VERSION_EQUAL 1.7) + set(WATCOM17 1) + endif() + if("${_compiler_version}" VERSION_EQUAL 1.8) + set(WATCOM18 1) + endif() + if("${_compiler_version}" VERSION_EQUAL 1.9) + set(WATCOM19 1) + endif() + endif() +endif() diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake new file mode 100644 index 0000000..7d787dd --- /dev/null +++ b/Modules/Platform/Windows-windres.cmake @@ -0,0 +1 @@ +set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>") diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake new file mode 100644 index 0000000..9a937a7 --- /dev/null +++ b/Modules/Platform/Windows.cmake @@ -0,0 +1,44 @@ +set(WIN32 1) + +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") + set(WINCE 1) +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(WINDOWS_PHONE 1) +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(WINDOWS_STORE 1) +endif() + +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +set(CMAKE_IMPORT_LIBRARY_PREFIX "") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +set(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +set(CMAKE_DL_LIBS "") + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +if(CMAKE_GENERATOR MATCHES "Borland") + set(CMAKE_START_TEMP_FILE "@&&|\n") + set(CMAKE_END_TEMP_FILE "\n|") +endif() + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +if(CMAKE_GENERATOR MATCHES "NMake") + set(CMAKE_START_TEMP_FILE "@<<\n") + set(CMAKE_END_TEMP_FILE "\n<<") +endif() + +include(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#set(CMAKE_START_TEMP_FILE "") +#set(CMAKE_END_TEMP_FILE "") +#set(CMAKE_VERBOSE_MAKEFILE 1) + diff --git a/Modules/Platform/WindowsCE-MSVC-C.cmake b/Modules/Platform/WindowsCE-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsCE-MSVC-CXX.cmake b/Modules/Platform/WindowsCE-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsCE.cmake b/Modules/Platform/WindowsCE.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsCE.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake new file mode 100644 index 0000000..658de3b --- /dev/null +++ b/Modules/Platform/WindowsPaths.cmake @@ -0,0 +1,116 @@ + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# 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.) + +# Block multiple inclusion because "CMakeCInformation.cmake" includes +# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module +# "CMakeSystemSpecificInformation.cmake" already included it. +# The extra inclusion is a work-around documented next to the include() +# call, so this can be removed when the work-around is removed. +if(__WINDOWS_PATHS_INCLUDED) + return() +endif() +set(__WINDOWS_PATHS_INCLUDED 1) + +# Add the program-files folder(s) to the list of installation +# prefixes. +# +# Windows 64-bit Binary: +# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] +# ENV{ProgramFiles} = [C:\Program Files] +# ENV{ProgramW6432} = <not set> +# (executed from cygwin): +# ENV{ProgramFiles(x86)} = <not set> +# ENV{ProgramFiles} = [C:\Program Files] +# ENV{ProgramW6432} = <not set> +# +# Windows 32-bit Binary: +# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] +# ENV{ProgramFiles} = [C:\Program Files (x86)] +# ENV{ProgramW6432} = [C:\Program Files] +# (executed from cygwin): +# ENV{ProgramFiles(x86)} = <not set> +# ENV{ProgramFiles} = [C:\Program Files (x86)] +# ENV{ProgramW6432} = [C:\Program Files] +if(DEFINED "ENV{ProgramW6432}") + # 32-bit binary on 64-bit windows. + # The 64-bit program files are in ProgramW6432. + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}") + + # The 32-bit program files are in ProgramFiles. + if(DEFINED "ENV{ProgramFiles}") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") + endif() +else() + # 64-bit binary, or 32-bit binary on 32-bit windows. + if(DEFINED "ENV{ProgramFiles}") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") + endif() + set(programfilesx86 "ProgramFiles(x86)") + if(DEFINED "ENV{${programfilesx86}}") + # 64-bit binary. 32-bit program files are in ProgramFiles(x86). + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{${programfilesx86}}") + elseif(DEFINED "ENV{SystemDrive}") + # Guess the 32-bit program files location. + if(EXISTS "$ENV{SystemDrive}/Program Files (x86)") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + "$ENV{SystemDrive}/Program Files (x86)") + endif() + endif() +endif() + +# Add the CMake install location. +get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) +get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}") + +if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) + # Add other locations. + 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() + +if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH /) +endif() + +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH + ) + +# mingw can also link against dlls which can also be in /bin, so list this too +if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) + list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + "${CMAKE_INSTALL_PREFIX}/bin" + ) + if (CMAKE_STAGING_PREFIX) + list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + "${CMAKE_STAGING_PREFIX}/bin" + ) + endif() +endif() +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + "${_CMAKE_INSTALL_DIR}/bin" + /bin + ) + +list(APPEND CMAKE_SYSTEM_PROGRAM_PATH + ) diff --git a/Modules/Platform/WindowsPhone-MSVC-C.cmake b/Modules/Platform/WindowsPhone-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsPhone-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsPhone-MSVC-CXX.cmake b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsPhone.cmake b/Modules/Platform/WindowsPhone.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsPhone.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/WindowsStore-MSVC-C.cmake b/Modules/Platform/WindowsStore-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsStore-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsStore-MSVC-CXX.cmake b/Modules/Platform/WindowsStore-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsStore-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsStore.cmake b/Modules/Platform/WindowsStore.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsStore.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/Xenix.cmake b/Modules/Platform/Xenix.cmake new file mode 100644 index 0000000..47852f8 --- /dev/null +++ b/Modules/Platform/Xenix.cmake @@ -0,0 +1,2 @@ +include(Platform/UnixPaths) + diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake new file mode 100644 index 0000000..e1279ef --- /dev/null +++ b/Modules/Platform/eCos.cmake @@ -0,0 +1,65 @@ +# support for eCos http://ecos.sourceware.org + +# Guard against multiple inclusion, which e.g. leads to multiple calls to add_definition() #12987 +if(__ECOS_CMAKE_INCLUDED) + return() +endif() +set(__ECOS_CMAKE_INCLUDED TRUE) + +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty + +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +set(CMAKE_EXECUTABLE_SUFFIX ".elf") # same suffix as if built using UseEcos.cmake +set(CMAKE_DL_LIBS "" ) + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + + +include(Platform/UnixPaths) + +# eCos can be built only with gcc +get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) +if(CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT _IN_TC) + message(FATAL_ERROR "GNU gcc is required for eCos") +endif() +if(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) + message(FATAL_ERROR "GNU g++ is required for eCos") +endif() + +# find eCos system files +find_path(ECOS_SYSTEM_CONFIG_HEADER_PATH NAMES pkgconf/system.h) +find_library(ECOS_SYSTEM_TARGET_LIBRARY NAMES libtarget.a) + +if(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH) + message(FATAL_ERROR "Could not find eCos pkgconf/system.h. Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") +endif() + +if(NOT ECOS_SYSTEM_TARGET_LIBRARY) + message(FATAL_ERROR "Could not find eCos \"libtarget.a\". Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") +endif() + +get_filename_component(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_TARGET_LIBRARY}" PATH) +include_directories(${ECOS_SYSTEM_CONFIG_HEADER_PATH}) +add_definitions(-D__ECOS__=1 -D__ECOS=1) + +# special link commands for eCos executables +set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>") +set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>") + +# eCos doesn't support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +set(CMAKE_CXX_LINK_SHARED_LIBRARY ) +set(CMAKE_CXX_LINK_MODULE_LIBRARY ) +set(CMAKE_C_LINK_SHARED_LIBRARY ) +set(CMAKE_C_LINK_MODULE_LIBRARY ) + diff --git a/Modules/Platform/gas.cmake b/Modules/Platform/gas.cmake new file mode 100644 index 0000000..7d2bc84 --- /dev/null +++ b/Modules/Platform/gas.cmake @@ -0,0 +1,19 @@ +if(UNIX) + set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o) +else() + set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj) +endif() + +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>") + +set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY + "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "<CMAKE_RANLIB> <TARGET> ") + +set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE + "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +# to be done +set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) +set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) + diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake new file mode 100644 index 0000000..c1db259 --- /dev/null +++ b/Modules/Platform/kFreeBSD.cmake @@ -0,0 +1,4 @@ +# kFreeBSD looks just like Linux. +include(Platform/Linux) + +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*") diff --git a/Modules/Platform/syllable.cmake b/Modules/Platform/syllable.cmake new file mode 100644 index 0000000..69c108d --- /dev/null +++ b/Modules/Platform/syllable.cmake @@ -0,0 +1,33 @@ +# this is the platform file for the Syllable OS (http://www.syllable.org) +# Syllable is a free OS (GPL), which is mostly POSIX conform +# the linker accepts the rpath related arguments, but this is later on +# ignored by the runtime linker +# shared libs are found exclusively via the environment variable DLL_PATH, +# which may contain also dirs containing the special variable @bindir@ +# by default @bindir@/lib is part of DLL_PATH +# in order to run the cmake tests successfully it is required that also +# @bindir@/. and @bindir@/../lib are in DLL_PATH + + +set(CMAKE_DL_LIBS "dl") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +#set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() + +include(Platform/UnixPaths) + +# these are Syllable specific: +list(APPEND CMAKE_SYSTEM_PREFIX_PATH /usr/indexes) |