@@ -26,20 +26,7 @@ add_requires(
2626)
2727add_requires (" openssl 1.1.1-w" , {configs = {shared = false }})
2828add_requires (" cpp-httplib 0.14.3" , {configs = {ssl = true }})
29-
30- if is_config (" backend" , " lua" ) then
31- add_requires (" scriptx main" , {configs = {backend = " Lua" }})
32-
33- elseif is_config (" backend" , " quickjs" ) then
34- add_requires (" scriptx main" , {configs = {backend = " QuickJs" }})
35-
36- elseif is_config (" backend" , " python" ) then
37- add_requires (" scriptx main" , {configs = {backend = " Python" }})
38-
39- elseif is_config (" backend" , " nodejs" ) then
40- add_requires (" scriptx main" , {configs = {backend = " V8" }})
41-
42- end
29+ add_requires (" scriptx main" , {configs = {backend = " Lua" }})
4330
4431if not has_config (" vs_runtime" ) then
4532 set_runtimes (" MD" )
@@ -51,11 +38,108 @@ option("target_type")
5138 set_values (" server" , " client" )
5239option_end ()
5340
54- option (" backend" )
55- set_default (" lua" )
56- set_values (" lua" , " quickjs" , " python" , " nodejs" )
41+ target (" legacy-script-engine-lua" )
42+ add_rules (" @levibuildscript/linkrule" )
43+ add_rules (" @levibuildscript/modpacker" )
44+ add_cxflags (" /EHa" , " /utf-8" , " /W4" , " /w44265" , " /w44289" , " /w44296" , " /w45263" , " /w44738" , " /w45204" ," /Zm2000" , {force = true })
45+ add_defines (
46+ " NOMINMAX" ,
47+ " UNICODE" ,
48+ " _AMD64_"
49+ )
50+ add_packages (
51+ " cpp-httplib" ,
52+ " demangler" ,
53+ " dyncall" ,
54+ " fmt" ,
55+ " legacymoney" ,
56+ " legacyparticleapi" ,
57+ " legacyremotecall" ,
58+ " levilamina" ,
59+ " lightwebsocketclient" ,
60+ " magic_enum" ,
61+ " nlohmann_json" ,
62+ " scriptx" ,
63+ " simpleini" ,
64+ " sqlite3" ,
65+ " toml++"
66+ )
67+ set_exceptions (" none" )
68+ set_kind (" shared" )
69+ set_languages (" cxx20" )
70+ set_symbols (" debug" )
71+
72+ add_defines (
73+ " LEGACY_SCRIPT_ENGINE_BACKEND_LUA"
74+ )
75+
76+ add_files (
77+ " src/**.cpp"
78+ )
79+ add_includedirs (
80+ " src" ,
81+ " src/legacy"
82+ )
83+
84+ after_build (function (target )
85+ local baselibPath = path.join (os.projectdir (), " src/baselib/BaseLib.lua" )
86+ local outputPath = path.join (os.projectdir (), " bin/" .. target :name () .. " /baselib" )
87+ os .mkdir (outputPath )
88+ os .cp (baselibPath , outputPath )
89+ end )
90+
91+ target (" legacy-script-engine-quickjs" )
92+ add_rules (" @levibuildscript/linkrule" )
93+ add_rules (" @levibuildscript/modpacker" )
94+ add_cxflags (" /EHa" , " /utf-8" , " /W4" , " /w44265" , " /w44289" , " /w44296" , " /w45263" , " /w44738" , " /w45204" ," /Zm2000" , {force = true })
95+ add_defines (
96+ " NOMINMAX" ,
97+ " UNICODE" ,
98+ " _AMD64_"
99+ )
100+
101+ add_packages (
102+ " cpp-httplib" ,
103+ " demangler" ,
104+ " dyncall" ,
105+ " fmt" ,
106+ " legacymoney" ,
107+ " legacyparticleapi" ,
108+ " legacyremotecall" ,
109+ " levilamina" ,
110+ " lightwebsocketclient" ,
111+ " magic_enum" ,
112+ " nlohmann_json" ,
113+ " scriptx" ,
114+ " simpleini" ,
115+ " sqlite3" ,
116+ " toml++"
117+ )
118+ set_exceptions (" none" )
119+ set_kind (" shared" )
120+ set_languages (" cxx20" )
121+ set_symbols (" debug" )
122+
123+ add_defines (
124+ " LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS"
125+ )
57126
58- target (" legacy-script-engine" )
127+ add_files (
128+ " src/**.cpp"
129+ )
130+ add_includedirs (
131+ " src" ,
132+ " src/legacy"
133+ )
134+
135+ after_build (function (target )
136+ local baselibPath = path.join (os.projectdir (), " src/baselib/BaseLib.js" )
137+ local outputPath = path.join (os.projectdir (), " bin/" .. target :name () .. " /baselib" )
138+ os .mkdir (outputPath )
139+ os .cp (baselibPath , outputPath )
140+ end )
141+
142+ target (" legacy-script-engine-nodejs" )
59143 add_rules (" @levibuildscript/linkrule" )
60144 add_rules (" @levibuildscript/modpacker" )
61145 add_cxflags (" /EHa" , " /utf-8" , " /W4" , " /w44265" , " /w44289" , " /w44296" , " /w45263" , " /w44738" , " /w45204" ," /Zm2000" , {force = true })
@@ -64,6 +148,7 @@ target("legacy-script-engine")
64148 " UNICODE" ,
65149 " _AMD64_"
66150 )
151+
67152 add_packages (
68153 " cpp-httplib" ,
69154 " demangler" ,
@@ -86,31 +171,60 @@ target("legacy-script-engine")
86171 set_languages (" cxx20" )
87172 set_symbols (" debug" )
88173
89- if is_config (" backend" , " lua" ) then
90- add_defines (
91- " LEGACY_SCRIPT_ENGINE_BACKEND_LUA"
92- )
93- set_basename (" legacy-script-engine-lua" )
174+ add_defines (
175+ " LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS"
176+ )
177+
178+ add_files (
179+ " src/**.cpp"
180+ )
181+ add_includedirs (
182+ " src" ,
183+ " src/legacy"
184+ )
94185
95- elseif is_config (" backend" , " quickjs" ) then
96- add_defines (
97- " LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS"
98- )
99- set_basename (" legacy-script-engine-quickjs" )
186+ after_build (function (target )
187+ local baselibPath = path.join (os.projectdir (), " src/baselib/BaseLib.js" )
188+ local outputPath = path.join (os.projectdir (), " bin/" .. target :name () .. " /baselib" )
189+ os .mkdir (outputPath )
190+ os .cp (baselibPath , outputPath )
191+ end )
100192
101- elseif is_config (" backend" , " python" ) then
102- add_defines (
103- " LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON"
104- )
105- set_basename (" legacy-script-engine-python" )
193+ target (" legacy-script-engine-python" )
194+ add_rules (" @levibuildscript/linkrule" )
195+ add_rules (" @levibuildscript/modpacker" )
196+ add_cxflags (" /EHa" , " /utf-8" , " /W4" , " /w44265" , " /w44289" , " /w44296" , " /w45263" , " /w44738" , " /w45204" ," /Zm2000" , {force = true })
197+ add_defines (
198+ " NOMINMAX" ,
199+ " UNICODE" ,
200+ " _AMD64_"
201+ )
106202
107- elseif is_config (" backend" , " nodejs" ) then
108- add_defines (
109- " LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS"
110- )
111- set_basename (" legacy-script-engine-nodejs" )
203+ add_packages (
204+ " cpp-httplib" ,
205+ " demangler" ,
206+ " dyncall" ,
207+ " fmt" ,
208+ " legacymoney" ,
209+ " legacyparticleapi" ,
210+ " legacyremotecall" ,
211+ " levilamina" ,
212+ " lightwebsocketclient" ,
213+ " magic_enum" ,
214+ " nlohmann_json" ,
215+ " scriptx" ,
216+ " simpleini" ,
217+ " sqlite3" ,
218+ " toml++"
219+ )
220+ set_exceptions (" none" )
221+ set_kind (" shared" )
222+ set_languages (" cxx20" )
223+ set_symbols (" debug" )
112224
113- end
225+ add_defines (
226+ " LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON"
227+ )
114228
115229 add_files (
116230 " src/**.cpp"
@@ -120,3 +234,9 @@ target("legacy-script-engine")
120234 " src/legacy"
121235 )
122236
237+ after_build (function (target )
238+ local baselibPath = path.join (os.projectdir (), " src/baselib/BaseLib.py" )
239+ local outputPath = path.join (os.projectdir (), " bin/" .. target :name () .. " /baselib" )
240+ os .mkdir (outputPath )
241+ os .cp (baselibPath , outputPath )
242+ end )
0 commit comments