cmake: included option for qt 6 compilation

Also fixed minor Qt 6 issue
This commit is contained in:
itsmattkc
2023-02-17 12:12:11 -08:00
parent 963d3b4b51
commit 491fbacfbc
3 changed files with 12 additions and 6 deletions
+9 -4
View File
@@ -18,6 +18,7 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(olive-editor VERSION 0.2.0 LANGUAGES CXX) project(olive-editor VERSION 0.2.0 LANGUAGES CXX)
option(BUILD_QT6 "Build with Qt 6 over 5 (experimental)" OFF)
option(BUILD_DOXYGEN "Build Doxygen documentation" OFF) option(BUILD_DOXYGEN "Build Doxygen documentation" OFF)
option(BUILD_TESTS "Build unit tests" OFF) option(BUILD_TESTS "Build unit tests" OFF)
option(USE_WERROR "Error on compile warning" OFF) option(USE_WERROR "Error on compile warning" OFF)
@@ -110,10 +111,14 @@ set(QT_LIBRARIES
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
list(APPEND QT_LIBRARIES DBus) list(APPEND QT_LIBRARIES DBus)
endif() endif()
if (BUILD_QT6)
set(QT_NAME Qt6)
else()
set(QT_NAME Qt5)
endif()
find_package(QT find_package(QT
NAMES NAMES
Qt6 ${QT_NAME}
Qt5
REQUIRED REQUIRED
COMPONENTS COMPONENTS
${QT_LIBRARIES} ${QT_LIBRARIES}
@@ -251,6 +256,6 @@ add_subdirectory(ext)
add_subdirectory(app) add_subdirectory(app)
if (BUILD_TESTS) if (BUILD_TESTS)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
+2 -2
View File
@@ -39,7 +39,7 @@ AV1Section::AV1Section(int default_crf, QWidget *parent) :
CodecSection(parent) CodecSection(parent)
{ {
QGridLayout* layout = new QGridLayout(this); QGridLayout* layout = new QGridLayout(this);
layout->setMargin(0); layout->setContentsMargins(0, 0, 0, 0);
int row = 0; int row = 0;
layout->addWidget(new QLabel(tr("Preset:")), row, 0); layout->addWidget(new QLabel(tr("Preset:")), row, 0);
@@ -104,7 +104,7 @@ AV1CRFSection::AV1CRFSection(int default_crf, QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
QHBoxLayout* layout = new QHBoxLayout(this); QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0); layout->setContentsMargins(0, 0, 0, 0);
crf_slider_ = new QSlider(Qt::Horizontal); crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF); crf_slider_->setMinimum(kMinimumCRF);
+1
View File
@@ -17,4 +17,5 @@
add_subdirectory(core) add_subdirectory(core)
set(KDDockWidgets_STATIC ON CACHE INTERNAL "Force KDDockWidgets to build statically") set(KDDockWidgets_STATIC ON CACHE INTERNAL "Force KDDockWidgets to build statically")
set(KDDockWidgets_QT6 ${BUILD_QT6} CACHE INTERNAL "Conform KDDockWidgets' Qt 6 setting to ours")
add_subdirectory(KDDockWidgets) add_subdirectory(KDDockWidgets)