-
Notifications
You must be signed in to change notification settings - Fork 98
[700] WASM 构建脚本 #3677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JimZhouZZY
wants to merge
1
commit into
main
Choose a base branch
from
zzy/700
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[700] WASM 构建脚本 #3677
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,14 +13,14 @@ end | |
| if has_config("libjpeg") then | ||
| add_requires("libjpeg") | ||
| end | ||
| add_requires("freetype", "zlib", "libaesgm") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,12 +29,6 @@ if has_config("coroutine") then | |
| add_cxflags("gcc::-Wno-error=dangling-pointer") | ||
| end | ||
|
|
||
| -- set wasm toolchain | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lolly 的 xmake.lua 会覆盖原有的 toolchain,所以我删除了这块