Skip to content

Commit

Permalink
BUILD: Switch to Qt 6 and C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebeatrici committed Sep 17, 2024
1 parent c7c3bd8 commit a1084c4
Show file tree
Hide file tree
Showing 34 changed files with 109 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ environment:

matrix:
- MUMBLE_ENVIRONMENT_TRIPLET: 'x64-windows-static-md-release'
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-windows-static-md-release.2023-12-31.6a3ce9c65'
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-windows-static-md-release.2024-07-22.9ad0398d8'

install:
- ps: .ci/install-environment_windows.ps1
Expand Down
10 changes: 6 additions & 4 deletions .ci/azure-pipelines/install-environment_linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ sudo apt -y install \
g++-multilib \
ninja-build \
pkg-config \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
qt6-base-dev \
qt6-l10n-tools \
qt6-tools-dev \
qt6-tools-dev-tools \
libqt6svg6-dev \
libgl-dev \
libboost-dev \
libssl-dev \
libprotobuf-dev \
Expand Down
4 changes: 2 additions & 2 deletions .ci/azure-pipelines/main-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
pool:
vmImage: 'windows-2022'
variables:
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-windows-static-md-release.2023-12-31.6a3ce9c65'
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-windows-static-md-release.2024-07-22.9ad0398d8'
MUMBLE_ENVIRONMENT_TRIPLET: 'x64-windows-static-md-release'
steps:
- template: steps_windows.yml
Expand All @@ -45,7 +45,7 @@ jobs:
pool:
vmImage: 'macOS-12'
variables:
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-osx-release.2023-12-31.6a3ce9c65'
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-osx-release.2024-08-17.9ad0398d8'
MUMBLE_ENVIRONMENT_TRIPLET: 'x64-osx-release'
steps:
- template: steps_macos.yml
Expand Down
4 changes: 2 additions & 2 deletions .ci/azure-pipelines/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
pool:
vmImage: 'windows-2022'
variables:
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-windows-static-md-release.2023-12-31.6a3ce9c65'
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-windows-static-md-release.2024-07-22.9ad0398d8'
MUMBLE_ENVIRONMENT_TRIPLET: 'x64-windows-static-md-release'
steps:
- template: steps_windows.yml
Expand All @@ -43,7 +43,7 @@ jobs:
pool:
vmImage: 'macOS-12'
variables:
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-osx-release.2023-12-31.6a3ce9c65'
MUMBLE_ENVIRONMENT_VERSION: 'mumble_env.x64-osx-release.2024-08-17.9ad0398d8'
MUMBLE_ENVIRONMENT_TRIPLET: 'x64-osx-release'
steps:
- template: steps_macos.yml
Expand Down
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ freebsd_instance:
freebsd_task:
pkg_script:
- pkg update && pkg upgrade -y
- pkg install -y git ninja pkgconf cmake qt5-buildtools qt5-qmake qt5-linguisttools qt5-concurrent qt5-network qt5-xml qt5-sql qt5-svg qt5-testlib boost-libs libsndfile protobuf ice37 avahi-libdns poco opus
- pkg install -y git ninja pkgconf cmake qt6-base qt6-svg qt6-tools boost-libs libsndfile protobuf ice37 avahi-libdns poco opus
fetch_submodules_script: git submodule --quiet update --init --recursive
build_script:
- mkdir build && cd build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/env bash

. /etc/os-release

sudo apt update

sudo apt -y install \
build-essential \
g++-multilib \
ninja-build \
pkg-config \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
qt6-base-dev \
qt6-tools-dev \
libboost-dev \
libssl-dev \
libprotobuf-dev \
Expand All @@ -30,3 +30,17 @@ sudo apt -y install \
zsync \
appstream \
libpoco-dev

# The package was initially called libqt6svg6-dev.
# Choose correct name based on the Ubuntu version.
if [[ $VERSION_ID = "22.04" ]]
then
# libgl-dev is required in order for GUI-related components to be found by CMake.
# qt6-l10n-tools and qt6-tools-dev-tools are required in order for LinguistTools to be found by CMake.
sudo apt -y install libgl-dev \
libqt6svg6-dev \
qt6-l10n-tools \
qt6-tools-dev-tools
else
sudo apt -y install qt6-svg-dev
fi
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ list(APPEND CMAKE_MODULE_PATH
)

if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)


include(pkg-utils)
Expand Down
3 changes: 0 additions & 3 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ if(MSVC)
"/ignore:4099"
)
endif()

# Workaround for MSVC 17.8 breaking change. (fixed in Qt 5.15.17)
add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
elseif(UNIX OR MINGW)
add_compile_options(
"-fvisibility=hidden"
Expand Down
10 changes: 0 additions & 10 deletions cmake/os.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,11 @@ else()
endif()

find_pkg(OpenSSL QUIET)
find_pkg(Qt5 QUIET)

if(NOT OpenSSL_FOUND)
if(APPLE)
# Homebrew
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
endif()
endif()

if(NOT Qt5_FOUND)
if(APPLE)
# Homebrew
set(Qt5_DIR "/usr/local/opt/qt5/lib/cmake/Qt5")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
set(Qt5_DIR "/usr/local/lib/qt5/cmake/Qt5")
endif()
endif()
endif()
6 changes: 3 additions & 3 deletions cmake/qt-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function(include_qt_plugin TARGET SCOPE PLUGIN)
endfunction()

function(compile_translations OUT_VAR OUT_DIR TS_FILES)
find_pkg(Qt5 COMPONENTS LinguistTools REQUIRED)
find_pkg(Qt6 COMPONENTS LinguistTools REQUIRED)

# Create output directory
file(MAKE_DIRECTORY "${OUT_DIR}")
Expand All @@ -47,7 +47,7 @@ function(compile_translations OUT_VAR OUT_DIR TS_FILES)
# Compile the given .ts files into .qm files into the output directory
foreach(CURRENT_TS IN LISTS TS_FILES)
set_source_files_properties("${CURRENT_TS}" PROPERTIES OUTPUT_LOCATION "${OUT_DIR}")
qt5_add_translation(COMPILED_FILES "${CURRENT_TS}")
qt6_add_translation(COMPILED_FILES "${CURRENT_TS}")
endforeach()

# return the list of compiled .qm files
Expand Down Expand Up @@ -96,7 +96,7 @@ endfunction()

function(query_qmake OUT_VAR PROP)
# Get the path to the qmake executable
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_target_property(QT_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION)

# Query qmake for the location of the installed Qt translations
execute_process(
Expand Down
8 changes: 4 additions & 4 deletions helpers/g15helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ set_target_properties(g15-helper
target_compile_definitions(g15-helper PRIVATE $<$<CONFIG:Debug>:USE_LOGFILE>)

if(g15-emulator)
find_pkg(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
find_pkg(Qt6 COMPONENTS Core Gui Widgets REQUIRED)
set_target_properties(g15-helper PROPERTIES AUTOMOC ON)
target_sources(g15-helper PRIVATE "g15helper_emu.cpp" "g15helper_emu.h")
target_link_libraries(g15-helper PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(g15-helper PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets)

if(static AND WIN32 AND TARGET Qt5::QWindowsIntegrationPlugin)
if(static AND WIN32 AND TARGET Qt6::QWindowsIntegrationPlugin)
include_qt_plugin(g15-helper PRIVATE QWindowsIntegrationPlugin)
target_link_libraries(g15-helper PRIVATE Qt5::QWindowsIntegrationPlugin)
target_link_libraries(g15-helper PRIVATE Qt6::QWindowsIntegrationPlugin)
endif()
else()
if(MSVC)
Expand Down
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ option(tracy "Enable the tracy profiler." OFF)
option(bundled-gsl "Use the bundled GSL version instead of looking for one on the system" ON)


find_pkg(Qt5
find_pkg(Qt6
COMPONENTS
Core
Network
Expand Down Expand Up @@ -176,9 +176,9 @@ target_link_libraries(shared
protobuf::libprotobuf
OpenSSL::Crypto
OpenSSL::SSL
Qt5::Core
Qt5::Network
Qt5::Xml
Qt6::Core
Qt6::Network
Qt6::Xml
)

if(WIN32)
Expand Down
42 changes: 21 additions & 21 deletions src/mumble/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if(MSVC)
option(elevation "Set \"uiAccess=true\", required for global shortcuts to work with privileged applications. Requires the client's executable to be signed with a trusted code signing certificate." OFF)
endif()

find_pkg(Qt5
find_pkg(Qt6
COMPONENTS
Concurrent
Sql
Expand Down Expand Up @@ -541,24 +541,24 @@ target_link_libraries(mumble_client_object_lib
PUBLIC
shared
utfcpp
Qt5::Concurrent
Qt5::Sql
Qt5::Svg
Qt5::Widgets
Qt6::Concurrent
Qt6::Sql
Qt6::Svg
Qt6::Widgets
)

if(static)
if(TARGET Qt5::QSQLiteDriverPlugin)
if(TARGET Qt6::QSQLiteDriverPlugin)
include_qt_plugin(mumble_client_object_lib PRIVATE "QSQLiteDriverPlugin")
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::QSQLiteDriverPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::QSQLiteDriverPlugin)
endif()
if(TARGET Qt5::QSvgIconPlugin)
if(TARGET Qt6::QSvgIconPlugin)
include_qt_plugin(mumble_client_object_lib PRIVATE "QSvgIconPlugin")
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::QSvgIconPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::QSvgIconPlugin)
endif()
if(TARGET Qt5::QSvgPlugin)
if(TARGET Qt6::QSvgPlugin)
include_qt_plugin(mumble_client_object_lib PRIVATE "QSvgPlugin")
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::QSvgPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::QSvgPlugin)
endif()
endif()

Expand Down Expand Up @@ -596,9 +596,9 @@ if(WIN32)
REQUIRED
)

if(static AND TARGET Qt5::QWindowsIntegrationPlugin)
if(static AND TARGET Qt6::QWindowsIntegrationPlugin)
include_qt_plugin(mumble_client_object_lib PRIVATE QWindowsIntegrationPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::QWindowsIntegrationPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::QWindowsIntegrationPlugin)
endif()

add_subdirectory("${3RDPARTY_DIR}/SPSCQueue" "${CMAKE_CURRENT_BINARY_DIR}/SPSCQueue" EXCLUDE_FROM_ALL)
Expand Down Expand Up @@ -648,9 +648,9 @@ else()
target_compile_definitions(mumble_client_object_lib PUBLIC "NO_XINPUT2")
endif()

if(static AND TARGET Qt5::QXcbIntegrationPlugin)
if(static AND TARGET Qt6::QXcbIntegrationPlugin)
include_qt_plugin(mumble_client_object_lib PRIVATE QXcbIntegrationPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::QXcbIntegrationPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::QXcbIntegrationPlugin)
endif()

target_sources(mumble_client_object_lib
Expand Down Expand Up @@ -685,9 +685,9 @@ else()
"os_macx.mm"
)

if(static AND TARGET Qt5::QCocoaIntegrationPlugin)
if(static AND TARGET Qt6::QCocoaIntegrationPlugin)
include_qt_plugin(mumble_client_object_lib PRIVATE QCocoaIntegrationPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::QCocoaIntegrationPlugin)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::QCocoaIntegrationPlugin)
endif()

target_link_libraries(mumble_client_object_lib
Expand Down Expand Up @@ -769,9 +769,9 @@ if(renamenoise)
endif()

if(qtspeech)
find_pkg(Qt5 COMPONENTS TextToSpeech REQUIRED)
find_pkg(Qt6 COMPONENTS TextToSpeech REQUIRED)
target_sources(mumble_client_object_lib PRIVATE "TextToSpeech.cpp")
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::TextToSpeech)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::TextToSpeech)
elseif(WIN32)
target_sources(mumble_client_object_lib PRIVATE "TextToSpeech_win.cpp")
if(MINGW)
Expand Down Expand Up @@ -822,7 +822,7 @@ if(NOT update)
endif()

if(NOT WIN32 AND NOT APPLE)
find_pkg(Qt5 COMPONENTS DBus REQUIRED)
find_pkg(Qt6 COMPONENTS DBus REQUIRED)

target_sources(mumble_client_object_lib
PRIVATE
Expand All @@ -831,7 +831,7 @@ if(NOT WIN32 AND NOT APPLE)
)

target_compile_definitions(mumble_client_object_lib PUBLIC "USE_DBUS")
target_link_libraries(mumble_client_object_lib PUBLIC Qt5::DBus)
target_link_libraries(mumble_client_object_lib PUBLIC Qt6::DBus)
endif()

if(translations)
Expand Down
2 changes: 0 additions & 2 deletions src/mumble/PluginUpdater.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ struct UpdateWidgetPair {
/// A helper struct to store a pair of a plugin ID and an URL corresponding to
/// the same plugin.
struct UpdateEntry {
UpdateEntry() = default;

plugin_id_t pluginID = std::numeric_limits< plugin_id_t >::max();
QUrl updateURL;
QString fileName;
Expand Down
Loading

0 comments on commit a1084c4

Please sign in to comment.