Skip to content
Snippets Groups Projects
Commit 86846b06 authored by Lars Bilke's avatar Lars Bilke Committed by Dmitri Naumov
Browse files

[cmake] Enable Python bindings for TFEL if OGS_USE_PYTHON=ON.

Will print out instructions to set the PYTHONPATH, e.g.:

-- TFEL build with Python bindings. To use them:
   export PYTHONPATH=/home/bilke/code/ogs/build/release/_ext/TFEL/lib/python3.10/site-packages:$PYTHONPATH
parent d0350272
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,35 @@ if(OGS_USE_MFRONT) ...@@ -53,6 +53,35 @@ if(OGS_USE_MFRONT)
endif() endif()
endif() endif()
if(NOT MFRONT) if(NOT MFRONT)
if(OGS_USE_PYTHON)
set(_py_version_major_minor
"${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}"
)
set(_py_boost_comp
"python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}"
)
find_package(Boost COMPONENTS ${_py_boost_comp})
if(Boost_${_py_boost_comp}_FOUND)
set(_tfel_cmake_args
"-DPython_ADDITIONAL_VERSIONS=${_py_version_major_minor}"
"-Denable-python-bindings=ON"
)
message(
STATUS
"TFEL build with Python bindings. To use them:\n "
" export PYTHONPATH=${PROJECT_BINARY_DIR}/_ext/TFEL/lib/python"
"${_py_version_major_minor}/site-packages:$PYTHONPATH"
)
else()
# Cleanup variables from previous find_package()-call
unset(Boost_INCLUDE_DIR)
unset(Boost_INCLUDE_DIRS)
message(
STATUS
"TFEL Python bindings disabled as Boosts Python library was not found."
)
endif()
endif()
BuildExternalProject( BuildExternalProject(
TFEL ${_tfel_source} TFEL ${_tfel_source}
CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
...@@ -60,6 +89,7 @@ if(OGS_USE_MFRONT) ...@@ -60,6 +89,7 @@ if(OGS_USE_MFRONT)
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"-Denable-testing=OFF" "-Denable-testing=OFF"
${_defaultCMakeArgs} ${_defaultCMakeArgs}
${_tfel_cmake_args}
) )
message( message(
STATUS STATUS
...@@ -252,7 +282,7 @@ endif() ...@@ -252,7 +282,7 @@ endif()
if(NOT HDF5_FOUND) if(NOT HDF5_FOUND)
BuildExternalProject( BuildExternalProject(
HDF5 ${_hdf5_source} CMAKE_ARGS ${_hdf5_options} ${_defaultCMakeArgs} HDF5 ${_hdf5_source} CMAKE_ARGS ${_hdf5_options} ${_defaultCMakeArgs}
${_cmake_generator} ${_cmake_generator}
) )
message( message(
STATUS STATUS
...@@ -322,8 +352,9 @@ elseif(NOT OGS_BUILD_VTK AND NOT OGS_USE_MKL) ...@@ -322,8 +352,9 @@ elseif(NOT OGS_BUILD_VTK AND NOT OGS_USE_MKL)
endif() endif()
if(NOT VTK_FOUND) if(NOT VTK_FOUND)
if("${OGS_EXTERNAL_DEPENDENCIES_CACHE}" STREQUAL "" AND if("${OGS_EXTERNAL_DEPENDENCIES_CACHE}" STREQUAL ""
NOT EXISTS "${PROJECT_BINARY_DIR}/_ext/VTK/src/VTK") AND NOT EXISTS "${PROJECT_BINARY_DIR}/_ext/VTK/src/VTK"
)
# Fixes https://stackoverflow.com/questions/9894961 on vismac05: # Fixes https://stackoverflow.com/questions/9894961 on vismac05:
set(_loguru_patch PATCH_COMMAND git apply set(_loguru_patch PATCH_COMMAND git apply
"${PROJECT_SOURCE_DIR}/scripts/cmake/loguru.patch" "${PROJECT_SOURCE_DIR}/scripts/cmake/loguru.patch"
......
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