diff options
| author | ruki <[email protected]> | 2023-04-01 21:48:12 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-01 21:48:12 +0800 |
| commit | 45495538d52c211c7cacd741f727234b2b920373 (patch) | |
| tree | 6bd8ef9a59f4a10a61c3b474a584a2390079dd1d | |
| parent | 980f79bca1a0fc89ab9f7cb698dcf2e299832a27 (diff) | |
| parent | deb6f50f31462813059fb08ce842a15218bb869f (diff) | |
Merge pull request #3585 from jingkaimori/jingkaimori/qt-wasm-linking
fix linking issues for qt6
| -rw-r--r-- | xmake/rules/qt/load.lua | 7 | ||||
| -rw-r--r-- | xmake/rules/qt/xmake.lua | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua index dcb8343ef..6544d2409 100644 --- a/xmake/rules/qt/load.lua +++ b/xmake/rules/qt/load.lua @@ -94,6 +94,8 @@ function _add_plugins(target, plugins) if plugin.linkdirs then target:values_add("qt.linkdirs", table.unpack(table.wrap(plugin.linkdirs))) end + -- TODO: add prebuilt object files in qt sdk. + -- these file is located at plugins/xxx/objects-Release/xxxPlugin_init/xxxPlugin_init.cpp.o end end @@ -368,6 +370,11 @@ function main(target, opt) _add_includedirs(target, path.join(qt.mkspecsdir, "wasm-emscripten")) target:add("rpathdirs", qt.libdir) target:add("linkdirs", qt.libdir) + -- add prebuilt object files in qt sdk. + -- these file is located at lib/objects-Release/xxxmodule_resources_x/.rcc/xxxmodule.cpp.o + for _, filepath in ipairs(os.files(path.join(qt.libdir, "objects-*", "*_resources_*", ".rcc", "*.o"))) do + table.insert(target:objectfiles(), filepath) + end target:add("ldflags", "-s WASM=1", "-s FETCH=1", "-s FULL_ES2=1", "-s FULL_ES3=1", "-s USE_WEBGL2=1", "--bind") target:add("ldflags", "-s ERROR_ON_UNDEFINED_SYMBOLS=1", "-s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"]", "-s ALLOW_MEMORY_GROWTH=1") target:add("shflags", "-s WASM=1", "-s FETCH=1", "-s FULL_ES2=1", "-s FULL_ES3=1", "-s USE_WEBGL2=1", "--bind") diff --git a/xmake/rules/qt/xmake.lua b/xmake/rules/qt/xmake.lua index 9737d828b..08e8265c2 100644 --- a/xmake/rules/qt/xmake.lua +++ b/xmake/rules/qt/xmake.lua @@ -248,7 +248,13 @@ rule("qt.quickapp_static") end elseif target:is_plat("wasm") then plugins.QWasmIntegrationPlugin = {linkdirs = "plugins/platforms", links = {"qwasm"}} - table.join2(frameworks, "QtEventDispatcherSupport", "QtFontDatabaseSupport", "QtEglSupport") + if qt_sdkver then + if qt_sdkver:lt("6.0") then + table.join2(frameworks, "QtEventDispatcherSupport", "QtFontDatabaseSupport", "QtEglSupport") + else + table.join2(frameworks, "QtOpenGL") + end + end end import("load")(target, {gui = true, plugins = plugins, frameworks = frameworks}) end) |
