Make configuration file compatible with Python3 and newer hdf5

This commit is contained in:
Guilhem Lavaux 2017-08-09 17:31:06 +03:00
parent c4f5029877
commit 8cbec6637c
3 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,5 @@
cmake_minimum_required(VERSION 3.6) cmake_minimum_required(VERSION 3.6)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
cmake_policy(SET CMP0012 OLD)
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}") list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}")
project(CosmoToolbox) project(CosmoToolbox)
@ -54,7 +53,7 @@ IF(YORICK_SUPPORT)
ENDIF((EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") OR (INTERNAL_NETCDF)) ENDIF((EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") OR (INTERNAL_NETCDF))
ENDIF(YORICK_SUPPORT) ENDIF(YORICK_SUPPORT)
find_program(CYTHON cython) find_program(CYTHON cython3 cython)
find_library(ZLIB z) find_library(ZLIB z)
find_library(DL_LIBRARY dl) find_library(DL_LIBRARY dl)
find_library(MATH_LIBRARY m) find_library(MATH_LIBRARY m)

View File

@ -1,10 +1,12 @@
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
"import distutils.sysconfig as cs; import os; v=cs.get_config_vars(); print(os.path.join(v['LIBDIR'],v['LDLIBRARY']));" "import distutils.sysconfig as cs; import os; import sys; v=cs.get_config_vars(); print(os.path.join(v['LIBDIR'],v['LDLIBRARY'])); sys.exit(0)"
RESULT_VARIABLE _PYLIB_SEARCH_SUCCESS RESULT_VARIABLE _PYLIB_SEARCH_SUCCESS
OUTPUT_VARIABLE _PYLIB_VALUES_OUTPUT OUTPUT_VARIABLE _PYLIB_VALUES_OUTPUT
ERROR_VARIABLE _PYLIB_ERROR_VALUE ERROR_VARIABLE _PYLIB_ERROR_VALUE
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
message(${_PYLIB_SEARCH_SUCCESS})
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
"import distutils.sysconfig as cs; import os; v=cs.get_config_vars(); print(v['INCLUDEPY']);" "import distutils.sysconfig as cs; import os; v=cs.get_config_vars(); print(v['INCLUDEPY']);"
RESULT_VARIABLE _PYINC_SEARCH_SUCCESS RESULT_VARIABLE _PYINC_SEARCH_SUCCESS

View File

@ -112,7 +112,12 @@ else (INTERNAL_HDF5)
cmessage(STATUS "HDF5 lib: ${HDF5_LIBRARIES}") cmessage(STATUS "HDF5 lib: ${HDF5_LIBRARIES}")
cmessage(STATUS "HDF5 includes: ${HDF5_INCLUDE_DIRS}") cmessage(STATUS "HDF5 includes: ${HDF5_INCLUDE_DIRS}")
cmessage(STATUS "HDF5 C lib: ${HDF5_C_LIBRARY}") cmessage(STATUS "HDF5 C lib: ${HDF5_C_LIBRARY}")
get_filename_component(HDF5_BIN_DIR ${HDF5_C_LIBRARY} DIRECTORY) cmessage(STATUS "HDF5 BIN: ${HDF5_BIN_DIR}")
foreach(hdf5lib IN LISTS HDF5_LIBRARIES)
if (${hdf5lib} MATCHES "(hdf5)|(HDF5)")
get_filename_component(HDF5_BIN_DIR ${hdf5lib} DIRECTORY)
endif()
endforeach()
cmessage(STATUS "HDF5 libpath: ${HDF5_BIN_DIR}") cmessage(STATUS "HDF5 libpath: ${HDF5_BIN_DIR}")
else() else()
cmessage(STATUS "Found HDF5 cmake config.") cmessage(STATUS "Found HDF5 cmake config.")