[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: [CMake] help with lahey (fortran) patch
From: Yngve Inntjore Levinsen <yngve.levinsen () gmail ! com>
Date: 2013-02-26 8:53:18
Message-ID: 512C77FE.2080306 () gmail ! com
[Download RAW message or body]
Hello,
I am in the process of preparing a patch proposal for the Lahey/Fujitsu
Fortran compiler (lf95). As I am not a programming expert nor a cmake
expert, I tried to base myself on the already available files for
Intel/NAG and friends in the Modules directory.
Some specific questions in addition to general feedback:
- There is a MODDIR and MODPATH flag for cmake/fortran, what is the
difference? For lf95 the flag --mod can have a list of paths separated
by ':', while -M can only get one path. I believe the latter is where
the created modules are placed.
- Adding "--staticlink". For me that makes sense since you usually want
to distribute the binaries to people which does not have lf95 libraries
available. What is the preference for cmake though? I notice for Intel
you do the opposite, and explicitly say that you want to link
dynamically to the Intel libraries..
- Did I get the flags correctly done? It is working in my tests but
maybe I still did something wrong..
- There are some extra recommended flags for lf95 in the documentation,
should they be turned on or will they be too specific? See page 50-51 of
this pdf: http://www.lahey.com/docs/UsersGuideEXP73_revD05.pdf
- Will this be correct on Windows? I don't have a machine to test...
- Where would I submit the proposal?
I attach both the patch and the output of "lf95 --help", since I suppose
not many people actually have this compiler available.. There is a
freely available documentation on the web for the very curious, which
you can find here: http://www.lahey.com/doc.htm
Cheers,
Yngve
["lahey.patch" (text/x-patch)]
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index f861e39..3debd0e 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -146,6 +146,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V")
set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler")
+ list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS LAHEY) # Lahey/Fujitsu..
+ set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_LAHEY "--version")
+ set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_LAHEY "Lahey/Fujitsu Fortran 95 Compiler")
+
# Try to identify the compiler.
set(CMAKE_Fortran_COMPILER_ID)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
diff --git a/Modules/Compiler/LAHEY-Fortran.cmake b/Modules/Compiler/LAHEY-Fortran.cmake
new file mode 100644
index 0000000..7d77d5f
--- /dev/null
+++ b/Modules/Compiler/LAHEY-Fortran.cmake
@@ -0,0 +1,8 @@
+include(Compiler/LAHEY)
+__compiler_lahey(Fortran)
+
+
+set(CMAKE_Fortran_MODDIR_FLAG "--mod ")
+set(CMAKE_Fortran_MODPATH_FLAG "-M ")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fix")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-nfix")
diff --git a/Modules/Compiler/LAHEY.cmake b/Modules/Compiler/LAHEY.cmake
new file mode 100644
index 0000000..c8bc219
--- /dev/null
+++ b/Modules/Compiler/LAHEY.cmake
@@ -0,0 +1,31 @@
+
+#=============================================================================
+# 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(__COMPILER_LAHEY)
+ return()
+endif()
+set(__COMPILER_LAHEY 1)
+
+macro(__compiler_lahey lang)
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "--verbose")
+
+ # Initial configuration flags.
+ set(CMAKE_${lang}_FLAGS_INIT "")
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -o0")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-os")
+ set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-o2")
+ set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g -o2")
+endmacro()
diff --git a/Modules/Platform/Linux-LAHEY-Fortran.cmake b/Modules/Platform/Linux-LAHEY-Fortran.cmake
new file mode 100644
index 0000000..7db7c6c
--- /dev/null
+++ b/Modules/Platform/Linux-LAHEY-Fortran.cmake
@@ -0,0 +1,11 @@
+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 "--shared")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-rpath,")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-rpath-link,-Xlinker,")
+set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,")
+# We want to link statically to lf95 specific libraries in all cases..
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "--staticlink")
["lf95-help.txt" (text/plain)]
usage: lf95 [@RESPFILE] [FILENAMES] [SWITCHES]
@RESPFILE is a file containing switches, file names, or other response files
FILENAMES are the names of source or object files
SWITCHES are option switches
You may mix command line switches in any order. They will be evaluated
from left to right, with the rightmost value used.
Option switches:
--[n]ap ensure consistent arithmetic precision
--block <value> set default block size for open statements
-[n]c suppress linking
--[n]chk checking
--[n]chkglobal global checking
--[n]co display compiler options
--[n]concc support carriage control characters in console I/O
-Cpp invoke C preprocessor
--[n]dal deallocate allocated arrays
--[n]dbl extend single precision reals to double precision
--[n]f95 turn on F95 conformance warnings
--file <name> use <name> literally as a file name
--[n]fix assume fixed form
-[n]g generate debugging information
-I <dir> directory containing include files
--include <dir1:dir2...> directory(s) containing include files
--[n]in no implicit typing
--[n]inline [<value>] inline user-defined procedures
--[n]info display informational messages
-l <name> specify library to link
-L <path> specify directory to find library in
--[n]li Lahey intrinsic procedures
--[n]long extend integer*4 to integer*8
--[n]lst create source listings
--[n]maxfatals <value> specify maximum fatal errors before stopping
--ml cdecl specify mixed language target
--mldefault cdecl specify default mixed language target
-M <dir> directory containing module files
--mod <dir1:dir2...> directory(s) containing module files
--o0 | -O0 no optimizations
--o1 | -O classical, memory, and interprocedural optimizations
--o2 --o1 plus loop and array optimizations
--out <name> | -o <name> specify output file name
--[n]ocl recognize Optimization Control Lines
--[n]openmp enable OpenMP directives
--[n]parallel automatic paralellization
--[n]pca protect constant arguments
--[n]prefetch Athlon and Pentium III optimizations
--[n]private set default private accessability
--[n]quad extend double precision reals to quad precision
--[n]quiet quiet compilation
--[n]sav save local variables
--[n]shared generate a shared library
--[n]sse2 optimize using SSE2 instructions
-static link with static libraries only
--[n]staticlink static link LF95 run-time only, dynamic link system
--[n]swm <args> suppress warning messages
--t4 generate 486 code
--tp generate Pentium code
--tpp generate Pentium Pro code
--tp4 generate Pentium 4 code
--threadheap <value> allocate thread storage on heap
--threads <value> number of threads
--[n]trace enable runtime error traceback
--[n]trap trap ndp exceptions
--[n]unroll <value> perform/control loop unrolling
--[n]varheap <value> allocate local variables on heap
--[n]verbose verbose mode
--[n]version display version information
--[n]warn display warnings
--[n]wide wide fixed-source format
--[n]wisk use Winteracter Starter Kit
--[n]wo warn if obsolescent feature
-x arg inline code
--[n]xref create cross reference listings
--[n]zfm use zero flush mode of SIMD floating point
--
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic