Skip to content

Commit 0d92160

Browse files
committed
add xmake
1 parent ed3aa7f commit 0d92160

File tree

13 files changed

+939
-1113
lines changed

13 files changed

+939
-1113
lines changed

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@
66
plugin/include/PluginConfiguration.h
77

88
*.p12
9-
*.zxp
9+
*.zxp
10+
11+
build
12+
.xmake
13+
compile_commands.json
14+
vsxmake*
15+
include/PluginConfiguration.h

installer/package-lock.json

+13-79
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin/build.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ function buildWindows() {
6565
return;
6666
}
6767

68-
exec(`"${cmakePath}" -S "${__dirname}" -B "${buildDirectory}" ${CmakeFlags}`);
69-
exec(`"${cmakePath}" --build "${buildDirectory}" --config ${activeConfiguration}`);
68+
if (isDev) {
69+
exec("xmake f --mode=debug --kind=shared")
70+
} else {
71+
exec("xmake f --mode=releasedbg --kind=shared")
72+
}
73+
exec("xmake build ScAnimatePlugin")
7074

7175
copyDir(binaryDirectory, outputDirectory);
7276
progress("Done");

plugin/package-lock.json

+8-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin/xmake.lua

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
add_rules("mode.debug", "mode.releasedbg")
2+
if is_kind("shared") then
3+
add_requireconfs("*", {configs = {shared = true, runtimes = "MD", vs_runtime = "MD"}})
4+
set_runtimes("MD")
5+
else
6+
add_requireconfs("*", {configs = {shared = false, runtimes = "MT", vs_runtime = "MT"}})
7+
set_runtimes("MT")
8+
end
9+
10+
add_requires("libnest2d 2022.11.16")
11+
add_requires("wxwidgets 3.2.4")
12+
add_requires("cdt 1.4.1")
13+
add_requires("nlohmann_json 3.11.3")
14+
add_requires("fmt 10.2.1")
15+
add_requires("spdlog v1.13.0")
16+
add_requires("opencv 4.9.0")
17+
18+
add_requires("supercell_flash")
19+
add_requires("atlas_generator")
20+
21+
target("ScAnimatePlugin")
22+
set_kind("$(kind)")
23+
set_languages("cxx17")
24+
25+
add_packages("supercell_flash")
26+
add_packages("atlas_generator", "wxwidgets", "cdt", "nlohmann_json", "fmt", "spdlog", "opencv", "openmp")
27+
28+
add_files("source/**.cpp")
29+
add_includedirs("include")
30+
add_headerfiles("include/(**.h)", "include/(**.hpp)")
31+
32+
set_extension(".fcm")
33+
34+
if is_plat("windows") and is_kind("shared") then
35+
add_rules("utils.symbols.export_all", {export_classes = true})
36+
end
37+
38+
add_syslinks("msvcrt", "user32", "gdi32", "winspool", "comdlg32", "advapi32", "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32", "opengl32")
39+
40+
-- SC Animate Image Debug Mode
41+
if has_config("SC_ANIMATE_IMAGE_DEBUG") then
42+
add_defines("CV_DEBUG")
43+
end
44+
if is_mode("debug") then
45+
set_targetdir("build/animate_bin/Debug")
46+
else
47+
set_targetdir("build_release/animate_bin/RelWithDebInfo")
48+
end
49+
50+
if is_plat("windows") then
51+
add_defines("_CRT_SECURE_NO_WARNINGS", "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING")
52+
add_defines("_WINDOWS", "SC_MSVC")
53+
end
54+
55+
before_build(function(target)
56+
local publisherName = "SupercellSWF"
57+
local publisherId = "org.scWorkshop.SupercellSWF.Publisher"
58+
local publisherUi = "org.scWorkshop.SupercellSWF.PublishSettings"
59+
local doctypeName = "SupercellSWF"
60+
local doctypeId = "org.scWorkshop.SupercellSWF"
61+
local MAJOR = 1
62+
local MINOR = 1
63+
local MAINTENANCE = 0
64+
65+
local code = [[
66+
#pragma once
67+
68+
#define PUBLISHER_NAME "${publisherName}"
69+
#define PUBLISHER_UNIVERSAL_NAME "${publisherId}"
70+
71+
#define PUBLISH_SETTINGS_UI_ID "${publisherUi}"
72+
73+
#define DOCTYPE_NAME "${doctypeName}"
74+
#define DOCTYPE_UNIVERSAL_NAME "${doctypeId}"
75+
76+
#define PLUGIN_VERSION_MAJOR ${MAJOR}
77+
#define PLUGIN_VERSION_MINOR ${MINOR}
78+
#define PLUGIN_VERSION_MAINTENANCE ${MAINTENANCE}
79+
]]
80+
81+
code = code:gsub("${publisherName}", publisherName)
82+
:gsub("${publisherId}", publisherId)
83+
:gsub("${publisherUi}", publisherUi)
84+
:gsub("${doctypeName}", doctypeName)
85+
:gsub("${doctypeId}", doctypeId)
86+
:gsub("${MAJOR}", tostring(MAJOR))
87+
:gsub("${MINOR}", tostring(MINOR))
88+
:gsub("${MAINTENANCE}", tostring(MAINTENANCE))
89+
90+
io.writefile("include/PluginConfiguration.h", code)
91+
end)

0 commit comments

Comments
 (0)