forked from SLP-Community/SexLabpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
113 lines (100 loc) · 3.38 KB
/
xmake.lua
File metadata and controls
113 lines (100 loc) · 3.38 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
111
112
113
set_xmakever("2.9.5")
-- Globals
PROJECT_NAME = "SexLabUtil"
-- includes, moved up to name the solution correctly
includes("lib/CommonLibSSE-NG")
-- Project
set_project(PROJECT_NAME)
set_version("2.16.0")
set_languages("cxx23")
set_license("apache-2.0")
set_warnings("allextra", "error")
-- Options
option("copy_to_papyrus")
set_default(true)
set_description("Copy finished build to Papyrus SKSE folder")
option_end()
-- Dependencies & Includes
-- https://github.com/xmake-io/xmake-repo/tree/dev
add_requires("yaml-cpp", "magic_enum", "nlohmann_json", "simpleini", "glm", "eigen")
-- policies
set_policy("package.requires_lock", true)
-- rules
add_rules("mode.debug", "mode.release")
if is_mode("debug") then
add_defines("DEBUG")
set_optimize("none")
elseif is_mode("release") then
add_defines("NDEBUG")
set_optimize("fastest")
set_symbols("debug")
end
-- Target
target(PROJECT_NAME)
-- Dependencies
add_packages("yaml-cpp", "magic_enum", "nlohmann_json", "simpleini", "glm", "eigen")
-- CommonLibSSE
add_deps("commonlibsse-ng")
add_rules("commonlibsse-ng.plugin", {
name = PROJECT_NAME,
author = "Scrab",
description = "Backend for skyrims adult animation framework 'SexLab'."
})
-- Source files
set_pcxxheader("src/PCH.h")
add_files("src/**.cpp")
add_headerfiles("src/**.h")
add_includedirs("src")
-- flags
add_cxxflags(
"cl::/cgthreads4",
"cl::/diagnostics:caret",
"cl::/external:W0",
"cl::/fp:contract",
"cl::/fp:except-",
"cl::/guard:cf-",
"cl::/Zc:enumTypes",
"cl::/Zc:preprocessor",
"cl::/Zc:templateScope",
"cl::/utf-8"
)
-- flags (cl: warnings -> errors)
add_cxxflags("cl::/we4715") -- `function` : not all control paths return a value
-- flags (cl: disable warnings)
add_cxxflags(
"cl::/wd4068", -- unknown pragma 'clang'
"cl::/wd4201", -- nonstandard extension used : nameless struct/union
"cl::/wd4265" -- 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
)
-- Conditional flags
if is_mode("debug") then
add_cxxflags("cl::/bigobj")
elseif is_mode("release") then
add_cxxflags("cl::/Zc:inline", "cl::/JMC-", "cl::/Ob3")
end
-- Post Build
after_build(function (target)
import("lib.detect.find_tool")
local python = find_tool("python3")
if python then
os.execv(python.program, {"scripts/generate_config.py"})
else
print("Warning: Python not found. Skipping config generation.")
end
local mod_folder = os.getenv("XSE_TES5_MODS_PATH")
if not has_config("copy_to_papyrus") then
print("Notice: copy_to_papyrus not defined. Skipping post-build copy.")
elseif mod_folder then
local plugin_path = path.join(mod_folder, "SL-Dev", "SKSE/Plugins")
if not os.isdir(plugin_path) then
os.mkdir(plugin_path)
end
os.cp(target:targetfile(), plugin_path)
os.cp(target:symbolfile(), plugin_path)
os.cp("scripts/out/*", plugin_path)
else
print("Warning: SkyrimPath not defined. Skipping post-build copy.")
end
print("Build finished. ")
end)
target_end()