nvp gen-cert rootA rootA.cnf nvp gen-cert clientA clientA.cnf -r rootA nvp gen-cert serverA serverA.cnf -r rootA
self.easy = curl.easy_init() __luna.set_gc_callback(self.easy, function(obj) logDEBUG("Releasing curl easy object.") curl.easy_cleanup(obj) logDEBUG("Done releasing curl object.") end)
self.req:set_opt(curl.option.SSL_VERIFYPEER, false)
self.req:set_opt(curl.option.CAINFO, self:getPath(nvland:getAppDir(), "assets", "certs", "cacert-2023-01-10.pem"))
Ignoring TypeAliasTemplateDecl cursor for base template class: nv::Vector<T>
function Class:setName(name) if name ~= self._name then -- Check if we had a type for the previous name: local luna = import "bind.LunaManager" local t = luna.tm:getType(self._name) -- self._fullNames = {} self._name = name if t then t:addName(name) -- logDEBUG("==> Added name ", name, " to type ", t:getNames()) end end end
self:writeLine("%s res = (%s)%s%s;", rtype:getName(), rtype:getName(), funcName, callstr)
if defName ~= baseName and not defName:startsWith("luna_anonymous") and defName:len() <= baseName:len() then -- logDEBUG("Replacing baseName: ", baseName, " with default name: ", defName) baseName = defName end
function Class:_addName(name) if luna:isPreferredName(name) or #self._names == 0 or name:len() < self._names[1] then -- add this as the first name for this type: table.insert(self._names, 1, name) else -- Add this name at the end of the list: table.insert(self._names, name) end self._nameMap[name] = true end
cfg.preferredNames = { "nv::U8", "nv::I8", "nv::U16", "nv::I16", "nv::U32", "nv::I32", "nv::U64", "nv::I64", }
QEventManager
and QEventHandler
nv::RefValue<T>
in the processnv_base_types.inl
to simplify procedural types definitionslogDEBUG("ClassWriter detected templated class: ", tplcl, " with args: ", args) -- Find what are the best argument names: local bestArgs = {} for _, arg in ipairs(args) do -- We really expect to have a type for this arg or it could be a number, or a bool ? local t = luna.tm:getType(arg) if t then local tname = t:getName() if tname ~= arg then nvDEBUG("=> Renaming template argument from '%s' to '%s'", arg, tname) arg = tname end end table.insert(bestArgs, arg) end
ClangParser:getOrCreateClassTemplate()
methodQFlags::enum_type
type, ignoring invalid template dependent type names: -- Check if the reported name is some kind of template dependent name, local parts = putils.split(fname, "::") table.remove(parts) local pname = table.concat(parts, "::") local tplcl = luna:getClassTemplateByName(pname) if tplcl then logWARN("Ignoring invalid template dependant typedef name: ", fname) else -- CHECK(fname ~= "QFlags::enum_type", "Detected invalid type name.") rtype:addName(fname) end
nv::RefVector<T>
template class.nv::Vector<nv::RefString> shaderEntrypoints;
RefValPusher
: template <typename T, bool copy = false> struct RefValPusher { static void push(lua_State* L, RefValue<T>* val) { luna::LunaPusher<T>::pushValue(L, val->get()); } }; template <typename T> struct RefValPusher<T, true> { static void push(lua_State* L, RefValue<T>* val) { T* obj = new T(val->get()); // Note: not using LunaPusher since we would not perform gc with it. // luna::LunaPusher<T*>::pushValue(L, obj); luna::Luna<T>::push(L, obj, true); } }; template <> struct RefValPusher<nv::String, true> { static void push(lua_State* L, RefValue<nv::String>* val) { nv::String& str = val->get(); lua_pushlstring(L, str.data(), str.size()); } };
QEventManager::trigger(…)
QEventManager::call_function()
(now working with simple types)QEventManager::trigger()
(now working with simple types)nvl
tablenvl.Context
and preparing nvl.Component
supportget_cwd
and get_home_dir
in nvCorenv::Any
to also store the type of the value contained in the std::any (as a StringID)DataMap
to AnyMap
AnyList
class)XXXList
and RefXXXList
typedefs to XXXVector and XXXRefVector respectively.AnyList
classAnyMapVector
and AnyListVector
AnyMap
)get
request handling in RequestManager (equivalent of make_get_request
in python)AnyMap
git clone https://github.com/emscripten-core/emsdk.git
emsdk_manager
: OKif self.compiler.is_emcc(): self.patch_file( self.get_path(build_dir, "CMakeLists.txt"), "set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)", "set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z)\nset_target_properties(zlib PROPERTIES OUTPUT_NAME zdyn)", ) self.run_emcmake(build_dir, prefix, ".") self.run_ninja(build_dir)
if self.compiler.is_emcc(): self.run_emcmake(build_dir, prefix, ".", generator="Unix Makefiles") self.run_make(build_dir)
def __init__(self, bman: BuildManager, desc=None): """Initialize this builder""" self.ctx = bman.ctx self.man = bman self.compiler = bman.compiler self.env = None self.tools = self.ctx.get_component("tools") desc = desc or {} deftools = ["ninja", "make"] if self.is_windows else ["ninja"] self.tool_envs = desc.get("tool_envs", deftools)
if self.compiler.is_emcc(): self.run_emcmake(build_dir, prefix, ".", generator="MinGW Makefiles") self.exec_emmake(build_dir) self.exec_emmake(build_dir, ["make", "install"])
def run_make(self, build_dir, **kwargs): """Execute the standard make build/install commands""" cmd = ["make"] if self.compiler.is_emcc(): ext = ".bat" if self.is_windows else "" folder = self.compiler.get_cxx_dir() emmake_path = self.get_path(folder, f"emmake{ext}") cmd = [emmake_path] + cmd self.check_execute(cmd, cwd=build_dir, env=self.env, **kwargs) self.check_execute(cmd + ["install"], cwd=build_dir, env=self.env, **kwargs)
self.run_cmake(build_dir, prefix, ".", generator="MinGW Makefiles") self.run_make(build_dir)
if self.compiler.is_emcc(): flags = ["no-asm", "no-shared", "no-hw", "no-engine"] self.run_configure(build_dir, prefix, flags=flags, configure_name="config") # Fixing this line in makefile: # CROSS_COMPILE=/mnt/data1/dev/projects/NervProj/tools/linux/emsdk-git/upstream/emscripten/em em_path = self.get_path(self.compiler.get_cxx_dir(), "em") self.patch_file(self.get_path(build_dir, "Makefile"), f"CROSS_COMPILE={em_path}", "CROSS_COMPILE=") self.exec_make(build_dir) self.exec_make(build_dir, ["install_sw"])
flags = [] if self.compiler.is_emcc(): flags = ["-DBUILD_SHARED_LIBS=OFF"] self.run_cmake(build_dir, prefix, ".", flags=flags) self.run_ninja(build_dir)
PNG_SHARED=OFF
def build_with_emcc_win(self, build_dir, prefix, _desc): """Build with emcc on windows""" # Building with emcc: # get the host path for QT: host_path = prefix.replace("windows_emcc", "windows_clang") logger.info("QT host path is: %s", host_path) self.check(self.dir_exists(host_path), "QT host path must exists.") # self.env["QT_HOST_PATH"]=host_path args = f"-qt-host-path {host_path} -platform wasm-emscripten -opensource" args += " -confirm-license -no-warnings-are-errors -feature-thread -static" args += " -skip qtwebengine -skip qtquick3d -skip qtquick3dphysics" em_dir = self.compiler.get_cxx_dir() cmake_args = f"-DCMAKE_TOOLCHAIN_FILE={em_dir}/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_SUPPRESS_DEVELOPER_WARNINGS=1" self.generate_qt_config(build_dir, prefix, args, cmake_args) cmd = [ self.tools.get_cmake_path(), "-DOPTFILE=config.opt", "-DTOP_LEVEL=TRUE", "-P", f"{build_dir}/qtbase/cmake/QtProcessConfigureArgs.cmake", "-Wno-dev", ] # let's run the configure.bat file: perl_dir = self.tools.get_tool_root_dir("perl") gperf_dir = self.tools.get_tool_dir("gperf") bison_dir = self.tools.get_tool_dir("bison") flex_dir = self.tools.get_tool_dir("flex") # py_dir = self.get_parent_folder(self.tools.get_tool_path("python")) dirs = [ self.get_path(build_dir, "qtbase", "bin"), # py_dir, # nodejs_dir, gperf_dir, bison_dir, flex_dir, self.get_path(perl_dir, "perl", "site", "bin"), self.get_path(perl_dir, "perl", "bin"), self.get_path(perl_dir, "c", "bin"), ] logger.info("Adding additional paths: %s", dirs) self.env = self.append_env_list(dirs, self.env) logger.info("Post config command: %s", cmd) self.check_execute(cmd, cwd=build_dir, env=self.env) # Building the library now: logger.info("Building QT6 libraries...") # cmd = [self.tools.get_cmake_path(), "--build", ".", "-t", "qtbase", "-t", "qtdeclarative"] cmd = [self.tools.get_cmake_path(), "--build", ".", "--parallel"] logger.info("cmake command: %s", cmd) self.check_execute(cmd, cwd=build_dir, env=self.env) logger.info("Installing QT6 libraries...") cmd = [self.tools.get_cmake_path(), "--install", "."] self.check_execute(cmd, cwd=build_dir, env=self.env) logger.info("Done building QT6 with emcc.") return
if self.compiler.is_emcc(): # Compile for emscripten: # Should run the command: # make HOST_CC="emcc" BUILDMODE=static self.execute( ["make", "install", f"PREFIX={prefix}", "HOST_CC=emcc", "BUILDMODE=static"], cwd=build_dir, env=self.env)
if(NV_STATIC_BUILD OR IS_EMSCRIPTEN) add_subdirectory(static) else() add_subdirectory(shared) endif()
void lock() noexcept { for (;;) { // Optimistically assume the lock is free on the first try if (!lock_.exchange(true, std::memory_order_acquire)) { return; } #ifndef __EMSCRIPTEN__ // Wait for lock to be released without generating cache misses while (lock_.load(std::memory_order_relaxed)) { // Issue X86 PAUSE or ARM YIELD instruction to reduce contention // between hyper-threads #if defined(_MSC_VER) _mm_pause(); #else __builtin_ia32_pause(); #endif } #endif } }
#ifndef __EMSCRIPTEN__ static_assert(sizeof(size_t) == 8, "Invalid size_t type"); #endif
if(IS_EMSCRIPTEN) install( FILES "$<TARGET_FILE_DIR:${TARGET_NAME}>/${TARGET_NAME}.js" "$<TARGET_FILE_DIR:${TARGET_NAME}>/${TARGET_NAME}.wasm" "$<TARGET_FILE_DIR:${TARGET_NAME}>/${TARGET_NAME}.html" DESTINATION ${TARGET_DIR}) else() install( TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${TARGET_DIR} LIBRARY DESTINATION ${TARGET_DIR}) endif()
if(IS_EMSCRIPTEN) set(assetFiles "config.yml") # Generate the command line that must be passed to emcc linker to produce the # given asset list. set(assertSourceDir ${CMAKE_INSTALL_PREFIX}) # set(assetBundleCmdLine "--use_preload_cache --no-heap-copy") set(assetBundleCmdLine "--no-heap-copy") foreach(assetFile ${assetFiles}) message( STATUS "Asset path '${assertSourceDir}/${assetFile}@/nvapp/${assetFile}'") set(assetBundleCmdLine "${assetBundleCmdLine} --preload-file \"${assertSourceDir}/${assetFile}@/nvapp/${assetFile}\" " ) endforeach() # Use a response file to store all the --preload-file directives so that # windows max cmdline length limit won't be hit (there can be a lot of them!) file(WRITE "${CMAKE_BINARY_DIR}/${TARGET_NAME}_emcc_preload_file.rsp" "${assetBundleCmdLine}") set(linkFlags "${linkFlags} \"@${CMAKE_BINARY_DIR}/${TARGET_NAME}_emcc_preload_file.rsp\"" ) set(linkFlags "${linkFlags} -s WASM=1 -O3 -s ALLOW_MEMORY_GROWTH=1") # cf. https://github.com/emscripten-core/emscripten/issues/5414 -s # SAFE_HEAP=1 --bind -o ../index.js -s LEGACY_GL_EMULATION=0 -s # GL_UNSAFE_OPTS=0 --pre-js pre-module.js --post-js post-module.js -s # ASSERTIONS=1 -s GL_ASSERTIONS=1 -s INVOKE_RUN=0 -std=c++11 -s USE_WEBGL2=1 # -s FULL_ES3=1 -s USE_GLFW=3 -s OFFSCREENCANVAS_SUPPORT=1 --preload-file # shaders --preload-file extern --use-preload-plugins" set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "${linkFlags}") endif()
set(QT_LIBS qwasm Qt6Gui Qt6Widgets Qt6OpenGLWidgets Qt6OpenGL Qt6Core Qt6Multimedia Qt6WebSockets Qt6BundledHarfbuzz Qt6BundledFreetype Qt6BundledLibpng Qt6BundledLibjpeg Qt6BundledPcre2 Qt6BundledZLIB)
# also link the missing QT object files: set(QT_OBJECTS "${QT6_DIR}/lib/objects-Release/Widgets_resources_1/.rcc/qrc_qstyle.cpp.o" "${QT6_DIR}/lib/objects-Release/Widgets_resources_2/.rcc/qrc_qstyle1.cpp.o" "${QT6_DIR}/lib/objects-Release/Widgets_resources_3/.rcc/qrc_qmessagebox.cpp.o" )
Uncaught ReferenceError: SharedArrayBuffer is not defined
containers/nginx_server/config/sites/main_site
): # Add COOP and COEP headers add_header Cross-Origin-Opener-Policy same-origin; add_header Cross-Origin-Embedder-Policy require-corp;
$ docker-compose down docker-compose up -d
Cross-Origin-Opener-Policy header has been ignored, because the URL's origin was untrustworthy. It was defined either in the final response or a redirect. Please deliver the response using the HTTPS protocol. You can also use the 'localhost' origin instead. See https://www.w3.org/TR/powerful-features/#potentially-trustworthy-origin and https://html.spec.whatwg.org/#the-cross-origin-opener-policy-header. caught ReferenceError: SharedArrayBuffer is not defined
@APP_NAME@
value in wasm_shell.html, and then trying to load https://nervtech.org/test/wasm_shell.html, But we get yet another error:set_target_properties(Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "cxx_std_17" INTERFACE_COMPILE_OPTIONS "SHELL:-pthread" INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/mkspecs/wasm-emscripten;${_IMPORT_PREFIX}/include" INTERFACE_LINK_LIBRARIES "embind;Threads::Threads" INTERFACE_LINK_OPTIONS "SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=1;SHELL:-s MAX_WEBGL_VERSION=2;SHELL:-s FETCH=1;SHELL:-s WASM_BIGINT=1;SHELL:-s MODULARIZE=1;SHELL:-s EXPORT_NAME=createQtAppInstance;SHELL:-s DISABLE_EXCEPTION_CATCHING=1;SHELL:-pthread;\$<\$<CONFIG:Debug>:;SHELL:-s DEMANGLE_SUPPORT=1;SHELL:-s GL_DEBUG=1;--profiling-funcs>;SHELL:-sASYNCIFY_IMPORTS=qt_asyncify_suspend_js,qt_asyncify_resume_js" _qt_package_version "6.4.2" )
set(linkFlags "${linkFlags} -s FETCH=1 -s WASM_BIGINT=1 -s MODULARIZE=1 -s EXPORT_NAME=createQtAppInstance" )
set(linkFlags "${linkFlags} -s FETCH=1 -s WASM_BIGINT=1 -s MODULARIZE=1 -s EXPORT_NAME=createQtAppInstance -s EXPORTED_RUNTIME_METHODS=UTF16ToString,stringToUTF16" )
-s INITIAL_MEMORY=1GB
)-s NO_RUNTIME_EXIT=1
, but then… Victory!! My empty QT window is finally displayed properly in the browser 🥳! (that's just an empty grey screen but that's really all I was expecting here 😄)set(QT_OBJECTS "${QT6_DIR}/lib/objects-Release/Widgets_resources_1/.rcc/qrc_qstyle.cpp.o" "${QT6_DIR}/lib/objects-Release/Widgets_resources_2/.rcc/qrc_qstyle1.cpp.o" "${QT6_DIR}/lib/objects-Release/Widgets_resources_3/.rcc/qrc_qmessagebox.cpp.o" "${QT6_DIR}/plugins/platforms/objects-Release/QWasmIntegrationPlugin_init/QWasmIntegrationPlugin_init.cpp.o" "${QT6_DIR}/lib/objects-Release/QWasmIntegrationPlugin_resources_1/.rcc/qrc_wasmfonts.cpp.o" )
# Iterate on each file to check if it's already installed or not: for src_file, dst_locs in file_map.items(): # dst_locs could be a simple string or a list, we convert this to a list anyway: if isinstance(dst_locs, str): dst_locs = [dst_locs] # We should iterate on each target location: for dst_loc in dst_locs: # if the dst_loc ends with a "/" character, it means we want to use the source file name: if dst_loc[-1] == "/": fname = self.get_filename(src_file) dst_file = self.get_path(dst_loc[:-1], fname) else: dst_file = dst_loc src_path = self.get_path(root_dir, src_file) dst_path = self.get_path(install_dir, dst_file) copy_needed = False if self.file_exists(dst_path): # Check if the hash will match: hash1 = self.compute_file_hash(src_path) hash2 = self.compute_file_hash(dst_path) if hash1 != hash2: logger.info("Updating dep module %s...", dst_file) self.remove_file(dst_path) copy_needed = True else: # The destination file doesn't exist yet, we simply install it: logger.info("Installing dep module %s...", dst_file) copy_needed = True if copy_needed: # Check that the source file exists: self.check(self.file_exists(src_path), "Invalid source file: %s", src_path) folder = self.get_parent_folder(dst_path) self.make_folder(folder) self.copy_file(src_path, dst_path)
wasm-ld: error: --shared-memory is disallowed by memory.cpp.o because it was not compiled with 'atomics' or 'bulk-memory' features.
if self.compiler.is_emcc(): ext = ".bat" if self.is_windows else "" folder = self.compiler.get_cxx_dir() emcmake_path = self.get_path(folder, f"emcmake{ext}") cmd = [emcmake_path] + cmd # add -pthread for CXX compilation: cmd += ['-DCMAKE_CXX_FLAGS="-pthread"']
nvp build libs yamlcpp -c emcc --rebuild
auto create_icon(const char* name) -> QIcon* { // Get the application root path: const auto& root_path = NervApp::instance().get_root_path(); auto fname = format_string("%s.png", name); return new QIcon(get_path(root_path, "assets", "icons", fname).c_str()); }
def serve_directory(self, root_dir, port): """Serve a given directory""" logger.info("Serving directory %s...", root_dir) os.chdir(root_dir) # change the current working directory to the folder to serve class MyRequestHandler(http.server.SimpleHTTPRequestHandler): """Simple request handler""" def __init__(self, *args, **kwargs): """Constructor""" super().__init__(*args, directory=root_dir, **kwargs) httpd = http.server.HTTPServer(("localhost", port), MyRequestHandler) httpd.serve_forever() logger.info("Done serving directory.")
gen_ssl_cert: notify: false cmd: $[TOOL_PATH:openssl] req -new -x509 -days 3650 -nodes -out server.pem -keyout server.key linux_env_vars: LD_LIBRARY_PATH: $[TOOL_DIR:openssl]/lib64
def gen_ssl_cert(self): "Generate the ssl certificate if needed" cert_dir = self.get_path(self.ctx.get_root_dir(), "data", "certs") self.make_folder(cert_dir) pem_file = self.get_path(cert_dir, "localhost.pem") if not self.file_exists(pem_file): logger.info("Generating self-signed SSL certificate for localhost...") tools = self.get_component("tools") openssl_path = tools.get_tool_path("openssl") cmd = ( "req -new -x509 -days 3650 -nodes -out localhost.pem -keyout localhost.key -subj /CN=localhost".split() ) cmd = [openssl_path] + cmd self.execute(cmd, cwd=cert_dir) self.check(self.file_exists(pem_file), "Invalid %s file", pem_file) key_file = self.get_path(cert_dir, "localhost.key") return pem_file, key_file
# Add the ssl layer: pem_file, key_file = self.gen_ssl_cert() cert = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) cert.load_cert_chain(pem_file, key_file) # wrap the server socket with SSL and start the server httpd.socket = cert.wrap_socket(httpd.socket, server_side=True) logger.info("Serving at https://localhost:%d/%s", port, index_file)
def generate_certificate(self, cname, common_name, root_cert=None): """Generate an SSL certificate""" tools = self.get_component("tools") openssl = tools.get_tool_path("openssl") if common_name is None: common_name = cname # Write the config file: tpl_file = "ssl_root.cnf" if root_cert is None else "ssl_client.cnf" tpl_file = self.get_path(self.ctx.get_root_dir(), "assets", "templates", tpl_file) content = self.read_text_file(tpl_file) content = self.fill_placeholders(content, {"${COMMON_NAME}": common_name}) if self.file_exists("config.cnf"): self.remove_file("config.cnf") self.write_text_file(content, "config.cnf") if root_cert is None: # Generate a root certificate: cmd1 = f"req -newkey rsa:2048 -sha256 -keyout {cname}_key.crt -out {cname}_req.crt -nodes -config ./config.cnf -batch" cmd2 = f"x509 -req -in {cname}_req.crt -sha256 -extfile ./config.cnf -extensions v3_ca -signkey {cname}_key.crt -out {cname}.crt -days 3650" cmd3 = f"x509 -subject -issuer -noout -in {cname}.crt" else: # Generate a non-root certificate: cmd1 = f"req -newkey rsa:2048 -sha256 -keyout {cname}_key.crt -out {cname}_req.crt -nodes -config ./config.cnf -batch" cmd2 = f"x509 -req -in {cname}_req.crt -sha256 -extfile ./config.cnf -extensions usr_cert -CA {root_cert}.crt -CAkey {root_cert}_key.crt -CAcreateserial -out {cname}_cert.crt -days 3650 -passin pass:" cmd3 = f"x509 -subject -issuer -noout -in {cname}.crt" cwd = self.get_cwd() logger.info("CWD: %s", cwd) # self.execute([openssl] + cmd0.split(), cwd=cwd) self.execute([openssl] + cmd1.split(), cwd=cwd) self.execute([openssl] + cmd2.split(), cwd=cwd) if root_cert is not None: # Combine the certificates: content1 = self.read_text_file(f"{cname}_cert.crt") content2 = self.read_text_file(f"{root_cert}.crt") self.write_text_file(content1 + content2, f"{cname}.crt") self.execute([openssl] + cmd3.split(), cwd=cwd)
nvp gen-cert NervTechCA nvp gen-cert nervtech.local -r NervTechCA --name nervtech.local
[ usr_cert ] subjectAltName = @alt_names [alt_names] DNS.1 = ${COMMON_NAME} DNS.2 = localhost IP.1 = 127.0.0.1
class MyRequestHandler(http.server.SimpleHTTPRequestHandler): """Simple request handler""" def __init__(self, *args, **kwargs): """Constructor""" super().__init__(*args, directory=root_dir, **kwargs) def end_headers(self): self.send_my_headers() http.server.SimpleHTTPRequestHandler.end_headers(self) def send_my_headers(self): """Senf my headers""" self.send_header("Cross-Origin-Opener-Policy", "same-origin") self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
firefox_path = os.getenv("FIREFOX_PATH") if firefox_path is not None: cmd = [firefox_path, url] def run_server(): """Run the server""" logger.info("Running server...") try: httpd.serve_forever() except KeyboardInterrupt: logger.info("HTTPS server interrupted.") logger.info("Done with HTTPS server thread.") thread = threading.Thread(target=run_server) thread.start() self.execute(cmd, shell=True) logger.info("Stopping HTTPS server...") httpd.shutdown() thread.join() else: # Just run the server with no thread: httpd.serve_forever() logger.info("Done serving directory.")
auto* menu = mbar->addMenu("&File"); auto* act = new QAction(create_icon("folder-open-document"), "Open file...", this);
if(IS_EMSCRIPTEN) set(assetFiles "config.yml" "assets/icons/folder-open-document.png") setup_emscripten_qt_target(${TARGET_NAME} assetFiles ${TARGET_DIR})
void MainWindow::build_dock_widgets() { auto* consoleDock = new DockWidget("Console"); _consolePanel = new ConsolePanel(); consoleDock->setWidget(_consolePanel); consoleDock->setAllowedAreas(Qt::AllDockWidgetAreas); #ifdef __EMSCRIPTEN__ // Disabling floating: consoleDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable); #endif addDockWidget(Qt::BottomDockWidgetArea, consoleDock); setDockOptions(QMainWindow::GroupedDragging | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks); setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); }
class ConsoleLogSink : public nv::LogSink { public: explicit ConsoleLogSink(ConsolePanel* console) : _console(console){}; void output(int level, const char* prefix, const char* msg, size_t size) override; private: ConsolePanel* _console{nullptr}; }; void ConsoleLogSink::output(int /*level*/, const char* prefix, const char* msg, size_t size) { String str(msg, size); str = prefix + str; _console->write_text(str.c_str()); }
auto* menu = mbar->addMenu("&File"); auto* act = new QAction(create_icon("folder-open-document"), "Open file...", this); QObject::connect(act, &QAction::triggered, [](bool /*checked*/) { logINFO("Handling open file event."); });
// Get a price for bitcoin: String endpoint = "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT"; auto* rman = RequestManager::instance(); auto resp = rman->get(endpoint.c_str()); if (resp->is_ok()) { logDEBUG("Got response: {}", resp->text()); } else { logWARN("Invalid response from binance."); }/
wasm-ld: error: --shared-memory is disallowed by easy.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.
// Get a price for bitcoin: String endpoint = "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT"; auto* rman = RequestManager::instance(); // perform an async get: rman->get_async(endpoint.c_str(), [](const RefPtr<RequestResponse>& resp) { if (resp->is_ok()) { logDEBUG("Got response: {}", resp->text()); } else { logWARN("Invalid response from binance."); } });
- name: depot_tools version: git sub_tools: gclient: gclient.bat fetch: fetch.bat sub_path: gclient.bat urls: http://files.nervtech.org/nvp_packages/tools/depot_tools-git-20230508-windows.7z # git: https://chromium.googlesource.com/chromium/tools/depot_tools.git
def build_git_tool_package(self, full_name, desc): """Retrieve a tool package from git""" # Prepare installation dir: dest_dir = self.get_path(self.tools_dir, full_name) # Get the git component: git = self.get_component("git") self.check(not self.dir_exists(dest_dir), "Directory %s already exists", dest_dir) # if not self.dir_exists(dest_dir): # Request the cloning: git_url = desc["git"] git.clone_repository(git_url, dest_dir) # Prepare the current date: date_str = datetime.now().strftime("%Y%m%d") # Build the package for this tool ? ext = ".7z" if self.is_windows else ".tar.xz" pkgname = f"{full_name}-{date_str}-{self.platform}{ext}" self.create_package(dest_dir, self.tools_dir, pkgname)
def build_on_windows(self, build_dir, prefix, _desc): """Build method for dawn on windows""" # Bootstrap the gclient configuration # cp scripts/standalone.gclient .gclient self.copy_file(self.get_path(build_dir, "scripts", "standalone.gclient"), self.get_path(build_dir, ".gclient")) gclient_path = self.tools.get_tool_path("gclient") # Should also add the depot_tools folder in the PATH: depot_dir = self.tools.get_tool_dir("gclient") logger.info("Depot_tools dir: %s", depot_dir) git_dir = self.tools.get_tool_path("git") # Also add path to powershell: paths = [depot_dir, git_dir, "C:\\Windows\\System32\\WindowsPowerShell\\v1.0"] self.prepend_env_list(paths, self.env) # Fetch external dependencies and toolchains with gclient # gclient sync cmd = [gclient_path, "sync"] self.execute(cmd, cwd=build_dir, env=self.env) # Run cmake: flags = ["-S", ".", "-B", "release_build"] self.run_cmake(build_dir, prefix, flags=flags) sub_dir = self.get_path(build_dir, "release_build") self.run_ninja(sub_dir)
Updating depot_tools... ________ running 'python3 build/vs_toolchain.py update --force' in 'D:\Projects\NervProj\build\libraries\dawn-git-20230508\.'
D:\Projects\NervProj\build\libraries>cd dawn-git-20230508 D:\Projects\NervProj\build\libraries\dawn-git-20230508>set PATH=D:\Projects\NervProj\tools\windows\depot_tools-git;%PATH% D:\Projects\NervProj\build\libraries\dawn-git-20230508>gclient.bat sync Updating depot_tools... Syncing projects: 100% (33/33), done. ________ running 'python3 build/vs_toolchain.py update --force' in 'D:\Projects\NervProj\build\libraries\dawn-git-20230508\.' ServiceException: 401 Anonymous caller does not have storage.objects.list access to the Google Cloud Storage bucket. Permission 'storage.objects.list' denied on resource (or it may not exist). No downloadable toolchain found. In order to use your locally installed version of Visual Studio to build Chrome please set DEPOT_TOOLS_WIN_TOOLCHAIN=0. For details search for DEPOT_TOOLS_WIN_TOOLCHAIN in the instructions at https://chromium.googlesource.com/chromium/src/+/HEAD/docs/windows_build_instructions.md
D:\Projects\NervProj\build\libraries\dawn-git-20230508>gclient.bat sync Updating depot_tools... Syncing projects: 100% (33/33), done. ________ running 'python3 tools/clang/scripts/update.py' in 'D:\Projects\NervProj\build\libraries\dawn-git-20230508\.' Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Win/clang-llvmorg-17-init-2082-g6d4a674a-1.tar.xz .......... Done. Hook 'python3 tools/clang/scripts/update.py' took 43.63 secs Running hooks: 40% ( 8/20) rc_win ________ running 'download_from_google_storage --no_resume --no_auth --bucket chromium-browser-clang/rc -s build/toolchain/win/rc/win/rc.exe.sha1' in 'D:\Projects\NervProj\build\libraries\dawn-git-20230508\.' 0> Downloading build/toolchain/win/rc/win/rc.exe@7d3a485bb5bae0cf3c6b8af95d21f36aa7d02832... Downloading 1 files took 2.396495 second(s) Running hooks: 50% (10/20) clang_format_win ________ running 'download_from_google_storage --no_resume --no_auth --bucket chromium-clang-format -s buildtools/win/clang-format.exe.sha1' in 'D:\Projects\NervProj\build\libraries\dawn-git-20230508\.' 0> Downloading buildtools/win/clang-format.exe@d88796ff22d70c7d5ede62636daa220ccd238f06... Downloading 1 files took 5.122753 second(s) Running hooks: 100% (20/20), done. D:\Projects\NervProj\build\libraries\dawn-git-20230508>
# logger.info("Installing dawn libraries...") def install_files(src_folder, exp, dst_folder, hint, **kwargs): # Get all the dawn libs: base_dir = kwargs.get("src_dir", sub_dir) flatten = kwargs.get("flatten", True) excluded = kwargs.get("excluded", []) src_dir = self.get_path(base_dir, src_folder) all_files = self.get_all_files(src_dir, exp=exp, recursive=True) dst_dir = self.get_path(prefix, dst_folder) self.make_folder(dst_dir) # copy the dawn libraries: for elem in all_files: ignored = False for pat in excluded: if re.search(pat, elem) is not None: ignored = True break if ignored: logger.info("Ignoring element %s", elem) continue logger.info("Installing %s %s", hint, elem) src = self.get_path(src_dir, elem) dst_file = self.get_filename(src) if flatten else elem dst = self.get_path(dst_dir, dst_file) pdir = self.get_parent_folder(dst) self.make_folder(pdir) self.check(not self.file_exists(dst), "File %s already exists.", dst) self.copy_file(src, dst) install_files("src/dawn", r"\.lib$", "lib", "library") install_files("src/tint", r"\.lib$", "lib", "library") install_files("gen/include/dawn", r"\.h$", "include/dawn", "header") install_files("include", r"\.h$", "include", "header", src_dir=build_dir, flatten=False) install_files(".", r"\.exe$", "bin", "app", excluded=["CMake", "unittests"])
inline void set(const Mat4& rhs, bool transpose = false) { if (transpose) { // copy rhs with transposition at the same time: for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { _mat[i][j] = rhs._mat[j][i]; } } } else { set(rhs.ptr()); } }
pipeline = eng->build_render_pipeline(vs, fs);
rnode->add_drawable("tests/cube", 0);
logDEBUG("Creating uniform buffers..."); cam_ubo = eng->create_buffer(udata, BufferUsage::Uniform);
// Render a cube: WGPURenderNode rnode(std_vfmt_ipnu, "tests/textured_cube_3d"); rnode .define_grp(defUBOs("camera", "frame_context"), def3dSampler(false), defFrag3dTex(false)) .add_bind_grp(0, bindUBOs("camera", "frame_context"), BindNearestSampler, tex) .add_drawable("tests/cube", 0); rpass.add_bundle(rnode);/