Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add flag for helping to build macOS universal binaries
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Jun 22, 2022
1 parent 1b8d734 commit 457678c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
32 changes: 24 additions & 8 deletions meson.build
Expand Up @@ -23,6 +23,7 @@ build_vst3 = get_option('build-vst3')
build_juce5_only = get_option('build-juce5-only')
build_juce6_only = get_option('build-juce6-only')
build_juce7_only = get_option('build-juce7-only')
build_universal = get_option('build-universal')
linux_embed = get_option('linux-embed')
optimizations = get_option('optimizations') and buildtype != 'debug'

Expand Down Expand Up @@ -188,10 +189,15 @@ if optimizations
'-fprefetch-loop-arrays',
]
endif
if host_machine.cpu_family().contains('x86')
if host_machine.cpu_family().contains('x86') or build_universal
build_flags_release += [
'-mtune=generic', '-msse', '-msse2', '-mfpmath=sse',
'-mtune=generic', '-msse', '-msse2',
]
if not build_universal
build_flags_release += [
'-mfpmath=sse',
]
endif
endif
endif

Expand All @@ -206,6 +212,12 @@ if os_darwin
build_flags_cpp += [
'-ObjC++',
]
if universal
build_flags += [
'-arch', 'x86_64',
'-arch', 'arm64',
]
endif
elif os_windows
build_flags += [
'-DWINDOWS=1',
Expand Down Expand Up @@ -249,16 +261,20 @@ if optimizations
]
endif

if os_windows
link_flags += [
'-static',
]
endif

if os_darwin
if universal
link_flags += [
'-arch', 'x86_64',
'-arch', 'arm64',
]
endif
link_flags_release += [
'-Wl,-dead_strip,-dead_strip_dylibs,-x',
]
elif os_windows
link_flags += [
'-static',
]
else
link_flags += [
'-Wl,--as-needed,--no-undefined',
Expand Down
6 changes: 6 additions & 0 deletions meson_options.txt
Expand Up @@ -46,6 +46,12 @@ option('build-juce7-only',
description: 'Build only juce7 libraries and plugins',
)

option('build-universal',
type: 'boolean',
value: false,
description: 'Build macOS universal binaries',
)

option('plugins',
type : 'array',
description: 'Plugins to build',
Expand Down

0 comments on commit 457678c

Please sign in to comment.