Skip to content
Snippets Groups Projects
Commit 70166cb0 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

Check Python version mismatch, cleanup definitions

parent 0c3995c0
No related branches found
No related tags found
No related merge requests found
......@@ -210,7 +210,7 @@ option(OGS_ENABLE_ELEMENT_PYRAMID "Build FEM elements for pyramids." ON)
option(OGS_CHECK_HEADER_COMPILATION "Check header for standalone compilation." OFF)
option(OGS_USE_PYTHON "Interface with python" OFF)
option(OGS_USE_PYTHON "Interface with Python" OFF)
###################
### Definitions ###
......@@ -266,11 +266,6 @@ if(MSVC AND OGS_32_BIT)
endif()
# End Eigen
if(OGS_USE_PYTHON)
add_definitions(-DOGS_USE_PYTHON)
add_subdirectory(ThirdParty/pybind11)
endif()
if (OGS_FATAL_ABORT)
add_definitions(-DOGS_FATAL_ABORT)
endif()
......
......@@ -45,6 +45,37 @@ if(OGS_BUILD_SWMM)
set_target_properties(SWMM SwmmInterface PROPERTIES COMPILE_FLAGS /W0)
endif()
if(OGS_USE_PYTHON)
add_subdirectory(pybind11)
function(check_python_version_compatibility)
if(NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
return()
endif()
include(${VTK_DIR}/VTKConfig.cmake)
if(NOT ${VTK_WRAP_PYTHON})
return()
endif()
if(NOT EXISTS ${VTK_MODULES_DIR}/vtkPython.cmake)
return()
endif()
include(${VTK_MODULES_DIR}/vtkPython.cmake)
if (NOT "${vtkPython_LIBRARIES}" STREQUAL "${PYTHON_LIBRARIES}")
message(SEND_ERROR "Mismatch between VTK's and OpenGeoSys' Python "
"libraries: ${vtkPython_LIBRARIES} vs. ${PYTHON_LIBRARIES}. "
"This will lead to compilation or linking errors. "
"You can fix this error by using the same Python version for "
"OpenGeoSys as VTK is built with.")
endif()
endfunction()
check_python_version_compatibility()
endif()
if(OGS_BUILD_UTILS)
include(${PROJECT_SOURCE_DIR}/scripts/cmake/MetisSetup.cmake)
endif()
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