summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSirLynix <[email protected]>2022-08-05 18:35:24 +0200
committerSirLynix <[email protected]>2022-08-05 18:35:24 +0200
commitcdd5062919821da123cd84d5dbb3cb07cd889ee9 (patch)
tree60856345007ddea1b304a5ab1020d808c6e2f7b2
parentcaf2e66bcecf3370472bcb9dca266ae5037f7284 (diff)
wasm: install all files (close #2645)
-rw-r--r--xmake/rules/platform/wasm/installfiles/xmake.lua33
-rw-r--r--xmake/rules/platform/xmake.lua5
2 files changed, 38 insertions, 0 deletions
diff --git a/xmake/rules/platform/wasm/installfiles/xmake.lua b/xmake/rules/platform/wasm/installfiles/xmake.lua
new file mode 100644
index 000000000..4ccc94e60
--- /dev/null
+++ b/xmake/rules/platform/wasm/installfiles/xmake.lua
@@ -0,0 +1,33 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author SirLynix, ruki
+-- @file xmake.lua
+--
+
+-- copy other files generated by emcc (see https://emscripten.org/docs/tools_reference/emcc.html#emcc-o-target)
+rule("platform.wasm.installfiles")
+ on_load("wasm", function (target)
+ if not target:is_binary() then
+ return
+ end
+ local targetfile = target:targetfile()
+ target:add("installfiles", targetfile:gsub("%.html", ".js"), { prefixdir = "bin" })
+ target:add("installfiles", targetfile:gsub("%.html", ".mem"), { prefixdir = "bin" })
+ target:add("installfiles", targetfile:gsub("%.html", ".mjs"), { prefixdir = "bin" })
+ target:add("installfiles", targetfile:gsub("%.html", ".wasm"), { prefixdir = "bin" })
+ end)
+
diff --git a/xmake/rules/platform/xmake.lua b/xmake/rules/platform/xmake.lua
index 3b11a8047..1e2cca8c6 100644
--- a/xmake/rules/platform/xmake.lua
+++ b/xmake/rules/platform/xmake.lua
@@ -18,6 +18,11 @@
-- @file xmake.lua
--
+rule("platform.wasm")
+ if is_plat("wasm") then
+ add_deps("platform.wasm.installfiles")
+ end
+
rule("platform.windows")
if is_host("windows") then
add_deps("platform.windows.def")