2
0
Brucey 2 жил өмнө
parent
commit
0272428e64
5 өөрчлөгдсөн 29 нэмэгдсэн , 1 устгасан
  1. 4 0
      CHANGELOG
  2. 3 0
      bmk.bmx
  3. 9 1
      bmk_config.bmx
  4. 12 0
      bmk_make.bmx
  5. 1 0
      bmk_modutil.bmx

+ 4 - 0
CHANGELOG

@@ -1,3 +1,7 @@
+## [3.53] - 2023-05-06
+### Added
+ - Coverage generation with -cov option.
+
 ## [3.52] - 2023-04-29
 ### Added
  - Added support for risc-v on Linux.

+ 3 - 0
bmk.bmx

@@ -128,6 +128,9 @@ Function SetConfigMung()
 		If processor.BCCVersion() = "BlitzMax" Then
 			If opt_threaded opt_configmung:+".mt"
 		End If
+		If opt_coverage Then
+			opt_configmung :+ ".cov"
+		End If
 		opt_configmung="."+opt_configmung+"."+processor.Platform()+"."'+opt_arch
 	Else
 		opt_debug=True

+ 9 - 1
bmk_config.bmx

@@ -10,7 +10,7 @@ Import brl.map
 
 Import "stringbuffer_core.bmx"
 
-Const BMK_VERSION:String = "3.52"
+Const BMK_VERSION:String = "3.53"
 
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc;asm;S"
 
@@ -62,6 +62,7 @@ Global opt_upx:Int
 Global opt_userdefs:String
 Global opt_gprof:Int
 Global opt_hi:Int
+Global opt_coverage:Int
 
 Global opt_dumpbuild
 
@@ -266,6 +267,8 @@ Function ParseConfigArgs$[]( args$[], legacyMax:Int = False )
 			opt_gprof = True
 		Case "hi"
 			opt_hi = True
+		Case "cov"
+			opt_coverage = True
 		Default
 			CmdError "Invalid option '" + argv + "'"
 		End Select
@@ -341,6 +344,11 @@ Function Usage:String(fullUsage:Int = False)
 		s:+ "~t~tBuilds an app using a custom appstub (i.e. not BRL.Appstub).~n"
 		s:+ "~t~tThis can be useful when you want more control over low-level application state."
 		s:+ "~n~n"
+		s:+ "~t-cov~n"
+		s:+ "~t~tBuilds a version with code coverage information.~n"
+		s:+ "~t~tBy default, when the application ends, an lcov.info is produced.~n"
+		s:+ "~t~tThis can be used by a variety of tools to generate coverage reports."
+		s:+ "~n~n"
 		s:+ "~t-d | -debug~n"
 		s:+ "~t~tBuilds a debug version. (This is the default for makeapp)."
 		s:+ "~n~n"

+ 12 - 0
bmk_make.bmx

@@ -369,6 +369,9 @@ Type TBuildManager Extends TCallback
 			If opt_gprof Then
 				cc_opts :+ " -pg"
 			End If
+			If opt_coverage Then
+				cc_opts :+ " -DBMX_COVERAGE"
+			End If
 		End If
 	
 		Local sb:TStringBuffer = New TStringBuffer
@@ -419,6 +422,9 @@ Type TBuildManager Extends TCallback
 			If opt_standalone Then
 				sb.Append(" -ib")
 			End If
+			If opt_coverage Then
+				sb.Append(" -cov")
+			End If
 		End If
 
 		source.cc_opts :+ cc_opts
@@ -1304,6 +1310,9 @@ Type TBuildManager Extends TCallback
 				If opt_gprof Then
 					cc_opts :+ " -pg"
 				End If
+				If opt_coverage Then
+					cc_opts :+ " -DBMX_COVERAGE"
+				End If
 			End If
 
 			source.cc_opts = ""
@@ -1356,6 +1365,9 @@ Type TBuildManager Extends TCallback
 				If opt_standalone Then
 					sb.Append(" -ib")
 				End If
+				If opt_coverage Then
+					sb.Append(" -cov")
+				End If
 			End If
 	
 			source.bcc_opts = sb.ToString()

+ 1 - 0
bmk_modutil.bmx

@@ -765,6 +765,7 @@ Function SetCompilerValues()
 	compilerOptions.Add("opengles", processor.Platform() = "android" Or processor.Platform() ="raspberrypi" Or processor.Platform() = "emscripten" Or processor.Platform() = "ios")
 
 	compilerOptions.Add("bmxng", processor.BCCVersion() <> "BlitzMax")
+	compilerOptions.Add("coverage", opt_coverage)
 
 	compilerOptions.Add("musl", processor.Platform() = "linux" Or processor.Platform() ="raspberrypi")