Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ endif
qblas_dep = dependency('qblas', fallback: ['qblas', 'qblas_dep'])

# Try to find SLEEF system-wide first, fall back to subproject if not found
sleef_dep = dependency('sleef', fallback: ['sleef', 'sleef_dep'], required: false)
# Required SLEEF version (must match sleef.wrap revision)
required_sleef_version = '3.9.0'
sleef_dep = dependency('sleef', version: '>=' + required_sleef_version, fallback: ['sleef', 'sleef_dep'], required: false)

use_system_sleef = false
fallback_reason = ''

if sleef_dep.found() and sleef_dep.type_name() != 'internal'
if sleef_dep.found() and sleef_dep.type_name() != 'internal' and sleef_dep.version().startswith(required_sleef_version)
# SLEEF found system-wide - verify quad-precision support
cpp = meson.get_compiler('cpp')
sleefquad_lib = cpp.find_library('sleefquad', required: false)
tlfloat_lib = cpp.find_library('tlfloat', required: false)

if sleefquad_lib.found() and tlfloat_lib.found()
if sleefquad_lib.found()
sleefquad_test_code = '''
#include <sleefquad.h>

Expand All @@ -41,26 +42,27 @@ if sleef_dep.found() and sleef_dep.type_name() != 'internal'
# this should compile and link
quad_works = cpp.links(
sleefquad_test_code,
dependencies: [sleef_dep, sleefquad_lib, tlfloat_lib],
dependencies: [sleef_dep, sleefquad_lib],
name: 'SLEEF quad-precision support'
)

if quad_works
sleefquad_dep = declare_dependency(
dependencies: [sleef_dep, sleefquad_lib]
)
tlfloat_dep = declare_dependency(
dependencies: [tlfloat_lib]
)
use_system_sleef = true
else
fallback_reason = 'System-wide SLEEF installation found but a test for quad precision support failed.'
endif
else
fallback_reason = 'System-wide SLEEF installation does not have a sleefquad library.'
fallback_reason = 'System-wide SLEEF installation does not have the sleefquad library.'
endif
else
fallback_reason = 'Cannot find system-wide SLEEF installation.'
if sleef_dep.found() and sleef_dep.type_name() != 'internal'
fallback_reason = 'System SLEEF version @0@ does not match required version @1@'.format(sleef_dep.version(), required_sleef_version)
else
fallback_reason = 'Cannot find system-wide SLEEF installation.'
endif
endif

if use_system_sleef
Expand All @@ -69,7 +71,6 @@ else
sleef_subproj = subproject('sleef')
sleef_dep = sleef_subproj.get_variable('sleef_dep')
sleefquad_dep = sleef_subproj.get_variable('sleefquad_dep')
tlfloat_dep = sleef_subproj.get_variable('tlfloat_dep')
warning(fallback_reason)
message('Proceeding with vendored SLEEF subproject instead')
endif
Expand All @@ -93,7 +94,7 @@ message('Using NumPy version: @0@'.format(numpy_version))
npymath_path = incdir_numpy / '..' / 'lib'
npymath_lib = c.find_library('npymath', dirs: npymath_path)

dependencies = [py_dep, qblas_dep, sleef_dep, sleefquad_dep, tlfloat_dep, npymath_lib]
dependencies = [py_dep, qblas_dep, sleef_dep, sleefquad_dep, npymath_lib]

# Add OpenMP dependency (optional, for threading)
openmp_dep = dependency('openmp', required: false, static: false)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
]
requires-python = ">=3.11.0"
dependencies = [
"numpy>=2.0"
"numpy>=2.4"
]

[project.optional-dependencies]
Expand Down
7 changes: 1 addition & 6 deletions subprojects/packagefiles/sleef/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sleef_configure = run_command([
'-DSLEEF_BUILD_SHARED_LIBS=OFF',
'-DSLEEF_BUILD_TESTS=OFF',
'-DSLEEF_BUILD_INLINE_HEADERS=OFF',
'-DSLEEF_ENABLE_TLFLOAT=OFF', # this is only used for testing in SLEEF, not runtime
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
'-DCMAKE_INSTALL_PREFIX=' + meson.current_build_dir() / sleef_install_dir
] + sleef_simd_flags, check: false, capture: true)
Expand Down Expand Up @@ -72,10 +73,4 @@ sleefquad_dep = declare_dependency(
dependencies: [sleef_build_dep, sleef_dep],
compile_args: compile_args_list,
link_args: ['-L' + meson.current_build_dir() / sleef_install_dir / 'lib', '-L' + meson.current_build_dir() / sleef_install_dir / 'lib64', '-lsleefquad']
)

tlfloat_dep = declare_dependency(
dependencies: [sleef_build_dep],
compile_args: compile_args_list,
link_args: ['-L' + meson.current_build_dir() / sleef_install_dir / 'lib', '-L' + meson.current_build_dir() / sleef_install_dir / 'lib64', '-ltlfloat']
)
2 changes: 1 addition & 1 deletion subprojects/sleef.wrap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[wrap-git]
directory=sleef
url=https://github.com/shibatch/sleef.git
revision=43a0252ba9331adc7fb10755021f802863678c38
revision=3.9.0
patch_directory=sleef

[provide]
Expand Down