Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions 3rdparty/lolly/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ if is_plat("mingw") and is_host("windows") then
set_toolchains("mingw@mingw-w64")
end

if is_plat("wasm") then

@JimZhouZZY JimZhouZZY Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lolly 的 xmake.lua 会覆盖原有的 toolchain,所以我删除了这块

add_requires("emscripten 3.1.25")
set_toolchains("emcc@emscripten")
end

-- Options
option("malloc")
set_default("default")
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/pdfhummus/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ end
if has_config("libjpeg") then
add_requires("libjpeg")
end
add_requires("freetype", "zlib", "libaesgm")

@JimZhouZZY JimZhouZZY Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

liii-libaesgm 需要作命名区分,因为在 pdfhummus 解析依赖的过程中仍然会去寻找 xrepo 的 libaesgm

add_requires("freetype", "zlib", "liii-libaesgm")
target("pdfhummus")
set_kind("$(kind)")
add_files("PDFWriter/*.cpp")
add_headerfiles("(PDFWriter/*.h)")
add_packages("freetype")
add_packages("libtiff", "libpng", "libjpeg")
add_packages("libaesgm", "zlib")
add_packages("liii-libaesgm", "zlib")
if has_package("libtiff") then
add_defines("_INCLUDE_TIFF_HEADER")
add_cxflags("-Wno-deprecated-declarations")
Expand Down
6 changes: 0 additions & 6 deletions 3rdparty/tbox/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ if has_config("coroutine") then
add_cxflags("gcc::-Wno-error=dangling-pointer")
end

-- set wasm toolchain

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto. 此处覆盖原有的 toolchain,所以我删除了这块

if is_plat("wasm") then
add_requires("emscripten")
set_toolchains("emcc@emscripten")
end

-- add build modes
add_rules("mode.release", "mode.debug", "mode.profile", "mode.coverage", "mode.valgrind", "mode.asan", "mode.tsan", "mode.ubsan")
if is_mode("debug") then
Expand Down
29 changes: 29 additions & 0 deletions bin/wasm_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
import sys
import os

root = sys.argv[1]

class Handler(SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=root, **kwargs)

def end_headers(self):
self.send_header(
"Cross-Origin-Opener-Policy",
"same-origin"
)
self.send_header(
"Cross-Origin-Embedder-Policy",
"require-corp"
)
super().end_headers()

server = ThreadingHTTPServer(
("127.0.0.1", 8000),
Handler
)

print("Serving on http://127.0.0.1:8000")

server.serve_forever()
19 changes: 19 additions & 0 deletions devel/700.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# [700] WASM 构建脚本
## What
调整 xmake 构建脚本适配 WASM 构建

## How to test
1. 配置
```
xmake f -c -p wasm -vD
```
2. 构建
```
xmake b -vD stem
```
3. 运行服务器
```
xmake r stem
```
4. 运行 stem
浏览器访问 127.0.0.1:8000
Loading
Loading