Browse Source

Fixed iOS build configuration

woollybah 5 years ago
parent
commit
b192293f7e
5 changed files with 48 additions and 30 deletions
  1. 4 0
      CHANGELOG
  2. 1 1
      bmk_config.bmx
  3. 29 24
      bmk_make.bmx
  4. 11 5
      bmk_util.bmx
  5. 3 0
      resources/ios/template/project.xcodeproj/project.pbxproj

+ 4 - 0
CHANGELOG

@@ -1,3 +1,7 @@
+## [3.43] - 2020-07-05
+### Fixed
+ - iOS build configuration.
+
 ## [3.42] - 2020-04-08
 ### Added
  - New '-hi' option to indicate app supports high resolution (hidpi) screens.

+ 1 - 1
bmk_config.bmx

@@ -10,7 +10,7 @@ Import brl.map
 
 Import "stringbuffer_core.bmx"
 
-Const BMK_VERSION:String = "3.42"
+Const BMK_VERSION:String = "3.43"
 
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc;asm;S"
 

+ 29 - 24
bmk_make.bmx

@@ -487,7 +487,7 @@ Type TBuildManager Extends TCallback
 				' sort archives for app linkage
 				If m.modid Then
 					Local path:String = m.arc_path
-					If processor.Platform() = "ios" Then
+					If IOS_HAS_MERGE  And processor.Platform() = "ios" Then
 						path = m.merge_path
 					End If
 					
@@ -696,21 +696,22 @@ Type TBuildManager Extends TCallback
 							End If
 
 						Case STAGE_MERGE
-
-							' a module?
-							If m.modid Then
-								Local max_obj_time:Int = m.MaxObjTime()
-
-								If max_obj_time > m.merge_time And Not m.dontbuild Then
-		
-									If Not opt_quiet Then
-										Print ShowPct(m.pct) + "Merging:" + StripDir(m.merge_path)
+							If IOS_HAS_MERGE Then
+								' a module?
+								If m.modid Then
+									Local max_obj_time:Int = m.MaxObjTime()
+	
+									If max_obj_time > m.merge_time And Not m.dontbuild Then
+			
+										If Not opt_quiet Then
+											Print ShowPct(m.pct) + "Merging:" + StripDir(m.merge_path)
+										End If
+	
+										CreateMergeArc m.merge_path, m.arc_path
+	
+										m.merge_time = time_(Null)
+										
 									End If
-
-									CreateMergeArc m.merge_path, m.arc_path
-
-									m.merge_time = time_(Null)
-									
 								End If
 							End If
 					End Select
@@ -1140,7 +1141,7 @@ Type TBuildManager Extends TCallback
 	Method GetISourceFile:TSourceFile(arc_path:String, arc_time:Int, iface_path:String, iface_time:Int, merge_path:String, merge_time:Int)
 		Local source:TSourceFile
 		
-		If processor.Platform() = "ios" Then
+		If IOS_HAS_MERGE And processor.Platform() = "ios" Then
 			source = TSourceFile(sources.ValueForKey(merge_path))
 		Else 
 			source = TSourceFile(sources.ValueForKey(arc_path))
@@ -1159,7 +1160,7 @@ Type TBuildManager Extends TCallback
 				source.iface_time = iface_time
 				source.merge_time = merge_time
 
-				If processor.Platform() = "ios" Then
+				If IOS_HAS_MERGE And processor.Platform() = "ios" Then
 					sources.Insert(merge_path, source)
 				Else
 					sources.Insert(arc_path, source)
@@ -1190,7 +1191,7 @@ Type TBuildManager Extends TCallback
 		Local merge_path:String
 		Local merge_time:Int
 		
-		If processor.Platform() = "ios" Then
+		If IOS_HAS_MERGE And processor.Platform() = "ios" Then
 			If processor.CPU() = "x86" Or processor.CPU() = "x64" Then
 				merge_path = ConcatString(path, "/", id, opt_configmung, "sim.a")
 			Else
@@ -1226,7 +1227,7 @@ Type TBuildManager Extends TCallback
 				CalculateDependencies(source, True, rebuild)
 
 				source.dontbuild = True
-				If processor.Platform() = "ios" Then
+				If IOS_HAS_MERGE And processor.Platform() = "ios" Then
 					source.stage = STAGE_MERGE
 					sources.Insert(source.merge_path, source)
 				Else
@@ -1359,13 +1360,17 @@ Type TBuildManager Extends TCallback
 			If processor.Platform() <> "ios" Then
 				link = CreateLinkStage(gen)
 			Else
-				Local realLink:TSourceFile = CreateLinkStage(gen)
+				If IOS_HAS_MERGE Then
+					Local realLink:TSourceFile = CreateLinkStage(gen)
 				
-				' create a fat archive
-				link = CreateMergeStage(realLink)
+					' create a fat archive
+					link = CreateMergeStage(realLink)
+				Else
+					link = CreateLinkStage(gen)
+				End If
 			End If
 		Else
-			If processor.Platform() = "ios" Then
+			If IOS_HAS_MERGE And processor.Platform() = "ios" Then
 				link = TSourceFile(sources.ValueForKey(source.merge_path))
 			Else
 				link = TSourceFile(sources.ValueForKey(source.arc_path))
@@ -1495,7 +1500,7 @@ Type TBuildManager Extends TCallback
 		link.depsList = New TList
 		link.depsList.AddLast(source)		
 
-		If processor.Platform() = "ios" Then
+		If IOS_HAS_MERGE And processor.Platform() = "ios" Then
 			sources.Insert(link.obj_path, link)
 		Else
 			sources.Insert(link.arc_path, link)

+ 11 - 5
bmk_util.bmx

@@ -8,6 +8,7 @@ Import "file_util.c"
 Const USE_NASM:Int=False
 
 Const CC_WARNINGS:Int=False'True
+Const IOS_HAS_MERGE:Int = False
 
 Type TModOpt ' BaH
 	Field cc_opts:String = ""
@@ -1114,6 +1115,7 @@ Function PackageIOSApp( path$, lnk_files:TList, opts$ )
 	project = project.Replace("${PROJECT}", appId)
 	project = project.Replace("${PROJECT_STRIPPED}", iOSFixAppId(appId))
 	project = project.Replace("${COMPANY_IDENTIFIER}", processor.option("company_identifier", "com.mycompany"))
+	project = project.Replace("${TEAM_ID}", processor.option("developer_team_id", "developer_team_id"))
 	
 	SaveString(project, projectPath)
 	
@@ -1299,6 +1301,10 @@ Function iOSProjectBuildFiles:String(uuid:String, fileMap:TFileMap)
 		Local fileRef:String = fileMap.FileId(path, uuid, TFileMap.REF, f.kind)
 		Local dir:String = ExtractDir(path)
 		Local name:String = StripDir(path)
+
+		If path.StartsWith("-framework") Then
+			name = path[11..]
+		End If
 		
 		Select f.kind
 			Case TFileId.TYPE_ARC, TFileId.TYPE_OBJ, TFileId.TYPE_DYL
@@ -1330,11 +1336,11 @@ Function iOSProjectFileRefs:String(uuid:String, fileMap:TFileMap)
 		
 		Select fid.kind
 			Case TFileId.TYPE_ARC
-				stack.AddLast "~t~t" + id + " = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = " + name + "; path = ~q" + path + "~q; sourceTree = ~q<absolute>~q; };"
+				stack.AddLast "~t~t" + id + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = " + name + "; path = ~q" + path + "~q; sourceTree = ~q<absolute>~q; };"
 			Case TFileId.TYPE_OBJ
-				stack.AddLast "~t~t" + id + " = {isa = PBXFileReference; lastKnownFileType = ~qcompiled.mach-o.objfile~q; name = " + name + "; path = ~q" + path + "~q; sourceTree = ~q<absolute>~q; };"
+				stack.AddLast "~t~t" + id + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = ~qcompiled.mach-o.objfile~q; name = " + name + "; path = ~q" + path + "~q; sourceTree = ~q<absolute>~q; };"
 			Case TFileId.TYPE_DYL
-				stack.AddLast "~t~t" + id + " = {isa = PBXFileReference; lastKnownFileType = ~qcompiled.mach-o.dylib~q; name = " + name + "; path = ~q" + path + "~q; sourceTree = ~q<absolute>~q; };"
+				stack.AddLast "~t~t" + id + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = ~qcompiled.mach-o.dylib~q; name = " + name + "; path = ~q" + path + "~q; sourceTree = ~q<absolute>~q; };"
 			Case TFileId.TYPE_DIR
 				stack.AddLast "~t~t" + id + " = {isa = PBXFileReference; lastKnownFileType = folder; path = ~q" + path + "~q; sourceTree = SOURCE_ROOT; };"
 
@@ -1347,7 +1353,7 @@ Function iOSProjectFileRefs:String(uuid:String, fileMap:TFileMap)
 						Local libPath:String = p[2..].Replace("~q", "") + "/" + name
 						If FileType(libPath) Then
 							found = True
-							stack.AddLast "~t~t" + id + " = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = " + name + "; path = ~q" + libPath + "~q; sourceTree = ~q<absolute>~q; };"
+							stack.AddLast "~t~t" + id + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = " + name + "; path = ~q" + libPath + "~q; sourceTree = ~q<absolute>~q; };"
 							Exit
 						End If
 					End If
@@ -1358,7 +1364,7 @@ Function iOSProjectFileRefs:String(uuid:String, fileMap:TFileMap)
 
 			Case TFileId.TYPE_FRM
 				name = path[11..]
-				stack.AddLast "~t~t" + id + " = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = " + name + ".framework; path = System/Library/Frameworks/" + name + ".framework; sourceTree = SDKROOT; };"
+				stack.AddLast "~t~t" + id + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = " + name + ".framework; path = System/Library/Frameworks/" + name + ".framework; sourceTree = SDKROOT; };"
 		End Select
 
 	Next

+ 3 - 0
resources/ios/template/project.xcodeproj/project.pbxproj

@@ -97,6 +97,9 @@
 		29B97317FDCFA39411CA2CEA /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				FD787AAB0E22A5CC003E8E36 /* [email protected] */,
+				FD787AA00E22A5CC003E8E36 /* Default.png */,
+				FD925B180E0F276600E92347 /* Icon.png */,
 			);
 			name = Resources;
 			sourceTree = "<group>";