Skip to content

Commit

Permalink
fileserver support linux
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Jan 19, 2024
1 parent 267ab12 commit 0b7735b
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 8 deletions.
5 changes: 5 additions & 0 deletions clibs/imgui/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ lm:source_set "imgui" {
"UNICODE",
}
},
linux = {
sources = {
"platform/linux/imgui_platform.cpp",
}
},
macos = {
sources = {
"platform/macos/imgui_platform.mm",
Expand Down
15 changes: 15 additions & 0 deletions clibs/imgui/platform/linux/imgui_platform.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <imgui.h>
#include "imgui_platform.h"

void platformInit(void* window) {
}

void platformShutdown() {
}

void platformNewFrame() {
}

void* platformGetHandle(ImGuiViewport* viewport) {
return nullptr;
}
5 changes: 5 additions & 0 deletions clibs/ltask/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ lm:lua_source "ltask" {
"winmm",
}
},
linux = {
defines = {
"_GNU_SOURCE",
},
},
msvc = {
flags = {
"/experimental:c11atomics"
Expand Down
3 changes: 3 additions & 0 deletions clibs/lua/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ lm:source_set "lua_source" {
windows = {
defines = "LUA_BUILD_AS_DLL",
},
linux = {
defines = "LUA_USE_POSIX",
},
macos = {
visibility = "default",
defines = "LUA_USE_MACOSX",
Expand Down
5 changes: 5 additions & 0 deletions clibs/ozz/ozz-animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,10 @@ lm:exe "gltf2ozz" {
},
windows = {
sources = lm.AntDir .. "/3rd/bgfx.luamake/utf8/utf8.rc"
},
linux = {
links = {
"m"
}
}
}
5 changes: 3 additions & 2 deletions clibs/ozz/ozz.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <lua.hpp>
#include <cstring>
#include "fastio.h"

#include <ozz/base/memory/allocator.h>
Expand Down Expand Up @@ -69,8 +70,8 @@ class MemoryPtrStream : public ozz::io::Stream {
default: return -1;
}

int r = (int)origin + _offset;
if (r < 0 || r > ms.size()){
int r = origin + _offset;
if (r < 0 || r > (int)ms.size()){
return -1;
}
moffset = r;
Expand Down
2 changes: 2 additions & 0 deletions clibs/ozz/ozz.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <ozz/animation/runtime/skeleton.h>
#include <ozz/animation/offline/raw_animation.h>

#include <cstring>

struct ozzUint16Verctor: public ozz::vector<uint16_t> {
ozzUint16Verctor()
: ozz::vector<uint16_t>()
Expand Down
12 changes: 12 additions & 0 deletions clibs/zip/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ lm:source_set "zlib-ng" {
windows = {
deps = "zlib-ng-x86",
},
linux = {
deps = "zlib-ng-x86",
},
macos = {
deps = "zlib-ng-arm",
},
Expand Down Expand Up @@ -186,6 +189,15 @@ lm:source_set "minizip-ng" {
MINIZIPDIR.."/mz_strm_os_win32.c",
},
},
linux = {
defines = {
"_GNU_SOURCE",
},
sources = {
MINIZIPDIR.."/mz_os_posix.c",
MINIZIPDIR.."/mz_strm_os_posix.c",
},
},
macos = {
sources = {
MINIZIPDIR.."/mz_os_posix.c",
Expand Down
3 changes: 3 additions & 0 deletions pkg/ant.audio/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ lm:lua_source "audio" {
macos = {
sources = "src/empty_luafmod.c",
},
linux = {
sources = "src/empty_luafmod.c",
},
ios = {
sources = "src/luafmod.cpp",
includes = {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ant.compile_resource/tool_exe_path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local BASETOOLS<const> = {
"shaderc", "texturec", "gltf2ozz"
}

local TOOLSUFFIX<const> = platform.os == "macos" and "" or ".exe"
local TOOLSUFFIX<const> = platform.os == "windows" and ".exe" or ""

local function check_tool_path_valid(path)
if not lfs.exists(path) then
Expand Down
1 change: 1 addition & 0 deletions pkg/ant.rmlui/src/css/PropertyBinary.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <array>
#include <cstddef>
#include <cstring>
#include <deque>
#include <functional>
#include <memory>
Expand Down
10 changes: 7 additions & 3 deletions runtime/common/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ void ant_loadmodules(lua_State* L) {
{ "font", luaopen_font },
{ "font.manager", luaopen_font_manager },
{ "font.truetype", luaopen_font_truetype },
{ "font.util", luaopen_font_util },
{ "datalist", luaopen_datalist },
{ "ozz", luaopen_ozz },
{ "math3d", luaopen_math3d },
Expand All @@ -104,7 +103,6 @@ void ant_loadmodules(lua_State* L) {
{ "luadebug.stdio", luaopen_luadebug_stdio },
{ "luadebug.visitor", luaopen_luadebug_visitor },
{ "rmlui", luaopen_rmlui },
{ "window", luaopen_window },
{ "noise", luaopen_noise },
{ "textureman.client", luaopen_textureman_client },
{ "textureman.server", luaopen_textureman_server },
Expand Down Expand Up @@ -142,13 +140,19 @@ void ant_loadmodules(lua_State* L) {
#else
{ "bee.filewatch", luaopen_bee_filewatch },
{ "bee.subprocess", luaopen_bee_subprocess },
{ "filedialog", luaopen_filedialog },
{ "imgui.widgets", luaopen_imgui_widgets },
#if !BX_PLATFORM_LINUX
{ "filedialog", luaopen_filedialog },
#endif
#endif
{ "system.scene", luaopen_system_scene },
{ "cull.core", luaopen_system_cull},
{ "zip", luaopen_zip },
#if !BX_PLATFORM_LINUX
{ "window", luaopen_window },
{ "httpc", luaopen_httpc },
{ "font.util", luaopen_font_util },
#endif
{ NULL, NULL },
};

Expand Down
6 changes: 4 additions & 2 deletions runtime/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ lm:lua_source "ant_common" {
windows = {
sources = "windows/main.cpp",
},
linux = {
sources = "posix/main.cpp",
},
macos = {
sources = "osx/main.cpp",
sources = "posix/main.cpp",
},
ios = {
includes = "../../clibs/window/ios",
sources = {
"common/ios/main.mm",
"common/ios/ios_error.mm",
Expand Down
File renamed without changes.

0 comments on commit 0b7735b

Please sign in to comment.