Skip to content

Commit

Permalink
[qt5] Validate
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhuai committed Dec 22, 2024
1 parent 1f65d84 commit 2619473
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/test_ports/vcpkg-ci-qt5/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
)
vcpkg_cmake_build()
20 changes: 20 additions & 0 deletions scripts/test_ports/vcpkg-ci-qt5/project/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.15)

project(qt5_test)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Core Quick QuickControls2 QmlImportScanner REQUIRED)

file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS main.cpp resources.qrc)
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})

target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::QuickControls2)

qt5_import_qml_plugins(${PROJECT_NAME})
23 changes: 23 additions & 0 deletions scripts/test_ports/vcpkg-ci-qt5/project/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <QDebug>
#include <QGuiApplication>
#include <QOpenGLContext>
#include <QQmlApplicationEngine>


int main(int argc, char *argv[]) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);

QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreated, &app,
[](QObject *obj, const QUrl &objUrl) {
if (!obj) {
QCoreApplication::exit(-1);
}
},
Qt::QueuedConnection);
engine.load(url);
return app.exec();
}
9 changes: 9 additions & 0 deletions scripts/test_ports/vcpkg-ci-qt5/project/main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import QtQuick 2.12
import QtQuick.Window 2.12

Window {
width: 960
height: 540
visible: true
title: qsTr("qt5_test")
}
5 changes: 5 additions & 0 deletions scripts/test_ports/vcpkg-ci-qt5/project/resources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
13 changes: 13 additions & 0 deletions scripts/test_ports/vcpkg-ci-qt5/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "vcpkg-ci-qt5",
"version-date": "2024-12-20",
"description": "Validates qt5",
"license": null,
"dependencies": [
"qt5",
{
"name": "vcpkg-cmake",
"host": true
}
]
}

0 comments on commit 2619473

Please sign in to comment.