mirror of https://github.com/ecmwf/eccodes.git
ECC-296 Clean up python CMakeLists
This commit is contained in:
parent
cad2ea0b4a
commit
cc54d6810a
|
@ -14,18 +14,7 @@ if( HAVE_PYTHON )
|
|||
#if( SWIG_FOUND AND PYTHONLIBS_FOUND )
|
||||
if( PYTHONLIBS_FOUND )
|
||||
|
||||
set(PYTHON_DEST_ECCODES "${INSTALL_LIB_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/eccodes" )
|
||||
set(PYTHON_DEST_GRIBAPI "${INSTALL_LIB_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/gribapi" )
|
||||
|
||||
file( RELATIVE_PATH relative_rpath "${CMAKE_INSTALL_PREFIX}/${PYTHON_DEST_ECCODES}" "${${PNAME}_FULL_INSTALL_LIB_DIR}" )
|
||||
|
||||
# debug_var( relative_rpath )
|
||||
|
||||
ecbuild_append_to_rpath( ${relative_rpath} )
|
||||
ecbuild_append_to_rpath( "../../lib" ) # for ctest to find the libs
|
||||
|
||||
# preparing for generating setup.py -- this may not be needed as cmake can do the swig + shared libs without libtool
|
||||
|
||||
if( NUMPY_FOUND )
|
||||
set( DATA_HANDLER "numpy" )
|
||||
else()
|
||||
|
@ -34,36 +23,26 @@ if( HAVE_PYTHON )
|
|||
set( _swig_c_wrapper swig_wrap_${DATA_HANDLER}.c )
|
||||
set( _swig_py_wrapper swig_wrap_${DATA_HANDLER}.py )
|
||||
|
||||
set( BUILD_DIR "${PROJECT_SOURCE_DIR}" ) # setup.py assumes build_dir is same as source_dir -- not true for cmake builds
|
||||
|
||||
set( LIB_PNG "${HAVE_LIBPNG}" )
|
||||
|
||||
set( LIB_JASPER ${HAVE_LIBJASPER} )
|
||||
if( HAVE_LIBJASPER )
|
||||
get_filename_component(JASPER_DIR ${JASPER_INCLUDE_DIR} PATH )
|
||||
endif()
|
||||
|
||||
set( LIB_OPENJPEG ${HAVE_LIBOPENJPEG} )
|
||||
if( HAVE_LIBOPENJPEG )
|
||||
get_filename_component(OPENJPEG_DIR ${OPENJPEG_INCLUDE_DIR} PATH )
|
||||
endif()
|
||||
|
||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PYTHON_INCLUDE_DIRS} )
|
||||
|
||||
configure_file( setup.py.in setup.py )
|
||||
|
||||
# compile swig interface
|
||||
|
||||
set(CMAKE_SWIG_FLAGS "")
|
||||
# set(CMAKE_SWIG_FLAGS "")
|
||||
|
||||
include_directories( ${PYTHON_INCLUDE_PATH} )
|
||||
# set_source_files_properties( gribapi_swig.i PROPERTIES C ON )
|
||||
|
||||
set_source_files_properties( gribapi_swig.i PROPERTIES C ON )
|
||||
|
||||
if( NUMPY_FOUND )
|
||||
set( CMAKE_SWIG_FLAGS "-DNUMPY" )
|
||||
include_directories( ${NUMPY_INCLUDE_DIRS} )
|
||||
endif()
|
||||
# if( NUMPY_FOUND )
|
||||
# set( CMAKE_SWIG_FLAGS "-DNUMPY" )
|
||||
# include_directories( ${NUMPY_INCLUDE_DIRS} )
|
||||
# endif()
|
||||
|
||||
####### Do not invoke swig. Use our own generated C wrapper file ######
|
||||
set( _gribapi_swig "_gribapi_swig${CMAKE_SHARED_LIBRARY_SUFFIX}" )
|
||||
|
@ -77,6 +56,7 @@ if( HAVE_PYTHON )
|
|||
# TYPE SHARED
|
||||
# NOINSTALL
|
||||
# SOURCES grib_interface.h grib_interface.c ${_swig_c_wrapper}
|
||||
# INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PYTHON_INCLUDE_DIRS}
|
||||
# LIBS eccodes ${PYTHON_LIBRARIES} )
|
||||
# Don't use the lib prefix. This is needed for the python case where a _modulename.so is generated
|
||||
#set_target_properties(_gribapi_swig PROPERTIES PREFIX "")
|
||||
|
|
|
@ -36,7 +36,7 @@ if with_openjpeg:
|
|||
add_attribute(libraries='openjpeg')
|
||||
|
||||
# assumes png is supplied by system paths -- may not be true
|
||||
png = @HAVE_PNG@
|
||||
png = @HAVE_LIBPNG@
|
||||
if png:
|
||||
add_attribute(libraries='png')
|
||||
|
||||
|
|
Loading…
Reference in New Issue