Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Qt6] More Qt6, goodbye Qt4 #21

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 49 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
name: 🧪Qt 5 linux build
name: 🧪 Linux build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
strategy:
matrix:
qt_version: [5, 6]

runs-on: ubuntu-latest

steps:
Expand All @@ -16,41 +22,56 @@ jobs:

- name: Get deps
run: |
if [ "${{ matrix.qt_version }}" -eq 6 ]; then
QT_PACKAGES="qt6-base-dev \
qtkeychain-qt6-dev \
qt6-webengine-dev \
qt6-webengine-dev-tools \
libglx-dev \
libgl1-mesa-dev"
else
QT_PACKAGES="qtbase5-dev \
qt5keychain-dev \
qtscript5-dev \
qtwebengine5-dev"
fi
sudo apt-get install \
cmake \
ninja-build \
clang \
qtbase5-dev \
qt5keychain-dev \
qtscript5-dev \
qtwebengine5-dev
${QT_PACKAGES}


- name: Build
run: |
mkdir -p build
cd build
if [ "${{ matrix.qt_version }}" -eq 6 ]; then
CMAKE_QT_OPTION="o2_WITH_QT6:BOOL=ON"
else
CMAKE_QT_OPTION="o2_WITH_QT6:BOOL=OFF"
fi
cmake -GNinja \
-Do2_BUILD_EXAMPLES:BOOL=ON \
-Do2_WITH_TESTS=ON \
-Do2_SHOW_TRACE:BOOL=ON \
-Do2_WITH_DROPBOX:BOOL=ON \
-Do2_WITH_FACEBOOK:BOOL=ON \
-Do2_WITH_FLICKR:BOOL=ON \
-Do2_WITH_GOOGLE:BOOL=ON \
-Do2_WITH_HUBIC:BOOL=ON \
-Do2_WITH_KEYCHAIN:BOOL=ON \
-Do2_WITH_MSGRAPH:BOOL=ON \
-Do2_WITH_OAUTH1:BOOL=ON \
-Do2_WITH_QT5:BOOL=ON \
-Do2_WITH_SKYDRIVE:BOOL=ON \
-Do2_WITH_SMUGMUG:BOOL=ON \
-Do2_WITH_SPOTIFY:BOOL=ON \
-Do2_WITH_SURVEYMONKEY:BOOL=ON \
-Do2_WITH_TWITTER:BOOL=ON \
-Do2_WITH_UBER:BOOL=ON \
-Do2_WITH_VIMEO:BOOL=ON \
..
ninja
-Do2_BUILD_EXAMPLES:BOOL=ON \
-Do2_WITH_TESTS=ON \
-Do2_SHOW_TRACE:BOOL=ON \
-Do2_WITH_DROPBOX:BOOL=ON \
-Do2_WITH_FACEBOOK:BOOL=ON \
-Do2_WITH_FLICKR:BOOL=ON \
-Do2_WITH_GOOGLE:BOOL=ON \
-Do2_WITH_HUBIC:BOOL=ON \
-Do2_WITH_KEYCHAIN:BOOL=ON \
-Do2_WITH_MSGRAPH:BOOL=ON \
-Do2_WITH_OAUTH1:BOOL=ON \
-D${CMAKE_QT_OPTION} \
-Do2_WITH_SKYDRIVE:BOOL=ON \
-Do2_WITH_SMUGMUG:BOOL=ON \
-Do2_WITH_SPOTIFY:BOOL=ON \
-Do2_WITH_SURVEYMONKEY:BOOL=ON \
-Do2_WITH_TWITTER:BOOL=ON \
-Do2_WITH_UBER:BOOL=ON \
-Do2_WITH_VIMEO:BOOL=ON \
-S . \
-B build
cmake --build build

- name: Run Tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang_static_analyzer/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ scan-build -o scanbuildoutput -plist -v cmake -Do2_BUILD_EXAMPLES:BOOL=ON \
-Do2_WITH_KEYCHAIN:BOOL=ON \
-Do2_WITH_MSGRAPH:BOOL=ON \
-Do2_WITH_OAUTH1:BOOL=ON \
-Do2_WITH_QT5:BOOL=ON \
-Do2_WITH_QT6:BOOL=OFF \
-Do2_WITH_SKYDRIVE:BOOL=ON \
-Do2_WITH_SMUGMUG:BOOL=ON \
-Do2_WITH_SPOTIFY:BOOL=ON \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
-Do2_WITH_KEYCHAIN:BOOL=ON \
-Do2_WITH_MSGRAPH:BOOL=ON \
-Do2_WITH_OAUTH1:BOOL=ON \
-Do2_WITH_QT5:BOOL=ON \
-Do2_WITH_QT6:BOOL=OFF \
-Do2_WITH_SKYDRIVE:BOOL=ON \
-Do2_WITH_SMUGMUG:BOOL=ON \
-Do2_WITH_SPOTIFY:BOOL=ON \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverity-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
-Do2_WITH_KEYCHAIN:BOOL=ON \
-Do2_WITH_MSGRAPH:BOOL=ON \
-Do2_WITH_OAUTH1:BOOL=ON \
-Do2_WITH_QT5:BOOL=ON \
-Do2_WITH_QT6:BOOL=OFF \
-Do2_WITH_SKYDRIVE:BOOL=ON \
-Do2_WITH_SMUGMUG:BOOL=ON \
-Do2_WITH_SPOTIFY:BOOL=ON \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mac/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cmake -GNinja \
-Do2_WITH_KEYCHAIN:BOOL=ON \
-Do2_WITH_MSGRAPH:BOOL=ON \
-Do2_WITH_OAUTH1:BOOL=ON \
-Do2_WITH_QT5:BOOL=ON \
-Do2_WITH_QT6:BOOL=OFF \
-Do2_WITH_SKYDRIVE:BOOL=ON \
-Do2_WITH_SMUGMUG:BOOL=ON \
-Do2_WITH_SPOTIFY:BOOL=ON \
Expand Down
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(API_VERSION ${VER_MAJOR}.${VER_MINOR}.${API_VER_PATCH})

project(o2 VERSION ${PROJECT_VERSION})

option(o2_WITH_QT5 "Use Qt5" ON)
option(o2_WITH_QT6 "Use Qt6" ON)

set(o2_LIB_SUFFIX "" CACHE STRING "Suffix for install 'lib' directory, e.g. 64 for lib64")

Expand Down Expand Up @@ -89,14 +89,11 @@ if (o2_WITH_OAUTH1)
endif()

if(o2_WITH_KEYCHAIN)
if(o2_WITH_QT5)
find_package(Qt5Keychain CONFIG REQUIRED)
else()
if(o2_WITH_QT6)
find_package(Qt6Keychain CONFIG REQUIRED)
else()
find_package(Qt5Keychain CONFIG REQUIRED)
endif()

message("Found QTKeychain")

endif(o2_WITH_KEYCHAIN)

if(o2_WITH_TWITTER OR o2_WITH_DROPBOX OR o2_WITH_FLICKR OR o2_WITH_SMUGMUG)
Expand Down
4 changes: 3 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ endif(o2_WITH_VIMEO)

if (o2_WITH_MSGRAPH)
add_subdirectory(msgraphdemo)
add_subdirectory(msgraphexternalinterceptordemo)
if (NOT o2_WITH_QT6) # Not yet completely updated to Qt6 compatibility, should not be too hard to do
add_subdirectory(msgraphexternalinterceptordemo)
endif (NOT o2_WITH_QT6)
endif(o2_WITH_MSGRAPH)
32 changes: 7 additions & 25 deletions examples/facebookdemo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

if(o2_WITH_QT5)
# Qt5 packages find their own dependencies.
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Script REQUIRED)
find_package(Qt5Network REQUIRED)
else(o2_WITH_QT5)
set(QT_USE_QTNETWORK true)
set(QT_USE_QTSCRIPT true)
find_package(Qt4 REQUIRED)
endif(o2_WITH_QT5)

if (NOT o2_WITH_QT5)
include( ${QT_USE_FILE} )
endif(NOT o2_WITH_QT5)
if(o2_WITH_QT6)
find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Widgets Script Network REQUIRED)
endif()

include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} "../../src" )

Expand All @@ -30,15 +20,7 @@ set(fb_SRCS
fbdemo.h
)

if(NOT o2_WITH_QT5)
add_definitions(${QT4_DEFINITIONS})
endif(NOT o2_WITH_QT5)

add_executable( fbexample ${fb_SRCS} )

if(o2_WITH_QT5)
target_link_libraries( fbexample Qt5::Core Qt5::Widgets Qt5::Network )
target_link_libraries( fbexample o2 )
else(o2_WITH_QT5)
target_link_libraries( fbexample ${QT_LIBRARIES} o2 )
endif(o2_WITH_QT5)
target_link_libraries( fbexample Qt::Core Qt::Widgets Qt::Network )
target_link_libraries( fbexample o2 )
32 changes: 7 additions & 25 deletions examples/facebookexternalinterceptordemo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

if(o2_WITH_QT5)
# Qt5 packages find their own dependencies.
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Script REQUIRED)
find_package(Qt5Network REQUIRED)
else(o2_WITH_QT5)
set(QT_USE_QTNETWORK true)
set(QT_USE_QTSCRIPT true)
find_package(Qt4 REQUIRED)
endif(o2_WITH_QT5)

if (NOT o2_WITH_QT5)
include( ${QT_USE_FILE} )
endif(NOT o2_WITH_QT5)
if(o2_WITH_QT6)
find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Widgets Script Network REQUIRED)
endif()

include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} "../../src" )

Expand All @@ -29,15 +19,7 @@ set(fb_SRCS
fbdemo.cpp
)

if(NOT o2_WITH_QT5)
add_definitions(${QT4_DEFINITIONS})
endif(NOT o2_WITH_QT5)

add_executable( fbexample ${fb_SRCS} )

if(o2_WITH_QT5)
qt5_use_modules( fbexample Core Widgets Network )
target_link_libraries( fbexample o2 )
else(o2_WITH_QT5)
target_link_libraries( fbexample ${QT_LIBRARIES} o2 )
endif(o2_WITH_QT5)
target_link_libraries( fbexample Qt::Core Qt::Widgets Qt::Network )
target_link_libraries( fbexample o2 )
32 changes: 7 additions & 25 deletions examples/msgraphdemo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

if(o2_WITH_QT5)
# Qt5 packages find their own dependencies.
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Widgets REQUIRED)
else(o2_WITH_QT5)
set(QT_USE_QTNETWORK true)
set(QT_USE_QTSCRIPT true)
find_package(Qt4 REQUIRED)
endif(o2_WITH_QT5)

if (NOT o2_WITH_QT5)
include( ${QT_USE_FILE} )
endif(NOT o2_WITH_QT5)
if(o2_WITH_QT6)
find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Widgets Script Network REQUIRED)
endif()

include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} "../../src" )

Expand All @@ -30,15 +20,7 @@ set(msgraph_SRCS
msgraphdemo.h
)

if(NOT o2_WITH_QT5)
add_definitions(${QT4_DEFINITIONS})
endif(NOT o2_WITH_QT5)

add_executable( msgraphexample ${msgraph_SRCS} )

if(o2_WITH_QT5)
target_link_libraries( msgraphexample Qt5::Core Qt5::Gui Qt5::Network Qt5::Widgets )
target_link_libraries( msgraphexample o2 )
else(o2_WITH_QT5)
target_link_libraries( msgraphexample ${QT_LIBRARIES} o2 )
endif(o2_WITH_QT5)
target_link_libraries( msgraphexample Qt::Core Qt::Widgets Qt::Network )
target_link_libraries( msgraphexample o2 )
10 changes: 5 additions & 5 deletions examples/msgraphdemo/msgraphdemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <QDesktopServices>
#include <QMetaEnum>
#include <QDebug>
#include <QRegExp>
#include <QRegularExpression>

#include "msgraphdemo.h"
#include "o0globals.h"
Expand Down Expand Up @@ -114,13 +114,13 @@ void MsgraphDemo::onFinished(int requestId, QNetworkReply::NetworkError error, Q
return;
}

QRegExp userPrincipalNameRE("\"userPrincipalName\":\"([^\"]+)\"");
if (userPrincipalNameRE.indexIn(reply) == -1) {
QRegularExpression userPrincipalNameRE("\"userPrincipalName\":\"([^\"]+)\"");
QRegularExpressionMatch match = userPrincipalNameRE.match(reply);
if (!match.hasMatch()) {
qDebug() << "Can not parse reply:" << reply;
emit userPrincipalNameFailed();
return;
}

qInfo() << "userPrincipalName: " << userPrincipalNameRE.cap(1);
qInfo() << "userPrincipalName: " << match.captured(0);
emit userPrincipalNameReceived();
}
34 changes: 7 additions & 27 deletions examples/msgraphexternalinterceptordemo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,11 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

if(o2_WITH_QT5)
# Qt5 packages find their own dependencies.
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Script REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5WebEngine REQUIRED)
find_package(Qt5WebEngineWidgets REQUIRED)
else(o2_WITH_QT5)
set(QT_USE_QTNETWORK true)
set(QT_USE_QTSCRIPT true)
find_package(Qt4 REQUIRED)
endif(o2_WITH_QT5)

if (NOT o2_WITH_QT5)
include( ${QT_USE_FILE} )
endif(NOT o2_WITH_QT5)
if(o2_WITH_QT6)
find_package(Qt6 COMPONENTS Core Widgets Network WebEngineCore WebEngineWidgets REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Widgets Script Network WebEngine WebEngineWidgets REQUIRED)
endif()

include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} "../../src" )

Expand All @@ -34,15 +22,7 @@ set(msgraph_SRCS
webenginepage.cpp
)

if(NOT o2_WITH_QT5)
add_definitions(${QT4_DEFINITIONS})
endif(NOT o2_WITH_QT5)

add_executable( msgraphexternalinterceptorexample ${msgraph_SRCS} )

if(o2_WITH_QT5)
target_link_libraries( msgraphexternalinterceptorexample Qt5::Core Qt5::Widgets Qt5::Network Qt5::WebEngine Qt5::WebEngineWidgets )
target_link_libraries( msgraphexternalinterceptorexample o2 )
else(o2_WITH_QT5)
target_link_libraries( msgraphexternalinterceptorexample ${QT_LIBRARIES} o2 )
endif(o2_WITH_QT5)
target_link_libraries( msgraphexternalinterceptorexample Qt::Core Qt::Widgets Qt::Network Qt::WebEngineWidgets )
target_link_libraries( msgraphexternalinterceptorexample o2 )
Loading
Loading