From b0765bd212bd0a4fd310cb3dd99b4f1f8ac5dc57 Mon Sep 17 00:00:00 2001 From: EndrII Date: Wed, 23 Sep 2020 15:41:57 +0300 Subject: [PATCH] added support static build of qt --- .gitmodules | 3 +++ QtStaticCMake | 1 + crossplatform/crossplatform.cmake | 38 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .gitmodules create mode 160000 QtStaticCMake diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8a63db4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "QtStaticCMake"] + path = QtStaticCMake + url = https://github.com/OlivierLDff/QtStaticCMake diff --git a/QtStaticCMake b/QtStaticCMake new file mode 160000 index 0000000..5b4bb89 --- /dev/null +++ b/QtStaticCMake @@ -0,0 +1 @@ +Subproject commit 5b4bb893934bd5cdeb39a52a46b4c05536603f95 diff --git a/crossplatform/crossplatform.cmake b/crossplatform/crossplatform.cmake index bc74b6e..f85a610 100755 --- a/crossplatform/crossplatform.cmake +++ b/crossplatform/crossplatform.cmake @@ -27,3 +27,41 @@ else(EXISTS ${CROSSPLATFORM_BUILD_TOOLCHAIN_PATH}) message("${TARGET_PLATFORM_TOOLCHAIN} not exits in ${CROSSPLATFORM_BUILD_TOOLCHAIN_PATH}") endif() +function(initWasmSupport name deployFile) + if(NOT TARGET ${name}) + message("the ${name} target is not created!") + return() + + endif(NOT TARGET ${name}) + + message("init support wasm build for target ${name}") + + if (DEFINED TARGET_PLATFORM_TOOLCHAIN) + if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32") + message(added deploy step for site) + set_target_properties(${name} PROPERTIES OUTPUT_NAME "${name}.js") + + addDeployFromFile(${deployFile}) + + include(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../QtStaticCMake/QtStaticCMake.cmake) + + qt_generate_plugin_import(${name} VERBOSE) + + # EXTRA_PLUGIN are the one required by plugin loaded by qt_generate_plugin_import + # It's not automatic yet :( All this workflow might change in future version of qt + # with better and better cmake support + qt_generate_qml_plugin_import(${name} + QML_SRC ${CMAKE_CURRENT_SOURCE_DIR} + EXTRA_PLUGIN + QtQuickVirtualKeyboardPlugin + QtQuickVirtualKeyboardSettingsPlugin + QtQuickVirtualKeyboardStylesPlugin + QmlFolderListModelPlugin + QQuickLayoutsPlugin + VERBOSE + ) + + endif(${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32") + endif(DEFINED TARGET_PLATFORM_TOOLCHAIN) + +endfunction()