forked from premake/premake-xcode
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xcode_api.lua
104 lines (87 loc) · 2.24 KB
/
xcode_api.lua
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
--
-- xcode_api.lua
-- Define the Apple XCode action and support functions.
-- Copyright (c) 2015 Blizzard Entertainment
--
local p = premake
local api = premake.api
local configset = premake.configset
p.IOS = "ios"
p.APPLETV = "appletv"
-- register IOS and AppleTV os
api.addAllowed("system", p.IOS)
api.addAllowed("system", p.APPLETV)
api.addAllowed("architecture", { "armv7", "armv7s", "arm64" })
-- add system tags for ios and appletv.
os.systemTags[p.IOS] = { "ios", "mobile" }
os.systemTags[p.APPLETV] = { "appletv", "mobile" }
local osoption = premake.option.get("os")
if osoption ~= nil then
table.insert(osoption.allowed, { p.IOS, "iOS" })
table.insert(osoption.allowed, { p.APPLETV, "Apple TV" })
end
-- register additional Xcode specific API's.
api.register {
name = "xcode_settings",
scope = "config",
kind = "keyed:mixed",
tokens = true
}
api.register {
name = "xcode_filesettings",
scope = "config",
kind = "keyed:mixed",
tokens = true
}
api.register {
name = "xcode_filetype",
scope = "project",
kind = "string",
tokens = true
}
api.register {
name = "xcode_resources",
scope = "project",
kind = "list:file",
tokens = true
}
-- List of all links that are optional. Each item must also appear in a links command.
api.register {
name = "xcode_weaklinks",
scope = "config",
kind = "list:mixed",
tokens = true
}
api.register {
name = "xcode_frameworkdirs",
scope = "config",
kind = "list:directory",
tokens = true
}
api.register {
name = "xcode_runpathdirs",
scope = "config",
kind = "list:string",
tokens = true
}
api.register {
name = "xcode_targetattributes",
scope = "project",
kind = "keyed:string"
}
premake.override(_G, "icon", function(base, name)
local c = base(name)
if _ACTION == "xcode" then
local f = configset.getFilter(api.scope.current)
files { name }
filter { "files:" .. name }
buildcommands {
"{COPY} \"%{premake.workspace.getrelative(wks, file.abspath)}\" \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/Icon.icns\""
}
buildoutputs {
"$(BUILT_PRODUCTS_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Icon.icns"
}
configset.setFilter(api.scope.current, f)
end
return c
end)