Kaynağa Gözat

New 'compile' option. Similar to makeapp, but doesn't link or create executables.

woollybah 7 yıl önce
ebeveyn
işleme
502e1bdec5
4 değiştirilmiş dosya ile 34 ekleme ve 17 silme
  1. 3 0
      CHANGELOG
  2. 20 12
      bmk.bmx
  3. 1 1
      bmk_config.bmx
  4. 10 4
      bmk_make.bmx

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+## [3.21] - 2018-01-10
+### Added
+ - New 'compile' option. Similar to makeapp, but doesn't link or create executables.
 ## [3.20] - 2017-12-12
 ### Fixed
  - Now correctly factors in generated sources when determining current build requirements.

+ 20 - 12
bmk.bmx

@@ -74,7 +74,9 @@ Case "makemods"
 			LoadOptions(True)
 		End If
 	EndIf
-
+Case "compile"
+	SetConfigMung
+	MakeApplication args,False,True
 Case "cleanmods"
 	CleanModules args
 Case "zapmod"
@@ -202,12 +204,18 @@ Function CleanModules( args$[] )
 
 End Function
 
-Function MakeApplication( args$[],makelib )
+Function MakeApplication( args$[],makelib:Int,compileOnly:Int = False )
 
-	If opt_execute
+	If opt_execute And Not compileOnly
 		If Len(args)=0 CmdError "Execute requires at least 1 argument"
 	Else
-		If Len(args)<>1 CmdError "Expecting only 1 argument for makeapp"
+		If Len(args)<>1 Then
+			If compileOnly Then
+				CmdError "Expecting only 1 argument for compile"
+			Else
+				CmdError "Expecting only 1 argument for makeapp"
+			End If
+		End If
 	EndIf
 
 	Local Main$=RealPath( args[0] )
@@ -235,7 +243,7 @@ Function MakeApplication( args$[],makelib )
 	
 	
 	' some more useful globals
-	If processor.Platform() = "macos" And opt_apptype="gui" Then
+	If processor.Platform() = "macos" And opt_apptype="gui" And Not compileOnly Then
 		Local appId$=StripDir( opt_outfile )
 		
 		globals.SetVar("APPID", appId)
@@ -289,7 +297,7 @@ Function MakeApplication( args$[],makelib )
 	EndIf
 
 	If processor.Platform() = "macos" Or processor.Platform() = "osx" Then
-		If opt_apptype="gui"
+		If opt_apptype="gui" And Not compileOnly
 	
 			'Local appId$=StripDir( opt_outfile )
 			Local appId$ = globals.Get("APPID")
@@ -367,12 +375,12 @@ Function MakeApplication( args$[],makelib )
 	Local buildManager:TBuildManager = New TBuildManager
 
 	' "android-project" check and copy
-	If processor.Platform() = "android" Then
+	If processor.Platform() = "android" And Not compileOnly Then
 		DeployAndroidProject()
 	End If
 
-	buildManager.MakeApp(Main, makelib)
-	buildManager.DoBuild(True)
+	buildManager.MakeApp(Main, makelib, compileOnly)
+	buildManager.DoBuild(Not compileOnly)
 
 	If opt_universal And processor.Platform() = "ios" Then
 
@@ -382,7 +390,7 @@ Function MakeApplication( args$[],makelib )
 		BeginMake
 
 		Local buildManager:TBuildManager = New TBuildManager
-		buildManager.MakeApp(Main, makelib)
+		buildManager.MakeApp(Main, makelib, compileOnly)
 		buildManager.DoBuild(True)
 
 		processor.ToggleCPU()
@@ -406,7 +414,7 @@ Rem
 		opt_outfile = previousOutfile
 	End If
 End Rem
-	If opt_standalone
+	If opt_standalone And Not compileOnly
 		Local buildScript:String = String(globals.GetRawVar("EXEPATH")) + "/" + StripExt(StripDir( app_main )) + "." + opt_apptype + opt_configmung + processor.CPU() + ".build"
 		Local ldScript:String = "$APP_ROOT/ld." + processor.AppDet() + ".txt"
 		
@@ -443,7 +451,7 @@ End Rem
 		
 	End If
 
-	If opt_execute
+	If opt_execute And Not compileOnly
 
 ?Not android
 		Print "Executing:"+StripDir( opt_outfile )

+ 1 - 1
bmk_config.bmx

@@ -9,7 +9,7 @@ Import Pub.MacOS
 
 Import "stringbuffer_core.bmx"
 
-Const BMK_VERSION:String = "3.20"
+Const BMK_VERSION:String = "3.21"
 
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc;asm;S"
 

+ 10 - 4
bmk_make.bmx

@@ -271,7 +271,7 @@ Type TBuildManager
 		Next
 	End Method
 
-	Method MakeApp(main_path:String, makelib:Int)
+	Method MakeApp(main_path:String, makelib:Int, compileOnly:Int = False)
 		app_main = main_path
 
 		Local source:TSourceFile = GetSourceFile(app_main, False, opt_all)
@@ -282,7 +282,12 @@ Type TBuildManager
 
 		Local build_path:String = ExtractDir(main_path) + "/.bmx"
 
-		source.obj_path = build_path + "/" + StripDir( main_path ) + "." + opt_apptype + opt_configmung + processor.CPU() + ".o"
+		Local appType:String
+		If Not compileOnly Or source.framewk Then
+			appType = "." + opt_apptype
+		End If
+		
+		source.obj_path = build_path + "/" + StripDir( main_path ) + apptype + opt_configmung + processor.CPU() + ".o"
 		source.obj_time = FileTime(source.obj_path)
 		source.iface_path = StripExt(source.obj_path) + ".o"
 		source.iface_time = FileTime(source.iface_path)
@@ -358,8 +363,9 @@ Type TBuildManager
 		Else
 			gen = CreateGenStage(source)
 		End If
-		Local link:TSourceFile = CreateLinkStage(gen)
-
+		If Not compileOnly Then
+			Local link:TSourceFile = CreateLinkStage(gen)
+		End If
 	End Method
 	
 	Method DoBuild(app_build:Int = False)