Petr
Petr

Reputation: 14505

How to link 3rd party libraries into Qt project that is targetted for WebAssembly (Wasm)

I have a large C++/Qt project that uses CMake to build, which is not supported by Qt when targetting into Wasm https://wiki.qt.io/Qt_for_WebAssembly (only qmake is supported now).

This project is depending on multiple 3rd party libraries, most notably yaml-cpp, which also uses cmake.

I can create a Qt project file for this, instead of using CMake, but it will cover only my application and not 3rd party libraries using CMake. If I was targetting some more common platform, like Linux or Windows, I suppose I could just compile the 3rd party libraries as dynamic libraries (.so or .dll) and then link my application to them, but I have no idea how to do this in Wasm world.

Is there a way to link or embed a 3rd library into output Wasm binary? I suppose I would have to compile yaml-cpp into Wasm itself and then link these 2 Wasm objects together in some way?

Did anyone ever succeeded in this? Is it even possible yet?

Upvotes: 1

Views: 715

Answers (1)

timday
timday

Reputation: 24892

My understanding is you would have to compile those third party libraries for wasm too. Browsers can safely execute wasm in a nice safe sandbox, but allowing execution of arbitrary code in DLLs would completely break that security.

Upvotes: 0

Related Questions