Skip to content

Commit 681d667

Browse files
authored
Merge pull request #41 from JosiahParry/webr
Webr
2 parents 32d0d7e + 2c987b5 commit 681d667

File tree

5 files changed

+34
-15
lines changed

5 files changed

+34
-15
lines changed

src/Makevars.webr

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
TARGET = wasm32-unknown-emscripten
2+
TARGET_DIR = $(CURDIR)/rust/target
3+
LIBDIR = $(TARGET_DIR)/$(TARGET)/release
4+
STATLIB = $(LIBDIR)/librsgeo.a
5+
PKG_LIBS = -L$(LIBDIR) -lrsgeo
6+
7+
CARGO_BUILD_ARGS = --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)
8+
9+
all: C_clean
10+
11+
$(SHLIB): $(STATLIB)
12+
13+
$(STATLIB):
14+
# In some environments, ~/.cargo/bin might not be included in PATH, so we need
15+
# to set it here to ensure cargo can be invoked. It is appended to PATH and
16+
# therefore is only used if cargo is absent from the user's PATH.
17+
export PATH="$(PATH):$(HOME)/.cargo/bin" && \
18+
if [ "$(TARGET)" != "wasm32-unknown-emscripten" ]; then \
19+
cargo build $(CARGO_BUILD_ARGS); \
20+
else \
21+
export CC="$(CC)" && \
22+
export CFLAGS="$(CFLAGS)" && \
23+
export CARGO_PROFILE_RELEASE_PANIC="abort" && \
24+
export RAYON_NUM_THREADS=1 && \
25+
cargo +nightly build $(CARGO_BUILD_ARGS) --target $(TARGET) -Zbuild-std=panic_abort,std; \
26+
fi
27+
28+
C_clean:
29+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)
30+
31+
clean:
32+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target

src/rust/Cargo.lock

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ sfconversions = { git = "https://github.com/JosiahParry/sfconversions" }
2020
geo-types = { git = "https://github.com/georust/geo" }
2121
# geo = { path = "../../../geo/geo" }
2222
geo = { git = "https://github.com/georust/geo" }
23+
libR-sys = { git = "https://github.com/extendr/libR-sys", branch = "parry-wasm" }

src/rust/vendor-config.toml

-13
This file was deleted.

src/rust/vendor.tar.xz

-2.77 MB
Binary file not shown.

0 commit comments

Comments
 (0)