Browse Source

Added ios arm64 support.

Mark Sibly 8 years ago
parent
commit
aa90ccc34b

+ 8 - 8
bin/env_macos.txt

@@ -55,12 +55,12 @@ MX2_LD_OPTS_EMSCRIPTEN_RELEASE=-O3
 'C compiler options
 MX2_CC_OPTS_EMSCRIPTEN=-std=gnu99 -s USE_SDL=2 -s TOTAL_MEMORY=67108864 -s DISABLE_EXCEPTION_CATCHING=1
 MX2_CC_OPTS_EMSCRIPTEN_DEBUG=-O2
-MX2_CC_OPTS_EMSCRIPTEN_RELEASE=-O3
+MX2_CC_OPTS_EMSCRIPTEN_RELEASE=-O3 -DNDEBUG
 
 'C++ compiler options
 MX2_CPP_OPTS_EMSCRIPTEN=-std=c++11 -s USE_SDL=2 -s TOTAL_MEMORY=67108864 -s DISABLE_EXCEPTION_CATCHING=1
 MX2_CPP_OPTS_EMSCRIPTEN_DEBUG=-O2
-MX2_CPP_OPTS_EMSCRIPTEN_RELEASE=-O3
+MX2_CPP_OPTS_EMSCRIPTEN_RELEASE=-O3 -DNDEBUG
 
 
 '***** ANDROID *****
@@ -73,16 +73,16 @@ PATH=${HOME}/Library/Android/sdk/ndk-bundle:${PATH}
 MX2_SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk
 
 'LD options
-MX2_LD_OPTS_IOS=-arch armv7 -isysroot ${MX2_SDKROOT}
-MX2_LD_OPTS_IOS_DEBUG=-O0 -g
-MX2_LD_OPTS_IOS_RELEASE=-O3
+MX2_LD_OPTS_IOS=-arch armv7 -arch arm64 -isysroot ${MX2_SDKROOT}
+MX2_LD_OPTS_IOS_DEBUG=
+MX2_LD_OPTS_IOS_RELEASE=-O3 
 
 'C compiler options
-MX2_CC_OPTS_IOS=-std=gnu99 -arch armv7 -isysroot ${MX2_SDKROOT} -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
-MX2_CC_OPTS_IOS_DEBUG=-O0 -g
+MX2_CC_OPTS_IOS=-std=gnu99 -arch armv7 -arch arm64 -isysroot ${MX2_SDKROOT} -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
+MX2_CC_OPTS_IOS_DEBUG=
 MX2_CC_OPTS_IOS_RELEASE=-O3 -DNDEBUG
 
 'C++ compiler options
-MX2_CPP_OPTS_IOS=-std=c++11 -arch armv7 -isysroot ${MX2_SDKROOT} -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
+MX2_CPP_OPTS_IOS=-std=c++11 -arch armv7 -arch arm64 -isysroot ${MX2_SDKROOT} -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
 MX2_CPP_OPTS_IOS_DEBUG=-O0 -g
 MX2_CPP_OPTS_IOS_RELEASE=-O3 -DNDEBUG

BIN
bin/mx2cc_macos


+ 4 - 0
modules/std/fiber/fcontext.monkey2

@@ -44,6 +44,10 @@ Namespace std.fiber
 	#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"
+
 #Endif
 
 Extern Private

+ 1 - 1
modules/theoraplayer/makefile.monkey2

@@ -140,7 +140,7 @@ Namespace theoraplayer
 #Import "native/theoraplayer/src/YUV/libyuv/src/scale.cc"
 #Import "native/theoraplayer/src/YUV/libyuv/src/scale_any.cc"
 #Import "native/theoraplayer/src/YUV/libyuv/src/scale_argb.cc"
-#Import "native/theoraplayer/src/YUV/libyuv/src/scale_argb_neon.cc"
+'#Import "native/theoraplayer/src/YUV/libyuv/src/scale_argb_neon.cc"	'problem on ios arm64...
 #Import "native/theoraplayer/src/YUV/libyuv/src/scale_common.cc"
 #Import "native/theoraplayer/src/YUV/libyuv/src/scale_gcc.cc"
 #Import "native/theoraplayer/src/YUV/libyuv/src/scale_mips.cc"

+ 50 - 12
src/mx2cc/buildproduct.monkey2

@@ -304,7 +304,6 @@ Class GccBuildProduct Extends BuildProduct
 			CXX_CMD="g++"+suffix
 			LD_CMD= "g++"+suffix
 			AS_CMD= "as"
-			If opts.target="ios" AS_CMD+=" -arch armv7"
 		End
 		
 	End
@@ -334,6 +333,14 @@ Class GccBuildProduct Extends BuildProduct
 		
 			cmd=AS_CMD+AS_OPTS
 			
+			If opts.target="ios"
+				If src.Contains( "_arm64_" )
+					cmd+=" -arch arm64"
+				Else
+					cmd+=" -arch armv7"
+				Endif
+			Endif
+			
 			isasm=True
 		End
 			
@@ -355,7 +362,21 @@ Class GccBuildProduct Extends BuildProduct
 					
 				If opts.verbose>0 Print "Scanning "+src
 				
-				Exec( cmd+" -MM ~q"+src+"~q >~q"+deps+"~q" ) 
+				Local tmp:=cmd
+				
+				'A bit dodgy - rip out -arch's from ios
+				If opts.target="ios"
+					Repeat
+						Local i0:=tmp.Find( " -arch "  )
+						If i0=-1 Exit
+						Local i1:=tmp.Find( " ",i0+7 )
+						If i1=-1 Exit
+						tmp=tmp.Slice( 0,i0+1 )+tmp.Slice( i1+1 )
+					Forever
+					tmp+=" -arch armv7"
+				Endif					
+				
+				Exec( tmp+" -MM ~q"+src+"~q >~q"+deps+"~q" ) 
 			Endif
 					
 			Local srcs:=LoadString( deps ).Split( " \" )
@@ -423,21 +444,38 @@ Class GccBuildProduct Extends BuildProduct
 		
 		DeleteFile( output )
 		
-		Local args:=""
-
-		For Local i:=0 Until objs.Length
-			
-			args+=" ~q"+objs.Get( i )+"~q"
+		If opts.target="ios"
+		
+			Local args:=""
+	
+			For Local i:=0 Until objs.Length
+				args+=" ~q"+objs.Get( i )+"~q"
+			Next
 			
-			If args.Length<1000 And i<objs.Length-1 Continue
-
-			Local cmd:=AR_CMD+" q ~q"+output+"~q"+args
+			Local cmd:="libtool -o ~q"+output+"~q"+args
 
 			Exec( cmd )
+		
+		Else
+		
+			Local args:=""
+	
+			For Local i:=0 Until objs.Length
+				
+				args+=" ~q"+objs.Get( i )+"~q"
 			
-			args=""
+				If args.Length<1000 And i<objs.Length-1 Continue
+				
+				Local cmd:=AR_CMD+" q ~q"+output+"~q"+args
+
+				Exec( cmd )
+				
+				args=""
 			
-		Next
+			Next
+		
+		Endif
+		
 	End
 	
 	Method BuildApp( objs:StringStack ) Virtual

+ 1 - 1
src/mx2cc/mx2cc.monkey2

@@ -21,7 +21,7 @@ Using mx2..
 
 Global StartDir:String
 
-Const TestArgs:="mx2cc makemods -target=android"
+Const TestArgs:="mx2cc makemods -target=ios std"' std"
  
 'Const TestArgs:="mx2cc makeapp -apptype=console -target=android src/mx2cc/test.monkey2"