diff --git a/bin/macos-arm64/env_macos-arm64.txt b/bin/macos-arm64/env_macos-arm64.txt new file mode 100644 index 00000000..4b9a58e1 --- /dev/null +++ b/bin/macos-arm64/env_macos-arm64.txt @@ -0,0 +1,166 @@ + +'-------------------------------------------------------------------------------------- +'----- MACOS DESKTOP TARGET +'-------------------------------------------------------------------------------------- + +WX_THREADS=1 + +'Hacks for dylibs in app + +'dylibs for in Contents/MacOS dir... +WX_APP_DIR_DYLIB= + +'frameworks go in app Contents/Frameworks dir +WX_APP_DIR_FRAMEWORK=../Frameworks + +WX_MACOS_ARCHS=-arch arm64 -target arm64-apple-darwin +'WX_MACOS_ARCHS=-mmacosx-version-min=10.9 + +'LD options +WX_LD_OPTS_MACOS=-Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/../Frameworks ${WX_MACOS_ARCHS} +WX_LD_OPTS_MACOS_DEBUG= +WX_LD_OPTS_MACOS_RELEASE=-O3 -Wl,-dead_strip -Wl,-S -Wl,-x + +'C compiler options +WX_CC_OPTS_MACOS=-std=gnu99 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CC_OPTS_MACOS_DEBUG= +WX_CC_OPTS_MACOS_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections + +'C++ compiler options +WX_CPP_OPTS_MACOS=-std=c++14 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CPP_OPTS_MACOS_DEBUG= +WX_CPP_OPTS_MACOS_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections + +'*****************************' +'LD options +WX_LD_OPTS_MACOS-ARM64=-Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/../Frameworks ${WX_MACOS_ARCHS} +WX_LD_OPTS_MACOS-ARM64_DEBUG= +WX_LD_OPTS_MACOS-ARM64_RELEASE=-O3 -Wl,-dead_strip -Wl,-S -Wl,-x + +'C compiler options +WX_CC_OPTS_MACOS-ARM64=-std=gnu99 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CC_OPTS_MACOS-ARM64_DEBUG= +WX_CC_OPTS_MACOS-ARM64_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections + +'C++ compiler options +WX_CPP_OPTS_MACOS-ARM64=-std=c++14 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CPP_OPTS_MACOS-ARM64_DEBUG= +WX_CPP_OPTS_MACOS-ARM64_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections +'*****************************' + + +'AS options +WX_AS_OPTS_MACOS=${WX_MACOS_ARCHS} + +'-------------------------------------------------------------------------------------- +'----- EMSCRIPTEN TARGET +'-------------------------------------------------------------------------------------- + +'Change this to the location of your emsdk: +' +EMSDK=${HOME}/emsdk + +PATH=${EMSDK}:${EMSDK}/clang/e1.38.0_64bit:${EMSDK}/node/8.9.1_64bit/bin:${EMSDK}/emscripten/1.38.0:${PATH} + +'El Capitan broke my python... +' +PATH=/usr/local/bin:${PATH} + +'To run emscripten apps you'll need the mserver mini-server. +' +WX_MSERVER=open "${WX_HOME}/devtools/mserver-v86c/mserver_macos.app" --args + +'LD options +WX_LD_OPTS_EMSCRIPTEN=-s FETCH=1 -s USE_SDL=2 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 +WX_LD_OPTS_EMSCRIPTEN_DEBUG=-O2 -s ASSERTIONS=2 +WX_LD_OPTS_EMSCRIPTEN_RELEASE=-O3 + +WX_LD_OPTS_EMSCRIPTEN_WASM=-s BINARYEN=1 + +'C compiler options +WX_CC_OPTS_EMSCRIPTEN=-std=gnu99 -s USE_SDL=2 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 +WX_CC_OPTS_EMSCRIPTEN_DEBUG=-O2 +WX_CC_OPTS_EMSCRIPTEN_RELEASE=-O3 -DNDEBUG + +'C++ compiler options +WX_CPP_OPTS_EMSCRIPTEN=-std=c++11 -s USE_SDL=2 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 +WX_CPP_OPTS_EMSCRIPTEN_DEBUG=-O2 +WX_CPP_OPTS_EMSCRIPTEN_RELEASE=-O3 -DNDEBUG + +'-------------------------------------------------------------------------------------- +'----- ANDROID TARGET +'-------------------------------------------------------------------------------------- + +WX_ANDROID_NDK=${HOME}/Library/Android/sdk/ndk/22.0.7026061 + +'Add path to android NDK +' +'PATH=${HOME}/Library/Android/sdk/ndk-bundle:${PATH} +PATH=${WX_ANDROID_NDK}:${PATH} + +'Controls APP_ABI in Application.mk for NDK +' +'WX_ANDROID_APP_ABI=all +'WX_ANDROID_APP_ABI=armeabi-v7a x86 +WX_ANDROID_APP_ABI=arm64-v8a x86_64 + +'Controls APP_PLATFORM in Application.mk for NDK +' +WX_ANDROID_APP_PLATFORM=android-16 + +'Android app compiler Compiler flags +' +WX_ANDROID_APP_CFLAGS=-std=gnu99 -fno-stack-protector -w +WX_ANDROID_APP_CPPFLAGS=-std=c++11 -fno-stack-protector -frtti -fexceptions -w + +'Controls version of STL used by android apps. +' +WX_ANDROID_APP_STL=c++_static + +'-------------------------------------------------------------------------------------- +'----- IOS TARGET +'-------------------------------------------------------------------------------------- + +' iOS archs +' +' iOS simulator x86: -arch i386 -target i386-apple-ios-simulator +' iOS simulator x64: -arch x86_64 -target x86_64-apple-ios-simulator +' iOS armv7 : -arch armv7 -target armv7-apple-ios +' iOS armv7s : -arch armv7s -target armv7-apple-ios +' iOS arm64 : -arch arm64 -target arm64-apple-ios (default) +' iOS arm64e : -arch arm64e -target arm64-apple-ios (to test) +' +WX_IOS_ARCHS=-arch arm64 -target arm64-apple-ios + +'Note: must appear BEFORE first use of WX_IOS_SDK +' +WX_IOS_USE_SIMULATOR=0 + +'This is now set for you by mx2cc. +' +'WX_IOS_SDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk (deprecated) + +WX_IOS_DEPLOYMENT_TARGET=9.0 + +'AS options +WX_AS_OPTS_IOS_ARM64=${WX_IOS_ARCHS} +WX_AS_OPTS_IOS_ARMV7=-arch armv7 -target armv7-apple-ios + +'LD options +WX_LD_OPTS_IOS=${WX_IOS_ARCHS} -isysroot ${WX_IOS_SDK} +WX_LD_OPTS_IOS_DEBUG= +WX_LD_OPTS_IOS_RELEASE=-O3 + +'C compiler options +' +WX_CC_OPTS_IOS=-std=gnu99 ${WX_IOS_ARCHS} -miphoneos-version-min=${WX_IOS_DEPLOYMENT_TARGET} -isysroot ${WX_IOS_SDK} -fobjc-arc -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality + +WX_CC_OPTS_IOS_DEBUG= +WX_CC_OPTS_IOS_RELEASE=-O3 -DNDEBUG + +'C++ compiler options +' +WX_CPP_OPTS_IOS=-std=c++11 ${WX_IOS_ARCHS} -miphoneos-version-min=${WX_IOS_DEPLOYMENT_TARGET} -isysroot ${WX_IOS_SDK} -fobjc-arc -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -fvisibility=hidden + +WX_CPP_OPTS_IOS_DEBUG=-O0 -g +WX_CPP_OPTS_IOS_RELEASE=-O3 -DNDEBUG diff --git a/bin/macos-arm64/wake b/bin/macos-arm64/wake new file mode 100755 index 00000000..e0fa2640 Binary files /dev/null and b/bin/macos-arm64/wake differ diff --git a/bin/macos/env_macos.txt b/bin/macos/env_macos.txt index 13117224..744956a4 100644 --- a/bin/macos/env_macos.txt +++ b/bin/macos/env_macos.txt @@ -1,5 +1,5 @@ -'--------------------------------------------------------------------------------------' +'-------------------------------------------------------------------------------------- '----- MACOS DESKTOP TARGET '-------------------------------------------------------------------------------------- @@ -13,23 +13,44 @@ WX_APP_DIR_DYLIB= 'frameworks go in app Contents/Frameworks dir WX_APP_DIR_FRAMEWORK=../Frameworks +WX_MACOS_ARCHS=-arch arm64 -target arm64-apple-darwin +'WX_MACOS_ARCHS=-mmacosx-version-min=10.9 + 'LD options -WX_LD_OPTS_MACOS=-mmacosx-version-min=10.9 -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/../Frameworks +WX_LD_OPTS_MACOS=-Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/../Frameworks ${WX_MACOS_ARCHS} WX_LD_OPTS_MACOS_DEBUG= WX_LD_OPTS_MACOS_RELEASE=-O3 -Wl,-dead_strip -Wl,-S -Wl,-x 'C compiler options -WX_CC_OPTS_MACOS=-std=gnu99 -mmacosx-version-min=10.9 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CC_OPTS_MACOS=-std=gnu99 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality WX_CC_OPTS_MACOS_DEBUG= WX_CC_OPTS_MACOS_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections 'C++ compiler options -WX_CPP_OPTS_MACOS=-std=c++14 -mmacosx-version-min=10.9 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CPP_OPTS_MACOS=-std=c++14 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality WX_CPP_OPTS_MACOS_DEBUG= WX_CPP_OPTS_MACOS_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections +'*****************************' +'LD options +WX_LD_OPTS_MACOS-ARM64=-Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/../Frameworks ${WX_MACOS_ARCHS} +WX_LD_OPTS_MACOS-ARM64_DEBUG= +WX_LD_OPTS_MACOS-ARM64_RELEASE=-O3 -Wl,-dead_strip -Wl,-S -Wl,-x + +'C compiler options +WX_CC_OPTS_MACOS-ARM64=-std=gnu99 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CC_OPTS_MACOS-ARM64_DEBUG= +WX_CC_OPTS_MACOS-ARM64_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections + +'C++ compiler options +WX_CPP_OPTS_MACOS-ARM64=-std=c++14 ${WX_MACOS_ARCHS} -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality +WX_CPP_OPTS_MACOS-ARM64_DEBUG= +WX_CPP_OPTS_MACOS-ARM64_RELEASE=-O3 -DNDEBUG -ffunction-sections -fdata-sections +'*****************************' + + 'AS options -WX_AS_OPTS= +WX_AS_OPTS_MACOS=${WX_MACOS_ARCHS} '-------------------------------------------------------------------------------------- '----- EMSCRIPTEN TARGET diff --git a/modules/openal/openal.wx b/modules/openal/openal.wx index 0de3abce..ccf48c19 100644 --- a/modules/openal/openal.wx +++ b/modules/openal/openal.wx @@ -19,7 +19,7 @@ #Import "" #Import "" -#else if __TARGET__="macos" +#else if __TARGET__="macos" or __TARGET__="macos-arm64" ' #Import "" 'built-in openal on macos is borked. diff --git a/modules/std/fiber/fcontext.wx b/modules/std/fiber/fcontext.wx index 5e84742b..2650ba55 100644 --- a/modules/std/fiber/fcontext.wx +++ b/modules/std/fiber/fcontext.wx @@ -26,6 +26,16 @@ Namespace std.fiber #import "native/asm/jump_x86_64_sysv_macho_gas.S" #import "native/asm/ontop_x86_64_sysv_macho_gas.S" +#Else If __TARGET__="macos-arm64" 'Apple Silicon + + '#import "native/asm/make_arm_aapcs_macho_gas.S" + '#import "native/asm/jump_arm_aapcs_macho_gas.S" + '#import "native/asm/ontop_arm_aapcs_macho_gas.S" + + #import "native/asm/make_arm64_aapcs_macho_gas.S" + #import "native/asm/jump_arm64_aapcs_macho_gas.S" + #import "native/asm/ontop_arm64_aapcs_macho_gas.S" + #Else If __TARGET__="linux" #import "native/asm/make_x86_64_sysv_elf_gas.S" diff --git a/src/wake/builder.wx b/src/wake/builder.wx index dfd7a199..e16f21dd 100644 --- a/src/wake/builder.wx +++ b/src/wake/builder.wx @@ -59,7 +59,7 @@ Class BuilderInstance ppsyms["__COMPILER__"]="~q"+opts.toolchain+"~q" '//new! maybe '__TOOL_CHAIN__' ? = 'msvc' or 'gcc' Select opts.target - Case "windows","macos","linux","raspbian" + Case "windows","macos","linux","raspbian", "macos-arm64" ppsyms["__DESKTOP_TARGET__"]="true" ppsyms["__MOBILE_TARGET__"]="false" @@ -100,6 +100,10 @@ Class BuilderInstance Elseif opts.target="ios" If opts.arch="x64" profileName+="_x64" + + ElseIf opts.target="macos-arm64" + + profileName+="_arm64" Endif diff --git a/src/wake/buildproduct.wx b/src/wake/buildproduct.wx index 61ba2094..1ef7edfb 100644 --- a/src/wake/buildproduct.wx +++ b/src/wake/buildproduct.wx @@ -203,7 +203,7 @@ Class BuildProduct 'FIXME! Hack for copying frameworks on macos! ' -#If __HOSTOS__="macos" +#If __HOSTOS__="macos" or __HOSTOS__="macos-arm64" If ExtractExt( src ).ToLower()=".framework" CreateDir( ExtractDir( dst ) ) If Not Exec( "rm -f -R "+dst ) Throw New BuildEx( "rm failed" ) @@ -383,7 +383,9 @@ Class GccBuildProduct Extends BuildProduct Else cmd+=" "+GetEnv( "WX_AS_OPTS_IOS_ARMV7" ) Endif - + + Else If opts.target="macos-arm64" + cmd+=" "+GetEnv( "WX_AS_OPTS_MACOS" ) Endif isasm=True @@ -609,7 +611,7 @@ Class GccBuildProduct Extends BuildProduct If opts.appType="gui" cmd+=" -mwindows" Endif - Case "macos" + Case "macos", "macos-arm64" If opts.appType="gui" diff --git a/src/wake/util.wx b/src/wake/util.wx index 04213de6..e72c3515 100644 --- a/src/wake/util.wx +++ b/src/wake/util.wx @@ -5,6 +5,8 @@ Namespace wx Const HostOS:="windows" #Else If __TARGET__="macos" Const HostOS:="macos" +#Else If __TARGET__="macos-arm64" +Const HostOS:="macos-arm64" #Else If __TARGET__="linux" Const HostOS:="linux" #Else If __TARGET__="raspbian" diff --git a/src/wake/wake.wx b/src/wake/wake.wx index 2a55ef46..9db1c65c 100644 --- a/src/wake/wake.wx +++ b/src/wake/wake.wx @@ -477,10 +477,10 @@ Function ParseOpts:String[]( opts:BuildOpts,args:String[] ) opts.appType=val Case "-target" Select val - Case "desktop","windows","macos","linux","raspbian","emscripten","android","ios" + Case "desktop","windows","macos","linux","raspbian","emscripten","android","ios","macos-arm64" opts.target=val Default - Fail( "Invalid value for 'target' option: '"+val+"' - must be 'desktop', 'raspbian', 'emscripten', 'android' or 'ios'" ) + Fail( "Invalid value for 'target' option: '"+val+"' - must be 'desktop', 'raspbian', 'emscripten', 'android' or 'ios' or 'macos-arm64'" ) End Case "-config" Select val @@ -557,6 +557,12 @@ Function ParseOpts:String[]( opts:BuildOpts,args:String[] ) If Not opts.appType opts.appType="gui" opts.arch="x64" + + Case "macos-arm64" + + If Not opts.appType opts.appType="gui" + + opts.arch="arm64" Case "raspbian" @@ -609,7 +615,7 @@ Function ParseOpts:String[]( opts:BuildOpts,args:String[] ) Case "console","gui" Select opts.target - Case "windows","macos","linux","raspbian" + Case "windows","macos","linux","raspbian", "macos-arm64" Default Fail( "apptype '"+opts.appType+"' is only valid for desktop targets" ) End