Skip to content
Snippets Groups Projects
Commit 944dd4bc authored by Jean-Baptiste Keck's avatar Jean-Baptiste Keck
Browse files

Fix du cmake pour la génération de HySoP/hysop/f2hysop.pyf, ajout de...

Fix du cmake pour la génération de HySoP/hysop/f2hysop.pyf, ajout de FindSWIG.cmake pour corriger le bug de version trouvée.
parent 6aaec7fc
No related branches found
No related tags found
No related merge requests found
......@@ -78,12 +78,10 @@ find_library(FFTWFloat_MPI_LIBRARY
NAMES fftw3f_mpi
)
#other types for the CXX library
#find_library (FFTWL_LIB "fftw3l")
#find_library (FFTWQ_LIB "fftw3q")
set(FFTW_OTHER_LIBRARIES) # ${FFTW_LIB} ${FFTWF_LIB} ${FFTWL_LIB} ${FFTWQ_LIB})
find_library(FFTWLongDouble_LIBRARY NAMES fftw3l)
find_library(FFTW__float128_LIBRARY NAMES fftw3q)
set(FFTW_PROCESS_INCLUDES FFTW_INCLUDE_DIR)
set(FFTW_PROCESS_LIBS FFTW_LIBRARY FFTWFloat_LIBRARY FFTW_MPI_LIBRARY FFTWFloat_MPI_LIBRARY)# FFTW_OTHER_LIBRARIES)
set(FFTW_PROCESS_LIBS FFTW_LIBRARY FFTWFloat_LIBRARY FFTW_MPI_LIBRARY FFTWFloat_MPI_LIBRARY FFTWLongDouble_LIBRARY FFTW__float128_LIBRARY)
libfind_process(FFTW)
#.rst:
# FindSWIG
# --------
#
# Find SWIG
#
# This module finds an installed SWIG. It sets the following variables:
#
# ::
#
# SWIG_FOUND - set to true if SWIG is found
# SWIG_DIR - the directory where swig is installed
# SWIG_EXECUTABLE - the path to the swig executable
# SWIG_VERSION - the version number of the swig executable
#
#
#
# The minimum required version of SWIG can be specified using the
# standard syntax, e.g. find_package(SWIG 1.1)
#
# All information is collected from the SWIG_EXECUTABLE so the version
# to be found can be changed from the command line by means of setting
# SWIG_EXECUTABLE
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
# Copyright 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
# Copyright 2014 Sylvain Joubert <joubert.sy@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_program(SWIG_EXECUTABLE NAMES swig3.0 swig swig2.0)
if(SWIG_EXECUTABLE)
execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
OUTPUT_VARIABLE SWIG_swiglib_output
ERROR_VARIABLE SWIG_swiglib_error
RESULT_VARIABLE SWIG_swiglib_result)
if(SWIG_swiglib_result)
if(SWIG_FIND_REQUIRED)
message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
else()
message(STATUS "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
endif()
else()
string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output})
find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH)
if(SWIG_DIR)
set(SWIG_USE_FILE UseSWIG) #priority to CMAKE_MODULE_DIRECTORY (and not MODULE_PATH).
execute_process(COMMAND ${SWIG_EXECUTABLE} -version
OUTPUT_VARIABLE SWIG_version_output
ERROR_VARIABLE SWIG_version_output
RESULT_VARIABLE SWIG_version_result)
if(SWIG_version_result)
message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}")
else()
string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
SWIG_version_output "${SWIG_version_output}")
set(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE)
endif()
endif()
endif()
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
VERSION_VAR SWIG_VERSION )
mark_as_advanced(SWIG_DIR SWIG_VERSION)
......@@ -215,15 +215,15 @@ include(HySoPInstallSetup)
# Remark : this must be done before add_subdir below, since install process in src needs CMAKE_INSTALL_PREFIX
# to be properly set.
if(EXISTS ${CMAKE_SOURCE_DIR}/${PACKAGE_NAME}/.f2py_f2cmap)
if(EXISTS ${CMAKE_SOURCE_DIR}/${PYPACKAGE_NAME}/.f2py_f2cmap)
message(STATUS "Generate f2py map file ...")
configure_file(${CMAKE_SOURCE_DIR}/${PACKAGE_NAME}/.f2py_f2cmap
configure_file(${CMAKE_SOURCE_DIR}/${PYPACKAGE_NAME}/.f2py_f2cmap
${CMAKE_BINARY_DIR}/.f2py_f2cmap)
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/${PACKAGE_NAME}/f2hysop.pyf.in)
if(EXISTS ${CMAKE_SOURCE_DIR}/${PYPACKAGE_NAME}/f2hysop.pyf.in)
message(STATUS "Generate f2hysop.pyf (f2py main signature file) ...")
configure_file(${CMAKE_SOURCE_DIR}/${PACKAGE_NAME}/f2hysop.pyf.in
${CMAKE_SOURCE_DIR}/${PACKAGE_NAME}/f2hysop.pyf)
configure_file(${CMAKE_SOURCE_DIR}/${PYPACKAGE_NAME}/f2hysop.pyf.in
${CMAKE_SOURCE_DIR}/${PYPACKAGE_NAME}/f2hysop.pyf)
endif()
# ====== Create non-python (fortran) libraries (fftw and scales interfaces), if required =====
......@@ -311,7 +311,7 @@ if(WITH_LIB_CXX)
DEPENDS python-build
COMMAND cp `find ${CMAKE_CURRENT_BINARY_DIR}/build -name _${CPP_2_HYSOP}.so` ${HYSOP_CXX_LIBRARY}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build"
COMMENT "Copy c++ library")
COMMENT "Copy swig c++ library to link")
get_filename_component(CXX_DIR "${CMAKE_SOURCE_DIR}/src/hysop++" ABSOLUTE)
get_filename_component(CXX_MAIN_DIR "${CXX_DIR}/main" ABSOLUTE)
......
......@@ -78,13 +78,12 @@ def create_swig_extension(name, inc_dirs, src_dirs=None, sources=None):
for root, dirnames, filenames in os.walk(idir):
for filename in fnmatch.filter(filenames, '*.cpp'):
sources.append(os.path.join(root, filename))
else:
for sdir in src_dirs:
sources += glob.glob(os.path.join(sdir, '*.cpp'))
else:
for f in sources:
include_dirs.add(os.path.dirname(f))
#else:
#for f in sources:
#include_dirs.add(os.path.dirname(f))
sources.insert(0,swig_config_file)
include_dirs = list(include_dirs)
......@@ -239,7 +238,7 @@ else:
# --- C++ files and swig interface --
enable_cpp = "@WITH_LIB_CPP@"
enable_cpp = "@WITH_LIB_CXX@"
if enable_cpp:
# path to .i files
swig_include_dirs = [os.path.join('@CMAKE_SOURCE_DIR@','swig')]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment