13
0

Prepare for Apple/ARM cross-compile on Intel macOS

This commit is contained in:
Robin Gareus 2020-12-12 04:47:21 +01:00
parent 5e76d63c06
commit 35c9b08154
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 19 additions and 1 deletions

View File

@ -76,6 +76,7 @@ while [ $# -gt 0 ] ; do
--no-nls) WITH_NLS= ; shift ;;
--nls) WITH_NLS=1 ; shift ;;
--chanstrip) HARRISONCHANNELSTRIP=$2 ; shift; shift ;;
--stack) GTKSTACK_ROOT=$2 ; shift; shift ;;
esac
done
@ -633,6 +634,9 @@ if file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q x86_64; the
elif file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q ppc; then
OSX_ARCH=ppc
OSX_BENSID=osxppc
elif file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q arm64; then
OSX_ARCH=arm64
OSX_BENSID=macarm64
else
OSX_ARCH=i386
OSX_BENSID=osx32

14
wscript
View File

@ -66,6 +66,8 @@ compiler_flags_dictionaries= {
'generic-x86' : '',
# Flags required to build for PowerPC only (OS X feature)
'generic-ppc' : '',
# Flags required to build for PowerPC only (OS X feature)
'generic-arm64' : '',
# All flags required to get basic warnings to be generated by the compiler
'basic-warnings' : [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter' ],
# Any additional flags for warnings that are specific to C (not C++)
@ -112,6 +114,7 @@ compiler_flags_dictionaries= {
'show-column' : '',
'generic-x86' : '',
'generic-ppc' : '',
'generic-arm64' : '',
'basic-warnings' : '',
'extra-c-warnings' : '',
'extra-cxx-warnings' : '',
@ -136,6 +139,7 @@ gcc_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-v
gcc_darwin_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
gcc_darwin_dict['generic-x86'] = [ '-arch', 'i386' ]
gcc_darwin_dict['generic-ppc'] = [ '-arch', 'ppc' ]
gcc_darwin_dict['generic-arm64'] = [ '-arch', 'arm64' ]
compiler_flags_dictionaries['gcc-darwin'] = gcc_darwin_dict;
clang_dict = compiler_flags_dictionaries['gcc'].copy();
@ -148,6 +152,7 @@ clang_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual', '-Wno-mismatched-ta
clang_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ]
clang_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
clang_dict['generic-x86'] = [ '-arch', 'i386' ]
clang_dict['generic-arm64'] = [ '-arch', 'arm64' ]
clang_dict['full-optimization'] = [ '-O3', '-fomit-frame-pointer', '-ffast-math', ]
compiler_flags_dictionaries['clang'] = clang_dict;
@ -523,6 +528,8 @@ int main() { return 0; }''',
# distingush 32 and 64 bit assembler
#
if not (opt.arm64 or conf.env['build_target'] == 'armhf' and conf.env['build_target'] == 'aarch64'):
compiler_flags.append ("-DARCH_X86")
if platform == 'linux' and conf.env['build_target'] != 'armhf' and conf.env['build_target'] != 'aarch64':
@ -692,6 +699,10 @@ int main() { return 0; }''',
compiler_flags.extend(flags_dict['generic-ppc'])
linker_flags.extend(flags_dict['generic-ppc'])
if opt.arm64:
compiler_flags.extend(flags_dict['generic-arm64'])
linker_flags.extend(flags_dict['generic-arm64'])
#
# warnings flags
#
@ -854,6 +865,8 @@ def options(opt):
help='Compile with -arch i386 (OS X ONLY)')
opt.add_option('--ppc', action='store_true', default=False, dest='ppc',
help='Compile with -arch ppc (OS X ONLY)')
opt.add_option('--arm64', action='store_true', default=False, dest='arm64',
help='Compile with -arch arm64 (macOS ONLY)')
opt.add_option('--versioned', action='store_true', default=False, dest='versioned',
help='Add revision information to executable name inside the build directory')
opt.add_option('--windows-vst', action='store_true', default=False, dest='windows_vst',
@ -1463,6 +1476,7 @@ const char* const ardour_config_info = "\\n\\
write_config_text('Buildstack', conf.env['DEPSTACK_REV'])
write_config_text('Mac i386 Architecture', opts.generic)
write_config_text('Mac ppc Architecture', opts.ppc)
write_config_text('Mac arm64 Architecture', opts.arm64)
config_text.write("\\n\\\n")
write_config_text('C compiler flags', conf.env['CFLAGS'])
write_config_text('C++ compiler flags', conf.env['CXXFLAGS'])