From 2c49da2bd13776ac3588259c5fd232e5505709b1 Mon Sep 17 00:00:00 2001 From: Tyler Kennedy Date: Sun, 4 Feb 2024 14:40:31 -0500 Subject: [PATCH] Ensure fallback implementation is always, for-real, available. --- setup.py | 13 ++++++++----- simdjson/csimdjson.cpp | 6 ++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 9fd0264..b4474f5 100644 --- a/setup.py +++ b/setup.py @@ -29,8 +29,10 @@ ' available.' ) +macros = [ + ('SIMDJSON_IMPLEMENTATION_FALLBACK', "1"), +] if os.getenv('BUILD_WITH_CYTHON') and CYTHON_AVAILABLE: - macros = [] compiler_directives = { 'embedsignature': True } @@ -38,10 +40,10 @@ if os.getenv('BUILD_FOR_DEBUG'): # Enable line tracing, which also enables support for coverage # reporting. - macros = [ - ('CYTHON_TRACE', 1), - ('CYTHON_TRACE_NOGIL', 1) - ] + macros.extend([ + ('CYTHON_TRACE', "1"), + ('CYTHON_TRACE_NOGIL', "1") + ]) compiler_directives['linetrace'] = True force = bool(os.getenv('FORCE_REBUILD')) @@ -67,6 +69,7 @@ 'simdjson/util.cpp', 'simdjson/csimdjson.cpp' ], + define_macros=macros, extra_compile_args=extra_compile_args, language='c++' ) diff --git a/simdjson/csimdjson.cpp b/simdjson/csimdjson.cpp index c7d33b5..ceae13c 100644 --- a/simdjson/csimdjson.cpp +++ b/simdjson/csimdjson.cpp @@ -3,6 +3,12 @@ /* BEGIN: Cython Metadata { "distutils": { + "define_macros": [ + [ + "SIMDJSON_IMPLEMENTATION_FALLBACK", + "1" + ] + ], "depends": [ "simdjson/simdjson.h", "simdjson/util.h"