forked from EndstoneMC/cpp-example-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
110 lines (98 loc) · 2.61 KB
/
xmake.lua
File metadata and controls
110 lines (98 loc) · 2.61 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
add_rules("mode.debug", "mode.release")
add_repositories(
"liteldev-repo https://github.com/LiteLDev/xmake-repo.git",
"iceblcokmc https://github.com/IceBlcokMC/xmake-repo.git"
)
add_requires(
"endstone 0.6.0",
"expected-lite 0.8.0",
"entt 3.14.0",
"microsoft-gsl 4.0.0",
"nlohmann_json 3.11.3",
"boost 1.85.0",
"glm 1.0.1",
"concurrentqueue 1.0.4",
"magic_enum 0.9.7"
)
local fmt_version = "fmt >=10.0.0 <11.0.0";
if is_plat("windows") then
add_requires(fmt_version)
elseif is_plat("linux") then
set_toolchains("clang")
add_requires("libelf 0.8.13")
add_requires(fmt_version, {configs = {header_only = true}})
end
if is_plat("windows") and not has_config("vs_runtime") then
set_runtimes("MD")
end
target("my-plugin")
add_defines(
"NOMINMAX",
"UNICODE",
"_HAS_CXX17",
"_HAS_CXX20",
"_HAS_CXX23"
)
add_packages(
"fmt",
"expected-lite",
"entt",
"microsoft-gsl",
"nlohmann_json",
"boost",
"glm",
"concurrentqueue",
"endstone",
"magic_enum"
)
set_kind("shared")
set_languages("cxx20")
set_symbols("debug")
add_includedirs("src")
add_files("src/**.cpp")
-- EndStone Entt
add_defines("ENTT_SPARSE_PAGE=2048")
add_defines("ENTT_PACKED_PAGE=128")
if is_plat("windows") then
add_cxxflags("/Zc:__cplusplus")
add_cxflags(
"/EHa",
"/utf-8",
-- "/W4",
"/sdl"
)
elseif is_plat("linux") then
add_rpathdirs("$ORIGIN/../")
add_cxflags(
"-fPIC",
"-stdlib=libc++",
"-fdeclspec",
{force = true}
)
add_ldflags(
"-stdlib=libc++",
{force = true}
)
add_packages("libelf")
add_syslinks("dl", "pthread", "c++", "c++abi")
end
if is_mode("debug") then
add_defines("DEBUG")
elseif is_mode("release") then
add_defines("NDEBUG")
end
after_build(function(target)
local output_dir = path.join(os.projectdir(), "bin")
os.cp(
target:targetfile(),
path.join(
output_dir,
target:name() .. (is_plat("linux") and ".so" or ".dll")
)
)
local pdb_path = path.join(output_dir, target:name() .. ".pdb")
if os.isfile(target:symbolfile()) then
os.cp(target:symbolfile(), pdb_path)
end
cprint("${bright green}[plugin Packer]: ${reset}plugin already generated to " .. output_dir)
end)