feat: back port install-dir for venv

This commit is contained in:
Guilhem Lavaux 2024-11-17 08:08:30 +01:00
parent 457627d112
commit 86ef777f87

View File

@ -23,6 +23,8 @@ This is the build helper. The arguments are the following:
--cxx-compiler COMPILER specify the CXX compiler to use (default to c++)
--julia JULIA_BINARY specify the full path of julia interpreter
--build-dir DIRECTORY specify the build directory (default to "build/" )
--install-dir DIRECTORY specity the prefix of the install directory
Current default is $default_install_dir
--debug build for full debugging
--no-debug-log remove all the debug output to increase speed on parallel
filesystem.
@ -155,6 +157,21 @@ check_existence -q "external/cosmotool/CMakeLists.txt" "Submodules were not clon
srcdir=$(pwd)
build_dir=${srcdir}/build
install_dir=
if test x"$CONDA_PREFIX" != x; then
install_dir=$CONDA_PREFIX
echo -e "-- ${C_WHITE}Conda environment detected:${C_DEFAULT} installation default in $CONDA_PREFIX"
elif test x"$VIRTUAL_ENV" != x; then
install_dir=$VIRTUAL_ENV
echo -e "-- ${C_WHITE}Python virtual environment detected:${C_DEFAULT} installation default in $VIRTUAL_ENV"
else
install_dir=$(pwd)/install
echo -e "-- ${C_WHITE}Using default install directory:${C_DEFAULT} $install_dir"
fi
echo
default_install_dir=$install_dir
build_type=Release
cmake=cmake
@ -195,6 +212,10 @@ while test $# -gt 0; do
julia_binary="$2"
shift
;;
--install-dir)
install_dir="$2"
shift
;;
--build-dir)
build_dir="$2"
shift
@ -390,7 +411,12 @@ fi
export CMAKE_PREFIX_PATH
#CMAKE_PREFIX_PATH=$(printf %q "${CMAKE_PREFIX_PATH}")
cmake_flags+=(-DARES_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_BUILD_TYPE=${build_type} -DCMAKE_C_COMPILER=${c_compiler} -DCMAKE_CXX_COMPILER=${cxx_compiler})
if test "x${install_dir}" != x; then
install_dir="-DCMAKE_INSTALL_PREFIX=${install_dir}"
fi
cmake_flags+=(-DARES_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_BUILD_TYPE=${build_type} -DCMAKE_C_COMPILER=${c_compiler} -DCMAKE_CXX_COMPILER=${cxx_compiler} ${install_dir})
if test x"${julia_binary}" != x""; then
cmake_flags+=(-DJULIA_EXECUTABLE=${julia_binary})
fi