| 1 |
From 1092a1ea9bc5ae6d185a00a9949dbf1cb8b84499 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Theodore Tucker <[email protected]> |
| 3 |
Date: Tue, 17 Mar 2026 16:55:38 +0000 |
| 4 |
Subject: [PATCH] Link against system CRoaring rather than vendor copy |
| 5 |
|
| 6 |
--- |
| 7 |
setup.py | 41 +++-------------------------------------- |
| 8 |
1 file changed, 3 insertions(+), 38 deletions(-) |
| 9 |
|
| 10 |
diff --git a/setup.py b/setup.py |
| 11 |
index 3b828f1..fb44716 100755 |
| 12 |
--- a/setup.py |
| 13 |
+++ b/setup.py |
| 14 |
@@ -33,54 +33,19 @@ except (IOError, ImportError, RuntimeError): |
| 15 |
print('Could not generate long description.') |
| 16 |
long_description = '' |
| 17 |
|
| 18 |
- |
| 19 |
-if PLATFORM_WINDOWS: |
| 20 |
- # MSVC defaults to C++14, so no explicit C++ standard flag is needed. |
| 21 |
- # roaring.c requires C11 for features like alignof and _Static_assert. |
| 22 |
- ext_compile_args = [] |
| 23 |
- c_compile_args = ['/std:c11'] |
| 24 |
-else: |
| 25 |
- c_compile_args = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D _GLIBCXX_ASSERTIONS'] |
| 26 |
- if PLATFORM_MACOSX: |
| 27 |
- c_compile_args.append('-mmacosx-version-min=10.14') |
| 28 |
- if 'DEBUG' in os.environ: |
| 29 |
- c_compile_args.extend(['-O0', '-g']) |
| 30 |
- else: |
| 31 |
- c_compile_args.append('-O3') |
| 32 |
- if 'ARCHI' in os.environ: |
| 33 |
- if os.environ['ARCHI'] != "generic": |
| 34 |
- c_compile_args.append('-march=%s' % os.environ['ARCHI']) |
| 35 |
- # The '-march=native' flag is not universally allowed. In particular, it |
| 36 |
- # will systematically fail on aarch64 systems (like the new Apple M1 systems). It |
| 37 |
- # also creates troubles under macOS with pip installs and requires ugly workarounds. |
| 38 |
- # The best way to handle people who want to use -march=native is to ask them |
| 39 |
- # to pass ARCHI=native to their build process. |
| 40 |
- # else: |
| 41 |
- # c_compile_args.append('-march=native') |
| 42 |
- ext_compile_args = c_compile_args + ['-std=c++11'] |
| 43 |
- c_compile_args = c_compile_args + ['-std=c11'] |
| 44 |
+compile_args = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D _GLIBCXX_ASSERTIONS'] |
| 45 |
|
| 46 |
pyroaring_module = Extension( |
| 47 |
'pyroaring', |
| 48 |
sources=[os.path.join(PKG_DIR, 'pyroaring.pyx')], |
| 49 |
- extra_compile_args=ext_compile_args, |
| 50 |
+ extra_compile_args=compile_args + ["-std=c++11"], |
| 51 |
language='c++', |
| 52 |
+ libraries=['roaring'], |
| 53 |
) |
| 54 |
|
| 55 |
-# roaring.c is compiled as a separate static library because it must be compiled |
| 56 |
-# as C (not C++), with a C11 standard flag. |
| 57 |
-libraries = [( |
| 58 |
- 'croaring', |
| 59 |
- { |
| 60 |
- 'sources': [os.path.join(PKG_DIR, 'roaring.c')], |
| 61 |
- 'cflags': c_compile_args, |
| 62 |
- }, |
| 63 |
-)] |
| 64 |
- |
| 65 |
setup( |
| 66 |
name='pyroaring', |
| 67 |
ext_modules=[pyroaring_module], |
| 68 |
- libraries=libraries, |
| 69 |
package_data={'pyroaring': ['py.typed', '__init__.pyi']}, |
| 70 |
packages=['pyroaring'], |
| 71 |
version=VERSION, |
| 72 |
-- |
| 73 |
2.47.3 |
| 74 |
|