build(options): Options propegate much more reliably

Build options such as build-python and build-fortran have much more
predicatable and sensible behavior
This commit is contained in:
2025-11-28 11:28:49 -05:00
parent 7a4ccff021
commit 7c33b89c77
10 changed files with 44 additions and 22 deletions

View File

@@ -1,13 +1,20 @@
# bring in all of the fourdst utility repositories # 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') composition_dep = fourdst_sp.get_variable('composition_dep')
log_dep = fourdst_sp.get_variable('log_dep') log_dep = fourdst_sp.get_variable('log_dep')
const_dep = fourdst_sp.get_variable('const_dep') const_dep = fourdst_sp.get_variable('const_dep')
config_dep = fourdst_sp.get_variable('config_dep') config_dep = fourdst_sp.get_variable('config_dep')
plugin_dep = fourdst_sp.get_variable('plugin_dep')
libcomposition = fourdst_sp.get_variable('libcomposition') libcomposition = fourdst_sp.get_variable('libcomposition')
libconst = fourdst_sp.get_variable('libconst') libconst = fourdst_sp.get_variable('libconst')
libconfig = fourdst_sp.get_variable('libconfig') libconfig = fourdst_sp.get_variable('libconfig')
liblogging = fourdst_sp.get_variable('liblogging') liblogging = fourdst_sp.get_variable('liblogging')
libplugin = fourdst_sp.get_variable('libplugin')

View File

@@ -1,5 +0,0 @@
libplugin_sp = subproject('libplugin')
plugin_dep = libplugin_sp.get_variable('plugin_dep')
libplugin = libplugin_sp.get_variable('libplugin')

View File

@@ -1,7 +1,6 @@
cmake = import('cmake') cmake = import('cmake')
subdir('fourdst') subdir('fourdst')
subdir('libplugin')
subdir('sundials') subdir('sundials')

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 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 default visibility for all C++ targets
add_project_arguments('-fvisibility=default', language: 'cpp') 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') 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
endif endif
endif
if (meson.get_compiler('fortran').version().version_compare('<14.0')) 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()) error('gfortran version must be at least 14.0, found ' + meson.get_compiler('fortran').version())
endif endif
endif
# For Eigen # For Eigen
add_project_arguments('-Wno-deprecated-declarations', language: 'cpp') add_project_arguments('-Wno-deprecated-declarations', language: 'cpp')

View File

@@ -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('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('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-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)') option('unsafe-fortran', type: 'boolean', value: false, description: 'Allow untested fortran compilers (compilers other than gfortran)')

View File

@@ -23,4 +23,7 @@ gridfire_extern_dep = declare_dependency(
install_subdir('include/gridfire', install_dir: get_option('includedir')) install_subdir('include/gridfire', install_dir: get_option('includedir'))
if get_option('build-fortran')
message('Configuring Fortran bindings...')
subdir('fortran') subdir('fortran')
endif

View File

@@ -59,6 +59,7 @@ gridfire_dep = declare_dependency(
install_subdir('include/gridfire', install_dir: get_option('includedir')) install_subdir('include/gridfire', install_dir: get_option('includedir'))
message('Configuring C API...')
subdir('extern') subdir('extern')
if get_option('build-python') if get_option('build-python')

View File

@@ -1,4 +1,4 @@
[wrap-git] [wrap-git]
url = https://github.com/4D-STAR/fourdst url = https://github.com/4D-STAR/fourdst
revision = v0.9.8 revision = v0.9.10
depth = 1 depth = 1

View File

@@ -1,4 +0,0 @@
[wrap-git]
url = https://github.com/4D-STAR/libplugin
revision = v0.3.5
depth = 1

View File

@@ -27,7 +27,7 @@ git clone --depth 1 "${REPO_URL}" "${TMPDIR}/project"
cd "${TMPDIR}/project" cd "${TMPDIR}/project"
# --- macOS Build Configuration --- # --- 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") 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 "$PY" -m pip install --upgrade pip setuptools wheel meson meson-python delocate
CC=clang CXX=clang++ "$PY" -m pip wheel . \ CC=clang CXX=clang++ "$PY" -m pip wheel . \
--config-settings=setup-args=-Dunity=on \
-w "${WHEEL_DIR}" -vv -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" echo "➤ Repairing wheel(s) with delocate"
delocate-wheel -w "${FINAL_WHEEL_DIR}" "${WHEEL_DIR}"/*.whl delocate-wheel -w "${FINAL_WHEEL_DIR}" "${WHEEL_DIR}"/*.whl