2021-10-16 21:41:39 +00:00
|
|
|
local future = arg[1]
|
|
|
|
|
2021-10-14 19:15:36 +00:00
|
|
|
local saphire = require "saphire"
|
|
|
|
local c = require "saphire-c"
|
|
|
|
|
|
|
|
local cc = os.getenv "CC" or "cc"
|
|
|
|
local ar = os.getenv "AR" or "ar"
|
|
|
|
|
|
|
|
local cflags = os.getenv "CFLAGS" or "-O2 -s"
|
|
|
|
|
|
|
|
local include_paths = "-I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw"
|
|
|
|
|
|
|
|
local los = require "los"
|
|
|
|
|
|
|
|
local consts = {
|
2021-10-16 22:00:01 +00:00
|
|
|
RAYLIB_VERSION = "4.0.0",
|
|
|
|
RAYLIB_API_VERSION = "400",
|
2021-10-14 19:15:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
local vars = saphire.map({
|
|
|
|
{ "RAYLIB_LIBTYPE", "STATIC" },
|
|
|
|
{ "RAYLIB_BUILD_MODE", "RELEASE" },
|
|
|
|
{ "RAYLIB_LIB_NAME", "raylib" },
|
|
|
|
{ "RAYLIB_RES_FILE", "./raylib.dll.rc.data" },
|
|
|
|
{ "PLATFORM", "PLATFORM_DESKTOP" },
|
2021-10-24 11:16:32 +00:00
|
|
|
{ "GRAPHICS", "GRAPHICS_API_OPENGL_33" },
|
2021-10-14 19:15:36 +00:00
|
|
|
{ "USE_EXTERNAL_GLFW", "FALSE" },
|
|
|
|
{ "USE_WAYLAND_DISPLAY", "FALSE" }
|
|
|
|
}, function (v)
|
|
|
|
return { v[1], os.getenv(v[1]) or v[2] }
|
|
|
|
end)
|
|
|
|
|
|
|
|
for i,v in ipairs(vars) do
|
|
|
|
vars[v[1]] = v[2]
|
|
|
|
end
|
|
|
|
|
2021-10-16 21:41:39 +00:00
|
|
|
local flags = string.format("%s -D%s -D%s %s", cflags, vars.PLATFORM, vars.GRAPHICS, include_paths)
|
|
|
|
|
2021-10-14 19:15:36 +00:00
|
|
|
local src = {
|
|
|
|
-- ["obj.o"] = { src... }
|
2021-10-16 21:41:39 +00:00
|
|
|
{ "rcore.o", { "rcore.c", "raylib.h", "rlgl.h", "utils.h", "raymath.h", "rcamera.h", "rgestures.h" } },
|
2021-10-14 19:15:36 +00:00
|
|
|
{ "rglfw.o", { "rglfw.c", flags = os.getenv "GLFW_OSX" or "" } },
|
|
|
|
{ "rshapes.o", { "rshapes.c", "raylib.h", "rlgl.h" } },
|
|
|
|
{ "rtextures.o", { "rtextures.c", "raylib.h", "rlgl.h", "utils.h" } },
|
|
|
|
{ "rtext.o", { "rtext.c", "raylib.h", "utils.h" } },
|
|
|
|
{ "utils.o", { "utils.c", "utils.h" } },
|
|
|
|
{ "rmodels.o", { "rmodels.c", "raylib.h", "rlgl.h", "raymath.h" } },
|
|
|
|
{ "raudio.o", { "raudio.c", "raylib.h" } }
|
|
|
|
}
|
|
|
|
|
2021-10-16 21:41:39 +00:00
|
|
|
local objs = c.compile(src, flags, "raylib", cc)
|
|
|
|
local libraylib = c.lib("libraylib.a", objs, "raylib")
|
|
|
|
|
|
|
|
libraylib:wait()
|
|
|
|
if future then
|
|
|
|
future:resolve()
|
|
|
|
end
|