Skip to content

Commit

Permalink
Merge pull request #2 from carlopi/fix_wasm_builds
Browse files Browse the repository at this point in the history
Add wasm builds
  • Loading branch information
samansmink authored Nov 13, 2024
2 parents 5bc26eb + e5cf3e9 commit b2df5c9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/MainDistributionPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
ci_tools_version: main
extension_name: rusty_quack
extra_toolchains: rust;python3
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools'
exclude_archs: 'wasm_threads;windows_amd64_rtools'
11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ edition = "2021"
[lib]
crate-type = ["cdylib"]

[[example]]
# crate-type can't be (at the moment) be overriden for specific targets
# src/wasm_lib.rs forwards to src/lib.rs so that we can change from cdylib
# (that is needed while compiling natively) to staticlib (needed since the
# actual linking will be done via emcc
name = "rusty_quack"
path = "src/wasm_lib.rs"
crate-type = ["staticlib"]

[dependencies]
duckdb = { version = "1.1.1", features = ["vtab-loadable"] }
duckdb-loadable-macros = "0.1.3"
libduckdb-sys = { version = "1.1.1", features = ["loadable-extension"] }
libduckdb-sys = { version = "1.1.1", features = ["loadable-extension"] }
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ test_debug: test_extension_debug
test_release: test_extension_release

clean: clean_build clean_rust
clean_all: clean_configure clean
clean_all: clean_configure clean
14 changes: 14 additions & 0 deletions src/wasm_lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![allow(special_module_name)]

mod lib;

// To build the Wasm target, a `staticlib` crate-type is required
//
// This is different than the default needed in native, and there is
// currently no way to select crate-type depending on target.
//
// This file sole purpose is remapping the content of lib as an
// example, do not change the content of the file.
//
// To build the Wasm target explicitly, use:
// cargo build --example $PACKAGE_NAME

0 comments on commit b2df5c9

Please sign in to comment.