diff --git a/profiler/build/wasm/Makefile b/profiler/build/wasm/Makefile new file mode 100644 index 00000000..7f34edf7 --- /dev/null +++ b/profiler/build/wasm/Makefile @@ -0,0 +1,12 @@ +all: release + +debug: + @+make -f debug.mk all + +release: + @+make -f release.mk all + +clean: + @+make -f build.mk clean + +.PHONY: all clean debug release db diff --git a/profiler/build/wasm/build.mk b/profiler/build/wasm/build.mk new file mode 100644 index 00000000..ae172db2 --- /dev/null +++ b/profiler/build/wasm/build.mk @@ -0,0 +1,19 @@ +CC=emcc +CXX=em++ + +CFLAGS += -sUSE_FREETYPE=1 -pthread +CXXFLAGS := $(CFLAGS) -std=c++17 +DEFINES += -DIMGUI_ENABLE_FREETYPE -DIMGUI_IMPL_OPENGL_ES2 +INCLUDES := -I../../../imgui -I$(HOME)/.emscripten_cache/sysroot/include/capstone +LIBS += -lpthread -ldl $(HOME)/.emscripten_cache/sysroot/lib/libcapstone.a -sUSE_GLFW=3 -sTOTAL_MEMORY=512mb -sWASM_BIGINT=1 -sPTHREAD_POOL_SIZE=4 + +PROJECT := Tracy +IMAGE := $(PROJECT)-$(BUILD).html +NO_TBB := 1 + +FILTER := ../../../nfd/nfd_win.cpp +include ../../../common/src-from-vcxproj.mk + +CXXFLAGS += -DTRACY_NO_FILESELECTOR + +include ../../../common/unix.mk diff --git a/profiler/build/wasm/debug.mk b/profiler/build/wasm/debug.mk new file mode 100644 index 00000000..9f09ba3e --- /dev/null +++ b/profiler/build/wasm/debug.mk @@ -0,0 +1,7 @@ +CFLAGS := -g3 -gsource-map -Wall +DEFINES := -DDEBUG +BUILD := debug +LIBS := -sDEMANGLE_SUPPORT=1 + +include ../../../common/unix-debug.mk +include build.mk diff --git a/profiler/build/wasm/httpd.py b/profiler/build/wasm/httpd.py new file mode 100644 index 00000000..15a17ef8 --- /dev/null +++ b/profiler/build/wasm/httpd.py @@ -0,0 +1,17 @@ +from http import server + +class MyHTTPRequestHandler(server.SimpleHTTPRequestHandler): + def end_headers(self): + self.send_my_headers() + server.SimpleHTTPRequestHandler.end_headers(self) + + def send_my_headers(self): + self.send_header("Cache-Control", "no-cache, no-store, must-revalidate") + self.send_header("Pragma", "no-cache") + self.send_header("Expires", "0") + self.send_header("Cross-Origin-Embedder-Policy", "require-corp"); + self.send_header("Cross-Origin-Opener-Policy", "same-origin"); + + +if __name__ == '__main__': + server.test(HandlerClass=MyHTTPRequestHandler) diff --git a/profiler/build/wasm/release.mk b/profiler/build/wasm/release.mk new file mode 100644 index 00000000..2d57ab34 --- /dev/null +++ b/profiler/build/wasm/release.mk @@ -0,0 +1,9 @@ +CFLAGS := -Os +ifndef TRACY_NO_LTO +CFLAGS += -flto +endif +DEFINES := -DNDEBUG +BUILD := release + +include ../../../common/unix-release.mk +include build.mk