From 86327226ccc417d02006433aa7abd59496497d09 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 10 Feb 2011 16:12:45 -0500 Subject: [svn-r20079] Correct Fortran handling in CMake files Tested: local: linux --- CMakeLists.txt | 8 ++- MANIFEST | 1 + config/cmake/HDF5UseFortran.cmake | 121 ++++++++++++++++++++++++++++++++++ fortran/CMakeLists.txt | 131 ------------------------------------- fortran/examples/CMakeLists.txt | 5 -- fortran/src/CMakeLists.txt | 1 + fortran/test/CMakeLists.txt | 13 ---- fortran/testpar/CMakeLists.txt | 10 +-- hl/CMakeLists.txt | 2 +- hl/fortran/CMakeLists.txt | 22 +------ hl/fortran/examples/CMakeLists.txt | 6 +- hl/fortran/src/CMakeLists.txt | 49 +++++--------- hl/fortran/test/CMakeLists.txt | 12 ++-- release_docs/USING_Windows.txt | 89 ++++++++++++++++--------- 14 files changed, 218 insertions(+), 252 deletions(-) create mode 100644 config/cmake/HDF5UseFortran.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dd9551..e531dd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -838,11 +838,12 @@ SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") IF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") OPTION (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) IF (HDF5_BUILD_FORTRAN) + INCLUDE (${HDF5_RESOURCES_DIR}/HDF5UseFortran.cmake) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran) IF (HDF5_BUILD_HL_LIB) IF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") #-- Build the High Level Fortran source codes - ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl/fortran ${HDF5_BINARY_DIR}/hl/fortran) + ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl/fortran ${PROJECT_BINARY_DIR}/hl/fortran) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") ENDIF (HDF5_BUILD_HL_LIB) ENDIF (HDF5_BUILD_FORTRAN) @@ -1041,7 +1042,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) ELSE (WIN32 AND NOT CYGWIN) SET (release_files ${release_files} - ${HDF5_SOURCE_DIR}/release_docs/INSTALL_cygwin.txt + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Cygwin.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL_MinGW.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL_VMS.txt ) @@ -1077,7 +1078,8 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) SET (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") ENDIF (EXISTS "${HDF5_SOURCE_DIR}/release_docs") SET (CPACK_PACKAGE_RELOCATABLE TRUE) - + #only needed for cmake 2.8.3 + SET (CPACK_MONOLITHIC_INSTALL 1) IF (WIN32) SET (CPACK_NSIS_CONTACT "help@hdfgroup.org") SET (CPACK_NSIS_MODIFY_PATH ON) diff --git a/MANIFEST b/MANIFEST index f0042b1..e07d44e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1975,6 +1975,7 @@ ./config/cmake/hdf5-config.cmake.install.in ./config/cmake/hdf5-config-version.cmake.in ./config/cmake/HDF5Macros.cmake +./config/cmake/HDF5UseFortran.cmake ./config/cmake/libhdf5.settings.cmake.in ./config/cmake/cacheinit.cmake ./config/cmake/mccacheinit.cmake diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake new file mode 100644 index 0000000..1f429f5 --- /dev/null +++ b/config/cmake/HDF5UseFortran.cmake @@ -0,0 +1,121 @@ +# +# This file provides functions for Fortran support. +# +#------------------------------------------------------------------------------- +ENABLE_LANGUAGE (Fortran) + +#----------------------------------------------------------------------------- +# Detect name mangling convention used between Fortran and C +#----------------------------------------------------------------------------- +INCLUDE (FortranCInterface) +FortranCInterface_HEADER ( + ${CMAKE_BINARY_DIR}/FCMangle.h + MACRO_NAMESPACE "H5_FC_" + SYMBOL_NAMESPACE "H5_FC_" + SYMBOLS mysub mymod:my_sub +) + +FILE (STRINGS ${CMAKE_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}") + +FILE (STRINGS ${CMAKE_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}") + +#----------------------------------------------------------------------------- +# 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 +) + +#----------------------------------------------------------------------------- +# 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) 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..af9d5a3 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}) #----------------------------------------------------------------------------- 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..c0ab1f9 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -5,11 +5,11 @@ 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} -) +#LINK_DIRECTORIES ( +# ${CMAKE_Fortran_MODULE_DIRECTORY} +# ${HDF5_F90_BINARY_DIR} +# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +#) #----------------------------------------------------------------------------- # Add Tests diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 9ce3043..0c0ad91 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 2.8) -PROJECT (HDF5_HL) +PROJECT (HDF5_HL C CXX) #----------------------------------------------------------------------------- # Shared Libs diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt index 4c2256c..1fd6de0 100644 --- a/hl/fortran/CMakeLists.txt +++ b/hl/fortran/CMakeLists.txt @@ -1,25 +1,5 @@ cmake_minimum_required (VERSION 2.8) -PROJECT(HDF5_HL_F90 C CXX Fortran) - -#----------------------------------------------------------------------------- -# Setup include Directories -#----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_F90_SRC_DIR}/src) -INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR}) -INCLUDE_DIRECTORIES (${HDF5_F90_SRC_BINARY_DIR}) -INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY}) - -LINK_DIRECTORIES (${HDF5_SRC_DIR} ${HDF5_F90_SRC_DIR}/src ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - -#----------------------------------------------------------------------------- -# 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) +PROJECT (HDF5_HL_F90 C CXX Fortran) #----------------------------------------------------------------------------- # List Source files diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 698407d..2f56297 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -4,12 +4,10 @@ PROJECT (HDF5_HL_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 ( +INCLUDE_DIRECTORIES ( ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_HL_F90_BINARY_DIR} ${HDF5_F90_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + ${HDF5_F90_SRC_DIR}/src ) SET (examples diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index ca0a35f..d6f522c 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -5,50 +5,38 @@ PROJECT(HDF5_HL_F90_SRC C CXX Fortran) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES ( - ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_F90_BINARY_DIR} - ${HDF5_F90_SRC_DIR}/src - ${HDF5_F90_SRC_BINARY_DIR} - ${HDF5_HL_F90_SRC_SOURCE_DIR} ${HDF5_HL_SRC_DIR}/src -) -LINK_DIRECTORIES ( - ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_HL_F90_BINARY_DIR} + ${HDF5_F90_SRC_DIR}/src ${HDF5_F90_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ) + #----------------------------------------------------------------------------- -# List Source files +# hl_f90CStub lib #----------------------------------------------------------------------------- -SET (HDF5_HL_F90_F_SRCS - ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBff.f90 - ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.f90 - ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.f90 -) - SET (HDF5_HL_F90_C_SRCS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMcc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBfc.c ) +SET_SOURCE_FILES_PROPERTIES (${HDF5_HL_F90_C_SRCS} PROPERTIES LANGUAGE C) SET (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) +SET_SOURCE_FILES_PROPERTIES (${HDF5_HL_F90_HEADERS} PROPERTIES LANGUAGE C) ADD_LIBRARY (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_C_SRCS} ${HDF5_HL_F90_HEADERS}) -TARGET_LINK_LIBRARIES (${HDF5_HL_F90_C_LIB_TARGET} - ${HDF5_F90_C_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} -) -# -# To Ensure that generated files are built, we must force a dependency -ADD_DEPENDENCIES(${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET}) +TARGET_LINK_LIBRARIES (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) +SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") +H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} ${LIB_TYPE}) -SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT - "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}" +#----------------------------------------------------------------------------- +# Fortran Modules +#----------------------------------------------------------------------------- +SET (HDF5_HL_F90_F_SRCS + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBff.f90 + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.f90 + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.f90 ) -H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} ${LIB_TYPE}) ADD_LIBRARY (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_F_SRCS}) SET (SHARED_LINK_FLAGS " ") @@ -71,18 +59,13 @@ IF (WIN32 AND NOT CYGWIN) ENDIF (WIN32 AND NOT CYGWIN) TARGET_FORTRAN_WIN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} ${SHARED_LINK_FLAGS}) SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran) -TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET} - ${HDF5_HL_F90_C_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} -) +TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} ${LIB_TYPE}) -ADD_DEPENDENCIES (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET}) #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- - INSTALL ( DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/ diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 280089a..4fb2614 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -5,12 +5,12 @@ PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) # Add Tests #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) -LINK_DIRECTORIES ( - ${CMAKE_Fortran_MODULE_DIRECTORY} - ${HDF5_HL_F90_BINARY_DIR} - ${HDF5_F90_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) +#LINK_DIRECTORIES ( +# ${CMAKE_Fortran_MODULE_DIRECTORY} +# ${HDF5_HL_F90_BINARY_DIR} +# ${HDF5_F90_BINARY_DIR} +# ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +#) # Remove any output file left over from previous test run ADD_TEST ( diff --git a/release_docs/USING_Windows.txt b/release_docs/USING_Windows.txt index 03dbc67..578b5f0 100644 --- a/release_docs/USING_Windows.txt +++ b/release_docs/USING_Windows.txt @@ -125,8 +125,34 @@ Notes: HDF5 tool export library for DLL: release version - 2. Examples (Not included in the binary distribution) - + 2. Examples (Included in the binary distribution as a zip file) + + Unpack the examples into a folder (c:\MyHDFstuff\hdf5examples). + The resulting structure under this folder should be: + c++ + c++/examples + examples + fortran + fortran/examples + hl + hl/c++ + hl/c++/examples + hl/examples + hl/fortran + hl/fortran/examples + windows + windows/c++ + windows/c++/examples + windows/examples + windows/fortran + windows/fortran/examples + windows/hl + windows/hl/examples + windows/hl/fortran + windows/hl/fortran/examples + hdf5build_examples.bat + InstallExamples.bat + HDF5 examples: Simple HDF5 C/C++/Fortran and High level C/Fortran examples @@ -156,7 +182,7 @@ To build and test HDF5 C examples: Solution" option. Then open the solution - c:\MyHDFstuff\hdf5\windows\examples\allexamples\allexamples.sln. + c:\MyHDFstuff\hdf5examples\windows\examples\allexamples\allexamples.sln. 2. Select "Build", and "Configuration Manager". @@ -172,8 +198,8 @@ To build and test HDF5 C examples: Select "Build" -> "Build Solution" or "Rebuild Solution" to build release version of project "allexamples". - When the debug and release build is done, there should be the following - subdirectories in c:\MyHDFstuff\hdf5\examples\ + When the debug or release build is done, there should be the following + subdirectories in c:\MyHDFstuff\hdf5examples\examples\ attributetest attributetestdll @@ -193,11 +219,12 @@ To build and test HDF5 C examples: writetestdll 3. Invoke a command prompt window and run the batch file InstallExamples.bat - which resides in the top level directory (c:\MyHDFstuff\hdf5). This file + which resides in the top level directory (c:\MyHDFstuff\hdf5examples). This file creates 4 new directories, examplesREL, examplesRELDLL, examplesDBG, and - examplesDBGDLL, in the c:\MyHDFstuff\hdf5\examples directory and places - all the executables in it. Both the release and debug versions of the - examples should be built before this step is done. + examplesDBGDLL, in the c:\MyHDFstuff\hdf5examples\examples directory and places + all the executables in it. If one of the release or debug versions of the examples is not + built before this step is done, messages about files not found can be + ignored. 4. We provide a batch file named testExamples.bat and an expected examples tests output file named testExamples_exp_output.txt in @@ -225,24 +252,24 @@ To build and test HDF5 C++ examples: Solution" option. Then open the solution - c:\MyHDFstuff\hdf5\windows\examples\allexamples\allcppexamples.sln. + c:\MyHDFstuff\hdf5examples\windows\examples\allexamples\allcppexamples.sln. 2. Select "Build", and "Configuration Manager". - 2.1 To build debug versions of C examples: + 2.1 To build release versions of C examples. - In "Active Solution Configuration", select "Debug". Select "Close". + In "Active Solution Configuration", select "Release". Select "Close". Select "Build" -> "Build Solution" or "Rebuild Solution" to build - debug version of project "allcppexamples". + release version of project "allcppexamples". - 2.2 To build release versions of C examples. + 2.2 To build debug versions of C examples: - In "Active Solution Configuration", select "Release". Select "Close". + In "Active Solution Configuration", select "Debug". Select "Close". Select "Build" -> "Build Solution" or "Rebuild Solution" to build - release version of project "allcppexamples". + debug version of project "allcppexamples". When the debug build or release build is done, there should be the following - subdirectories in c:\MyHDFstuff\hdf5\c++\examples\ + subdirectories in c:\MyHDFstuff\hdf5examples\c++\examples\ chunks chunksdll @@ -261,14 +288,15 @@ To build and test HDF5 C++ examples: 3. Invoke a command prompt window and run the batch file InstallcppExamples.bat which resides in the top level directory - (c:\MyHDFstuff\hdf5). This file creates 4 new directories, + (c:\MyHDFstuff\hdf5examples). This file creates 4 new directories, cppexamplesREL, cppexamplesRELDLL, cppexamplesDBG, and cppexamplesDBGDLL, - in the c:\MyHDFstuff\c++\examples directory and places all the executables - in it. Both the release and debug versions of the examples should be - built before this step is done. + in the c:\MyHDFstuff\hdf5examples\c++\examples directory and places all + the executables in it. If one of the release or debug versions of the + examples is not built before this step is done, messages about files not + found can be ignored. 4. We provide a batch file named testcppExamples.bat in - c:\MyHDFstuff\hdf5\c++\examples directory for you to test HDF5 C++ + c:\MyHDFstuff\hdf5examples\c++\examples directory for you to test HDF5 C++ examples. testcppExamples.bat batch file has 4 options: @@ -294,7 +322,7 @@ To build and test HDF5 High Level C examples: Solution" option. Then open the solution - c:\MyHDFstuff\hdf5\windows\hl\examples\allhlcexamples\allhlcexamples.sln + c:\MyHDFstuff\hdf5examples\windows\hl\examples\allhlcexamples\allhlcexamples.sln 2. Select "Build", and "Configuration Manager". @@ -310,7 +338,7 @@ To build and test HDF5 High Level C examples: Select "Build" -> "Build Solution" or "Rebuild Solution" to build release version of project "allhlcexamples". - When the debug and release build is done, binaries will be built in the + When the debug or release build is done, binaries will be built in the following subdirectories of c:\MyHDFstuff\hdf5\examples\ ex_image[1-2](dll) @@ -320,15 +348,16 @@ To build and test HDF5 High Level C examples: ptExample[FL+VL](dll) 3. Invoke a command prompt and run the batch file Install_hlcexamples.bat - which resides in the top level directory (c:\MyHDFstuff\hdf5). This file + which resides in the top level directory (c:\MyHDFstuff\hdf5examples). This file creates 4 new directories, HLCexamplesRELEASE, HLCexamplesRELEASEDLL, HLCexamplesDEBUG, and HLCexamplesDEBUGDLL, in the - c:\MyHDFstuff\hdf5\hl\examples directory and places all the executables in - it. Both the release and debug versions of the examples should be built - before this step is done. + c:\MyHDFstuff\hdf5examples\hl\examples directory and places all the executables in + it. If one of the release or debug versions of the examples is not + built before this step is done, messages about files not found can be + ignored. 4. We provide a batch file named test_hl_cexamples.bat in - c:\MyHDFstuff\hdf5\hl\examples directory for you to test HDF5 high level C + c:\MyHDFstuff\hdf5examples\hl\examples directory for you to test HDF5 high level C examples. test_hl_cexamples.bat batch file has 4 options: @@ -597,7 +626,7 @@ using the Visual C++ Development Environment. 1.1 Project name and location issues: It is recommended that you use the given directory structure for building - HDF5. However, it is possible to create your own structure. If you must + HDF5 Examples. However, it is possible to create your own structure. If you must install all.sln and all.vcproj in another directory, relative to hdf5 directory, you will be asked to locate the sub-project files, when you open the project all.sln. -- cgit v0.12