add:添加xmake脚本。
This commit is contained in:
parent
2ac80fc6a8
commit
b94fbfb742
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ build
|
|||||||
cmake-*
|
cmake-*
|
||||||
auto_build
|
auto_build
|
||||||
export
|
export
|
||||||
|
.xmake
|
@ -1,8 +1,13 @@
|
|||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
#include <filesystem>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifdef USE_BOOST_FILESYSTEM
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
#else
|
||||||
|
#include <filesystem>
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
return 语句的值代表着你从 C++ 函数返回的 Lua 堆栈上的元素个数。
|
return 语句的值代表着你从 C++ 函数返回的 Lua 堆栈上的元素个数。
|
||||||
|
28
fs/xmake.lua
Normal file
28
fs/xmake.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
add_rules("mode.debug", "mode.release")
|
||||||
|
set_languages("c++17")
|
||||||
|
|
||||||
|
if is_plat("windows") then
|
||||||
|
add_cxxflags("/source-charset:utf-8", {force = true})
|
||||||
|
end
|
||||||
|
if is_plat("mingw") then
|
||||||
|
add_cxxflags("-Wno-unused-variable -finput-charset=utf-8 -fexec-charset=gbk")
|
||||||
|
end
|
||||||
|
if is_mode("debug") then
|
||||||
|
set_suffixname("d")
|
||||||
|
end
|
||||||
|
target("lua_fs")
|
||||||
|
add_options("boost")
|
||||||
|
add_defines("FS_LIB_EXPORT")
|
||||||
|
set_kind("shared")
|
||||||
|
add_files("*.cxx")
|
||||||
|
add_deps("lua")
|
||||||
|
option("boost")
|
||||||
|
set_default(false)
|
||||||
|
set_showmenu(true)
|
||||||
|
boost_root_dir = os.getenv("BOOST_HEADER_DIR")
|
||||||
|
boost_lib_dir = os.getenv("BOOST_LIB_DIR")
|
||||||
|
boost_libs = os.getenv("BOOST_LIBS")
|
||||||
|
add_includedirs(boost_root_dir)
|
||||||
|
add_defines("USE_BOOST_FILESYSTEM")
|
||||||
|
add_linkdirs(boost_lib_dir)
|
||||||
|
add_links(boost_libs)
|
31
lua/xmake.lua
Normal file
31
lua/xmake.lua
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
-- 设置最小版本要求
|
||||||
|
set_version("5.4.7")
|
||||||
|
|
||||||
|
-- 设置项目语言
|
||||||
|
add_rules("mode.debug", "mode.release")
|
||||||
|
|
||||||
|
-- 创建静态库
|
||||||
|
target("lua")
|
||||||
|
add_includedirs("src", { public = true })
|
||||||
|
set_kind("static")
|
||||||
|
add_defines("LUA_COMPAT_5_3")
|
||||||
|
add_files("src/*.c", { exclude = { "src/lua.c", "src/luac.c" } })
|
||||||
|
if is_plat("windows") then
|
||||||
|
add_cflags("/wd4530")
|
||||||
|
add_defines("LUA_BUILD_AS_DLL")
|
||||||
|
-- 在Windows上,如果有额外的链接库,可以在这里添加
|
||||||
|
-- add_links("some_library")
|
||||||
|
elseif is_plat("linux") then
|
||||||
|
add_defines("LUA_USE_LINUX")
|
||||||
|
add_links("m", "dl", "E")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 创建Lua可执行文件
|
||||||
|
target("mlua")
|
||||||
|
set_kind("binary")
|
||||||
|
add_files("src/lua.c")
|
||||||
|
add_deps("lua")
|
||||||
|
target("mluac")
|
||||||
|
set_kind("binary")
|
||||||
|
add_files("src/luac.c")
|
||||||
|
add_deps("lua")
|
Loading…
x
Reference in New Issue
Block a user