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 = {
|
|
|
|
RAYLIB_VERSION = "3.7.0",
|
|
|
|
RAYLIB_API_VERSION = "370",
|
|
|
|
}
|
|
|
|
|
|
|
|
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" },
|
|
|
|
{ "GRAPHICS", "GRAPHICS_API_OPENGL_33" },
|
|
|
|
{ "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
|