From b7c761961281608f08c182a4cd232d59b3131519 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Mon, 20 Nov 2023 14:36:10 -0600 Subject: [PATCH] (maint) support building pdk and bolt runtimes on osx arm64 --- configs/projects/bolt-runtime.rb | 9 ++++++--- configs/projects/pdk-runtime.rb | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/configs/projects/bolt-runtime.rb b/configs/projects/bolt-runtime.rb index a443eec5a..7023c642a 100644 --- a/configs/projects/bolt-runtime.rb +++ b/configs/projects/bolt-runtime.rb @@ -85,14 +85,17 @@ end if platform.is_macos? - # For OS X, we should optimize for an older architecture than Apple + proj.setting(:cppflags, "-I#{proj.includedir}") + proj.setting(:cflags, proj.cppflags.to_s) + + # For OS X, we should optimize for an older x86 architecture than Apple # currently ships for; there's a lot of older xeon chips based on # that architecture still in use throughout the Mac ecosystem. # Additionally, OS X doesn't use RPATH for linking. We shouldn't # define it or try to force it in the linker, because this might # break gcc or clang if they try to use the RPATH values we forced. - proj.setting(:cppflags, "-I#{proj.includedir}") - proj.setting(:cflags, "-march=core2 -msse4 #{proj.cppflags}") + proj.setting(:cflags, "-march=core2 -msse4 #{proj.cflags}") unless platform.architecture == 'arm64' + proj.setting(:ldflags, "-L#{proj.libdir} ") end diff --git a/configs/projects/pdk-runtime.rb b/configs/projects/pdk-runtime.rb index d4b51ac5a..e3f2a6f39 100644 --- a/configs/projects/pdk-runtime.rb +++ b/configs/projects/pdk-runtime.rb @@ -128,11 +128,12 @@ proj.setting(:ldflags, "-L#{proj.tools_root}/lib -L#{proj.gcc_root}/lib -L#{proj.libdir}") elsif platform.is_macos? proj.setting(:cppflags, "-I#{proj.includedir}") + proj.setting(:cflags, "#{proj.cppflags}") # Since we are cross-compiling for later use, we can only optimize for # the oldest supported platform and even up to macOS 10.13 there are # a few Core 2 hardware platforms supported. (4 May 2018) - proj.setting(:cflags, "-march=core2 -msse4 #{proj.cppflags}") + proj.setting(:cflags, "-march=core2 -msse4 #{proj.cflags}") unless platform.architecture == 'arm64' # OS X doesn't use RPATH for linking. We shouldn't # define it or try to force it in the linker, because this might