summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/genie/src/actions/xcode/xcode14.lua
blob: 2b17166ad0cfbc5edb23e1d1c299479ec1da5534 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--
-- xcode14.lua
-- Define the Apple XCode 14.0 action and support functions.
--

	local premake = premake
	premake.xcode14 = { }

	local xcode  = premake.xcode
	local xcode10 = premake.xcode10
	local xcode11 = premake.xcode11
	local xcode14 = premake.xcode14

	function xcode14.XCBuildConfiguration_Target(tr, target, cfg)
		local options = xcode11.XCBuildConfiguration_Target(tr, target, cfg)
		options.CODE_SIGN_IDENTITY = "-"

		local action = premake.action.current()
		xcode.setdeploymenttarget(cfg, action.xcode, options)

		local iosversion = options.IPHONEOS_DEPLOYMENT_TARGET
		local macosversion = options.MACOSX_DEPLOYMENT_TARGET
		local tvosversion = options.TVOS_DEPLOYMENT_TARGET

		if iosversion and not xcode.versionge(iosversion, "11") then
		   error("XCode14 does not support deployment for iOS older than 11")
		elseif macosversion and not xcode.versionge(macosversion, "10.13") then
		   error("XCode14 does not support deployment for macOS older than 10.13")
		elseif tvosversion and not xcode.versionge(tvosversion, "11") then
		   error("XCode14 does not support deployment for tvOS older than 11")
		end

		return options
	end

	function xcode14.XCBuildConfiguration_Project(tr, prj, cfg)
		local options = xcode10.XCBuildConfiguration_Project(tr, prj, cfg)

		options.ENABLE_BITCODE = "NO" -- Bitcode is now deprecated.

		-- We need to set the deployment target for both target
		-- and project. XCode will complain, otherwise.
		local action = premake.action.current()
		xcode.setdeploymenttarget(cfg, action.xcode, options)

		return options
	end

	function xcode14.project(prj)
		local tr = xcode.buildprjtree(prj)
		xcode.Header(tr, 48)
		xcode.PBXBuildFile(tr)
		xcode.PBXContainerItemProxy(tr)
		xcode.PBXFileReference(tr,prj)
		xcode.PBXFrameworksBuildPhase(tr)
		xcode.PBXGroup(tr)
		xcode.PBXNativeTarget(tr)
		xcode.PBXProject(tr, "8.0")
		xcode.PBXReferenceProxy(tr)
		xcode.PBXResourcesBuildPhase(tr)
		xcode.PBXShellScriptBuildPhase(tr)
		xcode.PBXCopyFilesBuildPhase(tr)
		xcode.PBXSourcesBuildPhase(tr,prj)
		xcode.PBXVariantGroup(tr)
		xcode.PBXTargetDependency(tr)
		xcode.XCBuildConfiguration(tr, prj, {
			ontarget = xcode14.XCBuildConfiguration_Target,
			onproject = xcode14.XCBuildConfiguration_Project,
		})
		xcode.XCBuildConfigurationList(tr)
		xcode.Footer(tr)
	end
	--]]


--
-- xcode14 action
--

	newaction
	{
		trigger         = "xcode14",
		shortname       = "Xcode 14",
		description     = "Generate Apple Xcode 14 project files",
		os              = "macosx",

		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Bundle" },

		valid_languages = { "C", "C++" },

		valid_tools     = {
			cc     = { "gcc" },
		},

		valid_platforms = { Native = "Native" },
		default_platform = "Native",

		onsolution = function(sln)
			premake.generate(sln, "%%.xcworkspace/contents.xcworkspacedata", xcode.workspace_generate)
			premake.generate(sln, "%%.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings", xcode.workspace_settings)
			premake.generate(sln, "%%.xcworkspace/xcshareddata/xcschemes/-ALL-.xcscheme", xcode.workspace_scheme)
		end,

		onproject = function(prj)
			premake.generate(prj, "%%.xcodeproj/project.pbxproj", xcode14.project)
			xcode.generate_schemes(prj, "%%.xcodeproj/xcshareddata/xcschemes")
		end,

		oncleanproject = function(prj)
			premake.clean.directory(prj, "%%.xcodeproj")
			premake.clean.directory(prj, "%%.xcworkspace")
		end,

		oncheckproject = xcode.checkproject,

		xcode = {
			iOSTargetPlatformVersion = nil,
			macOSTargetPlatformVersion = nil,
			tvOSTargetPlatformVersion = nil,
		},
	}