From 4877aa9723933f0501bc7cec6aec120916748aac Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sat, 7 Aug 2021 11:45:39 -0400 Subject: [PATCH] Fix Makefile to build WASM examples. - Add --preload-file flag before specifying the resource dir - Add empty resource dir to `shapes/` (otherwise wasm-ld will fail) - Add wasm outputs to .gitigore --- .gitignore | 6 ++++++ examples/Makefile | 2 +- examples/shapes/resources/.gitignore | 0 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 examples/shapes/resources/.gitignore diff --git a/.gitignore b/.gitignore index 9153a03ea..00c9bdcec 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,12 @@ packages/ *.bc *.so +# Ignore wasm data in examples/ +examples/**/*.wasm +examples/**/*.data +examples/**/*.js +examples/**/*.html + # Ignore files build by xcode *.mode*v* *.pbxuser diff --git a/examples/Makefile b/examples/Makefile index bded27e53..5abf0c708 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -244,7 +244,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB) # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --preload-file resources # specify a resources folder for data compilation # --source-map-base # allow debugging in browser with source map - CFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 $(dir $<)resources@resources + CFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file $(dir $<)resources@resources # NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way, # we can compile same code for ALL platforms with no change required, but, working on bigger diff --git a/examples/shapes/resources/.gitignore b/examples/shapes/resources/.gitignore new file mode 100644 index 000000000..e69de29bb