-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathxmake.lua
42 lines (36 loc) · 1.34 KB
/
xmake.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
add_rules("mode.debug", "mode.release")
set_languages("c11", "cxx20")
set_policy("build.ccache", false)
if (is_os("windows")) then
target("meta")
set_runtimes("MD") -- runtime depend on LLVM compiled version, official version is MT
set_kind("binary")
add_files("src/**.cpp")
add_cxflags("-Wno-c++11-narrowing", "-fno-rtti", {force = true, tools={"gcc", "clang"}})
add_cxflags("/GR-", {force=true, tools={"clang_cl", "cl"}})
add_links("lib/**")
add_syslinks("Version", "ntdll", "Ws2_32", "advapi32", "Shcore", "user32", "shell32", "Ole32", {public = true})
add_includedirs("include")
else
add_requires("zstd")
target("meta")
set_kind("binary")
add_files("**.cpp")
add_cxflags("-Wno-c++11-narrowing")
add_cxflags("-fno-rtti", {force=true, tools={"gcc", "clang"}})
add_cxflags("/GR-", {force=true, tools={"clang_cl", "cl"}})
add_syslinks("pthread", "curses")
add_linkdirs("lib")
add_includedirs("include")
add_packages("zstd")
on_load(function (target, opt)
local libs = {}
local p = "lib/lib*.a"
for __, filepath in ipairs(os.files(p)) do
local basename = path.basename(filepath)
local matchname = string.match(basename, "lib(.*)$")
table.insert(libs, matchname or basename)
end
target:add("links", libs)
end)
end