-
Notifications
You must be signed in to change notification settings - Fork 14
/
Package.swift
285 lines (263 loc) · 14.6 KB
/
Package.swift
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
// swift-tools-version:5.7
/// `UnmodifiedRaylibSrc` contains a copy and paste of the original source folder with no changes.
/// `ModifiedRaylibSrc` contains only changed files in the same directory structure as `UnmodifiedRaylibSrc`.
/// `_swifty` suffix on public headers indicate that the file contains clang attributes for swift.
import PackageDescription
var cSettings: [CSetting] {
var array: [CSetting] = []
array.append(.define("PLATFORM_DESKTOP", .when(platforms: [.macOS, .windows, .linux])))
array.append(.define("SUPPORT_DEFAULT_FONT"))
array.append(.define("RAYGUI_IMPLEMENTATION"))
array.append(.define("_DEBUG", .when(configuration: .debug)))
// Windows
array.append(.define("HOST_PLATFORM_OS", to: "WINDOWS", .when(platforms: [.windows])))
array.append(.define("_GLFW_WIN32", .when(platforms: [.windows])))
array.append(.define("_CRT_SECURE_NO_WARNINGS", .when(platforms: [.windows]))) // Silence warnings
// Linux
array.append(.define("HOST_PLATFORM_OS", to: "LINUX", .when(platforms: [.linux])))
array.append(.define("_GLFW_X11", .when(platforms: [.linux])))
array.append(.define("_DEFAULT_SOURCE", .when(platforms: [.linux])))
// macOS
array.append(.define("HOST_PLATFORM_OS", to: "OSX", .when(platforms: [.macOS])))
array.append(.define("_GLFW_COCOA", .when(platforms: [.macOS])))
array.append(.headerSearchPath("UnmodifiedRaylibSrc/external/glfw/include"))
array.append(.headerSearchPath("UnmodifiedRaylibSrc"))
return array
}
var sources: [String] {
var array: [String] = []
// Raylib
let raylib = ["rcore.c", "rmodels.c", "raudio.c", "rshapes.c", "rtext.c", "rtextures.c", "utils.c"]
array.append(contentsOf: raylib.map({"UnmodifiedRaylibSrc/" + $0}))
// --- Modified ----
// A copy of raygui.h with no source code changes. Needed for implimentations.
// The original Makefile created this copy at build time.
array.append("ModifiedRaylibSrc/extras/raygui.c")
// GLFW Common
let glfw = ["context.c", "init.c", "input.c", "monitor.c", "vulkan.c", "window.c"]
array.append(contentsOf: glfw.map({"UnmodifiedRaylibSrc/external/glfw/src/" + $0}))
#if os(macOS)
// Changes source to support ARC. Was needed to remove the no-arc unsafe build flag. Was needed to allow git tags for dependencies in projects.
let macOSModified = ["cocoa_init.m", "cocoa_window.m", "nsgl_context.m"]
array.append(contentsOf: macOSModified.map({"ModifiedRaylibSrc/external/glfw/src/" + $0}))
#endif
#if os(macOS)
let mac = ["cocoa_init.m", "cocoa_joystick.m", "cocoa_monitor.m", "cocoa_window.m", "cocoa_time.c", "posix_thread.c", "nsgl_context.m", "egl_context.c", "osmesa_context.c"]
array.append(contentsOf: mac.map({"UnmodifiedRaylibSrc/external/glfw/src/" + $0}))
#endif
#if os(Windows)
let windows = ["win32_init.c", "win32_joystick.c", "win32_monitor.c", "win32_time.c", "win32_thread.c", "win32_window.c", "wgl_context.c", "egl_context.c", "osmesa_context.c"]
array.append(contentsOf: windows.map({"UnmodifiedRaylibSrc/external/glfw/src/" + $0}))
#endif
#if os(Linux)
let linux = ["x11_init.c", "x11_monitor.c", "x11_window.c", "xkb_unicode.c", "posix_time.c", "posix_thread.c", "glx_context.c", "egl_context.c", "osmesa_context.c", "linux_joystick.c"]
array.append(contentsOf: linux.map({"UnmodifiedRaylibSrc/external/glfw/src/" + $0}))
#endif
return array
}
let package = Package(
name: "Raylib",
products: [
.library(name: "Raylib", targets: ["Raylib", "RaylibC"]),
.library(name: "RaylibC", targets: ["RaylibC"]),
],
targets: [
.executableTarget(name: "Example", dependencies: ["Raylib"]),
.target(name: "Raylib", dependencies: ["RaylibC"]),
.target(name: "RaylibC", exclude: exclude, sources: sources, publicHeadersPath: "Include", cSettings: cSettings),
],
cLanguageStandard: .c99
)
#if os(macOS)
var exclude: [String] {
return [
"UnmodifiedRaylibSrc/external/glfw/src/win32_joystick.c",
"UnmodifiedRaylibSrc/Makefile",
"UnmodifiedRaylibSrc/raylib.dll.rc.data",
"UnmodifiedRaylibSrc/external/glfw/src/win32_monitor.c",
"UnmodifiedRaylibSrc/raylib.ico",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindOSMesa.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/wl_window.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/x86_64-w64-mingw32.cmake",
"UnmodifiedRaylibSrc/external/glfw/CMake/cmake_uninstall.cmake.in",
"UnmodifiedRaylibSrc/external/glfw/src/posix_time.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/i686-w64-mingw32.cmake",
"UnmodifiedRaylibSrc/external/glfw/CMake/Info.plist.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/i686-w64-mingw32-clang.cmake",
"UnmodifiedRaylibSrc/external/glfw/CMake/glfw3.pc.in",
"UnmodifiedRaylibSrc/external/glfw/src/null_window.c",
"UnmodifiedRaylibSrc/external/glfw/src/wl_monitor.c",
"UnmodifiedRaylibSrc/external/glfw/LICENSE.md",
"UnmodifiedRaylibSrc/raylib.dll.rc",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindWaylandProtocols.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/null_monitor.c",
"UnmodifiedRaylibSrc/external/glfw/src/glfw.rc.in",
"UnmodifiedRaylibSrc/external/glfw/src/x11_window.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindXKBCommon.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/win32_window.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/x86_64-w64-mingw32-clang.cmake",
"UnmodifiedRaylibSrc/raylib.rc",
"UnmodifiedRaylibSrc/external/glfw/README.md",
"UnmodifiedRaylibSrc/external/glfw/CMake/GenerateMappings.cmake",
"UnmodifiedRaylibSrc/external/glfw/deps/glad_gl.c",
"UnmodifiedRaylibSrc/external/glfw/src/x11_init.c",
"UnmodifiedRaylibSrc/external/glfw/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindEpollShim.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/null_init.c",
"UnmodifiedRaylibSrc/external/glfw/src/win32_thread.c",
"UnmodifiedRaylibSrc/external/glfw/src/mappings.h.in",
"UnmodifiedRaylibSrc/external/glfw/src/linux_joystick.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/glfw3Config.cmake.in",
"UnmodifiedRaylibSrc/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/src/wgl_context.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/MacOSXBundleInfo.plist.in",
"UnmodifiedRaylibSrc/external/glfw/src/null_joystick.c",
"UnmodifiedRaylibSrc/external/glfw/src/xkb_unicode.c",
"UnmodifiedRaylibSrc/external/glfw/src/x11_monitor.c",
"UnmodifiedRaylibSrc/rglfw.c",
"UnmodifiedRaylibSrc/external/glfw/src/win32_init.c",
"UnmodifiedRaylibSrc/external/glfw/src/glfw_config.h.in",
"UnmodifiedRaylibSrc/shell.html",
"UnmodifiedRaylibSrc/minshell.html",
"UnmodifiedRaylibSrc/external/glfw/deps/getopt.c",
"UnmodifiedRaylibSrc/raylib.rc.data",
"UnmodifiedRaylibSrc/external/glfw/src/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/src/win32_time.c",
"UnmodifiedRaylibSrc/external/glfw/src/wl_init.c",
"UnmodifiedRaylibSrc/external/glfw/deps/glad_vulkan.c",
"UnmodifiedRaylibSrc/external/glfw/src/glx_context.c",
"UnmodifiedRaylibSrc/build.zig",
"UnmodifiedRaylibSrc/minshell.html",
// Replaced with modified source
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_init.m",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_window.m",
"UnmodifiedRaylibSrc/external/glfw/src/nsgl_context.m",
]
}
#endif
#if os(Windows)
//MARK: - Windows Exclude
var exclude: [String] {
return [
"UnmodifiedRaylibSrc/external/glfw/src/null_window.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/i686-w64-mingw32-clang.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_joystick.m",
"UnmodifiedRaylibSrc/external/glfw/src/posix_time.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindWaylandProtocols.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/mappings.h.in",
"UnmodifiedRaylibSrc/external/glfw/LICENSE.md",
"UnmodifiedRaylibSrc/external/glfw/src/nsgl_context.m",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindXKBCommon.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/glfw.rc.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/x86_64-w64-mingw32-clang.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/glx_context.c",
"UnmodifiedRaylibSrc/raylib.rc.data",
"UnmodifiedRaylibSrc/external/glfw/src/null_monitor.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/cmake_uninstall.cmake.in",
"UnmodifiedRaylibSrc/external/glfw/src/wl_init.c",
"UnmodifiedRaylibSrc/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_monitor.m",
"UnmodifiedRaylibSrc/external/glfw/src/x11_window.c",
"UnmodifiedRaylibSrc/external/glfw/src/posix_thread.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/glfw3.pc.in",
"UnmodifiedRaylibSrc/raylib.dll.rc.data",
"UnmodifiedRaylibSrc/external/glfw/src/glfw_config.h.in",
"UnmodifiedRaylibSrc/external/glfw/src/wl_window.c",
"UnmodifiedRaylibSrc/raylib.dll.rc",
"UnmodifiedRaylibSrc/external/glfw/CMake/Info.plist.in",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_time.c",
"UnmodifiedRaylibSrc/external/glfw/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindEpollShim.cmake",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindOSMesa.cmake",
"UnmodifiedRaylibSrc/rglfw.c",
"UnmodifiedRaylibSrc/external/glfw/src/x11_monitor.c",
"UnmodifiedRaylibSrc/external/glfw/src/linux_joystick.c",
"UnmodifiedRaylibSrc/external/glfw/deps/glad_vulkan.c",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_window.m",
"UnmodifiedRaylibSrc/external/glfw/CMake/MacOSXBundleInfo.plist.in",
"UnmodifiedRaylibSrc/raylib.rc",
"UnmodifiedRaylibSrc/Makefile",
"UnmodifiedRaylibSrc/external/glfw/README.md",
"UnmodifiedRaylibSrc/external/glfw/CMake/glfw3Config.cmake.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/i686-w64-mingw32.cmake",
"UnmodifiedRaylibSrc/external/glfw/CMake/x86_64-w64-mingw32.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/wl_monitor.c",
"UnmodifiedRaylibSrc/external/glfw/src/x11_init.c",
"UnmodifiedRaylibSrc/external/glfw/src/null_joystick.c",
"UnmodifiedRaylibSrc/shell.html",
"UnmodifiedRaylibSrc/minshell.html",
"UnmodifiedRaylibSrc/external/glfw/src/null_init.c",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_init.m",
"UnmodifiedRaylibSrc/external/glfw/src/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/src/xkb_unicode.c",
"UnmodifiedRaylibSrc/external/glfw/deps/getopt.c",
"UnmodifiedRaylibSrc/external/glfw/deps/glad_gl.c",
"UnmodifiedRaylibSrc/raylib.ico",
"UnmodifiedRaylibSrc/external/glfw/CMake/GenerateMappings.cmake",
"UnmodifiedRaylibSrc/build.zig",
"UnmodifiedRaylibSrc/minshell.html",
]
}
#endif
#if os(Linux)
var exclude: [String] {
return [
"UnmodifiedRaylibSrc/external/glfw/src/win32_window.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/Info.plist.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/glfw3Config.cmake.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/i686-w64-mingw32.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/nsgl_context.m",
"UnmodifiedRaylibSrc/external/glfw/CMake/x86_64-w64-mingw32.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/wl_monitor.c",
"UnmodifiedRaylibSrc/external/glfw/src/null_init.c",
"UnmodifiedRaylibSrc/external/glfw/src/wl_window.c",
"UnmodifiedRaylibSrc/raylib.rc.data",
"UnmodifiedRaylibSrc/raylib.dll.rc.data",
"UnmodifiedRaylibSrc/external/glfw/src/win32_init.c",
"UnmodifiedRaylibSrc/external/glfw/src/win32_monitor.c",
"UnmodifiedRaylibSrc/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindEpollShim.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/null_window.c",
"UnmodifiedRaylibSrc/Makefile",
"UnmodifiedRaylibSrc/external/glfw/src/wl_init.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/glfw3.pc.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/i686-w64-mingw32-clang.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_monitor.m",
"UnmodifiedRaylibSrc/external/glfw/src/win32_time.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindXKBCommon.cmake",
"UnmodifiedRaylibSrc/external/glfw/CMake/x86_64-w64-mingw32-clang.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_joystick.m",
"UnmodifiedRaylibSrc/external/glfw/deps/glad_vulkan.c",
"UnmodifiedRaylibSrc/external/glfw/deps/getopt.c",
"UnmodifiedRaylibSrc/external/glfw/README.md",
"UnmodifiedRaylibSrc/external/glfw/src/glfw.rc.in",
"UnmodifiedRaylibSrc/external/glfw/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/src/win32_thread.c",
"UnmodifiedRaylibSrc/external/glfw/src/mappings.h.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/GenerateMappings.cmake",
"UnmodifiedRaylibSrc/rglfw.c",
"UnmodifiedRaylibSrc/shell.html",
"UnmodifiedRaylibSrc/minshell.html",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_window.m",
"UnmodifiedRaylibSrc/external/glfw/src/null_joystick.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/cmake_uninstall.cmake.in",
"UnmodifiedRaylibSrc/raylib.rc",
"UnmodifiedRaylibSrc/raylib.dll.rc",
"UnmodifiedRaylibSrc/raylib.ico",
"UnmodifiedRaylibSrc/external/glfw/src/win32_joystick.c",
"UnmodifiedRaylibSrc/external/glfw/src/null_monitor.c",
"UnmodifiedRaylibSrc/external/glfw/CMake/MacOSXBundleInfo.plist.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindWaylandProtocols.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_time.c",
"UnmodifiedRaylibSrc/external/glfw/src/CMakeLists.txt",
"UnmodifiedRaylibSrc/external/glfw/LICENSE.md",
"UnmodifiedRaylibSrc/external/glfw/src/cocoa_init.m",
"UnmodifiedRaylibSrc/external/glfw/deps/glad_gl.c",
"UnmodifiedRaylibSrc/external/glfw/src/glfw_config.h.in",
"UnmodifiedRaylibSrc/external/glfw/CMake/modules/FindOSMesa.cmake",
"UnmodifiedRaylibSrc/external/glfw/src/wgl_context.c",
"UnmodifiedRaylibSrc/build.zig",
"UnmodifiedRaylibSrc/minshell.html",
]
}
#endif