Skip to content

Commit

Permalink
lua build as shared lib
Browse files Browse the repository at this point in the history
  • Loading branch information
sniper00 committed Oct 3, 2024
1 parent 2a090d4 commit 5ad414f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion moon-src/moon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ int main(int argc, char* argv[]) {

#if TARGET_PLATFORM == PLATFORM_WINDOWS
server_->set_env("LUA_CPATH_EXT", "/?.dll;");
#elif TARGET_PLATFORM == PLATFORM_MAC
server_->set_env("LUA_CPATH_EXT", "/?.dylib;");
#else
server_->set_env("LUA_CPATH_EXT", "/?.so;");
server_->set_env("LUA_CPATH_EXT", "/?.so;");
#endif

if (!server_->get_env("PATH")) {
Expand Down
14 changes: 8 additions & 6 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ os.execute("git pull")
os.execute("git submodule init")
os.execute("git submodule update")

local LUA_BUILD_AS_DLL = true
local LUA_BUILD_AS_SHARED = true

workspace "Server"
configurations { "Debug", "Release" }
Expand Down Expand Up @@ -43,24 +43,26 @@ project "lua"
location "build/projects/%{prj.name}"
objdir "build/obj/%{prj.name}/%{cfg.buildcfg}"
targetdir "build/bin/%{cfg.buildcfg}"
kind "StaticLib"
if LUA_BUILD_AS_SHARED then
kind "SharedLib"
postbuildcommands{"{COPY} %{cfg.buildtarget.abspath} %{wks.location}"}
else
kind "StaticLib"
end
language "C"
includedirs {"./third/lua"}
files {"./third/lua/onelua.c"}
defines {"MAKE_LIB"}
filter { "system:windows" }
disablewarnings { "4244","4324","4702","4310", "4701"}
if LUA_BUILD_AS_DLL then
kind "SharedLib"
if LUA_BUILD_AS_SHARED then
defines {"LUA_BUILD_AS_DLL"}
postbuildcommands{"{COPY} %{cfg.buildtarget.abspath} %{wks.location}"}
end
filter { "system:linux" }
defines {"LUA_USE_LINUX"}
filter { "system:macosx" }
defines {"LUA_USE_MACOSX"}


project "mimalloc"
location "build/projects/%{prj.name}"
objdir "build/obj/%{prj.name}/%{cfg.buildcfg}"
Expand Down

0 comments on commit 5ad414f

Please sign in to comment.