From d03eca80772c2290d6d06da9d7c4a978712218f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franck=20P=C3=A9rignon?= <franck.perignon@imag.fr> Date: Mon, 21 Mar 2011 15:17:12 +0000 Subject: [PATCH] Cmake, compil ppm --- .../Core/CMake/._LibFindMacros.cmake | Bin 4096 -> 0 bytes CMake-for-ppm/Core/CMake/FindMetis.cmake | 33 ------ CMake-for-ppm/Core/CMake/FindPPMCore.cmake | 42 -------- .../Core/CMake/FindPPMNumerics.cmake | 45 -------- CMake-for-ppm/Core/CMake/FindPPM_core.cmake | 36 ------- CMake-for-ppm/Core/CMake/LibFindMacros.cmake | 99 ------------------ .../Core/CMake/OutOfSourceBuild.cmake | 18 ---- CMake-for-ppm/Core/CMake/Tools.cmake | 78 -------------- CMake/FindMPI_Fortran.cmake | 1 - CMake/FindMetis.cmake | 1 + CMake/{ParmesTools.cmake => MyTools.cmake} | 0 CMake/TestFortranAcceptsFlag.cmake | 38 +++++++ HySoP/CMakeLists.txt | 10 +- .../interfaces/Fortran2Cpp/WrapFortran.f90 | 7 +- .../interfaces/ppm/wrap_ppm_topologies.f95 | 49 +++++++++ 15 files changed, 98 insertions(+), 359 deletions(-) delete mode 100644 CMake-for-ppm/Core/CMake/._LibFindMacros.cmake delete mode 100644 CMake-for-ppm/Core/CMake/FindMetis.cmake delete mode 100644 CMake-for-ppm/Core/CMake/FindPPMCore.cmake delete mode 100644 CMake-for-ppm/Core/CMake/FindPPMNumerics.cmake delete mode 100644 CMake-for-ppm/Core/CMake/FindPPM_core.cmake delete mode 100644 CMake-for-ppm/Core/CMake/LibFindMacros.cmake delete mode 100644 CMake-for-ppm/Core/CMake/OutOfSourceBuild.cmake delete mode 100644 CMake-for-ppm/Core/CMake/Tools.cmake rename CMake/{ParmesTools.cmake => MyTools.cmake} (100%) create mode 100644 CMake/TestFortranAcceptsFlag.cmake create mode 100644 HySoP/src/interfaces/ppm/wrap_ppm_topologies.f95 diff --git a/CMake-for-ppm/Core/CMake/._LibFindMacros.cmake b/CMake-for-ppm/Core/CMake/._LibFindMacros.cmake deleted file mode 100644 index 9bc11ed8b1b848548ec50409310d8221ebaa7fa4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeH~y-LJD5XUEi_)#2IRuZ<cO%BVm668QI2pTvWkxeooOZFq|?iKn7zJ;Bo&*Y1o zyWT0$#`<9Xu<U&7Fgw3)VE1?rb^r=qvzt41&o+uNI0)wqVDcXB;7>jPk~G-==%Ord z!;_bF1-u3O;ZI2t{7w9{HY(%8ATd+udBZ)Q^~L3tN44nC;@leLpc<rbemZ?k9*?rl z`(c*n&mwC@UMt>XUYKSn(dE~onhV{8ajbFKS8o4s-8_j+qvB{|osS)|i2xBG0z`la z5CI}U1c(3;AOb{SYYD`??|b)ywCsdq7M)qz8d+;>&xH1<y)c?f`NSl)o>h|TKJ3C< RJM`$|zvur+oItu-eFDn{K*j(7 diff --git a/CMake-for-ppm/Core/CMake/FindMetis.cmake b/CMake-for-ppm/Core/CMake/FindMetis.cmake deleted file mode 100644 index 8b6243449..000000000 --- a/CMake-for-ppm/Core/CMake/FindMetis.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# - Try to find Metis -# Once done, this will define -# -# Metis_FOUND - system has Metis -# Metis_INCLUDE_DIRS - the Metis include directories -# Metis_LIBRARIES - link these to use Metis -# -# Franck Perignon, jan. 2011, from http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries -# -# -include(LibFindMacros) - -# Use pkg-config to get hints about paths -libfind_pkg_check_modules(Metis_PKGCONF Metis) - -# Include dir -find_path( - Metis_INCLUDE_DIR - NAMES metis.h - PATHS ENV INCLUDE ENV PATH ${Metis_PKGCONF_INCLUDE_DIRS} -) - -# Finally the library itself -find_library( - Metis_LIBRARY - NAMES metis - PATHS ${Metis_PKGCONF_LIBRARY_DIRS} ENV LIBRARY_PATH ENV LD_LIBRARY_PATH - ) - -set(Metis_PROCESS_INCLUDES Metis_INCLUDE_DIR) -set(Metis_PROCESS_LIBS Metis_LIBRARY) -libfind_process(Metis) - diff --git a/CMake-for-ppm/Core/CMake/FindPPMCore.cmake b/CMake-for-ppm/Core/CMake/FindPPMCore.cmake deleted file mode 100644 index fd8825232..000000000 --- a/CMake-for-ppm/Core/CMake/FindPPMCore.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# - Try to find ppm_core library -# Once done, this will define -# -# PPMCore_FOUND - system has ppm_core -# PPMCore_INCLUDE_DIRS - the ppm_core include directories -# PPMCore_LIBRARIES - link these to use ppm_core -# -# LJK, Franck Perignon, jan. 2011 -# -# -include(LibFindMacros) - -# Use pkg-config to get hints about paths -libfind_pkg_check_modules(PPMCore_PKGCONF PPMCore) - -# Modules and headers location -find_path( - PPMCore_MODULES_DIR - NAMES ppm_module_alloc.mod - PATHS ENV INCLUDE ENV PATH ${PPMCore_PKGCONF_INCLUDE_DIRS} ${PPMCore}/include/Modules -) -find_path( - PPMCore_INCLUDE_DIR - NAMES ppm_error.h - PATHS ENV INCLUDE ENV PATH ${PPMCore_PKGCONF_INCLUDE_DIRS} ${PPMCore}/include/ -) - -# Finally the library itself -find_library( - PPMCore_LIBRARY - NAMES ppm_core - PATHS ${PPMCore_PKGCONF_LIBRARY_DIRS} ENV LIBRARY_PATH ENV LD_LIBRARY_PATH ${PPMCore}/lib - ) - -if(PPMCore_INCLUDE_DIR AND PPMCore_MODULES_DIR) - set(PPMCore_INCLUDE_DIR ${PPMCore_INCLUDE_DIR} ${PPMCore_MODULES_DIR}) -endif(PPMCore_INCLUDE_DIR AND PPMCore_MODULES_DIR) - -set(PPMCore_PROCESS_INCLUDES PPMCore_INCLUDE_DIR) -set(PPMCore_PROCESS_LIBS PPMCore_LIBRARY) -libfind_process(PPMCore) - diff --git a/CMake-for-ppm/Core/CMake/FindPPMNumerics.cmake b/CMake-for-ppm/Core/CMake/FindPPMNumerics.cmake deleted file mode 100644 index 2c89f80b6..000000000 --- a/CMake-for-ppm/Core/CMake/FindPPMNumerics.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# - Try to find ppmnumerics library -# Once done, this will define -# -# PPMNumerics_FOUND - system has ppm_numerics -# PPMNumerics_INCLUDE_DIRS - the ppm_numerics include directories -# PPMNumerics_LIBRARIES - link these to use ppm_numerics -# -# LJK, Franck Perignon, jan. 2011 -# -# -include(LibFindMacros) - -# Dependencies -libfind_package(PPMNumerics PPMCore) - -# Use pkg-config to get hints about paths -libfind_pkg_check_modules(PPMNumerics_PKGCONF PPMNumerics) - -# Modules and headers location -find_path( - PPMNumerics_MODULES_DIR - NAMES ppm_module_alloc.mod - PATHS ENV INCLUDE ENV PATH ${PPMNumerics_PKGCONF_INCLUDE_DIRS} -) - -find_path( - PPMNumerics_INCLUDE_DIR - NAMES ppm_error.h - PATHS ENV INCLUDE ENV PATH ${PPMNumerics_PKGCONF_INCLUDE_DIRS} -) - -# Finally the library itself -find_library( - PPMNumerics_LIBRARY - NAMES ppmcore - PATHS ${PPMNumerics_PKGCONF_LIBRARY_DIRS} ENV LIBRARY_PATH ENV LD_LIBRARY_PATH - ) - -if(PPMNumerics_INCLUDE_DIR AND PPMNumerics_MODULES_DIR) - set(PPMNumerics_INCLUDE_DIR ${PPMNumerics_INCLUDE_DIR} ${PPMNumerics_MODULES_DIR}) -endif(PPMNumerics_INCLUDE_DIR AND PPMNumerics_MODULES_DIR) - -set(PPMNumerics_PROCESS_INCLUDES PPMNumerics_INCLUDE_DIR) -set(PPMNumerics_PROCESS_LIBS PPMNumerics_LIBRARY) -libfind_process(PPMNumerics) diff --git a/CMake-for-ppm/Core/CMake/FindPPM_core.cmake b/CMake-for-ppm/Core/CMake/FindPPM_core.cmake deleted file mode 100644 index dc11d7909..000000000 --- a/CMake-for-ppm/Core/CMake/FindPPM_core.cmake +++ /dev/null @@ -1,36 +0,0 @@ -# - Try to find PPM_core library -# Once done, this will define -# -# PPM_core_FOUND - system has PPM_core -# PPM_core_INCLUDE_DIRS - the PPM_core include directories -# PPM_core_LIBRARIES - link these to use PPM_core -# -# Franck Perignon, jan. 2011, from http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries -# -# -include(LibFindMacros) - -# Use pkg-config to get hints about paths -libfind_pkg_check_modules(PPM_core_PKGCONF PPM_core) - -# Include dir -find_path( - PPM_core_INCLUDE_DIR - NAMES ppm_param.h - PATHS ENV INCLUDE ENV PATH ${PPM_core_PKGCONF_INCLUDE_DIRS} -) - -# Finally the library itself -find_library( - PPM_core_LIBRARY - NAMES ppmcore - PATHS ${PPM_core_PKGCONF_LIBRARY_DIRS} ENV LIBRARY_PATH ENV LD_LIBRARY_PATH - ) -if(PPM_core_INCLUDE_DIR) - set(PPM_core_INCLUDE_DIR ${PPM_core_INCLUDE_DIR} ${PPM_core_INCLUDE_DIR}/Modules) -endif(PPM_core_INCLUDE_DIR) - -set(PPM_core_PROCESS_INCLUDES PPM_core_INCLUDE_DIR) -set(PPM_core_PROCESS_LIBS PPM_core_LIBRARY) -libfind_process(PPM_core) - diff --git a/CMake-for-ppm/Core/CMake/LibFindMacros.cmake b/CMake-for-ppm/Core/CMake/LibFindMacros.cmake deleted file mode 100644 index 69975c51b..000000000 --- a/CMake-for-ppm/Core/CMake/LibFindMacros.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments -# used for the current package. For this to work, the first parameter must be the -# prefix of the current package, then the prefix of the new package etc, which are -# passed to find_package. -macro (libfind_package PREFIX) - set (LIBFIND_PACKAGE_ARGS ${ARGN}) - if (${PREFIX}_FIND_QUIETLY) - set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET) - endif (${PREFIX}_FIND_QUIETLY) - if (${PREFIX}_FIND_REQUIRED) - set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED) - endif (${PREFIX}_FIND_REQUIRED) - find_package(${LIBFIND_PACKAGE_ARGS}) -endmacro (libfind_package) - -# CMake developers made the UsePkgConfig system deprecated in the same release (2.6) -# where they added pkg_check_modules. Consequently I need to support both in my scripts -# to avoid those deprecated warnings. Here's a helper that does just that. -# Works identically to pkg_check_modules, except that no checks are needed prior to use. -macro (libfind_pkg_check_modules PREFIX PKGNAME) - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - include(UsePkgConfig) - pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(${PREFIX} ${PKGNAME}) - endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) -endmacro (libfind_pkg_check_modules) - -# Do the final processing once the paths have been detected. -# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain -# all the variables, each of which contain one include directory. -# Ditto for ${PREFIX}_PROCESS_LIBS and library files. -# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. -# Also handles errors in case library detection was required, etc. -macro (libfind_process PREFIX) - # Skip processing if already processed during this run - if (NOT ${PREFIX}_FOUND) - # Start with the assumption that the library was found - set (${PREFIX}_FOUND TRUE) - - # Process all includes and set _FOUND to false if any are missing - foreach (i ${${PREFIX}_PROCESS_INCLUDES}) - if (${i}) - set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}}) - mark_as_advanced(${i}) - else (${i}) - set (${PREFIX}_FOUND FALSE) - endif (${i}) - endforeach (i) - - # Process all libraries and set _FOUND to false if any are missing - foreach (i ${${PREFIX}_PROCESS_LIBS}) - if (${i}) - set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}}) - mark_as_advanced(${i}) - else (${i}) - set (${PREFIX}_FOUND FALSE) - endif (${i}) - endforeach (i) - - # Print message and/or exit on fatal error - if (${PREFIX}_FOUND) - if (NOT ${PREFIX}_FIND_QUIETLY) - message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") - endif (NOT ${PREFIX}_FIND_QUIETLY) - else (${PREFIX}_FOUND) - if (${PREFIX}_FIND_REQUIRED) - foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) - message("${i}=${${i}}") - endforeach (i) - message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.") - endif (${PREFIX}_FIND_REQUIRED) - endif (${PREFIX}_FOUND) - endif (NOT ${PREFIX}_FOUND) -endmacro (libfind_process) - -macro(libfind_library PREFIX basename) - set(TMP "") - if(MSVC80) - set(TMP -vc80) - endif(MSVC80) - if(MSVC90) - set(TMP -vc90) - endif(MSVC90) - set(${PREFIX}_LIBNAMES ${basename}${TMP}) - if(${ARGC} GREATER 2) - set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2}) - string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES}) - set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP}) - endif(${ARGC} GREATER 2) - find_library(${PREFIX}_LIBRARY - NAMES ${${PREFIX}_LIBNAMES} - PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS} - ) -endmacro(libfind_library) - diff --git a/CMake-for-ppm/Core/CMake/OutOfSourceBuild.cmake b/CMake-for-ppm/Core/CMake/OutOfSourceBuild.cmake deleted file mode 100644 index c7323e984..000000000 --- a/CMake-for-ppm/Core/CMake/OutOfSourceBuild.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# -# Use this to force out-of source build. -# -option(IN_SOURCE_BUILD "Switch to on if you really want a build in the source directory." OFF) - -if(NOT IN_SOURCE_BUILD) - if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "CMake generation for this library is not allowed within the source directory! -Remove the CMakeCache.txt file and try again from another folder, e.g.: - - rm CMakeCache.txt - cd <somewhere (preferably a local place on your computer and not a network folder)> - cmake <source directory> - -If you really need an in source build, then run : cmake -DIN_SOURCE_BUILD=ON -") - endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) -endif(NOT IN_SOURCE_BUILD) diff --git a/CMake-for-ppm/Core/CMake/Tools.cmake b/CMake-for-ppm/Core/CMake/Tools.cmake deleted file mode 100644 index 6f4a5654b..000000000 --- a/CMake-for-ppm/Core/CMake/Tools.cmake +++ /dev/null @@ -1,78 +0,0 @@ -include(LibFindMacros) - -# Basic list manipulation -macro(CAR var) - set(${var} ${ARGV1}) -endmacro(CAR) - -macro(CDR var junk) - set(${var} ${ARGN}) -endmacro(CDR) - -# LIST(APPEND ...) is not correct on <COMPILER>_FLAGS -macro(APPEND_FLAGS) - CAR(_V ${ARGV}) - CDR(_F ${ARGV}) - set(${_V} "${${_V}} ${_F}") -endmacro(APPEND_FLAGS) - - -# Add all dirs in _DIRS into the searched directories for include files -# Set, for dir in _DIRS: -# - ${PROJECT_NAME}_INCLUDE_DIRECTORIES -# - ${PROJECT_NAME}_REMEMBER_INC_${dir} (to avoid multiple sets) -macro(REMEMBER_INCLUDE_DIRECTORIES _DIRS) - foreach(_D ${_DIRS}) - if(NOT ${PROJECT_NAME}_REMEMBER_INC_${_D}) - set(${PROJECT_NAME}_REMEMBER_INC_${_D} TRUE) - list(APPEND ${PROJECT_NAME}_INCLUDE_DIRECTORIES ${_D}) - include_directories(${_DIRS}) - endif(NOT ${PROJECT_NAME}_REMEMBER_INC_${_D}) - endforeach(_D ${_DIRS}) -endmacro(REMEMBER_INCLUDE_DIRECTORIES _DIRS) - -# Add all dirs in _DIRS into the searched directories for linked libraries -# Set, for dir in _DIRS: -# - ${PROJECT_NAME}_LINK_DIRECTORIES -# - ${PROJECT_NAME}_REMEMBER_LINK_${dir} (to avoid multiple sets) -macro(REMEMBER_LINK_DIRECTORIES _DIRS) - foreach(_D ${_DIRS}) - if(NOT ${PROJECT_NAME}_REMEMBER_LINK_${_D}) - set(${PROJECT_NAME}_REMEMBER_LINK_${_D} TRUE) - list(APPEND ${PROJECT_NAME}_LINK_DIRECTORIES ${_D}) - link_directories(${_D}) - endif(NOT ${PROJECT_NAME}_REMEMBER_LINK_${_D}) - endforeach(_D ${_DIRS}) -endmacro(REMEMBER_LINK_DIRECTORIES _DIRS) - -# Add all libraries in _LIBS into the searched directories for linked libraries -# Set, for lib in _LIBS: -# - ${PROJECT_NAME}_LINK_LIBRARIES -# - ${PROJECT_NAME}_REMEMBER_LINK_LIBRARIES_${lib} (to avoid multiple sets) -macro(REMEMBER_LINK_LIBRARIES _LIBS) - foreach(_LIB ${_LIBS}) - if(NOT ${PROJECT_NAME}_REMEMBER_LINK_LIBRARIES_${_LIB}) - set(${PROJECT_NAME}_REMEMBER_LINK_LIBRARIES_${_LIB} TRUE) - list(APPEND ${PROJECT_NAME}_LINK_LIBRARIES ${_LIB}) - endif(NOT ${PROJECT_NAME}_REMEMBER_LINK_LIBRARIES_${_LIB}) - endforeach(_LIB ${_LIBS}) -endmacro(REMEMBER_LINK_LIBRARIES _LIBS) - -# The use of ADD_DEFINITION results in a warning with Fortran compiler -macro(APPEND_C_FLAGS) - APPEND_FLAGS(CMAKE_C_FLAGS ${ARGV}) -endmacro(APPEND_C_FLAGS) - -macro(APPEND_CXX_FLAGS) - APPEND_FLAGS(CMAKE_CXX_FLAGS ${ARGV}) -endmacro(APPEND_CXX_FLAGS) - -macro(APPEND_Fortran_FLAGS) - APPEND_FLAGS(CMAKE_Fortran_FLAGS ${ARGV}) -endmacro(APPEND_Fortran_FLAGS) - -# debug -macro(display V) - MESSAGE(STATUS "${V} = ${${V}}") -endmacro(display V) - diff --git a/CMake/FindMPI_Fortran.cmake b/CMake/FindMPI_Fortran.cmake index a22385ab8..cfad65598 100644 --- a/CMake/FindMPI_Fortran.cmake +++ b/CMake/FindMPI_Fortran.cmake @@ -16,7 +16,6 @@ # If mpiexec is not set, that means MPI has not been searched. Forced it if(NOT MPIEXEC) find_package(MPI REQUIRED) - message(STATUS "search MPI ...") endif(NOT MPIEXEC) set(_MPI_PREFIX_PATH) if(WIN32) diff --git a/CMake/FindMetis.cmake b/CMake/FindMetis.cmake index 8b6243449..34a918369 100644 --- a/CMake/FindMetis.cmake +++ b/CMake/FindMetis.cmake @@ -18,6 +18,7 @@ find_path( Metis_INCLUDE_DIR NAMES metis.h PATHS ENV INCLUDE ENV PATH ${Metis_PKGCONF_INCLUDE_DIRS} + PATH_SUFFIXES metis ) # Finally the library itself diff --git a/CMake/ParmesTools.cmake b/CMake/MyTools.cmake similarity index 100% rename from CMake/ParmesTools.cmake rename to CMake/MyTools.cmake diff --git a/CMake/TestFortranAcceptsFlag.cmake b/CMake/TestFortranAcceptsFlag.cmake new file mode 100644 index 000000000..73f3b1a1d --- /dev/null +++ b/CMake/TestFortranAcceptsFlag.cmake @@ -0,0 +1,38 @@ +# - Test Fortran compiler for a flag +# Check if the Fortran compiler accepts a flag +# +# Macro CHECK_Fortran_ACCEPTS_FLAG(FLAGS VARIABLE) - +# checks if the function exists +# FLAGS - the flags to try +# VARIABLE - variable to store the result +# +# F. Pérignon - LJK/CNRS - March 2011 +# From Kitware TestCXXAcceptsFlag.cmake +# + +MACRO(CHECK_Fortran_ACCEPTS_FLAG FLAGS VARIABLE) + IF(NOT DEFINED ${VARIABLE}) + MESSAGE(STATUS "Checking to see if Fortran compiler accepts flag ${FLAGS}") + FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/Dummy.f + "program TESTFortran + implicit none + print *, 'Hello' + end program ") + TRY_COMPILE(${VARIABLE} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/Dummy.f + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${FLAGS} + OUTPUT_VARIABLE OUTPUT) + IF(${VARIABLE}) + MESSAGE(STATUS "Checking to see if Fortran compiler accepts flag ${FLAGS} - yes") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler accepts the flag ${FLAGS} passed with " + "the following output:\n${OUTPUT}\n\n") + ELSE(${VARIABLE}) + MESSAGE(STATUS "Checking to see if Fortran compiler accepts flag ${FLAGS} - no") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran compiler accepts the flag ${FLAGS} failed with " + "the following output:\n${OUTPUT}\n\n") + ENDIF(${VARIABLE}) + ENDIF(NOT DEFINED ${VARIABLE}) +ENDMACRO(CHECK_Fortran_ACCEPTS_FLAG) diff --git a/HySoP/CMakeLists.txt b/HySoP/CMakeLists.txt index 14175281b..a892312a4 100644 --- a/HySoP/CMakeLists.txt +++ b/HySoP/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake) # Force out-of-source build include(OutOfSourceBuild) # Some usefull macros -include(ParmesTools) +include(MyTools) # User defined options option(VERBOSE_MODE "enable verbose mode for cmake exec. Default = on" ON) @@ -131,8 +131,8 @@ set(${PROJECT_NAME}_MAINSRCDIRS src/main ) -# List of the possible file names extensions -set(EXTS *.cxx *.hpp *.h *.f90) +# Matching expr for files to be compiled. +set(EXTS *.cxx *.hpp *.h *.f90 *.f95) # Note FP : we can also use cmake vars ${CMAKE_Fortran_SOURCE_FILE_EXTENSIONS} ${CMAKE_C_SOURCE_FILE_EXTENSIONS} ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS} # Source files list: @@ -143,7 +143,7 @@ foreach(_DIR ${${PROJECT_NAME}_SRCDIRS}) if(_DIR_FILES_EXT) list(APPEND ${PROJECT_NAME}_SRC ${_DIR_FILES_EXT}) endif(_DIR_FILES_EXT) - endforeach(_EXT ${_ALL_EXTS}) + endforeach(_EXT ${EXTS}) endforeach(_DIR ${${PROJECT_NAME}_SRCDIRS}) foreach(_DIR ${${PROJECT_NAME}_MAINSRCDIRS}) @@ -153,7 +153,7 @@ foreach(_DIR ${${PROJECT_NAME}_MAINSRCDIRS}) if(_DIR_FILES_EXT) list(APPEND ${PROJECT_NAME}_MAINSRC ${_DIR_FILES_EXT}) endif(_DIR_FILES_EXT) - endforeach(_EXT ${_ALL_EXTS}) + endforeach(_EXT ${EXTS}) endforeach(_DIR ${${PROJECT_NAME}_MAINSRCDIRS}) # -I diff --git a/HySoP/src/interfaces/Fortran2Cpp/WrapFortran.f90 b/HySoP/src/interfaces/Fortran2Cpp/WrapFortran.f90 index 9a5c2028c..7748dd0c4 100644 --- a/HySoP/src/interfaces/Fortran2Cpp/WrapFortran.f90 +++ b/HySoP/src/interfaces/Fortran2Cpp/WrapFortran.f90 @@ -5,7 +5,10 @@ module WrapFort implicit none public aliasF2C - + + real(kind=8) :: ref + integer, parameter :: real_kind = kind(ref) + !> A structure to bind C and fortran pointers type, bind(C), public :: C2FPtr integer (c_int) :: length @@ -19,7 +22,7 @@ contains subroutine aliasF2C(vectorC, vectorF, length) type(c_ptr),intent(inout) :: vectorC integer(c_int), intent(out) :: length - real(c_double), pointer, dimension(:) :: vectorF + real(kind=real_kind), pointer, dimension(:) :: vectorF if(.not.associated(vectorF) ) then stop 'Error, input Fortran vector is not associated' diff --git a/HySoP/src/interfaces/ppm/wrap_ppm_topologies.f95 b/HySoP/src/interfaces/ppm/wrap_ppm_topologies.f95 new file mode 100644 index 000000000..8f2de2eae --- /dev/null +++ b/HySoP/src/interfaces/ppm/wrap_ppm_topologies.f95 @@ -0,0 +1,49 @@ +!> Fortran 2003 interface to ppm routines related to topologies +module wrap_ppm_topologies + + use ppm_module_mktopo + use WrapFort + + implicit none + +contains + + !> Purely geometry-based decompositions + subroutine create_topology_geom(dimPb, topoid, decomp, assig, minPhys, maxPhys, bc, ghostsize, costPerProc) + + integer(kind=c_int), intent(in) :: dimPb + integer(kind=c_int), intent(inout) :: topoid + integer(kind=c_int), intent(inout) :: decomp + integer(kind=c_int), intent(in) :: assig + type(c_Ptr), intent(in), VALUE :: minPhys + type(c_Ptr), intent(in), VALUE :: maxPhys + type(c_Ptr), intent(in), VALUE :: bc + real(kind=real_kind), intent(in) :: ghostsize + type(c_ptr), intent(inout) :: costPerProc + + + ! Local vars + integer :: info + integer :: nbProcs = 3 ! TODO : input arg + real(kind=real_kind), pointer, dimension(:) :: cost => NULL() + real(kind=real_kind), pointer, dimension(:) ::min_phys => NULL(), max_phys => NULL() + integer, pointer, dimension(:) :: bcdef => NULL() + ! Wrap C pointers + call c_f_pointer (minPhys, min_phys, (/dimPb/)) + call c_f_pointer(maxPhys, max_phys, (/dimPb/)) + call c_f_pointer(bc, bcdef, (/dimPb/)) + + ! If cost is already allocated + if(c_associated(costPerProc)) then + call c_f_pointer(costPerProc, cost, (/nbProcs/)) + end if + + ! We skip optional vars for the moment ... + call ppm_topo_mkgeom_d(topoid, decomp,assig, min_phys, max_phys, bcdef, ghostsize, cost, info) + + call aliasF2C(costPerProc, cost, nbProcs) + + end subroutine create_topology_geom + + +end module wrap_ppm_topologies -- GitLab