From 55ecedbd904ca95ec772bf231c6c5d83882e788f Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 17 Nov 2016 22:43:04 +0100 Subject: Add CMake macros for statechart code generation Introduce qt5_add_statecharts, used exactly like qt5_add_resources. Example usage: qt5_add_statecharts(MAIN_SRCS ../../compiled/connection.scxml ) Add tests Change-Id: If24ea872815e053582b0d7b8d89c4bbfb1162f88 Reviewed-by: Jan Arne Petersen Reviewed-by: Ulf Hermann --- tests/auto/cmake/CMakeLists.txt | 2 + .../auto/cmake/test_qtscxml_module/CMakeLists.txt | 16 +++++++ tests/auto/cmake/test_qtscxml_module/main.cpp | 50 ++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 tests/auto/cmake/test_qtscxml_module/CMakeLists.txt create mode 100644 tests/auto/cmake/test_qtscxml_module/main.cpp (limited to 'tests') diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 8518d09..9c9e098 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -11,3 +11,5 @@ include("${_Qt5CTestMacros}") test_module_includes( Scxml QScxmlEvent ) + +expect_pass(test_qtscxml_module) diff --git a/tests/auto/cmake/test_qtscxml_module/CMakeLists.txt b/tests/auto/cmake/test_qtscxml_module/CMakeLists.txt new file mode 100644 index 0000000..e2cf03a --- /dev/null +++ b/tests/auto/cmake/test_qtscxml_module/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.8) + +project(test_qtscxml_module) + +find_package(Qt5Scxml REQUIRED) + +set(MAIN_SRCS main.cpp) +qt5_add_statecharts(MAIN_SRCS + ../../compiled/connection.scxml + + # unused, just for testing whether it's possible to pass multiple files + ../../compiled/topmachine.scxml +) +add_executable(mainapp ${MAIN_SRCS}) +target_include_directories(mainapp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(mainapp Qt5::Scxml) diff --git a/tests/auto/cmake/test_qtscxml_module/main.cpp b/tests/auto/cmake/test_qtscxml_module/main.cpp new file mode 100644 index 0000000..2d081df --- /dev/null +++ b/tests/auto/cmake/test_qtscxml_module/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtScxml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "connection.h" + +int main(int argc, char **argv) +{ + Q_UNUSED(argc); + Q_UNUSED(argv); + + Connection connection; + Q_UNUSED(connection); + return 0; +} -- cgit v1.2.3