Commit 00eaf6aa authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[piexwasm] Add Makefile to em++ compile the piex code

Make em++ compile -Os and export needed SDK symbols: cwrap and the SDK
callback helpers addFunction and removeFunction). Compile and link the
PIEX with with piex.cpp, which will be added in a future CL.

Bug: 935285
Change-Id: I1c3ebcf088cb8ece69767b9d26012bc015083615
Reviewed-on: https://chromium-review.googlesource.com/c/1487754Reviewed-by: default avatarAnand Mistry <amistry@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Auto-Submit: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635399}
parent fa563ebe
# Makefile for piex-wasm
PIEX = node_modules/piex
PSRC = $(PIEX)/src/piex.cc \
$(PIEX)/src/tiff_parser.cc \
$(PIEX)/src/image_type_recognition/image_type_recognition_lite.cc \
$(PIEX)/src/tiff_directory/tiff_directory.cc \
$(PIEX)/src/binary_parse/range_checked_byte_ptr.cc \
$(PIEX)/src/binary_parse/cached_paged_byte_array.cc
WAPI = ["cwrap", "addFunction", "removeFunction"]
INCS = -I $(PIEX) -I .
WASM = -s WASM=1 -fno-exceptions -D NO_ENABLE_LOGGING
WOPT = -Os --llvm-opts 3 \
-s STRICT=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s EXTRA_EXPORTED_RUNTIME_METHODS='$(WAPI)' \
-s RESERVED_FUNCTION_POINTERS=2
all: a.out.js
a.out.js: piex.cpp.bc piex.src.bc
em++ --bind --std=c++11 $(WASM) $(WOPT) $^
piex.cpp.bc: piex.cpp log.h logfatal.h Makefile
em++ --bind --std=c++11 $(WASM) $(WOPT) $(INCS) piex.cpp -o $@
piex.src.bc: $(PSRC) Makefile
em++ --bind --std=c++11 $(WASM) $(WOPT) $(INCS) $(PSRC) -o $@
.PHONY: clean
clean:
$(shell rm -f tests.hash tests.log package-lock* *.bc a.out.*)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment