Skip to content

Commit

Permalink
add lm.AntDir
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Jan 18, 2024
1 parent f4a9982 commit 8a5108a
Show file tree
Hide file tree
Showing 31 changed files with 196 additions and 267 deletions.
4 changes: 1 addition & 3 deletions clibs/bake/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ do return end
local lm = require "luamake"
local fs = require "bee.filesystem"

dofile "../common.lua"

lm.defines = lm.mode ~= "release" and "_DEBUG"

local GLMInclude = Ant3rd .. "glm"
local GLMInclude = lm.AntDir .. "/3rd/glm"
lm:source_set "Meshbaker" {
includes = {
GLMInclude,
Expand Down
4 changes: 1 addition & 3 deletions clibs/bee/make.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
local lm = require "luamake"

dofile "../common.lua"

lm.rootdir = Ant3rd.."bee.lua"
lm.rootdir = lm.AntDir.."/3rd/bee.lua"

local OS = {
"win",
Expand Down
18 changes: 7 additions & 11 deletions clibs/bgfx/bgfx.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
local lm = require "luamake"

dofile "../common.lua"
lm.BgfxDir = lm.AntDir.."/3rd/bgfx"
lm.BxDir = lm.AntDir.."/3rd/bx"
lm.BimgDir = lm.AntDir.."/3rd/bimg"

lm.BgfxDir = lm:path(Ant3rd .. "bgfx/")
lm.BxDir = lm:path(Ant3rd .. "bx/")
lm.BimgDir = lm:path(Ant3rd .. "bimg/")

lm:import(Ant3rd .. "bgfx.luamake/use.lua")

local SHADER_PKG_DIR <const> = Ant3rd .. "../pkg/ant.resources/shaders/"
lm:import(lm.AntDir.."/3rd/bgfx.luamake/use.lua")

lm:copy "copy_bgfx_shader" {
input = {
Expand All @@ -17,8 +13,8 @@ lm:copy "copy_bgfx_shader" {
lm.BgfxDir .. "/examples/common/shaderlib.sh",
},
output = {
SHADER_PKG_DIR .. "bgfx_shader.sh",
SHADER_PKG_DIR .. "bgfx_compute.sh",
SHADER_PKG_DIR .. "shaderlib.sh",
lm.AntDir .. "/pkg/ant.resources/shaders/bgfx_shader.sh",
lm.AntDir .. "/pkg/ant.resources/shaders/bgfx_compute.sh",
lm.AntDir .. "/pkg/ant.resources/shaders/shaderlib.sh",
}
}
10 changes: 4 additions & 6 deletions clibs/common.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
local lm = require "luamake"

Ant3rd = "../../3rd/"
BgfxInclude = {
Ant3rd .. "bgfx/include",
Ant3rd .. "bx/include",
lm.AntDir .. "/3rd/bgfx/include",
lm.AntDir .. "/3rd/bx/include",
}

if lm.os == "windows" then
if lm.compiler == "msvc" then
BgfxInclude[#BgfxInclude+1] = Ant3rd .. "bx/include/compat/msvc"
BgfxInclude[#BgfxInclude+1] = lm.AntDir .. "/3rd/bx/include/compat/msvc"
else
BgfxInclude[#BgfxInclude+1] = Ant3rd .. "bx/include/compat/mingw"
BgfxInclude[#BgfxInclude+1] = lm.AntDir .. "/3rd/bx/include/compat/mingw"
end
end
8 changes: 3 additions & 5 deletions clibs/ecs/make.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
local lm = require "luamake"

dofile "../common.lua"

lm:copy "copy_ecs_lua" {
input = Ant3rd .. "luaecs/ecs.lua",
output = "../../pkg/ant.luaecs/ecs.lua"
input = lm.AntDir .. "/3rd/luaecs/ecs.lua",
output = lm.AntDir .. "/pkg/ant.luaecs/ecs.lua"
}

lm:lua_source "ecs" {
deps = "copy_ecs_lua",
sources = Ant3rd .. "luaecs/*.c",
sources = lm.AntDir .. "/3rd/luaecs/*.c",
msvc = {
flags = {
"/wd4996",
Expand Down
2 changes: 0 additions & 2 deletions clibs/foundation/make.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local lm = require "luamake"

dofile "../common.lua"

lm:lua_source "foundation" {
sources = {
"vla.c",
Expand Down
6 changes: 3 additions & 3 deletions clibs/image/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ lm:lua_source "image" {
defines = "BX_CONFIG_DEBUG=" .. (lm.mode == "debug" and 1 or 0),
includes = {
BgfxInclude,
Ant3rd .. "bimg/include",
Ant3rd .. "glm",
Ant3rd .. "bee.lua",
lm.AntDir .. "/3rd/bimg/include",
lm.AntDir .. "/3rd/glm",
lm.AntDir .. "/3rd/bee.lua",
"../bgfx",
"../luabind",
},
Expand Down
10 changes: 4 additions & 6 deletions clibs/imgui-widgets/make.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local lm = require "luamake"

dofile "../common.lua"

local defines = {
"IMGUI_DISABLE_OBSOLETE_FUNCTIONS",
"IMGUI_DISABLE_OBSOLETE_KEYIO",
Expand All @@ -15,8 +13,8 @@ local defines = {
lm:source_set "imgui" {
includes = {
"../imgui",
Ant3rd .. "glm",
Ant3rd .. "imgui",
lm.AntDir .. "/3rd/glm",
lm.AntDir .. "/3rd/imgui",
},
sources = {
"zmo/*.cpp",
Expand All @@ -31,8 +29,8 @@ lm:source_set "imgui" {
lm:lua_source "imgui" {
includes = {
"../imgui",
Ant3rd .. "glm",
Ant3rd .. "imgui",
lm.AntDir .. "/3rd/glm",
lm.AntDir .. "/3rd/imgui",
},
sources = {
"luabinding.cpp",
Expand Down
11 changes: 6 additions & 5 deletions clibs/imgui/gen.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
local AnrDir = ...
local meta; do
local json = dofile "3rd/ant/pkg/ant.json/main.lua"
local json = dofile(AnrDir.."/pkg/ant.json/main.lua")
local function readall(path)
local f <close> = assert(io.open(path, "rb"))
return f:read "a"
end
meta = json.decode(readall "3rd/ant/clibs/imgui/dear_bindings/cimgui.json")
meta = json.decode(readall(AnrDir.."/clibs/imgui/dear_bindings/cimgui.json"))
end

local w <close> = assert(io.open("3rd/ant/clibs/imgui/imgui_enum.h", "wb"))
local w <close> = assert(io.open(AnrDir.."/clibs/imgui/imgui_enum.h", "wb"))

local function writeln(fmt, ...)
w:write(string.format(fmt, ...))
Expand Down Expand Up @@ -91,11 +92,11 @@ writeln("\tlua_newtable(L);")
for _, name in ipairs(init.flags) do
writeln("\tflag_gen(L, \"%s\", e%s);", name:match "^(.-)Flags$", name)
end
writeln("\tlua_setfield(L, -2, \"flags\");")
writeln("\tlua_setfield(L, -2, \"Flags\");")
writeln("")
writeln("\tlua_newtable(L);")
for _, name in ipairs(init.enums) do
writeln("\tenum_gen(L, \"%s\", e%s);", name, name)
end
writeln("\tlua_setfield(L, -2, \"enum\");")
writeln("\tlua_setfield(L, -2, \"Enum\");")
writeln("}")
25 changes: 13 additions & 12 deletions clibs/imgui/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ local defines = {
lm:source_set "imgui" {
includes = {
".",
Ant3rd .. "imgui",
lm.AntDir .. "/3rd/imgui",
},
defines = defines,
windows = {
sources = {
"platform/windows/imgui_platform.cpp",
Ant3rd .. "imgui/backends/imgui_impl_win32.cpp",
lm.AntDir .. "/3rd/imgui/backends/imgui_impl_win32.cpp",
},
defines = {
"_UNICODE",
Expand All @@ -31,7 +31,7 @@ lm:source_set "imgui" {
macos = {
sources = {
"platform/macos/imgui_platform.mm",
Ant3rd .. "imgui/backends/imgui_impl_osx.mm",
lm.AntDir .. "/3rd/imgui/backends/imgui_impl_osx.mm",
},
flags = {
"-fobjc-arc"
Expand All @@ -50,13 +50,13 @@ lm:source_set "imgui" {
lm:source_set "imgui" {
includes = {
".",
Ant3rd .. "imgui",
lm.AntDir .. "/3rd/imgui",
},
sources = {
Ant3rd .. "imgui/imgui_draw.cpp",
Ant3rd .. "imgui/imgui_tables.cpp",
Ant3rd .. "imgui/imgui_widgets.cpp",
Ant3rd .. "imgui/imgui.cpp",
lm.AntDir .. "/3rd/imgui/imgui_draw.cpp",
lm.AntDir .. "/3rd/imgui/imgui_tables.cpp",
lm.AntDir .. "/3rd/imgui/imgui_widgets.cpp",
lm.AntDir .. "/3rd/imgui/imgui.cpp",
},
defines = defines,
}
Expand All @@ -65,9 +65,9 @@ lm:lua_source "imgui" {
deps = "luabind",
includes = {
".",
Ant3rd .. "imgui",
Ant3rd .. "glm",
Ant3rd .. "bee.lua",
lm.AntDir .. "/3rd/imgui",
lm.AntDir .. "/3rd/glm",
lm.AntDir .. "/3rd/bee.lua",
BgfxInclude,
"../bgfx",
"../luabind"
Expand Down Expand Up @@ -96,5 +96,6 @@ lm:lua_source "imgui" {
}

lm:runlua "imgui-gen" {
script = "gen.lua"
script = "gen.lua",
args = { lm.AntDir }
}
20 changes: 8 additions & 12 deletions clibs/ltask/make.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
local lm = require "luamake"

dofile "../common.lua"

local TaskDir = "../../engine/task/"

lm:copy "copy_task_lua" {
input = {
Ant3rd .. "ltask/service/root.lua",
Ant3rd .. "ltask/service/timer.lua",
Ant3rd .. "ltask/service/service.lua",
lm.AntDir .. "/3rd/ltask/service/root.lua",
lm.AntDir .. "/3rd/ltask/service/timer.lua",
lm.AntDir .. "/3rd/ltask/service/service.lua",
},
output = {
TaskDir .. "service/root.lua",
TaskDir .. "service/timer.lua",
TaskDir .. "service/service.lua",
lm.AntDir .. "/engine/task/service/root.lua",
lm.AntDir .. "/engine/task/service/timer.lua",
lm.AntDir .. "/engine/task/service/service.lua",
}
}

lm:lua_source "ltask" {
deps = "copy_task_lua",
sources = {
Ant3rd .. "ltask/src/*.c",
"!" .. Ant3rd .. "ltask/src/main.c",
lm.AntDir .. "/3rd/ltask/src/*.c",
"!" .. lm.AntDir .. "/3rd/ltask/src/main.c",
},
defines = {
--"DEBUGLOG",
Expand Down
4 changes: 1 addition & 3 deletions clibs/lua/make.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
local lm = require "luamake"

dofile "../common.lua"

if lm.mode == "debug" and lm.target == "x64" and lm.compiler == "msvc" then
lm.ldflags = {
"/STACK:"..0x160000
}
end
lm.rootdir = Ant3rd .. "bee.lua/3rd/lua/"
lm.rootdir = lm.AntDir .. "/3rd/bee.lua/3rd/lua/"

lm:source_set "lua_source" {
sources = "onelua.c",
Expand Down
4 changes: 1 addition & 3 deletions clibs/noise/make.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
local lm = require "luamake"

dofile "../common.lua"

lm:lua_source "noise" {
includes = {
Ant3rd .. "glm"
lm.AntDir .. "/3rd/glm"
},
sources = {
"noise.cpp",
Expand Down
6 changes: 2 additions & 4 deletions clibs/ozz/make.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local lm = require "luamake"

dofile "../common.lua"

lm:import "ozz-animation.lua"

lm:lua_source "ozz" {
Expand All @@ -12,8 +10,8 @@ lm:lua_source "ozz" {
"ozz-animation-geometry",
},
includes = {
Ant3rd .. "ozz-animation/include",
Ant3rd .. "bee.lua",
lm.AntDir .. "/3rd/ozz-animation/include",
lm.AntDir .. "/3rd/bee.lua",
"../luabind",
},
sources = {
Expand Down
6 changes: 2 additions & 4 deletions clibs/ozz/ozz-animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ local lm = require "luamake"

local EnableEditor = lm.os ~= "ios"

dofile "../common.lua"

lm.rootdir = Ant3rd .."ozz-animation"
lm.rootdir = lm.AntDir .. "/3rd/ozz-animation"

lm:source_set "ozz-animation-json" {
includes = "extern/jsoncpp/dist",
Expand Down Expand Up @@ -59,6 +57,6 @@ lm:exe "gltf2ozz" {
"!src/animation/offline/tools/dump2ozz.cc",
},
windows = {
sources = Ant3rd .. "bgfx.luamake/utf8/utf8.rc"
sources = lm.AntDir .. "/3rd/bgfx.luamake/utf8/utf8.rc"
}
}
Loading

0 comments on commit 8a5108a

Please sign in to comment.