From ceba718a08508f582e58899feb2a4b3ef3f465ef Mon Sep 17 00:00:00 2001 From: David Minton Date: Tue, 13 Feb 2024 14:36:02 -0500 Subject: [PATCH] Updated more of the build scripts to get debug mode working --- CMakeLists.txt | 2 ++ SHTOOLS | 2 +- buildscripts/build_negishi.sh | 4 ++-- buildscripts/install_editable_debug.sh | 30 -------------------------- cmake/Modules/SetSwiftestFlags.cmake | 6 ++++++ 5 files changed, 11 insertions(+), 33 deletions(-) delete mode 100755 buildscripts/install_editable_debug.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 5feb7155e..09db2a050 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,8 @@ ELSE() SET(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) SET(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) ENDIF () + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # Have the .mod files placed in the include folder SET(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/SHTOOLS b/SHTOOLS index f50f58a9e..8b74bb7a2 160000 --- a/SHTOOLS +++ b/SHTOOLS @@ -1 +1 @@ -Subproject commit f50f58a9e0cdadfdd100f7ebf00847813f960d77 +Subproject commit 8b74bb7a27b7dab588893ab368c86ab4d735f333 diff --git a/buildscripts/build_negishi.sh b/buildscripts/build_negishi.sh index 31a555de9..3d0f12994 100755 --- a/buildscripts/build_negishi.sh +++ b/buildscripts/build_negishi.sh @@ -20,7 +20,7 @@ module load netcdf-fortran/intel-oneapi/4.6.1 module load shtools/intel-oneapi/4.11.10 cmake -P distclean.cmake pip install --config-settings=editable.rebuild=true \ - --config-settings=build-dir="build/{wheel_tag}" \ + --config-settings=build-dir="build" \ --config-settings=cmake.build-type="${BUILD_TYPE}" \ --config-settings=cmake.args="-DUSE_SIMD=ON" \ --config-settings=cmake.args="-DUSE_OPENMP=ON" \ @@ -31,4 +31,4 @@ pip install --config-settings=editable.rebuild=true \ -ve . -LD_LIBRARY_PATH=$(realpath ${ROOT_DIR}/build/*/bin):$LD_LIBRARY_PATH \ No newline at end of file +LD_LIBRARY_PATH=$(realpath ${ROOT_DIR}/build/bin):$LD_LIBRARY_PATH \ No newline at end of file diff --git a/buildscripts/install_editable_debug.sh b/buildscripts/install_editable_debug.sh deleted file mode 100755 index fb600a58a..000000000 --- a/buildscripts/install_editable_debug.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/zsh -# installs an editable (local) package in debug mode -set -a -SCRIPT_DIR=$(realpath $(dirname $0)) -ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) -VENV_DIR=${ROOT_DIR}/venv -cd ${ROOT_DIR} - -# Create the virtual environment if it doesn't exist -if [ ! -d "${VENV_DIR}" ]; then - python3 -m venv ${VENV_DIR} -fi - -# Activate the virtual environment only if it's not already active -if [ -z "${VIRTUAL_ENV}" ]; then - . ${VENV_DIR}/bin/activate -fi - -python3 -m pip install --upgrade pip -pip install scikit-build-core pyproject-metadata pathspec ninja cython cmake ffmpeg-python -pip install --config-settings=editable.rebuild=true \ - --config-settings=build-dir="build/{wheel_tag}" \ - --config-settings=cmake.build-type="Debug" \ - --config-settings=cmake.args="-DUSE_SIMD=ON" \ - --config-settings=cmake.args="-DUSE_OPENMP=ON" \ - --no-build-isolation \ - -ve . -mkdir -p $HOME/.local/lib -LIBFILE=$(realpath ${ROOT_DIR}/build/*/bin/*swiftest.*) -ln -fs $LIBFILE $HOME/.local/lib diff --git a/cmake/Modules/SetSwiftestFlags.cmake b/cmake/Modules/SetSwiftestFlags.cmake index 83bf8ac5d..638c7aff7 100644 --- a/cmake/Modules/SetSwiftestFlags.cmake +++ b/cmake/Modules/SetSwiftestFlags.cmake @@ -309,6 +309,12 @@ IF (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "TESTING" ) Fortran "/Qopt-prefetch-" # Intel Windows ) ELSE () + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran REQUIRED "-pg -g3" + ) + SET_COMPILE_FLAG(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" + C REQUIRED "-g3" + ) SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" Fortran REQUIRED "-O0" # All compilers not on Windows )