diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index f53675cd..64679769 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -55,8 +55,8 @@ jobs: - name: Install git, linguist uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: git ruby-github-linguist - version: docs + packages: git ruby-github-linguist emscripten + version: docs2 - name: Build sphinx docs run: make docs_dependencies html diff --git a/c/Makefile b/c/Makefile index 6543ad76..8d65b883 100644 --- a/c/Makefile +++ b/c/Makefile @@ -66,10 +66,17 @@ native_test: native .PHONY: clean clean: - @rm -rf build {.,*,*/*}/{*.pyc,__pycache__,.mypy_cache,.pytest_cache,.benchmarks} || echo + @rm -rf build dist {.,*,*/*}/{*.pyc,__pycache__,.mypy_cache,.pytest_cache,.benchmarks} || echo -.PHONY: wasm -wasm: ../LICENSE - @wget https://github.com/jedisct1/libclang_rt.builtins-wasm32.a -O wasm32.a +dist/lib.wasm: build/lib.c + @mkdir -p dist + @emcc build/lib.c -Wl,--whole-archive -DUNITY_END -O$(O) -o dist/lib.js + +build/lib.c: ../LICENSE @mkdir -p build - @clang -DUNITY_END --target=wasm32-unknown-wasi --sysroot /tmp/wasi-libc -nostartfiles -Wl,--import-memory -Wl,--no-entry -Wl,--export-all -o build/c.wasm test.c + @> build/lib.c + @for file in src/p*.c; do \ + if [ -f "$$file" ]; then \ + echo "#include \"../$$file\"" >> build/lib.c; \ + fi \ + done diff --git a/c/wasi-libc b/c/wasi-libc deleted file mode 160000 index 5d3c5e91..00000000 --- a/c/wasi-libc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5d3c5e918c38a4432d5efbfc0f70de76c4779eed diff --git a/cplusplus/Makefile b/cplusplus/Makefile index c52cbb6f..19671776 100644 --- a/cplusplus/Makefile +++ b/cplusplus/Makefile @@ -58,4 +58,17 @@ native_test: native .PHONY: clean clean: - @rm -rf build {.,*,*/*}/{*.pyc,__pycache__,.mypy_cache,.pytest_cache,.benchmarks} || echo + @rm -rf build dist {.,*,*/*}/{*.pyc,__pycache__,.mypy_cache,.pytest_cache,.benchmarks} || echo + +dist/lib.wasm: build/lib.cpp + @mkdir -p dist + @emc++ build/lib.cpp -Wl,--whole-archive -DUNITY_END -O$(O) -o dist/lib.js + +build/lib.cpp: ../LICENSE + @mkdir -p build + @> build/lib.cpp + @for file in src/p*.cpp; do \ + if [ -f "$$file" ]; then \ + echo "#include \"../$$file\"" >> build/lib.c; \ + fi \ + done diff --git a/docs/Makefile b/docs/Makefile index bb864d63..b9d88380 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -40,6 +40,11 @@ _static/dist/bundle.js: @mkdir -p _static/dist @cp ../javascript/dist/bundle-js.js _static/dist/bundle-js.js +_static/dist/cplusplus-lib.js: + @$(MAKE) -C ../cplusplus dist/lib.js $(MFLAGS) + @cp ../c/dist/lib.js _static/dist/cp-lib.js + @cp ../c/dist/lib.wasm _static/dist/cp-lib.wasm + _static/dist/rust.js: @cd ../rust && wasm-pack build --target web --out-dir ../docs/_static/dist/ @@ -48,7 +53,7 @@ _static/dist/python.tar.gz: .PHONY: html html: - @$(MAKE) _static/dist/bundle.js _static/dist/python.tar.gz _static/dist/rust.js $(MFLAGS) -j + @$(MAKE) _static/dist/bundle.js _static/dist/c-lib.js _static/dist/cplusplus-lib.js _static/dist/python.tar.gz _static/dist/rust.js $(MFLAGS) -j @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) # Catch-all target: route all unknown targets to Sphinx using the new