Update emsdk version, and enable multithreading on web
This commit is contained in:
parent
216469fab0
commit
435ee25848
6 changed files with 25 additions and 15 deletions
|
|
@ -23,7 +23,6 @@ option(USE_THREADSAN "Enable Thread Sanitizer" OFF)
|
|||
option(USE_MEMORYSAN "Enable Memory Sanitizer" OFF)
|
||||
|
||||
option(NO_CONAN_BUILD "Not using conan to get packages" OFF)
|
||||
option(EMSCRIPTEN_SINGLE_HTML_FILE "Building with emscripten generates a single HTML file" OFF)
|
||||
option(CONFIG_NEXT_TO_EXECUTABLE "Place configuration folder next to executable (portable executable)" OFF)
|
||||
option(MACOS_MAKE_BUNDLE "Package the application as a bundle" ON)
|
||||
|
||||
|
|
@ -233,14 +232,9 @@ if(EMSCRIPTEN)
|
|||
target_link_options(infinipaint PRIVATE -O3)
|
||||
endif()
|
||||
|
||||
target_compile_options(infinipaint PRIVATE -Wall -sUSE_HARFBUZZ=1 -fdiagnostics-color -sUSE_SDL=0 -include functional -fexceptions)
|
||||
target_link_options(infinipaint PRIVATE --emrun -sUSE_HARFBUZZ=1 -sUSE_SDL=0 -sFULL_ES2 -sUSE_WEBGL2=1 -sFETCH --embed-file data -sALLOW_MEMORY_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=ccall -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sMAXIMUM_MEMORY=4GB -sSINGLE_FILE -lidbfs.js -sINITIAL_MEMORY=67108864 -fexceptions)
|
||||
if(EMSCRIPTEN_SINGLE_HTML_FILE)
|
||||
target_link_options(infinipaint PRIVATE --shell-file emscripteninstall/singlefilereleaseshell.html)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
else()
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".js")
|
||||
endif()
|
||||
target_compile_options(infinipaint PRIVATE -Wall -sUSE_HARFBUZZ=1 -fdiagnostics-color -sUSE_SDL=0 -include functional -fexceptions -pthread)
|
||||
target_link_options(infinipaint PRIVATE --emrun -sUSE_HARFBUZZ=1 -sUSE_SDL=0 -sFULL_ES2 -sUSE_WEBGL2=1 -sFETCH --embed-file data -sALLOW_MEMORY_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=ccall -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sMAXIMUM_MEMORY=4GB -sSINGLE_FILE -lidbfs.js -fexceptions -pthread) # -sINITIAL_MEMORY=67108864
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".js")
|
||||
message("In Emscripten Mode")
|
||||
endif()
|
||||
|
||||
|
|
@ -326,6 +320,7 @@ endif()
|
|||
|
||||
if(EMSCRIPTEN)
|
||||
add_subdirectory(deps/datachannel-wasm EXCLUDE_FROM_ALL)
|
||||
target_compile_options(datachannel-wasm PRIVATE -pthread)
|
||||
target_link_libraries(infinipaint datachannel-wasm)
|
||||
else()
|
||||
target_link_libraries(infinipaint LibDataChannel::LibDataChannel CURL::libcurl)
|
||||
|
|
|
|||
|
|
@ -707,6 +707,9 @@ class ConanSkia(ConanFile):
|
|||
cflags_c = []
|
||||
cflags_cc = self.conf.get("tools.build:cxxflags", default=[], check_type=list)
|
||||
cflags_cc += [cppstd_flag(self)]
|
||||
if cflags_cc == [None]: # Fail to get c++ flags when using emsdk, so set the flags manually here
|
||||
print("Failed to get C++ build flags, setting flags manually")
|
||||
cflags_cc = ["-pthread"]
|
||||
|
||||
args += f"extra_cflags={json.dumps(cflags)}\n"
|
||||
args += f"extra_cflags_c={json.dumps(cflags_c)}\n"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,19 @@
|
|||
[settings]
|
||||
os=Emscripten
|
||||
arch=wasm
|
||||
compiler=clang
|
||||
compiler.version=15
|
||||
build_type=Release
|
||||
compiler=emcc
|
||||
compiler.cppstd=23
|
||||
compiler.libcxx=libc++
|
||||
build_type=Release
|
||||
# Optional settings to enable multithreading (see note below)
|
||||
compiler.threads=posix
|
||||
compiler.version=4.0.22
|
||||
os=Emscripten
|
||||
|
||||
[tool_requires]
|
||||
emsdk/4.0.22
|
||||
cmake/3.27.0
|
||||
emsdk/3.1.73
|
||||
|
||||
[conf]
|
||||
# Optional settings to enable memory allocation
|
||||
tools.build:exelinkflags=['-sALLOW_MEMORY_GROWTH=1', '-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB', '-pthread']
|
||||
tools.build:sharedlinkflags=['-sALLOW_MEMORY_GROWTH=1', '-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB', '-pthread']
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
#include <memory>
|
||||
#include <functional>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#include <mutex>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "FileDownloader.hpp"
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
std::vector<FileDownloader::DownloadHandler> FileDownloader::currentDownloads;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void ScreenshotTool::gui_toolbox() {
|
|||
if(t.gui.text_button_wide("Take Screenshot", "Take Screenshot")) {
|
||||
controls.selectionMode = 0;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
take_screenshot("a" + controls.typeSelections[controls.selectedType]);
|
||||
take_screenshot("a" + controls.typeSelections[screenshotConfig.selectedType]);
|
||||
#else
|
||||
// We can't actually use the extension from the callback, so we have to set the extension of choice beforehand
|
||||
Toolbar::ExtensionFilter setExtensionFilter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue