diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b8882053dc..23189e3f712 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/ci/extends/template-build-linux.yml b/scripts/ci/extends/template-build-linux.yml index e05b9378c3f..d7475ed0c36 100644 --- a/scripts/ci/extends/template-build-linux.yml +++ b/scripts/ci/extends/template-build-linux.yml @@ -14,8 +14,8 @@ - ln -s `$readlink_cmd -f $build_dir_full` build/${CMAKE_PRESET} - ([[ $BUILD_CTEST_LARGE_ON_MASTER && "${CI_COMMIT_BRANCH}" == "master" ]]) && export BUILD_CTEST_LARGE=true - cmake --preset=$CMAKE_PRESET --log-level=VERBOSE -Wno-dev $CMAKE_ARGS - # Activate .venv - - test -f $build_dir_full/.venv/bin/activate && source $build_dir_full/.venv/bin/activate + # Activate .venv via .envrc + - test -f $build_dir_full/.venv/bin/activate && source $build_dir_full/.envrc - | function maybe_run_with_xvfb() { diff --git a/scripts/cmake/DependenciesExternalProject.cmake b/scripts/cmake/DependenciesExternalProject.cmake index 7d9db0892d3..297fad4c3b9 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()