Skip to content

Commit

Permalink
Rename to primitives and remove asyncify
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Apr 4, 2023
1 parent 7749355 commit c62b11e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cpp/dockerfiles/Dockerfile.wasm-linux-clang
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ WORKDIR /usr/src/barretenberg/cpp/src
RUN curl -s -L https://github.com/CraneStation/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz | tar zxfv -
WORKDIR /usr/src/barretenberg/cpp
COPY . .
# Build both honk_tests barretenberg.wasm a3crypto.wasm
# Build both honk_tests barretenberg.wasm primitives.wasm
# This ensures that we aren't using features that would be incompatible with WASM for Honk
RUN cmake --preset wasm && cmake --build --preset wasm --target honk_tests --target barretenberg.wasm --target a3crypto.wasm
RUN cmake --preset wasm && cmake --build --preset wasm --target honk_tests --target barretenberg.wasm --target primitives.wasm

FROM alpine:3.17
COPY --from=builder /usr/src/barretenberg/cpp/build-wasm/bin/barretenberg.wasm /usr/src/barretenberg/cpp/build/bin/barretenberg.wasm
COPY --from=builder /usr/src/barretenberg/cpp/build-wasm/bin/a3crypto.wasm /usr/src/barretenberg/cpp/build/bin/a3crypto.wasm
COPY --from=builder /usr/src/barretenberg/cpp/build-wasm/bin/primitives.wasm /usr/src/barretenberg/cpp/build/bin/primitives.wasm
COPY --from=builder /usr/src/barretenberg/cpp/build-wasm/bin/*_tests /usr/src/barretenberg/cpp/build/bin/
10 changes: 6 additions & 4 deletions cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ if(WASM)
-nostartfiles -O2 -Wl,--no-entry -Wl,--export-dynamic -Wl,--import-memory -Wl,--allow-undefined -Wl,--stack-first -Wl,-z,stack-size=1048576
)

# Repeat the above but for the smaller primitives.wasm
# Used in packages where we don't need the full contents of barretenberg
add_executable(
a3crypto.wasm
primitives.wasm
$<TARGET_OBJECTS:numeric_objects>
$<TARGET_OBJECTS:crypto_sha256_objects>
$<TARGET_OBJECTS:crypto_aes128_objects>
Expand All @@ -126,7 +128,7 @@ if(WASM)
)

target_link_options(
a3crypto.wasm
primitives.wasm
PRIVATE
-nostartfiles -O2 -Wl,--no-entry -Wl,--export-dynamic -Wl,--import-memory -Wl,--allow-undefined -Wl,--stack-first -Wl,-z,stack-size=1048576
)
Expand All @@ -145,9 +147,9 @@ if(WASM)
)

add_custom_command(
TARGET a3crypto.wasm
TARGET primitives.wasm
POST_BUILD
COMMAND wasm-opt "$<TARGET_FILE:a3crypto.wasm>" -O2 --asyncify -o "$<TARGET_FILE:a3crypto.wasm>"
COMMAND wasm-opt "$<TARGET_FILE:primitives.wasm>" -O2 -o "$<TARGET_FILE:primitives.wasm>"
VERBATIM
)

Expand Down

0 comments on commit c62b11e

Please sign in to comment.