summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindHDF5.cmake19
-rw-r--r--Modules/Platform/AIX-VisualAge-Fortran.cmake1
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx16
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmLocalVisualStudio7Generator.h3
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx7
-rw-r--r--Source/kwsys/SystemTools.cxx73
-rw-r--r--Source/kwsys/SystemTools.hxx.in8
-rw-r--r--Source/kwsys/hash_fun.hxx.in24
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake2
-rw-r--r--Tests/CMakeLists.txt6
-rw-r--r--Tests/FortranOnly/CMakeLists.txt42
-rw-r--r--Tests/FortranOnly/checksayhello.cmake7
-rw-r--r--Tests/FortranOnly/checktestf2.cmake8
-rw-r--r--Tests/FortranOnly/hello.f5
-rw-r--r--Tests/FortranOnly/testf.f6
-rw-r--r--Tests/FortranOnly/world.f5
17 files changed, 158 insertions, 78 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 6f01ea0..bc60638 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -10,8 +10,8 @@
# are specified, then the find module will default to finding only the HDF5 C
# library. If one or more COMPONENTS are specified, the module will attempt to
# find the language bindings for the specified components. The only valid
-# components are C, CXX, Fortran, and HL. If the COMPONENTS argument is not
-# given, the module will attempt to find only the C bindings.
+# components are C, CXX, Fortran, HL, and Fortran_HL. If the COMPONENTS
+# argument is not given, the module will attempt to find only the C bindings.
#
# On UNIX systems, this module will read the variable HDF5_USE_STATIC_LIBRARIES
# to determine whether or not to prefer a static link to a dynamic link for HDF5
@@ -34,6 +34,8 @@
# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings
# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings
# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API
+# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran
+# bindings.
# HDF5_LIBRARIES - Required libraries for all requested bindings
# HDF5_FOUND - true if HDF5 was found on the system
# HDF5_LIBRARY_DIRS - the full set of library directories
@@ -67,6 +69,7 @@ set( HDF5_VALID_COMPONENTS
CXX
Fortran
HL
+ Fortran_HL
)
# Validate the list of find components.
@@ -189,6 +192,7 @@ if( NOT HDF5_FOUND )
set( HDF5_CXX_TARGET hdf5_cpp )
set( HDF5_HL_TARGET hdf5_hl )
set( HDF5_Fortran_TARGET hdf5_fortran )
+ set( HDF5_Fortran_HL_TARGET hdf5_hl_fortran )
foreach( _component ${HDF5_LANGUAGE_BINDINGS} )
list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location )
get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION )
@@ -211,7 +215,10 @@ if( NOT HDF5_FOUND )
set( HDF5_C_LIBRARY_NAMES_INIT hdf5 )
set( HDF5_HL_LIBRARY_NAMES_INIT hdf5_hl ${HDF5_C_LIBRARY_NAMES_INIT} )
set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} )
- set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran ${HDF5_C_LIBRARY_NAMES_INIT} )
+ set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran
+ ${HDF5_C_LIBRARY_NAMES_INIT} )
+ set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran
+ ${HDF5_Fortran_LIBRARY_NAMES_INIT} )
foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} )
if( HDF5_${LANGUAGE}_COMPILE_LINE )
@@ -222,8 +229,8 @@ if( NOT HDF5_FOUND )
HDF5_${LANGUAGE}_LIBRARY_NAMES
)
- # take a guess that the includes may be in the 'include' sibling directory
- # of a library directory.
+ # take a guess that the includes may be in the 'include' sibling
+ # directory of a library directory.
foreach( dir ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
list( APPEND HDF5_${LANGUAGE}_INCLUDE_FLAGS ${dir}/../include )
endforeach()
@@ -233,7 +240,7 @@ if( NOT HDF5_FOUND )
list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} )
# find the HDF5 include directories
- if(${LANGUAGE} STREQUAL "Fortran")
+ if(${LANGUAGE} MATCHES "Fortran.*")
set(HDF5_INCLUDE_FILENAME hdf5.mod)
else()
set(HDF5_INCLUDE_FILENAME hdf5.h)
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/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 1850c16..ef378f9 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -93,10 +93,18 @@ void cmLocalVisualStudio10Generator::Generate()
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
- cmVisualStudio10TargetGenerator tg(
- &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
- this->GetGlobalGenerator()));
- tg.Generate();
+ if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(l->second))
+ {
+ this->CreateSingleVCProj(l->first.c_str(),l->second);
+ }
+ else
+ {
+ cmVisualStudio10TargetGenerator tg(
+ &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
+ this->GetGlobalGenerator()));
+ tg.Generate();
+ }
}
this->WriteStampFiles();
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 3e76f59..525a5da 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1622,6 +1622,10 @@ WriteCustomRule(std::ostream& fout,
}
std::string script = this->ConstructScript(command, i->c_str());
+ if(this->FortranProject)
+ {
+ cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str());
+ }
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 4fdbc58..35f659f 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -75,6 +75,8 @@ public:
virtual void ReadAndStoreExternalGUID(const char* name,
const char* path);
+protected:
+ void CreateSingleVCProj(const char *lname, cmTarget &tgt);
private:
typedef cmVisualStudioGeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
@@ -85,7 +87,6 @@ private:
void WriteVCProjHeader(std::ostream& fout, const char *libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
- void CreateSingleVCProj(const char *lname, cmTarget &tgt);
void WriteVCProjFile(std::ostream& fout, const char *libName,
cmTarget &tgt);
void WriteConfigurations(std::ostream& fout,
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ac4296c..8cba84c 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1578,6 +1578,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
i != depends.end(); ++i)
{
cmTarget* dt = *i;
+ // skip fortran targets as they can not be processed by MSBuild
+ // the only reference will be in the .sln file
+ if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(*dt))
+ {
+ continue;
+ }
this->WriteString("<ProjectReference Include=\"", 2);
cmMakefile* mf = dt->GetMakefile();
std::string name = dt->GetName();
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index eefa7f5..c4aff4a 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -56,6 +56,7 @@
// support for realpath call
#ifndef _WIN32
+#include <sys/time.h>
#include <utime.h>
#include <limits.h>
#include <sys/wait.h>
@@ -281,71 +282,29 @@ extern int putenv (char *__string) __THROW;
}
#endif
-/* Implement floattime() for various platforms */
-// Taken from Python 2.1.3
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-# include <sys/timeb.h>
-# define HAVE_FTIME
-# if defined( __BORLANDC__)
-# define FTIME ftime
-# define TIMEB timeb
-# else // Visual studio?
-# define FTIME _ftime
-# define TIMEB _timeb
-# endif
-#elif defined( __CYGWIN__ ) || defined( __linux__ ) || defined(__APPLE__)
-# include <sys/time.h>
-# include <time.h>
-# define HAVE_GETTIMEOFDAY
-#endif
-
namespace KWSYS_NAMESPACE
{
+double SystemTools::GetTime(void)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+ return (429.4967296*ft.dwHighDateTime
+ + 0.0000001*ft.dwLowDateTime
+ - 11644473600.0);
+#else
+ struct timeval t;
+ gettimeofday(&t, 0);
+ return 1.0*double(t.tv_sec) + 0.000001*double(t.tv_usec);
+#endif
+}
+
class SystemToolsTranslationMap :
public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
{
};
-
-double
-SystemTools::GetTime(void)
-{
- /* There are three ways to get the time:
- (1) gettimeofday() -- resolution in microseconds
- (2) ftime() -- resolution in milliseconds
- (3) time() -- resolution in seconds
- In all cases the return value is a float in seconds.
- Since on some systems (e.g. SCO ODT 3.0) gettimeofday() may
- fail, so we fall back on ftime() or time().
- Note: clock resolution does not imply clock accuracy! */
-#ifdef HAVE_GETTIMEOFDAY
- {
- struct timeval t;
-#ifdef GETTIMEOFDAY_NO_TZ
- if (gettimeofday(&t) == 0)
-#else /* !GETTIMEOFDAY_NO_TZ */
- if (gettimeofday(&t, static_cast<struct timezone *>(NULL)) == 0)
-#endif /* !GETTIMEOFDAY_NO_TZ */
- return static_cast<double>(t.tv_sec) +
- static_cast<double>(t.tv_usec)*0.000001;
- }
-#endif /* !HAVE_GETTIMEOFDAY */
- {
-#if defined(HAVE_FTIME)
- struct TIMEB t;
- ::FTIME(&t);
- return static_cast<double>(t.time) +
- static_cast<double>(t.millitm) * static_cast<double>(0.001);
-#else /* !HAVE_FTIME */
- time_t secs;
- time(&secs);
- return static_cast<double>(secs);
-#endif /* !HAVE_FTIME */
- }
-}
-
// adds the elements of the env variable path to the arg passed in
void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env)
{
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index cf47923..fd2ed19 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -690,13 +690,7 @@ public:
* -----------------------------------------------------------------
*/
- /**
- * Get current time as a double. On certain platforms this will
- * return higher resolution than seconds:
- * (1) gettimeofday() -- resolution in microseconds
- * (2) ftime() -- resolution in milliseconds
- * (3) time() -- resolution in seconds
- */
+ /** Get current time in seconds since Posix Epoch (Jan 1, 1970). */
static double GetTime();
/**
diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in
index f21efc5..926ec92 100644
--- a/Source/kwsys/hash_fun.hxx.in
+++ b/Source/kwsys/hash_fun.hxx.in
@@ -38,7 +38,7 @@
#define @KWSYS_NAMESPACE@_hash_fun_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
+#include <@KWSYS_NAMESPACE@/FundamentalType.h>
#include <@KWSYS_NAMESPACE@/cstddef> // size_t
namespace @KWSYS_NAMESPACE@
@@ -110,6 +110,28 @@ struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; }
};
+// use long long or __int64
+#if @KWSYS_NAMESPACE@_USE_LONG_LONG
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<long long> {
+ size_t operator()(long long __x) const { return __x; }
+};
+
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<unsigned long long> {
+ size_t operator()(unsigned long long __x) const { return __x; }
+};
+#elif @KWSYS_NAMESPACE@_USE___INT64
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<__int64> {
+ size_t operator()(__int64 __x) const { return __x; }
+};
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<unsigned __int64> {
+ size_t operator()(unsigned __int64 __x) const { return __x; }
+};
+#endif // use long long or __int64
+
} // namespace @KWSYS_NAMESPACE@
#endif
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 7dd40cf..1620393 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2011)
SET(KWSYS_DATE_STAMP_MONTH 08)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 03)
+SET(KWSYS_DATE_STAMP_DAY 16)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 4bf83b7..757947e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -16,6 +16,8 @@ MACRO(ADD_TEST_MACRO NAME COMMAND)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
ENDMACRO(ADD_TEST_MACRO)
+INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
+
# Fake a user home directory to avoid polluting the real one.
IF(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
SET(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome")
@@ -155,6 +157,9 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
SET_TESTS_PROPERTIES(MissingSourceFile PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c")
+ IF(CMAKE_Fortran_COMPILER)
+ ADD_TEST_MACRO(FortranOnly FortranOnly)
+ ENDIF()
ADD_TEST_MACRO(COnly COnly)
ADD_TEST_MACRO(CxxOnly CxxOnly)
ADD_TEST_MACRO(IPO COnly/COnly)
@@ -1879,7 +1884,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# fortran does not work for IDE builds because
# CMAKE_STANDARD_LIBRARIES needs to be per language
IF(CMAKE_TEST_GENERATOR MATCHES "Make|KDevelop")
- INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
IF(CMAKE_Fortran_COMPILER)
ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND}
--build-and-test
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
new file mode 100644
index 0000000..3c4f0e7
--- /dev/null
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required (VERSION 2.8)
+project(FortranOnly Fortran)
+message("CTEST_FULL_OUTPUT ")
+
+# create a library with hello and world functions
+add_library(FortranOnlylib hello.f world.f)
+# create an executable that calls hello and world
+add_executable(FortranOnly testf.f)
+target_link_libraries(FortranOnly FortranOnlylib)
+
+# create a custom command that runs FortranOnly and puts
+# the output into the file testfhello.txt
+add_custom_command(OUTPUT ${FortranOnly_BINARY_DIR}/testfhello.txt
+ COMMAND ${FortranOnly_BINARY_DIR}/${CMAKE_CFG_INTDIR}/FortranOnly
+ > testfhello.txt)
+# create a second executable FortranOnly2 that has
+# testfhello.txt has an source file so that it will
+# run the above custom command.
+add_executable(FortranOnly2 testfhello.txt testf.f)
+target_link_libraries(FortranOnly2 FortranOnlylib)
+# create a custom target to check the content of testfhello.txt
+# by running the cmake script checktestf2.cmake
+add_custom_target(checktestf2 ALL
+ COMMAND ${CMAKE_COMMAND}
+ -P ${FortranOnly_SOURCE_DIR}/checktestf2.cmake)
+
+# create a custom target that runs FortranOnly exectuable and creates
+# a file out.txt that should have hello world in it.
+add_custom_target(sayhello ALL
+ COMMAND ${FortranOnly_BINARY_DIR}/${CMAKE_CFG_INTDIR}/FortranOnly > out.txt
+)
+# make sure stuff is built in the right order
+add_dependencies(checktestf2 FortranOnly2)
+add_dependencies(sayhello FortranOnly)
+add_dependencies(FortranOnly2 FortranOnly)
+
+# add a custom target that checkes that out.txt has the correct
+# content
+add_custom_target(checksayhello ALL
+ COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checksayhello.cmake
+ )
+add_dependencies(checksayhello sayhello)
diff --git a/Tests/FortranOnly/checksayhello.cmake b/Tests/FortranOnly/checksayhello.cmake
new file mode 100644
index 0000000..5352290
--- /dev/null
+++ b/Tests/FortranOnly/checksayhello.cmake
@@ -0,0 +1,7 @@
+file(READ out.txt IN)
+message("${IN}")
+if(IN MATCHES Hello AND IN MATCHES World)
+ message("Passed")
+else()
+ message(FATAL_ERROR "Hello world not found")
+endif()
diff --git a/Tests/FortranOnly/checktestf2.cmake b/Tests/FortranOnly/checktestf2.cmake
new file mode 100644
index 0000000..f0e6be3
--- /dev/null
+++ b/Tests/FortranOnly/checktestf2.cmake
@@ -0,0 +1,8 @@
+file(READ testfhello.txt IN)
+message("${IN}")
+if(IN MATCHES Hello AND IN MATCHES World)
+ message("Passed")
+else()
+ message(FATAL_ERROR "Hello world not found")
+endif()
+file(WRITE testfhello2.txt ${IN})
diff --git a/Tests/FortranOnly/hello.f b/Tests/FortranOnly/hello.f
new file mode 100644
index 0000000..63e6408
--- /dev/null
+++ b/Tests/FortranOnly/hello.f
@@ -0,0 +1,5 @@
+ SUBROUTINE HELLO
+
+ PRINT *, 'Hello'
+
+ END
diff --git a/Tests/FortranOnly/testf.f b/Tests/FortranOnly/testf.f
new file mode 100644
index 0000000..4909181
--- /dev/null
+++ b/Tests/FortranOnly/testf.f
@@ -0,0 +1,6 @@
+ PROGRAM TESTF
+
+ CALL HELLO()
+ CALL WORLD()
+
+ END
diff --git a/Tests/FortranOnly/world.f b/Tests/FortranOnly/world.f
new file mode 100644
index 0000000..deae3fa
--- /dev/null
+++ b/Tests/FortranOnly/world.f
@@ -0,0 +1,5 @@
+ SUBROUTINE WORLD
+
+ PRINT *, 'World!'
+
+ END