From 7c33b89c773e08c6a8fe68658d801eb8321b2547 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Fri, 28 Nov 2025 11:28:49 -0500 Subject: [PATCH] build(options): Options propegate much more reliably Build options such as build-python and build-fortran have much more predicatable and sensible behavior --- build-config/fourdst/meson.build | 11 ++++++++-- build-config/libplugin/meson.build | 5 ----- build-config/meson.build | 1 - meson.build | 8 +++---- meson_options.txt | 4 ++-- src/extern/meson.build | 5 ++++- src/meson.build | 1 + subprojects/fourdst.wrap | 2 +- subprojects/libplugin.wrap | 4 ---- utils/wheels/build-wheels-macos_aarch64.sh | 25 ++++++++++++++++++++-- 10 files changed, 44 insertions(+), 22 deletions(-) delete mode 100644 build-config/libplugin/meson.build delete mode 100644 subprojects/libplugin.wrap diff --git a/build-config/fourdst/meson.build b/build-config/fourdst/meson.build index dd1abc14..124ecdcf 100644 --- a/build-config/fourdst/meson.build +++ b/build-config/fourdst/meson.build @@ -1,13 +1,20 @@ # bring in all of the fourdst utility repositories -fourdst_sp = subproject('fourdst') +fourdst_sp = subproject('fourdst', + default_options: + ['build-tests=' + get_option('build-tests').to_string(), + 'build-python=' + get_option('build-python').to_string() + ] +) composition_dep = fourdst_sp.get_variable('composition_dep') log_dep = fourdst_sp.get_variable('log_dep') const_dep = fourdst_sp.get_variable('const_dep') config_dep = fourdst_sp.get_variable('config_dep') +plugin_dep = fourdst_sp.get_variable('plugin_dep') libcomposition = fourdst_sp.get_variable('libcomposition') libconst = fourdst_sp.get_variable('libconst') libconfig = fourdst_sp.get_variable('libconfig') -liblogging = fourdst_sp.get_variable('liblogging') \ No newline at end of file +liblogging = fourdst_sp.get_variable('liblogging') +libplugin = fourdst_sp.get_variable('libplugin') \ No newline at end of file diff --git a/build-config/libplugin/meson.build b/build-config/libplugin/meson.build deleted file mode 100644 index f39c8f5c..00000000 --- a/build-config/libplugin/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -libplugin_sp = subproject('libplugin') - -plugin_dep = libplugin_sp.get_variable('plugin_dep') -libplugin = libplugin_sp.get_variable('libplugin') - diff --git a/build-config/meson.build b/build-config/meson.build index 08312c6c..8c41081a 100644 --- a/build-config/meson.build +++ b/build-config/meson.build @@ -1,7 +1,6 @@ cmake = import('cmake') subdir('fourdst') -subdir('libplugin') subdir('sundials') diff --git a/meson.build b/meson.build index 378165c1..7dd5d4cc 100644 --- a/meson.build +++ b/meson.build @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # *********************************************************************** # -project('GridFire', ['c', 'cpp', 'fortran'], version: 'v0.7.2_rc2', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0') +project('GridFire', ['c', 'cpp', 'fortran'], version: 'v0.7.3_rc2', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0') # Add default visibility for all C++ targets add_project_arguments('-fvisibility=default', language: 'cpp') @@ -55,13 +55,13 @@ if (build_fortran) error('The only supported fortran compiler for GridFire is gfortran (version >= 14.0), found ' + fc + '. GridFire has not been tested with any other compilers. You can disable this check with the -Dunsafe-fortran=true flag to try other compilers') endif endif + if (meson.get_compiler('fortran').version().version_compare('<14.0')) + error('gfortran version must be at least 14.0, found ' + meson.get_compiler('fortran').version()) + endif endif -if (meson.get_compiler('fortran').version().version_compare('<14.0')) - error('gfortran version must be at least 14.0, found ' + meson.get_compiler('fortran').version()) -endif # For Eigen add_project_arguments('-Wno-deprecated-declarations', language: 'cpp') diff --git a/meson_options.txt b/meson_options.txt index 868af617..63a752d5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,6 @@ option('log-level', type: 'combo', choices: ['traceL3', 'traceL2', 'traceL1', 'debug', 'info', 'warning', 'error', 'critial'], value: 'info', description: 'Set the log level for the GridFire library') option('pkg-config', type: 'boolean', value: true, description: 'generate pkg-config file for GridFire (gridfire.pc)') -option('build-python', type: 'boolean', value: true, description: 'build the python bindings so you can use GridFire from python') +option('build-python', type: 'boolean', value: false, description: 'build the python bindings so you can use GridFire from python') option('build-tests', type: 'boolean', value: true, description: 'build the test suite') -option('build-fortran', type: 'boolean', value: true, description: 'build fortran module support') +option('build-fortran', type: 'boolean', value: false, description: 'build fortran module support') option('unsafe-fortran', type: 'boolean', value: false, description: 'Allow untested fortran compilers (compilers other than gfortran)') diff --git a/src/extern/meson.build b/src/extern/meson.build index 49e3739a..d9900ff1 100644 --- a/src/extern/meson.build +++ b/src/extern/meson.build @@ -23,4 +23,7 @@ gridfire_extern_dep = declare_dependency( install_subdir('include/gridfire', install_dir: get_option('includedir')) -subdir('fortran') +if get_option('build-fortran') + message('Configuring Fortran bindings...') + subdir('fortran') +endif diff --git a/src/meson.build b/src/meson.build index 4532d6da..84495c35 100644 --- a/src/meson.build +++ b/src/meson.build @@ -59,6 +59,7 @@ gridfire_dep = declare_dependency( install_subdir('include/gridfire', install_dir: get_option('includedir')) +message('Configuring C API...') subdir('extern') if get_option('build-python') diff --git a/subprojects/fourdst.wrap b/subprojects/fourdst.wrap index f8a87d6d..e718833b 100644 --- a/subprojects/fourdst.wrap +++ b/subprojects/fourdst.wrap @@ -1,4 +1,4 @@ [wrap-git] url = https://github.com/4D-STAR/fourdst -revision = v0.9.8 +revision = v0.9.10 depth = 1 diff --git a/subprojects/libplugin.wrap b/subprojects/libplugin.wrap deleted file mode 100644 index b8a3eda5..00000000 --- a/subprojects/libplugin.wrap +++ /dev/null @@ -1,4 +0,0 @@ -[wrap-git] -url = https://github.com/4D-STAR/libplugin -revision = v0.3.5 -depth = 1 diff --git a/utils/wheels/build-wheels-macos_aarch64.sh b/utils/wheels/build-wheels-macos_aarch64.sh index df1a7323..e8e67291 100755 --- a/utils/wheels/build-wheels-macos_aarch64.sh +++ b/utils/wheels/build-wheels-macos_aarch64.sh @@ -27,7 +27,7 @@ git clone --depth 1 "${REPO_URL}" "${TMPDIR}/project" cd "${TMPDIR}/project" # --- macOS Build Configuration --- -export MACOSX_DEPLOYMENT_TARGET=12.0 +export MACOSX_DEPLOYMENT_TARGET=15.0 PYTHON_VERSIONS=("3.8.20" "3.9.23" "3.10.18" "3.11.13" "3.12.11" "3.13.5" "3.13.5t" "3.14.0rc1" "3.14.0rc1t" 'pypy3.10-7.3.19' "pypy3.11-7.3.20") @@ -54,9 +54,30 @@ for PY_VERSION in "${PYTHON_VERSIONS[@]}"; do "$PY" -m pip install --upgrade pip setuptools wheel meson meson-python delocate CC=clang CXX=clang++ "$PY" -m pip wheel . \ - --config-settings=setup-args=-Dunity=on \ -w "${WHEEL_DIR}" -vv + echo "➤ Sanitizing RPATHs before delocation..." + + CURRENT_WHEEL=$(find "${WHEEL_DIR}" -name "*.whl" | head -n 1) + + if [ -f "$CURRENT_WHEEL" ]; then + "$PY" -m wheel unpack "$CURRENT_WHEEL" -d "${WHEEL_DIR}/unpacked" + + UNPACKED_ROOT=$(find "${WHEEL_DIR}/unpacked" -mindepth 1 -maxdepth 1 -type d) + + find "$UNPACKED_ROOT" -name "*.so" | while read -r SO_FILE; do + echo " Processing: $SO_FILE" + "$PY" "../../build-python/fix_rpaths.py" "$SO_FILE" + done + + "$PY" -m wheel pack "$UNPACKED_ROOT" -d "${WHEEL_DIR}" + + rm -rf "${WHEEL_DIR}/unpacked" + else + echo "Error: No wheel found to sanitize!" + exit 1 + fi + echo "➤ Repairing wheel(s) with delocate" delocate-wheel -w "${FINAL_WHEEL_DIR}" "${WHEEL_DIR}"/*.whl