Skip to content

Commit

Permalink
[Qt6] Focus on Qt6
Browse files Browse the repository at this point in the history
Drop Qt4 compatibility
Replace o2_WITH_QT5 with o2_WITH_QT6
  • Loading branch information
m-kuhn committed Dec 10, 2024
1 parent b342c02 commit 4e5be60
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 240 deletions.
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
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 )
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 WebEngine 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::WebEngine Qt::WebEngineWidgets )
target_link_libraries( msgraphexternalinterceptorexample o2 )
32 changes: 7 additions & 25 deletions examples/twitterdemo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,20 @@ 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(o2_WITH_QT6)
find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Widgets Script Network REQUIRED)
endif()

if (NOT o2_WITH_QT5)
include( ${QT_USE_FILE} )
endif(NOT o2_WITH_QT5)

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

set(fb_SRCS
main.cpp
tweeter.cpp
)

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

add_executable( twitterexample ${fb_SRCS} )

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

0 comments on commit 4e5be60

Please sign in to comment.