diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b8882053dcc97608ce2ca22cd1de3ad4a68f575..23189e3f71299c62f0db2a3300898570a0effce4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,13 +232,18 @@ if(OGS_WRITE_BENCHMARK_COMMANDS) endif() # cmake-lint: disable=E1126 -file( - CONFIGURE - OUTPUT - .envrc - CONTENT - "PATH_add ${CMAKE_INSTALL_BINDIR}\n[ -d \".venv\" ] && source .venv/bin/activate" +set(_envrc_content + "[ -d \"${PROJECT_BINARY_DIR}/.venv\" ] && source ${PROJECT_BINARY_DIR}/.venv/bin/activate" + "export PATH=$PATH:${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" ) +if(_TFEL_SITE-PACKAGES_DIR) + set(_envrc_content + "${_envrc_content}" + "export PYTHONPATH=${_TFEL_SITE-PACKAGES_DIR}:$PYTHONPATH" + ) +endif() +string(REPLACE ";" "\n" _envrc_content "${_envrc_content}") +file(CONFIGURE OUTPUT .envrc CONTENT "${_envrc_content}") check_header_compilation() diff --git a/scripts/cmake/DependenciesExternalProject.cmake b/scripts/cmake/DependenciesExternalProject.cmake index 7d9db0892d3b432e7a8b15d5ca509895c582d2bc..297fad4c3b948151c8f47361b64ac87eb68c6ce2 100644 --- a/scripts/cmake/DependenciesExternalProject.cmake +++ b/scripts/cmake/DependenciesExternalProject.cmake @@ -65,12 +65,6 @@ if(OGS_USE_MFRONT) "-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) @@ -111,8 +105,20 @@ if(OGS_USE_MFRONT) STATUS "ExternalProject_Add(): added package TFEL@rliv-${ogs.minimum_version.tfel-rliv}" ) + if(Boost_${_py_boost_comp}_FOUND) + set(_TFEL_SITE-PACKAGES_DIR + "${build_dir_TFEL}/lib/python${_py_version_major_minor}/site-packages" + CACHE INTERNAL "" + ) + endif() set(TFELHOME ${build_dir_TFEL} CACHE PATH "" FORCE) endif() + if(_TFEL_SITE-PACKAGES_DIR) + message( + STATUS "TFEL build with Python bindings. To use them:\n " + " export PYTHONPATH=${_TFEL_SITE-PACKAGES_DIR}:$PYTHONPATH" + ) + endif() endif() if(OGS_USE_PETSC) @@ -350,6 +356,7 @@ endif() # Building from source requires newer hdf version string(REPLACE "." "_" HDF5_TAG ${ogs.tested_version.hdf5}) +# cmake-lint: disable=C0103 if(COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.2) set(ogs.minimum_version.vtk "9.3.0") endif()