Skip to content

Commit 746396e

Browse files
committed
build: move most rule logic to shared
1 parent e49d708 commit 746396e

4 files changed

Lines changed: 38 additions & 205 deletions

File tree

res/commonlibsse-plugin.cpp.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <SKSE/SKSE.h>
2+
3+
SKSE_EXPORT constinit auto SKSEPlugin_Version = []() {
4+
SKSE::PluginVersionData v;
5+
v.PluginVersion({ ${COMMONLIB_PLUGIN_VERSION_MAJOR}, ${COMMONLIB_PLUGIN_VERSION_MINOR}, ${COMMONLIB_PLUGIN_VERSION_PATCH}, 0 });
6+
v.PluginName("${COMMONLIB_PLUGIN_NAME}");
7+
v.AuthorName("${COMMONLIB_PLUGIN_AUTHOR}");
8+
v.AuthorEmail("${COMMONLIB_PLUGIN_CONTACT}");
9+
v.UsesAddressLibrary();
10+
v.UsesUpdatedStructs();
11+
v.CompatibleVersions({ SKSE::RUNTIME_LATEST });
12+
return v;
13+
}();

xmake-rules.lua

Lines changed: 0 additions & 175 deletions
This file was deleted.

xmake.lua

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ add_rules("plugin.vsxmake.autoupdate")
1414

1515
-- include subprojects
1616
includes("lib/commonlib-shared")
17-
includes("xmake-rules.lua")
1817

1918
-- define targets
2019
target("commonlibsse", function()
@@ -42,33 +41,29 @@ target("commonlibsse", function()
4241

4342
-- set precompiled header
4443
set_pcxxheader("include/SKSE/Impl/PCH.h")
44+
end)
4545

46-
-- add flags (cl: disable warnings)
47-
add_cxxflags(
48-
"cl::/wd4005", -- macro redefinition
49-
"cl::/wd4061", -- enumerator `identifier` in switch of enum `enumeration` is not explicitly handled by a case label
50-
"cl::/wd4068", -- unknown pragma 'clang'
51-
"cl::/wd4264", -- 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden
52-
"cl::/wd4265", -- 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
53-
"cl::/wd4266", -- 'function' : no override available for virtual member function from base 'type'; function is hidden
54-
"cl::/wd4371", -- 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member'
55-
"cl::/wd4514", -- 'function' : unreferenced inline function has been removed
56-
"cl::/wd4582", -- 'type': constructor is not implicitly called
57-
"cl::/wd4583", -- 'type': destructor is not implicitly called
58-
"cl::/wd4623", -- 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted
59-
"cl::/wd4625", -- 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
60-
"cl::/wd4626", -- 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
61-
"cl::/wd4686", -- 'user-defined type' : possible change in behavior, change in UDT return calling convention
62-
"cl::/wd4710", -- 'function' : function not inlined
63-
"cl::/wd4711", -- function 'function' selected for inline expansion
64-
"cl::/wd4820", -- 'bytes' bytes padding added after construct 'member_name'
65-
"cl::/wd5082", -- second argument to 'va_start' is not the last named parameter
66-
"cl::/wd5026", -- 'type': move constructor was implicitly defined as deleted
67-
"cl::/wd5027", -- 'type': move assignment operator was implicitly defined as deleted
68-
"cl::/wd5045", -- compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
69-
"cl::/wd5053", -- support for 'explicit(<expr>)' in C++17 and earlier is a vendor extension
70-
"cl::/wd5105", -- macro expansion producing 'defined' has undefined behavior (workaround for older msvc bug)
71-
"cl::/wd5204", -- 'type-name': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
72-
"cl::/wd5220" -- 'member': a non-static data member with a volatile qualified type no longer implies that compiler generated copy / move constructors and copy / move assignment operators are not trivial
73-
)
46+
rule("commonlibsse.plugin", function()
47+
add_deps("commonlib.plugin")
48+
49+
on_load(function(target)
50+
target:data_set("commonlib.plugin.config", target:extraconf("rules", "commonlibsse.plugin"))
51+
target:data_set("commonlib.plugin.package", { prefixdir = "Data" })
52+
end)
53+
54+
on_config(function(target)
55+
target:add("deps", "commonlibsse")
56+
57+
target:add("configfiles", path.join(os.scriptdir(), "res/commonlibsse-plugin.cpp.in"))
58+
target:add("files", path.join(target:configdir(), "commonlibsse-plugin.cpp"))
59+
60+
if os.getenv("XSE_TES5_MODS_PATH") then
61+
target:set("installdir", path.join(os.getenv("XSE_TES5_MODS_PATH"), target:name()))
62+
elseif os.getenv("XSE_TES5_GAME_PATH") then
63+
target:set("installdir", path.join(os.getenv("XSE_TES5_GAME_PATH"), "Data"))
64+
end
65+
66+
target:add("installfiles", target:targetfile(), { prefixdir = "SKSE/Plugins" })
67+
target:add("installfiles", target:symbolfile(), { prefixdir = "SKSE/Plugins" })
68+
end)
7469
end)

0 commit comments

Comments
 (0)