From febfa73d29dc50f9ff73eeaf554a28f8c1299caf Mon Sep 17 00:00:00 2001 From: Yasser Grimes Date: Fri, 2 Jun 2023 11:51:15 +0300 Subject: [PATCH] McuSupport: Add an empty MCU project template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In addition to the descriptive Qmlproject base template containing hints about most possible configurations, this template is intended to be as blank as possible for a cleaner project configuration for the case where the properties already known by the developer. Task-number: QTCREATORBUG-29192 Change-Id: I670bc502ba30d5297668c77004ddfdf756764809 Reviewed-by: Reviewed-by: Sivert Krøvel Reviewed-by: Alessandro Portale --- src/plugins/mcusupport/mcusupport.qrc | 4 + .../wizards/qmlproject-empty/CMakeLists.txt | 8 ++ .../wizards/qmlproject-empty/main.qml.tpl | 8 ++ .../qmlproject-empty/project.qmlproject.tpl | 75 +++++++++++++++++++ .../wizards/qmlproject-empty/wizard.json | 71 ++++++++++++++++++ .../wizards/qmlproject/project.qmlproject.tpl | 2 +- .../mcusupport/wizards/qmlproject/wizard.json | 4 +- 7 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 src/plugins/mcusupport/wizards/qmlproject-empty/CMakeLists.txt create mode 100644 src/plugins/mcusupport/wizards/qmlproject-empty/main.qml.tpl create mode 100644 src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl create mode 100644 src/plugins/mcusupport/wizards/qmlproject-empty/wizard.json diff --git a/src/plugins/mcusupport/mcusupport.qrc b/src/plugins/mcusupport/mcusupport.qrc index 7aeb7b93873..dc64ac1ca2f 100644 --- a/src/plugins/mcusupport/mcusupport.qrc +++ b/src/plugins/mcusupport/mcusupport.qrc @@ -21,5 +21,9 @@ wizards/qmlproject/component.qml.tpl wizards/qmlproject/wizard.json wizards/qmlproject/Qul.cmake + wizards/qmlproject-empty/CMakeLists.txt + wizards/qmlproject-empty/main.qml.tpl + wizards/qmlproject-empty/project.qmlproject.tpl + wizards/qmlproject-empty/wizard.json diff --git a/src/plugins/mcusupport/wizards/qmlproject-empty/CMakeLists.txt b/src/plugins/mcusupport/wizards/qmlproject-empty/CMakeLists.txt new file mode 100644 index 00000000000..49a4a8f949f --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject-empty/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required (VERSION 3.21.1) + +project(%{CorrectedProjectName} VERSION 0.0.1 LANGUAGES C CXX ASM) + +find_package(Qul) + +qul_add_target(%{CorrectedProjectName} QML_PROJECT %{QmlProjectFile} GENERATE_ENTRYPOINT) +app_target_setup_os(%{CorrectedProjectName}) diff --git a/src/plugins/mcusupport/wizards/qmlproject-empty/main.qml.tpl b/src/plugins/mcusupport/wizards/qmlproject-empty/main.qml.tpl new file mode 100644 index 00000000000..aec54b32fb5 --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject-empty/main.qml.tpl @@ -0,0 +1,8 @@ +import QtQuick + +Rectangle { + Text { + anchors.centerIn: parent + text: "Qt for MCUs" + } +} diff --git a/src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl b/src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl new file mode 100644 index 00000000000..ab85861a5ec --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl @@ -0,0 +1,75 @@ +import QmlProject 1.3 + +Project { + qtForMCUs: true // Required by QDS to enable/disable features Supported/Unsupported by QtMCUs projects. Currently ignored by qmlprojectexporter. + // importPaths: [] // Alternative API to ModuleFiles for importing modules. + // projectRootPath: "." // Optional root path relative to qmlproject file path. + mainFile: "%{MainQmlFile}" // The application's entrypoint + + MCU.Config { + controlsStyle: "QtQuick.Controls.StyleDefault" + debugBytecode: false + debugLineDirectives: false + + // maxResourceCacheSize: 0 // Set to 0 by default. Required for OnDemand resource cache policy and resource compression. + + // Global settings for image properties. Can be overridden for selected resources in ImageFiles nodes. + resourceImagePixelFormat: "Automatic" + resourceCachePolicy: "NoCaching" + resourceCompression: false + + // Font engine selection + fontEngine: "Static" // alternative option: "Spark". + + // Font defaults for both engines + defaultFontFamily: "DejaVu Sans Mono" + defaultFontQuality: "VeryHigh" + glyphsCachePolicy: "NoCaching" + maxParagraphSize: 100 + + // Font properties for "Static" + addDefaultFonts: true // Set to false to disable add adding default fonts to your project. + autoGenerateGlyphs: true + + // Font properties for "Spark" + // These properties are in effect only if the "Spark" font engine is used + complexTextRendering: true // Set this to false if complex scripts are not needed (Arabic scripts, Indic scripts, etc.) + fontCachePriming: false // Set to true to decrease application startup time. Only applies to fonts configured with unicode ranges (font.unicodeCoverage). + fontCacheSize: 0 // If this is needed, use a suitable number. Setting this to a sensible value will improve performance, the global default is 104800. + fontHeapSize: -1 // Set to sufficient value to improve performance. -1 means no restrictions to heap allocation. + fontHeapPrealloc: true + fontCachePrealloc: true + } + + QmlFiles { + files: ["%{MainQmlFile}"] + } + + ImageFiles { + files: [] + } + + FontFiles { + files: [] + } + + TranslationFiles { + files: [] + } + + InterfaceFiles { + files: [] + } + + ModuleFiles { + files: [] + // Uncomment for adding Qul modules + MCU.qulModules: [ + // "Qul::Controls", + // "Qul::ControlsTemplates", + // "Qul::Shapes", + // "Qul::Timeline" + ] + } + +} diff --git a/src/plugins/mcusupport/wizards/qmlproject-empty/wizard.json b/src/plugins/mcusupport/wizards/qmlproject-empty/wizard.json new file mode 100644 index 00000000000..80f6439f4cd --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject-empty/wizard.json @@ -0,0 +1,71 @@ +{ + "version": 1, + "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject" ], + "id": "M.McuSupportApplicationEmpty", + "category": "D.ApplicationMCU", + "trDescription": "Suitable for Qt for MCUs versions 2.4 and later. Creates an empty application that you can deploy, run and debug on MCU boards", + "trDisplayName": "Qt for MCUs Empty Application", + "trDisplayCategory": "QmlProject Application (Qt for MCUs)", + "icon": "../icon.png", + "iconKind": "Themed", + "enabled": true, + + "options": + [ + { "key": "CorrectedProjectName", "value": "%{JS: '%{ProjectName}'.replace(/-/g, '_')}"}, + { "key": "MainQmlFile", "value": "%{CorrectedProjectName}.qml" }, + { "key": "QmlProjectFile", "value": "%{CorrectedProjectName}.qmlproject" }, + { "key": "CMakeFile", "value": "%{CorrectedProjectName}/CMakeLists.txt" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project" + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{JS: !value('IsSubproject')}", + "data": { + "projectFilePath": "%{CMakeFile}" + } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "CMakeLists.txt", + "openAsProject": true + }, + { + "source": "project.qmlproject.tpl", + "target": "%{ProjectDirectory}/%{QmlProjectFile}", + "openInEditor": true + }, + { + "source": "main.qml.tpl", + "target": "%{ProjectDirectory}/%{MainQmlFile}", + "openInEditor": true + }, + { + "source": "%{IDE:ResourcePath}/templates/wizards/projects/git.ignore", + "target": ".gitignore", + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" + } + ] + } + ] +} diff --git a/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl b/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl index 71a1db1e167..0c879ccfb0d 100644 --- a/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl +++ b/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl @@ -4,7 +4,7 @@ Project { qtForMCUs: true // Required by QDS to enable/disable features Supported/Unsupported by QtMCUs projects. Currently ignored by qmlprojectexporter. // importPaths: ["imports/CustomModule"] // Alternative API for importing modules. // projectRootPath: "." // Optional root path relative to qmlproject file path. - mainFile: "%{MainQmlFile}" // Required to determin which qml file is the application entrypoint, when no custom c++ entrypoint is specified. + mainFile: "%{MainQmlFile}" // The application's entrypoint /* Global configuration */ MCU.Config { diff --git a/src/plugins/mcusupport/wizards/qmlproject/wizard.json b/src/plugins/mcusupport/wizards/qmlproject/wizard.json index 9c1e036e910..4a5f582d432 100644 --- a/src/plugins/mcusupport/wizards/qmlproject/wizard.json +++ b/src/plugins/mcusupport/wizards/qmlproject/wizard.json @@ -1,10 +1,10 @@ { "version": 1, "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject" ], - "id": "M.McuSupportApplication", + "id": "M.McuSupportApplicationExample", "category": "D.ApplicationMCU", "trDescription": "Suitable for Qt for MCUs versions 2.4 and later. Creates an application that uses a subset of Qt QML and Qt Quick Controls types (as supported by Qt for MCUs) that you can deploy, run, and debug on MCU boards.", - "trDisplayName": "Qt for MCUs Application", + "trDisplayName": "Qt for MCUs Example Application", "trDisplayCategory": "QmlProject Application (Qt for MCUs)", "icon": "../icon.png", "iconKind": "Themed",