Selaa lähdekoodia

Tweaked mx2cc so gcc builds create deps files at same time as compiling. Duh.

Mark Sibly 7 vuotta sitten
vanhempi
commit
0687e2b705
2 muutettua tiedostoa jossa 45 lisäystä ja 77 poistoa
  1. 3 1
      VERSIONS.TXT
  2. 42 76
      src/mx2cc/buildproduct.monkey2

+ 3 - 1
VERSIONS.TXT

@@ -1,7 +1,9 @@
 
 ***** Monkey2 v2018.03 Mx2cc v1.1.12 *****
 
-Updated my anroid dev system to: Android Studio 3.1 ; Android SDK Tools 26.1.1 ; NDK 16.1.4479499 ; Android SDK 27 (Oreo 8.1)
+Tweaked mx2cc's gcc dependancy checking so it happens while compiling (just like msvc's) so there should now only be 1 'slow build' under mingw instead of 2. Sometimes it's just a matter of knowing that a certain command line option even exists!
+
+Updated my anroid dev system to: Android Studio 3.1 ; Android SDK Tools 26.1.1 ; NDK 16.1.4479499 ; Android SDK 27 (Oreo 8.1) so you should do the same if you haven't yet.
 
 Removed the ComponentType param overloads from NumComponents and GetComponent in Entity. Use NumComponents<T> and GetComponent<T> instead. Duh. Also added GetComponents<T>:T[]().
 

+ 42 - 76
src/mx2cc/buildproduct.monkey2

@@ -407,61 +407,14 @@ Class GccBuildProduct Extends BuildProduct
 		
 			If isasm Return obj
 			
-			Local uptodate:=GetFileType( deps )=FileType.File
-			
-			If Not uptodate And opts.toolchain="gcc"
-
-				If opts.verbose>0 Print "Scanning "+src
-					
-				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
-					
-					If opts.arch<>"x64" tmp+=" -arch armv7"
-				Endif
-				
-				tmp+=" -MM ~q"+src+"~q >~q"+deps+"~q"
-				
-				Exec( tmp )
-				
-				Local buf:=New StringStack
-				
-				Local lines:=LoadString( deps ).Split( " \" )
-				
-				For Local i:=1 Until lines.Length
-					
-					Local line:=lines[i].Trim().Replace( "\ "," " )
-					
-					If Not line Or line=src Continue
-					
-					buf.Add( line )
-				Next
-				
-				SaveString( buf.Join( "~n" ),deps )
-				
-				uptodate=True
-			Endif
-			
-			If uptodate
-				
-				Local str:=LoadString( deps )
+			If GetFileType( deps )=FileType.File
 				
-				If Not str Return obj
+				Local uptodate:=True
 				
-				Local lines:=str.Split( "~n" )
+				Local srcs:=LoadString( deps )
+				If Not srcs Return obj
 				
-				For Local line:=Eachin lines
-					
-					Local src:=line
+				For Local src:=Eachin srcs.Split( "~n" )
 					
 					Local time:=GetFileTime( src )
 					
@@ -470,22 +423,54 @@ Class GccBuildProduct Extends BuildProduct
 						uptodate=False
 						Exit
 					Endif
-							
 				Next
 				
 				If uptodate Return obj
 				
 			Endif
-				
 		Else
-			
 			DeleteFile( deps )
-
 		Endif
 			
 		If opts.verbose>0 Print StripDir( src )
+			
+		If opts.toolchain<>"msvc"
+			
+			If isasm
+				cmd+=" -o ~q"+obj+"~q ~q"+src+"~q"
+				Exec( cmd )
+				Return obj
+			Endif
+			
+			'A bit dodgy - rip out -arch's from ios
+			If opts.target="ios"
+				Repeat
+					Local i0:=cmd.Find( " -arch "  )
+					If i0=-1 Exit
+					Local i1:=cmd.Find( " ",i0+7 )
+					If i1=-1 Exit
+					cmd=cmd.Slice( 0,i0+1 )+cmd.Slice( i1+1 )
+				Forever
+				If opts.arch<>"x64" cmd+=" -arch armv7"
+			Endif
+			
+			cmd+=" -MMD -MF~q"+deps+"~q"
+			cmd+=" -o ~q"+obj+"~q ~q"+src+"~q"
+			If opts.verbose>2 Print cmd
+			Exec( cmd )
+			
+			Local buf:=New StringStack
+			Local lines:=LoadString( deps ).Split( " \" )
+			For Local i:=1 Until lines.Length
+				Local line:=lines[i].Trim().Replace( "\ "," " )
+				If Not line Or line=src Continue
+				buf.Add( line )
+			Next
+			SaveString( buf.Join( "~n" ),deps )
+			
+			Return obj
 				
-		If opts.toolchain="msvc"
+		Else If opts.toolchain="msvc"
 
 			If isasm
 				cmd+=" -Fo~q"+obj+"~q ~q"+src+"~q"
@@ -494,55 +479,36 @@ Class GccBuildProduct Extends BuildProduct
 			Endif
 			
 			Local fstdout:=AllocTmpFile( "stdout" )
-			
 			cmd+=" -showIncludes -Fo~q"+obj+"~q ~q"+src+"~q >"+fstdout
 			
 			If opts.verbose>2 Print cmd
-				
 			Local fstderr:=AllocTmpFile( "stderr" )
-			
 			If system( cmd+" 2>"+fstderr )
-
 				Local buf:=New StringStack
-				
 				For Local line:=Eachin LoadString( fstdout,True ).Split( "~n" )
-					
 					If Not line.StartsWith( "Note: including file:" ) buf.Add( line )
 				Next
-				
 				Local err:="System command failed:~n~n"+cmd+"~n~n"+buf.Join( "~n" )+"~n"
-				
 				err+=LoadString( fstderr,True )
-				
 				Throw New BuildEx( err )
 			Endif
 			
 			Local buf:=New StringStack
-			
 			Local lines:=LoadString( fstdout ).Split( "~n" )
-			
 			For Local line:=Eachin lines
-				
 				If Not line.StartsWith( "Note: including file:" ) Continue
-				
 				line=line.Slice( 21 ).Trim()
-				
 				If line.ToLower().Contains( "\program files (x86)\" ) Continue
-				
 				line=line.Replace( "\","/" )
-				
 				buf.Add( line )
 			Next
-			
 			SaveString( buf.Join( "~n" ),deps )
 			
 			Return obj
 		Endif
 
 		cmd+=" -o ~q"+obj+"~q ~q"+src+"~q"
-				
 		Exec( cmd )
-			
 		Return obj
 	End