McuSupport: Update wizard entry point generation

Use app_target_default_main() macro and default entry points that come
with Qul instead providing own main.cpp templates.

Qt for MCUs has own default entry points implementations that may vary
for release to release. OS cmake variable is also removed in Qul 1.4.

Change-Id: I729b28250671c1a873d30d8c6c4f8d12306435d2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Jacek Nijaki
2020-08-13 14:07:10 +02:00
parent 8c227dea1d
commit c3641b02e4
5 changed files with 4 additions and 65 deletions

View File

@@ -8,8 +8,6 @@
<file>wizards/icon@2x.png</file>
<file>wizards/application/CMakeLists.txt</file>
<file>wizards/application/project.qmlproject.tpl</file>
<file>wizards/application/BareMetal/main.cpp.tpl</file>
<file>wizards/application/FreeRTOS/main.cpp.tpl</file>
<file>wizards/application/main.qml.tpl</file>
<file>wizards/application/wizard.json</file>
</qresource>

View File

@@ -1,14 +0,0 @@
#include "%{ProjectName}.h"
#include <qul/application.h>
#include <qul/qul.h>
int main()
{
Qul::initPlatform();
Qul::Application app;
static %{ProjectName} item;
app.setRootItem(&item);
app.exec();
return 0;
}

View File

@@ -4,8 +4,10 @@ project(%{ProjectName} VERSION 0.0.1 LANGUAGES C CXX ASM)
find_package(Qul)
add_executable(%{ProjectName} ${OS}/main.cpp)
add_executable(%{ProjectName})
qul_target_qml_sources(%{ProjectName} %{MainQmlFile})
target_link_libraries(%{ProjectName} Qul::QuickUltralite)
app_target_setup_os(%{ProjectName})
app_target_default_main(%{ProjectName} %{RootItemName})

View File

@@ -1,38 +0,0 @@
#include "%{ProjectName}.h"
#include <qul/application.h>
#include <qul/qul.h>
#include <cstdio>
#include <FreeRTOS.h>
#include <task.h>
#ifndef QUL_STACK_SIZE
#error QUL_STACK_SIZE must be defined.
#endif
static void Qul_Thread(void *argument);
int main()
{
Qul::initPlatform();
if (xTaskCreate(Qul_Thread, "QulExec", QUL_STACK_SIZE, 0, 4, 0) != pdPASS) {
std::printf("Task creation failed!.\\r\\n");
configASSERT(false);
}
vTaskStartScheduler();
// Should not reach this point
configASSERT(false);
return 0;
}
static void Qul_Thread(void *argument)
{
Qul::Application app;
static %{ProjectName} item;
app.setRootItem(&item);
app.exec();
}

View File

@@ -12,6 +12,7 @@
"options":
[
{ "key": "MainQmlFile", "value": "%{ProjectName}.qml" },
{ "key": "RootItemName", "value": "%{ProjectName}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }
],
@@ -52,16 +53,6 @@
"target": "%{ProjectDirectory}/%{ProjectName}.qmlproject",
"openInEditor": false
},
{
"source": "BareMetal/main.cpp.tpl",
"target": "%{ProjectDirectory}/BareMetal/main.cpp",
"openInEditor": false
},
{
"source": "FreeRTOS/main.cpp.tpl",
"target": "%{ProjectDirectory}/FreeRTOS/main.cpp",
"openInEditor": false
},
{
"source": "main.qml.tpl",
"target": "%{ProjectDirectory}/%{MainQmlFile}",