Commit d11c4ba6 authored by Nebil Ayape Katcho's avatar Nebil Ayape Katcho

Changes in cmake files for compiling crysfml with hdf5

Preprocessor directives have been removed from CFML_ILL_Instrm_Data.
parent e9cd8a90
Pipeline #7300 failed with stages
in 7 minutes
......@@ -46,12 +46,26 @@ endif()
set (CRYSFML_PREFIX ${CMAKE_INSTALL_PREFIX}/${CRYSFML_PREFIX})
message(STATUS "CrysFML installation path set to ${CRYSFML_PREFIX}")
# Include and library paths for HDF5.
# They must be set by the user.
if(DEFINED HDF5_INCLUDE_PATH)
set(HDF5_INCLUDE_PATH ${HDF5_INCLUDE_PATH} CACHE PATH "HDF5 include path")
else()
set(HDF5_INCLUDE_PATH "" CACHE PATH "HDF5 include path")
endif()
if(NOT DEFINED HDF5_LIBRARY_PATH)
set(HDF5_LIBRARY_PATH ${HDF5_LIBRARY_PATH} CACHE PATH "HDF5 library path")
else()
set(HDF5_LIBRARY_PATH "" CACHE PATH "HDF5 library path")
endif()
#################################
# Project section
#################################
# The project is declared. It is a Fortran project.
project(libcrysfml Fortran CXX)
project(libcrysfml Fortran)
# Set the a verbose make.
set(CMAKE_VERBOSE_MAKEFILE ON)
......@@ -81,9 +95,9 @@ if (NOT CRYSFML08)
set_compiler_flags()
# The subdirectories of the project.
add_subdirectory(Src)
if (USE_HDF)
add_subdirectory(SrcCpp)
endif()
#if (USE_HDF)
# add_subdirectory(SrcCpp)
#endif()
else()
include(set_compiler_flags_08)
set_compiler_flags_08()
......
......@@ -242,17 +242,17 @@ Module CFML_ILL_Instrm_Data
invert => Invert_A
use CFML_Diffraction_Patterns, only: Diffraction_Pattern_Type, Allocate_Diffraction_Pattern
#ifdef USE_HDF
use CFML_ILL_Instrm_Data_Nexus, only:fra1,Read_Numor_D19_NXS2,Read_Header_NXS,Get_Header_Numor_NXS, &
Read_Init_NXS,get_Header_ScanType_NXS,get_Header_Instr_Name_NXS, &
get_Header_SubT_NXS, &
Read_IntegerBloc_NXS,get_IntegerBloc_NXS, &
Read_FloatBloc_NXS,get_FloatBloc_NXS,&
Read_DataBlocParam_NXS,get_DataBlocTime_NXS,get_DataBlocMoni_NXS,&
get_DataBlocTotalCount_NXS,get_DataBlocAngle1_NXS,&
get_DataBlocDataFull_NXS
#endif
!#ifdef USE_HDF
! use CFML_ILL_Instrm_Data_Nexus, only:fra1,Read_Numor_D19_NXS2,Read_Header_NXS,Get_Header_Numor_NXS, &
! Read_Init_NXS,get_Header_ScanType_NXS,get_Header_Instr_Name_NXS, &
! get_Header_SubT_NXS, &
! Read_IntegerBloc_NXS,get_IntegerBloc_NXS, &
! Read_FloatBloc_NXS,get_FloatBloc_NXS,&
! Read_DataBlocParam_NXS,get_DataBlocTime_NXS,get_DataBlocMoni_NXS,&
! get_DataBlocTotalCount_NXS,get_DataBlocAngle1_NXS,&
! get_DataBlocDataFull_NXS
!#endif
!---- Variables ----!
Implicit none
......
......@@ -2,9 +2,9 @@
# Include section
#################################
if(USE_HDF)
add_definitions(-DUSE_HDF)
endif()
#if(USE_HDF)
# add_definitions(-DUSE_HDF)
#endif()
# Build crysfml_common library.
include(crysfml_common.cmake)
......@@ -15,4 +15,5 @@ include(crysfml.cmake)
# If GUI option is True, build also wcrysfml library.
if(GUI)
include(wcrysfml.cmake)
endif()
\ No newline at end of file
endif()
......@@ -6,6 +6,12 @@
set(SOURCES CFML_IO_Mess.f90
CFML_Optimization_SAn.f90)
# Add CFML_HDF5 module if USE_HDF5 = ON
if(USE_HDF)
include(hdf5.cmake)
set(SOURCES ${SOURCES} CFML_HDF5.f90)
endif()
# Set the optimization flags.
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${OPT_FLAGS})
......@@ -25,6 +31,10 @@ set(LIBRARY_NAME crysfml)
# This directory contains the crysfml_common library mod files.
include_directories(${CRYSFML_COMMON_MODULE_DIRECTORY})
if(USE_HDF)
include_directories(${HDF5_INCLUDE_PATH})
link_directories(${HDF5_LIBRARY_PATH})
endif()
# The crysfml library is the CONSOLE version of the library.
add_library(${LIBRARY_NAME} STATIC ${SOURCES} ${CRYSFML_COMMON_OBJECTS})
......@@ -32,6 +42,11 @@ add_library(${LIBRARY_NAME} STATIC ${SOURCES} ${CRYSFML_COMMON_OBJECTS})
# Add a dependency to crysfml_common to keep sure that the crysfml_common library will be built first.
add_dependencies(${LIBRARY_NAME} crysfml_common)
if(USE_HDF)
# The library is linked to hdf5
target_link_libraries(${LIBRARY_NAME} ${HDF5_LIBS})
endif()
# The directory where the crysfml specific module files will be stored.
set(CRYSFML_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/crysfml_modules)
......
macro(set_compiler_flags)
# Nullify all the Fortran flags.
set(CMAKE_Fortran_FLAGS "")
#set(CMAKE_Fortran_FLAGS "")
get_filename_component(COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME_WE)
......@@ -16,8 +16,7 @@ macro(set_compiler_flags)
set(OPT_FLAGS1 "/Od /check:noarg_temp_created ")
set(OPT_FLAGS2 "/Od /check:noarg_temp_created ")
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
set(CMAKE_Fortran_FLAGS_RELEASE "/Qopt-report=0 /nologo /fpp")
# set(CMAKE_Fortran_FLAGS_RELEASE "/Qopt-report=0 /nologo")
set(CMAKE_Fortran_FLAGS_RELEASE "/Qopt-report=0 /nologo")
set(OPT_FLAGS0 "/O0")
set(OPT_FLAGS "/O2 /Qparallel")
set(OPT_FLAGS1 "/Od")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment