From 662e44632192d1eabb2e31c4eb72ebd97b7f5a8d Mon Sep 17 00:00:00 2001 From: "clemens.schmid@esrf.fr" Date: Tue, 25 Aug 2026 10:39:18 +0200 Subject: [PATCH 1/3] add arch flag to scons build command scons arch=native lib # local scons arch=x86-64-v3 lib # portable AVX2 deploy scons lib # default: no -march (unchanged behaviour) or via $ export OBJCRYST_ARCH=x86-64-v3 --- SConstruct | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SConstruct b/SConstruct index a525990b..852f0bfd 100644 --- a/SConstruct +++ b/SConstruct @@ -75,6 +75,12 @@ vars.Add(EnumVariable( vars.Add(BoolVariable( 'profile', 'build with profiling information', False)) +vars.Add( + 'arch', + 'target CPU passed to -march in the \'fast\' build, e.g. \'native\' for local ' + 'builds or \'x86-64-v3\' for a portable AVX2 deployment. Empty means no -march. ' + 'Defaults to the OBJCRYST_ARCH environment variable if set.', + os.environ.get('OBJCRYST_ARCH', '')) vars.Update(env) # Use C++ compiler specified by the 'tool' option. @@ -184,6 +190,8 @@ else: else: env.AppendUnique(CCFLAGS=['-fno-strict-aliasing']) fast_opts = ['-ffast-math'] + if env.get('arch'): + fast_opts.append('-march=' + env['arch']) if env['PLATFORM'] == 'darwin': # macOS bundle From b4d9008463bd0dc46440c57e3ed10f54a6c24bf7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Aug 2026 08:41:10 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit hooks --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 852f0bfd..fd66c232 100644 --- a/SConstruct +++ b/SConstruct @@ -191,7 +191,7 @@ else: env.AppendUnique(CCFLAGS=['-fno-strict-aliasing']) fast_opts = ['-ffast-math'] if env.get('arch'): - fast_opts.append('-march=' + env['arch']) + fast_opts.append('-march=' + env['arch']) if env['PLATFORM'] == 'darwin': # macOS bundle From 3c32e5621fc52576931532b059023bef548049fd Mon Sep 17 00:00:00 2001 From: Clemens Schmid Date: Tue, 25 Aug 2026 13:43:19 +0200 Subject: [PATCH 3/3] add news file --- news/compile_arch.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/compile_arch.rst diff --git a/news/compile_arch.rst b/news/compile_arch.rst new file mode 100644 index 00000000..f1a594d2 --- /dev/null +++ b/news/compile_arch.rst @@ -0,0 +1,23 @@ +**Added:** + +* Add SCons ``arch`` option to set architecture during compilation. By default, no arch is specified. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +*