Skip to content

Commit d0f7bd1

Browse files
committed
feat: init
0 parents  commit d0f7bd1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3275
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true

.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export EMSDK="$HOME/emsdk"
2+
export EM_CONFIG="$EMSDK/.emscripten"
3+
export EMSDK_NODE_JS="$EMSDK/node/18.20.3_64bit/bin"
4+
export EMSDK_PYTHON="$EMSDK/python/3.9.2_64bit/bin/python3"
5+
export SSL_CERT_FILE="$EMSDK/python/3.9.2_64bit/lib/python3.9/site-packages/certifi/cacert.pem"
6+
7+
export EMCC_FORCE_STDLIBS=1
8+
export CPPFLAGS="-I$(brew --prefix jpeg)/include -I$(brew --prefix libpng)/include -I$(brew --prefix giflib)/include"
9+
export LDFLAGS="-L$(brew --prefix jpeg)/lib -L$(brew --prefix libpng)/lib -L$(brew --prefix giflib)/lib -ljpeg -lz -lpng -lgif"

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# CMake 相关配置
2+
CMakeLists.txt.user
3+
CMakeCache.txt
4+
CMakeFiles
5+
CMakeScripts
6+
Testing
7+
Makefile
8+
cmake_install.cmake
9+
install_manifest.txt
10+
compile_commands.json
11+
CTestTestfile.cmake
12+
_deps
13+
14+
# Node.js 相关配置
15+
node_modules
16+
17+
# MacOS 相关配置
18+
.DS_Store
19+
20+
# 日志相关配置
21+
*.log
22+
23+
# 其他配置
24+
es
25+
lib
26+
dist
27+
public

.gitmodules

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[submodule "libwebp"]
2+
path = libwebp
3+
url = [email protected]:webmproject/libwebp.git
4+
branch = main
5+
[submodule "libpng"]
6+
path = libpng
7+
url = [email protected]:pnggroup/libpng.git
8+
branch = master
9+
[submodule "libjpeg"]
10+
path = libjpeg
11+
url = [email protected]:LuaDist/libjpeg.git
12+
branch = master
13+
[submodule "giflib"]
14+
path = giflib
15+
url = git://git.code.sf.net/p/giflib/code
16+
branch = master

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
engine-strict = true
2+
tag-version-prefix =
3+
strict-peer-dependencies = true
4+
message = chore(release): Bump to version %s

.prettierrc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"semi": false,
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"trailingComma": "none",
7+
"jsxSingleQuote": true,
8+
"overrides": [
9+
{
10+
"files": ["*.json5"],
11+
"options": {
12+
"singleQuote": false,
13+
"quoteProps": "preserve"
14+
}
15+
},
16+
{
17+
"files": ["*.yml"],
18+
"options": {
19+
"singleQuote": false
20+
}
21+
}
22+
]
23+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024-present Liang Liu.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Libwebp Wasm
2+
3+
## Introduction
4+
5+
The process of converting the [libwebp](https://github.com/webmproject/libwebp) project from C/C++ to WASM is achieved using the [Emscripten](https://emscripten.org) compiler. The general workflow is as follows:
6+
7+
![Emscripten Compilation Flow](https://user-images.githubusercontent.com/8049878/189127696-bba0af00-d58d-42b3-b09e-9e15eb255731.png "Emscripten Compilation Flow")
8+
9+
## Usage
10+
11+
### Installation
12+
13+
#### Toolchain
14+
15+
This includes installing [emsdk](https://github.com/emscripten-core/emsdk), [cmake](https://cmake.org), and [pnpm](https://pnpm.io). For specific installation methods, refer to the [Emscripten official documentation](https://emscripten.org/docs/getting_started/downloads.html), [pnpm official documentation](https://pnpm.io/installation), and [installing cmake](https://juejin.cn/post/6844904024433491982#heading-6).
16+
17+
#### submodule
18+
19+
```bash
20+
git submodule update --init --recursive --remote --rebase
21+
```
22+
23+
### Build
24+
25+
Currently, the build script only supports macOS, so the following build method is only applicable to macOS. Additionally, if you are using zsh, it is recommended to install [the dotenv plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dotenv) to enable features like setting environment variables if a .env file is present in the current directory.
26+
27+
```bash
28+
pnpm build:mac
29+
```
30+
31+
Note: The modification of upstream submodule project code is currently done by running the git apply command. Sometimes you need to commit your own changes in the submodule directory and manually generate the patch.
32+
33+
```bash
34+
pnpm build:patch
35+
```
36+
37+
## Example
38+
39+
- [Gif to Webp](https://libwebp-wasm.github.io/gif2webp/example/)
40+
41+
## License
42+
43+
MIT

README.zh-CN.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Libwebp Wasm
2+
3+
## 介绍
4+
5+
通过使用 [Emscripten](https://emscripten.org) 编译器的方式,从而实现 [libwebp](https://github.com/webmproject/libwebp) 项目从 C/C++ 到 WASM 的转变。大致的流程如下:
6+
7+
![Emscripten 编译流程](https://user-images.githubusercontent.com/8049878/189127696-bba0af00-d58d-42b3-b09e-9e15eb255731.png "Emscripten 编译流程")
8+
9+
## 使用
10+
11+
### 安装
12+
13+
#### 工具链
14+
15+
主要包括安装 [emsdk](https://github.com/emscripten-core/emsdk)[cmake](https://cmake.org) 以及 [pnpm](https://pnpm.io),具体的安装方式可以参考 [Emscripten 官方文档](https://emscripten.org/docs/getting_started/downloads.html)[pnpm 官方文档](https://pnpm.io/installation)以及[安装 cmake](https://juejin.cn/post/6844904024433491982#heading-6)
16+
17+
#### submodule
18+
19+
```bash
20+
git submodule update --init --recursive --remote --rebase
21+
```
22+
23+
### 构建
24+
25+
由于目前的构建脚本只支持 MacOS,所以下面的构建方式只适用于 MacOS。另外,在使用 zsh 的情况下,推荐安装 [dotenv 插件](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dotenv),这样就可以实现一些功能,比如在当前目录存在 .env 文件的情况下设置环境变量。
26+
27+
```bash
28+
pnpm build:mac
29+
```
30+
31+
注意:现在是通过运行 `git apply` 命令的方式,实现修改上游 submodule 项目代码的目的。所以,有时候需要在 submodule 目录下提交自己的 commit,然后手动执行生成 patch 的操作。
32+
33+
```bash
34+
pnpm build:patch
35+
```
36+
37+
## 例子
38+
39+
- [Gif 转 Webp](https://libwebp-wasm.github.io/gif2webp/example/)
40+
41+
## License
42+
43+
MIT

0 commit comments

Comments
 (0)