diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-02-22 14:55:04 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-02-22 14:55:04 (GMT) |
commit | 5d320f5c89fdb0a830a9f435e32c3cde3a8bd863 (patch) | |
tree | a79e9e3fbda396ebdf70e67b82d75144449af07d /fortran | |
parent | cab5c372bfc34773014c13a38ca8dc30d5a89441 (diff) | |
download | hdf5-5d320f5c89fdb0a830a9f435e32c3cde3a8bd863.zip hdf5-5d320f5c89fdb0a830a9f435e32c3cde3a8bd863.tar.gz hdf5-5d320f5c89fdb0a830a9f435e32c3cde3a8bd863.tar.bz2 |
[svn-r20141] Bring 1.8 r20139 cmake and windows changes to trunk
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/CMakeLists.txt | 131 | ||||
-rw-r--r-- | fortran/examples/CMakeLists.txt | 5 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 13 | ||||
-rw-r--r-- | fortran/testpar/CMakeLists.txt | 5 |
5 files changed, 1 insertions, 154 deletions
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index a4bfb17..1a6329f 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -2,142 +2,11 @@ cmake_minimum_required (VERSION 2.8) PROJECT (HDF5_F90 C CXX Fortran) #----------------------------------------------------------------------------- -# Detect name mangling convention used between Fortran and C -#----------------------------------------------------------------------------- -INCLUDE (FortranCInterface) -FortranCInterface_HEADER ( - ${HDF5_F90_BINARY_DIR}/FCMangle.h - MACRO_NAMESPACE "H5_FC_" - SYMBOL_NAMESPACE "H5_FC_" - SYMBOLS mysub mymod:my_sub -) - -FILE (STRINGS ${HDF5_F90_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)") -STRING (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) -SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}" PARENT_SCOPE) - -FILE (STRINGS ${HDF5_F90_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)") -STRING (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) -SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}" PARENT_SCOPE) - -#----------------------------------------------------------------------------- -# The provided CMake Fortran macros don't provide a general check function -# so this one is used for a sizeof test. -#----------------------------------------------------------------------------- -MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) - IF (NOT DEFINED ${VARIABLE}) - MESSAGE (STATUS "Testing Fortran ${FUNCTION}") - IF (CMAKE_REQUIRED_LIBRARIES) - SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ELSE (CMAKE_REQUIRED_LIBRARIES) - SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - ENDIF (CMAKE_REQUIRED_LIBRARIES) - FILE (WRITE - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f - "${CODE}" - ) - TRY_COMPILE (${VARIABLE} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - -# MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") -# MESSAGE ( "Test result ${OUTPUT}") -# MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - - IF (${VARIABLE}) - SET (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") - MESSAGE (STATUS "Testing Fortran ${FUNCTION} - OK") - FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" - ) - ELSE (${VARIABLE}) - MESSAGE (STATUS "Testing Fortran ${FUNCTION} - Fail") - SET (${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}") - FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") - ENDIF (${VARIABLE}) - ENDIF (NOT DEFINED ${VARIABLE}) -ENDMACRO (CHECK_FORTRAN_FEATURE) - -#----------------------------------------------------------------------------- -# Configure Checks which require Fortran compilation must go in here -# not in the main ConfigureChecks.cmake files, because if the user has -# no Fortran compiler, problems arise. -# -# Be careful with leading spaces here, do not remove them. -#----------------------------------------------------------------------------- -CHECK_FORTRAN_FEATURE(sizeof - " - PROGRAM main - i = sizeof(x) - END PROGRAM - " - FORTRAN_HAVE_SIZEOF -) - -CHECK_FORTRAN_FEATURE(RealIsNotDouble - " - MODULE type_mod - INTERFACE h5t - MODULE PROCEDURE h5t_real - MODULE PROCEDURE h5t_dble - END INTERFACE - CONTAINS - SUBROUTINE h5t_real(r) - REAL :: r - END SUBROUTINE h5t_real - SUBROUTINE h5t_dble(d) - DOUBLE PRECISION :: d - END SUBROUTINE h5t_dble - END MODULE type_mod - PROGRAM main - USE type_mod - REAL :: r - DOUBLE PRECISION :: d - CALL h5t(r) - CALL h5t(d) - END PROGRAM main - " - FORTRAN_DEFAULT_REAL_NOT_DOUBLE -) - -#----------------------------------------------------------------------------- -# Make sure generated files and modules are picked up correctly -#----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES ( - ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_F90_BINARY_DIR} -) - -#----------------------------------------------------------------------------- -# Add debug information (intel Fortran : JB) -#----------------------------------------------------------------------------- -IF (CMAKE_Fortran_COMPILER MATCHES ifort) - IF (WIN32) - SET (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE) - ENDIF (WIN32) -ENDIF (CMAKE_Fortran_COMPILER MATCHES ifort) - -#----------------------------------------------------------------------------- # Traverse source subdirectory #----------------------------------------------------------------------------- ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/src ${HDF5_F90_BINARY_DIR}/src) #----------------------------------------------------------------------------- -# When building utility executables we reuse these variables -#----------------------------------------------------------------------------- -#inherit EXE_EXT from parent HDF5 cmake project -#inherit MAKE_SYSTEM from parent HDF5 cmake project -#inherit CFG_INIT from parent HDF5 cmake project - -#----------------------------------------------------------------------------- # Build the Fortran Examples #----------------------------------------------------------------------------- IF (HDF5_BUILD_EXAMPLES) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index c0ddf32..b1a9b90 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -9,11 +9,6 @@ PROJECT (HDF5_F90_EXAMPLES C CXX Fortran) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) -LINK_DIRECTORIES ( - ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_F90_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) #----------------------------------------------------------------------------- # Define Sources diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 6a88eca..d5cbc1b 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -74,6 +74,7 @@ ADD_CUSTOM_COMMAND ( DEPENDS H5fortran_detect ) +INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) #----------------------------------------------------------------------------- ADD_EXECUTABLE (H5match_types ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 3c905e7..df370bf 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -5,19 +5,11 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) -LINK_DIRECTORIES ( - ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_F90_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) #----------------------------------------------------------------------------- # Add Test Lib #----------------------------------------------------------------------------- ADD_LIBRARY (${HDF5_F90_C_TEST_LIB_TARGET} ${LIB_TYPE} t.c) -# Must explicity add a dependency here to force the generation of headers -# which are created for ${HDF5_F90_C_LIB_TARGET} -#ADD_DEPENDENCIES(${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) TARGET_LINK_LIBRARIES (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} @@ -25,11 +17,6 @@ TARGET_LINK_LIBRARIES (${HDF5_F90_C_TEST_LIB_TARGET} H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} ${LIB_TYPE}) ADD_LIBRARY (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.f90) -# Must explicity add a dependency here to force the generation of headers -# which are created for ${HDF5_F90_C_LIB_TARGET} -ADD_DEPENDENCIES(${HDF5_F90_TEST_LIB_TARGET} - ${HDF5_F90_C_TEST_LIB_TARGET} -) SET (SHARED_LINK_FLAGS " ") IF (WIN32 AND NOT CYGWIN) IF (BUILD_SHARED_LIBS) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 9cfbae5..c94640a 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -5,11 +5,6 @@ PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) -LINK_DIRECTORIES ( - ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_F90_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) #----------------------------------------------------------------------------- # Add Tests |