From 8d45f81046a159df38e20b00cf0d74b1bb02a073 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 15 Feb 2015 17:14:09 +0100 Subject: [PATCH] More emcc stuff --- Makefile | 5 ++++- kernel/yosys.cc | 13 ++++++++++--- misc/yosys.html | 38 +++++++++++++++++++++++++------------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 775fce1ad..c762bd38c 100644 --- a/Makefile +++ b/Makefile @@ -95,10 +95,11 @@ CXXFLAGS += -std=gnu++0x -Os else ifeq ($(CONFIG),emcc) CXX = emcc -CXXFLAGS := -std=c++11 $(filter-out -fPIC,$(filter-out -ggdb,$(CXXFLAGS))) +CXXFLAGS := -std=c++11 $(filter-out -fPIC -ggdb,$(CXXFLAGS)) EMCCFLAGS := -Os -Wno-warn-absolute-paths EMCCFLAGS += --memory-init-file 0 -s NO_EXIT_RUNTIME=1 EMCCFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt']" +EMCCFLAGS += --embed-file share # https://github.com/kripken/emscripten/blob/master/src/settings.js # EMCCFLAGS += -s ALLOW_MEMORY_GROWTH=1 # EMCCFLAGS += -s DISABLE_EXCEPTION_CATCHING=0 @@ -111,7 +112,9 @@ LDFLAGS += $(EMCCFLAGS) LDLIBS = EXE = .js +TARGETS := $(filter-out yosys-config,$(TARGETS)) EXTRA_TARGETS += yosys.html + yosys.html: misc/yosys.html $(P) cp misc/yosys.html yosys.html diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 530d78796..b54836621 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -619,26 +619,33 @@ std::string proc_self_dirname() #error Dont know how to determine process executable base path! #endif +#ifdef EMSCRIPTEN +std::string proc_share_dirname() +{ + return "/share"; +} +#else std::string proc_share_dirname() { std::string proc_self_path = proc_self_dirname(); -#ifdef _WIN32 +# ifdef _WIN32 std::string proc_share_path = proc_self_path + "share\\"; if (check_file_exists(proc_share_path, true)) return proc_share_path; proc_share_path = proc_self_path + "..\\share\\"; if (check_file_exists(proc_share_path, true)) return proc_share_path; -#else +# else std::string proc_share_path = proc_self_path + "share/"; if (check_file_exists(proc_share_path, true)) return proc_share_path; proc_share_path = proc_self_path + "../share/yosys/"; if (check_file_exists(proc_share_path, true)) return proc_share_path; -#endif +# endif log_error("proc_share_dirname: unable to determine share/ directory!\n"); } +#endif bool fgetline(FILE *f, std::string &buffer) { diff --git a/misc/yosys.html b/misc/yosys.html index 929d0dd3b..29d89e6fe 100644 --- a/misc/yosys.html +++ b/misc/yosys.html @@ -4,18 +4,18 @@

yosys.js example application


Loading...
- +