From fb077477391b7108a489c54739777dd0cf62d250 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 29 Oct 2020 08:27:34 +0100 Subject: Fix the C++ - based examples to work Adapt CMakeList.txt, fix includes. Change-Id: Idc9636bee798c4a025b70f91b8379a9b9c79a82c Reviewed-by: Christian Tismer --- examples/scriptableapplication/CMakeLists.txt | 14 ++++++++------ examples/scriptableapplication/mainwindow.cpp | 2 +- examples/scriptableapplication/pythonutils.h | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'examples/scriptableapplication') diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt index d80664f53..2ccb9897d 100644 --- a/examples/scriptableapplication/CMakeLists.txt +++ b/examples/scriptableapplication/CMakeLists.txt @@ -12,7 +12,9 @@ project(scriptableapplication) set(CMAKE_CXX_STANDARD 11) # Find required Qt packages. -find_package(Qt5 5.12 REQUIRED COMPONENTS Core Gui Widgets) +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Widgets) # Use provided python interpreter if given. if(NOT python_interpreter) @@ -63,9 +65,9 @@ endif() # Get all relevant Qt include dirs, to pass them on to shiboken. -get_property(QT_CORE_INCLUDE_DIRS TARGET Qt5::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES) -get_property(QT_GUI_INCLUDE_DIRS TARGET Qt5::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES) -get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt5::Widgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES) +get_property(QT_CORE_INCLUDE_DIRS TARGET Qt6::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES) +get_property(QT_GUI_INCLUDE_DIRS TARGET Qt6::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES) +get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt6::Widgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES) set(QT_INCLUDE_DIRS ${QT_CORE_INCLUDE_DIRS} ${QT_GUI_INCLUDE_DIRS} ${QT_WIDGETS_INCLUDE_DIRS}) set(INCLUDES "") foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS}) @@ -73,7 +75,7 @@ foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS}) endforeach() # On macOS, check if Qt is a framework build. This affects how include paths should be handled. -get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK) +get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK) if (QtCore_is_framework) get_target_property(qt_core_library_location Qt5::Core LOCATION) get_filename_component(qt_core_library_location_dir "${qt_core_library_location}" DIRECTORY) @@ -157,7 +159,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_INCLUDE_DIR}) target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_ADDITIONAL_INCLUDES}) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets) target_link_libraries(${PROJECT_NAME} PRIVATE ${SHIBOKEN6_MODULE_SHARED_LIBRARIES}) target_link_libraries(${PROJECT_NAME} PRIVATE ${PYSIDE2_SHARED_LIBRARIES}) diff --git a/examples/scriptableapplication/mainwindow.cpp b/examples/scriptableapplication/mainwindow.cpp index ed12f94b1..315ea227e 100644 --- a/examples/scriptableapplication/mainwindow.cpp +++ b/examples/scriptableapplication/mainwindow.cpp @@ -51,7 +51,6 @@ #include "mainwindow.h" #include "pythonutils.h" -#include #include #include #include @@ -60,6 +59,7 @@ #include #include +#include #include #include diff --git a/examples/scriptableapplication/pythonutils.h b/examples/scriptableapplication/pythonutils.h index 21aef194e..942dee508 100644 --- a/examples/scriptableapplication/pythonutils.h +++ b/examples/scriptableapplication/pythonutils.h @@ -51,9 +51,9 @@ #ifndef PYTHONUTILS_H #define PYTHONUTILS_H +#include + class QObject; -class QString; -class QStringList; namespace PythonUtils { -- cgit v1.2.3