diff options
-rw-r--r-- | src/scxml/Qt5ScxmlConfigExtras.cmake.in | 51 | ||||
-rw-r--r-- | src/scxml/Qt5ScxmlMacros.cmake | 67 | ||||
-rw-r--r-- | tests/auto/cmake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/auto/cmake/test_qtscxml_module/CMakeLists.txt | 16 | ||||
-rw-r--r-- | tests/auto/cmake/test_qtscxml_module/main.cpp | 50 |
5 files changed, 186 insertions, 0 deletions
diff --git a/src/scxml/Qt5ScxmlConfigExtras.cmake.in b/src/scxml/Qt5ScxmlConfigExtras.cmake.in new file mode 100644 index 0000000..edb320a --- /dev/null +++ b/src/scxml/Qt5ScxmlConfigExtras.cmake.in @@ -0,0 +1,51 @@ +# +# 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$ + +if (NOT TARGET Qt5::qscxmlc) + add_executable(Qt5::qscxmlc IMPORTED) + +!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) + set(imported_location \"${_qt5Scxml_install_prefix}/$${CMAKE_BIN_DIR}qscxmlc$$CMAKE_BIN_SUFFIX\") +!!ELSE + set(imported_location \"$${CMAKE_BIN_DIR}qscxmlc$$CMAKE_BIN_SUFFIX\") +!!ENDIF + _qt5_Scxml_check_file_exists(${imported_location}) + + set_target_properties(Qt5::qscxmlc PROPERTIES + IMPORTED_LOCATION ${imported_location} + ) + get_target_property(Qt5Scxml_QSCXMLC_EXECUTABLE Qt5::qscxmlc LOCATION) +endif() diff --git a/src/scxml/Qt5ScxmlMacros.cmake b/src/scxml/Qt5ScxmlMacros.cmake new file mode 100644 index 0000000..234258c --- /dev/null +++ b/src/scxml/Qt5ScxmlMacros.cmake @@ -0,0 +1,67 @@ +# +# 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$ + +if(NOT Qt5Scxml_QSCXMLC_EXECUTABLE) + message(FATAL_ERROR "qscxmlc executable not found -- Check installation.") +endif() + +# qt5_add_statecharts(outfiles inputfile ... ) + +function(qt5_add_statecharts outfiles) + set(options) + set(oneValueArgs) + set(multiValueArgs OPTIONS) + + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set(scxml_files ${ARGS_UNPARSED_ARGUMENTS}) + + foreach(it ${scxml_files}) + get_filename_component(outfilename ${it} NAME_WE) + get_filename_component(infile ${it} ABSOLUTE) + set(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfilename}) + set(outfile_cpp ${CMAKE_CURRENT_BINARY_DIR}/${outfilename}.cpp) + set(outfile_h ${CMAKE_CURRENT_BINARY_DIR}/${outfilename}.h) + + add_custom_command(OUTPUT ${outfile_cpp} ${outfile_h} + COMMAND ${Qt5Scxml_QSCXMLC_EXECUTABLE} + ARGS ${ARGS_OPTIONS} --output ${outfile} ${infile} + MAIN_DEPENDENCY ${infile} + VERBATIM) + list(APPEND ${outfiles} ${outfile_cpp}) + endforeach() + set(${outfiles} ${${outfiles}} PARENT_SCOPE) +endfunction() 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; +} |