Skip to content

Commit

Permalink
(maint) support building pdk and bolt runtimes on osx arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tw1r3 committed Nov 20, 2023
1 parent 2e05ce2 commit 5bde02e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions configs/projects/bolt-runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion configs/projects/pdk-runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5bde02e

Please sign in to comment.