From acb2cbf442c98b80ebc99e781fffa12612273521 Mon Sep 17 00:00:00 2001 From: Moros Smith Date: Sun, 18 Aug 2024 10:02:10 -0400 Subject: [PATCH 1/4] add custom emscripten shell file --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1576f00..623753c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,7 +258,8 @@ if (EMSCRIPTEN) -sUSE_LIBPNG=1 -sLLD_REPORT_UNDEFINED) endif() - + + set_target_properties(${OutputExecutable} PROPERTIES LINK_FLAGS "--shell-file ${CMAKE_CURRENT_SOURCE_DIR}/emscripten_shell.html") endif() # Emscripten ###################################################################### From 02dca56ee15d5e96b70afa02e15c2543177d2eda Mon Sep 17 00:00:00 2001 From: Moros Smith Date: Sun, 18 Aug 2024 10:49:35 -0400 Subject: [PATCH 2/4] rename output html file to index.html to ease deployment --- CMakeLists.txt | 14 ++++ emscripten_shell.html | 148 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 emscripten_shell.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 623753c..c42dd86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,6 +260,20 @@ if (EMSCRIPTEN) endif() set_target_properties(${OutputExecutable} PROPERTIES LINK_FLAGS "--shell-file ${CMAKE_CURRENT_SOURCE_DIR}/emscripten_shell.html") + + add_custom_command( + TARGET ${OutputExecutable} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E remove -f ${CMAKE_BINARY_DIR}/bin/index.html + ) + + add_custom_command( + TARGET ${OutputExecutable} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E rename ${CMAKE_BINARY_DIR}/bin/${OutputExecutable}.html ${CMAKE_BINARY_DIR}/bin/index.html + ) endif() # Emscripten ###################################################################### diff --git a/emscripten_shell.html b/emscripten_shell.html new file mode 100644 index 0000000..5c4ff2c --- /dev/null +++ b/emscripten_shell.html @@ -0,0 +1,148 @@ + + + + + + Hamster + + + + +
+ +
+ + + {{{ SCRIPT }}} + + + \ No newline at end of file From 3c75a8db28daf40269b5950dd07da398ed558008 Mon Sep 17 00:00:00 2001 From: Moros Smith Date: Sun, 18 Aug 2024 10:52:52 -0400 Subject: [PATCH 3/4] set working directory to project root --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1576f00..5af694a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,7 +169,7 @@ if(WIN32 AND MSVC) # set working directory for Visual Studio Debugger set_target_properties( ${OutputExecutable} PROPERTIES - VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) # set subsytem, console if HAS_TERMINAL is true. windows if not From 3d95c8b00f1c7742ef61e9de55ebfc0deab32d45 Mon Sep 17 00:00:00 2001 From: Moros Smith Date: Sun, 18 Aug 2024 11:05:00 -0400 Subject: [PATCH 4/4] comment out emscripten SetWindowTitle implementation --- src/olcPixelGameEngine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/olcPixelGameEngine.h b/src/olcPixelGameEngine.h index c7fbb7c..a32c239 100644 --- a/src/olcPixelGameEngine.h +++ b/src/olcPixelGameEngine.h @@ -6568,7 +6568,10 @@ namespace olc virtual olc::rcode SetWindowTitle(const std::string& s) override - { emscripten_set_window_title(s.c_str()); return olc::OK; } + { + // emscripten_set_window_title(s.c_str()); + return olc::OK; + } virtual olc::rcode StartSystemEventLoop() override { return olc::OK; }