Skip to content

Commit

Permalink
CMake: add option to build with Qt6
Browse files Browse the repository at this point in the history
QT6=ON does not build yet.
  • Loading branch information
Be-ing committed Sep 16, 2021
1 parent 9fc8b6b commit b2c2218
Showing 1 changed file with 163 additions and 138 deletions.
301 changes: 163 additions & 138 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,18 @@ if(NOT CMAKE_CONFIGURATION_TYPES)
endif()
endif()

option(QT6 "Build with Qt6" OFF)

if(APPLE)
# Minimum macOS version supported by Qt 5.12
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS version the build will be able to run on" FORCE)
# Needed for deployment target < 10.14
add_compile_options(-fno-aligned-allocation)
if(QT6)
# Minimum macOS version supported by Qt 6
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14 CACHE STRING "Minimum macOS version the build will be able to run on" FORCE)
else()
# Minimum macOS version supported by Qt 5.12
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS version the build will be able to run on" FORCE)
# Needed for deployment target < 10.14
add_compile_options(-fno-aligned-allocation)
endif()
endif()

project(mixxx VERSION 2.4.0)
Expand Down Expand Up @@ -798,14 +805,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/preferences/settingsmanager.cpp
src/preferences/upgrade.cpp
src/recording/recordingmanager.cpp
src/skin/legacy/colorschemeparser.cpp
src/skin/legacy/imgcolor.cpp
src/skin/legacy/imginvert.cpp
src/skin/legacy/imgloader.cpp
src/skin/legacy/launchimage.cpp
src/skin/legacy/legacyskinparser.cpp
src/skin/legacy/pixmapsource.cpp
src/skin/legacy/legacyskin.cpp
src/skin/qml/asyncimageprovider.cpp
src/skin/qml/qmlcontrolproxy.cpp
src/skin/qml/qmlconfigproxy.cpp
Expand Down Expand Up @@ -932,125 +931,137 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/util/workerthread.cpp
src/util/workerthreadscheduler.cpp
src/util/xml.cpp
src/waveform/guitick.cpp
src/waveform/renderers/glslwaveformrenderersignal.cpp
src/waveform/renderers/glvsynctestrenderer.cpp
src/waveform/renderers/glwaveformrendererfilteredsignal.cpp
src/waveform/renderers/glwaveformrendererrgb.cpp
src/waveform/renderers/glwaveformrenderersimplesignal.cpp
src/waveform/renderers/qtvsynctestrenderer.cpp
src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp
src/waveform/renderers/qtwaveformrenderersimplesignal.cpp
src/waveform/renderers/waveformmark.cpp
src/waveform/renderers/waveformmarkrange.cpp
src/waveform/renderers/waveformmarkset.cpp
src/waveform/renderers/waveformrenderbackground.cpp
src/waveform/renderers/waveformrenderbeat.cpp
src/waveform/renderers/waveformrendererabstract.cpp
src/waveform/renderers/waveformrendererendoftrack.cpp
src/waveform/renderers/waveformrendererfilteredsignal.cpp
src/waveform/renderers/waveformrendererhsv.cpp
src/waveform/renderers/waveformrendererpreroll.cpp
src/waveform/renderers/waveformrendererrgb.cpp
src/waveform/renderers/waveformrenderersignalbase.cpp
src/waveform/renderers/waveformrendermark.cpp
src/waveform/renderers/waveformrendermarkrange.cpp
src/waveform/renderers/waveformsignalcolors.cpp
src/waveform/renderers/waveformwidgetrenderer.cpp
src/waveform/sharedglcontext.cpp
src/waveform/visualplayposition.cpp
src/waveform/visualsmanager.cpp
src/waveform/vsyncthread.cpp
src/waveform/waveform.cpp
src/waveform/waveformfactory.cpp
src/waveform/waveformmarklabel.cpp
src/waveform/waveformwidgetfactory.cpp
src/waveform/widgets/emptywaveformwidget.cpp
src/waveform/widgets/glrgbwaveformwidget.cpp
src/waveform/widgets/glsimplewaveformwidget.cpp
src/waveform/widgets/glslwaveformwidget.cpp
src/waveform/widgets/glvsynctestwidget.cpp
src/waveform/widgets/glwaveformwidget.cpp
src/waveform/widgets/hsvwaveformwidget.cpp
src/waveform/widgets/qthsvwaveformwidget.cpp
src/waveform/widgets/qtrgbwaveformwidget.cpp
src/waveform/widgets/qtsimplewaveformwidget.cpp
src/waveform/widgets/qtvsynctestwidget.cpp
src/waveform/widgets/qtwaveformwidget.cpp
src/waveform/widgets/rgbwaveformwidget.cpp
src/waveform/widgets/softwarewaveformwidget.cpp
src/waveform/widgets/waveformwidgetabstract.cpp
src/widget/controlwidgetconnection.cpp
src/widget/hexspinbox.cpp
src/widget/paintable.cpp
src/widget/wanalysislibrarytableview.cpp
src/widget/wbasewidget.cpp
src/widget/wbattery.cpp
src/widget/wbeatspinbox.cpp
src/widget/wcolorpicker.cpp
src/widget/wcolorpickeraction.cpp
src/widget/wcombobox.cpp
src/widget/wcoverart.cpp
src/widget/wcoverartlabel.cpp
src/widget/wcoverartmenu.cpp
src/widget/wcuemenupopup.cpp
src/widget/wdisplay.cpp
src/widget/weffect.cpp
src/widget/weffectbuttonparameter.cpp
src/widget/weffectchain.cpp
src/widget/weffectparameter.cpp
src/widget/weffectparameterbase.cpp
src/widget/weffectparameterknob.cpp
src/widget/weffectparameterknobcomposed.cpp
src/widget/weffectpushbutton.cpp
src/widget/weffectselector.cpp
src/widget/whotcuebutton.cpp
src/widget/wimagestore.cpp
src/widget/wkey.cpp
src/widget/wknob.cpp
src/widget/wknobcomposed.cpp
src/widget/wlabel.cpp
src/widget/wlibrary.cpp
src/widget/wlibrarysidebar.cpp
src/widget/wlibrarytableview.cpp
src/widget/wlibrarytextbrowser.cpp
src/widget/wmainmenubar.cpp
src/widget/wnumber.cpp
src/widget/wnumberdb.cpp
src/widget/wnumberpos.cpp
src/widget/wnumberrate.cpp
src/widget/woverview.cpp
src/widget/woverviewhsv.cpp
src/widget/woverviewlmh.cpp
src/widget/woverviewrgb.cpp
src/widget/wpixmapstore.cpp
src/widget/wpushbutton.cpp
src/widget/wrecordingduration.cpp
src/widget/wscrollable.cpp
src/widget/wsearchlineedit.cpp
src/widget/wsearchrelatedtracksmenu.cpp
src/widget/wsingletoncontainer.cpp
src/widget/wsizeawarestack.cpp
src/widget/wskincolor.cpp
src/widget/wslidercomposed.cpp
src/widget/wspinny.cpp
src/widget/wsplitter.cpp
src/widget/wstarrating.cpp
src/widget/wstatuslight.cpp
src/widget/wtime.cpp
src/widget/wtrackmenu.cpp
src/widget/wtrackproperty.cpp
src/widget/wtracktableview.cpp
src/widget/wtracktableviewheader.cpp
src/widget/wtracktext.cpp
src/widget/wtrackwidgetgroup.cpp
src/widget/wvumeter.cpp
src/widget/wwaveformviewer.cpp
src/widget/wwidget.cpp
src/widget/wwidgetgroup.cpp
src/widget/wwidgetstack.cpp
src/widget/wraterange.cpp
)
if(NOT QT6)
target_sources(mixxx-lib PRIVATE
src/skin/legacy/colorschemeparser.cpp
src/skin/legacy/imgcolor.cpp
src/skin/legacy/imginvert.cpp
src/skin/legacy/imgloader.cpp
src/skin/legacy/launchimage.cpp
src/skin/legacy/legacyskinparser.cpp
src/skin/legacy/pixmapsource.cpp
src/skin/legacy/legacyskin.cpp
src/waveform/guitick.cpp
src/waveform/renderers/glslwaveformrenderersignal.cpp
src/waveform/renderers/glvsynctestrenderer.cpp
src/waveform/renderers/glwaveformrendererfilteredsignal.cpp
src/waveform/renderers/glwaveformrendererrgb.cpp
src/waveform/renderers/glwaveformrenderersimplesignal.cpp
src/waveform/renderers/qtvsynctestrenderer.cpp
src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp
src/waveform/renderers/qtwaveformrenderersimplesignal.cpp
src/waveform/renderers/waveformmark.cpp
src/waveform/renderers/waveformmarkrange.cpp
src/waveform/renderers/waveformmarkset.cpp
src/waveform/renderers/waveformrenderbackground.cpp
src/waveform/renderers/waveformrenderbeat.cpp
src/waveform/renderers/waveformrendererabstract.cpp
src/waveform/renderers/waveformrendererendoftrack.cpp
src/waveform/renderers/waveformrendererfilteredsignal.cpp
src/waveform/renderers/waveformrendererhsv.cpp
src/waveform/renderers/waveformrendererpreroll.cpp
src/waveform/renderers/waveformrendererrgb.cpp
src/waveform/renderers/waveformrenderersignalbase.cpp
src/waveform/renderers/waveformrendermark.cpp
src/waveform/renderers/waveformrendermarkrange.cpp
src/waveform/renderers/waveformsignalcolors.cpp
src/waveform/renderers/waveformwidgetrenderer.cpp
src/waveform/sharedglcontext.cpp
src/waveform/visualplayposition.cpp
src/waveform/visualsmanager.cpp
src/waveform/vsyncthread.cpp
src/waveform/waveform.cpp
src/waveform/waveformfactory.cpp
src/waveform/waveformmarklabel.cpp
src/waveform/waveformwidgetfactory.cpp
src/waveform/widgets/emptywaveformwidget.cpp
src/waveform/widgets/glrgbwaveformwidget.cpp
src/waveform/widgets/glsimplewaveformwidget.cpp
src/waveform/widgets/glslwaveformwidget.cpp
src/waveform/widgets/glvsynctestwidget.cpp
src/waveform/widgets/glwaveformwidget.cpp
src/waveform/widgets/hsvwaveformwidget.cpp
src/waveform/widgets/qthsvwaveformwidget.cpp
src/waveform/widgets/qtrgbwaveformwidget.cpp
src/waveform/widgets/qtsimplewaveformwidget.cpp
src/waveform/widgets/qtvsynctestwidget.cpp
src/waveform/widgets/qtwaveformwidget.cpp
src/waveform/widgets/rgbwaveformwidget.cpp
src/waveform/widgets/softwarewaveformwidget.cpp
src/waveform/widgets/waveformwidgetabstract.cpp
src/widget/controlwidgetconnection.cpp
src/widget/hexspinbox.cpp
src/widget/paintable.cpp
src/widget/wanalysislibrarytableview.cpp
src/widget/wbasewidget.cpp
src/widget/wbattery.cpp
src/widget/wbeatspinbox.cpp
src/widget/wcolorpicker.cpp
src/widget/wcolorpickeraction.cpp
src/widget/wcombobox.cpp
src/widget/wcoverart.cpp
src/widget/wcoverartlabel.cpp
src/widget/wcoverartmenu.cpp
src/widget/wcuemenupopup.cpp
src/widget/wdisplay.cpp
src/widget/weffect.cpp
src/widget/weffectbuttonparameter.cpp
src/widget/weffectchain.cpp
src/widget/weffectparameter.cpp
src/widget/weffectparameterbase.cpp
src/widget/weffectparameterknob.cpp
src/widget/weffectparameterknobcomposed.cpp
src/widget/weffectpushbutton.cpp
src/widget/weffectselector.cpp
src/widget/whotcuebutton.cpp
src/widget/wimagestore.cpp
src/widget/wkey.cpp
src/widget/wknob.cpp
src/widget/wknobcomposed.cpp
src/widget/wlabel.cpp
src/widget/wlibrary.cpp
src/widget/wlibrarysidebar.cpp
src/widget/wlibrarytableview.cpp
src/widget/wlibrarytextbrowser.cpp
src/widget/wmainmenubar.cpp
src/widget/wnumber.cpp
src/widget/wnumberdb.cpp
src/widget/wnumberpos.cpp
src/widget/wnumberrate.cpp
src/widget/woverview.cpp
src/widget/woverviewhsv.cpp
src/widget/woverviewlmh.cpp
src/widget/woverviewrgb.cpp
src/widget/wpixmapstore.cpp
src/widget/wpushbutton.cpp
src/widget/wrecordingduration.cpp
src/widget/wscrollable.cpp
src/widget/wsearchlineedit.cpp
src/widget/wsearchrelatedtracksmenu.cpp
src/widget/wsingletoncontainer.cpp
src/widget/wsizeawarestack.cpp
src/widget/wskincolor.cpp
src/widget/wslidercomposed.cpp
src/widget/wspinny.cpp
src/widget/wsplitter.cpp
src/widget/wstarrating.cpp
src/widget/wstatuslight.cpp
src/widget/wtime.cpp
src/widget/wtrackmenu.cpp
src/widget/wtrackproperty.cpp
src/widget/wtracktableview.cpp
src/widget/wtracktableviewheader.cpp
src/widget/wtracktext.cpp
src/widget/wtrackwidgetgroup.cpp
src/widget/wvumeter.cpp
src/widget/wwaveformviewer.cpp
src/widget/wwidget.cpp
src/widget/wwidgetgroup.cpp
src/widget/wwidgetstack.cpp
src/widget/wraterange.cpp
)
endif()
set_target_properties(mixxx-lib PROPERTIES AUTOMOC ON AUTOUIC ON CXX_CLANG_TIDY "${CLANG_TIDY}")
target_include_directories(mixxx-lib PUBLIC src "${CMAKE_CURRENT_BINARY_DIR}/src")
if(UNIX AND NOT APPLE)
Expand Down Expand Up @@ -2096,7 +2107,12 @@ target_link_libraries(mixxx-lib PRIVATE mixxx-proto)
target_include_directories(mixxx-lib SYSTEM PUBLIC lib/rigtorp/SPSCQueue/include)

# Qt
find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED)
if(QT6)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
set(QT6_NEW_COMPONENTS "SvgWidgets;Core5Compat")
else()
find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED)
endif()
find_package(Qt${QT_VERSION_MAJOR}
COMPONENTS
Concurrent
Expand All @@ -2112,6 +2128,7 @@ find_package(Qt${QT_VERSION_MAJOR}
Test
Widgets
Xml
${QT6_NEW_COMPONENTS}
REQUIRED
)
# PUBLIC is required below to find included headers
Expand All @@ -2129,6 +2146,12 @@ target_link_libraries(mixxx-lib PUBLIC
Qt${QT_VERSION_MAJOR}::Test
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Xml)
if(QT6)
foreach(COMPONENT ${QT6_NEW_COMPONENTS})
target_link_libraries(mixxx-lib PUBLIC Qt6::${COMPONENT})
endforeach()
endif()

target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER)
is_static_library(Qt_IS_STATIC Qt${QT_VERSION_MAJOR}::Core)
if(Qt_IS_STATIC)
Expand Down Expand Up @@ -2195,13 +2218,15 @@ if(APPLE)
"-weak_framework IOKit"
)
endif()
elseif(UNIX)
find_package(X11 REQUIRED)
find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED)
target_include_directories(mixxx-lib SYSTEM PUBLIC "${X11_INCLUDE_DIR}")
elseif(UNIX AND NOT APPLE)
if(NOT QT6)
find_package(X11 REQUIRED)
find_package(Qt5 COMPONENTS X11Extras REQUIRED)
target_include_directories(mixxx-lib SYSTEM PUBLIC "${X11_INCLUDE_DIR}")
target_link_libraries(mixxx-lib PRIVATE "${X11_LIBRARIES}" Qt5::X11Extras)
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED)
target_link_libraries(mixxx-lib PRIVATE
"${X11_LIBRARIES}"
Qt${QT_VERSION_MAJOR}::X11Extras
Qt${QT_VERSION_MAJOR}::DBus
)
elseif(WIN32)
Expand Down Expand Up @@ -2718,7 +2743,7 @@ endif()
# QtKeychain
option(QTKEYCHAIN "Secure credentials storage support for Live Broadcasting profiles" ON)
if(QTKEYCHAIN)
find_package(Qt5Keychain REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}Keychain REQUIRED)
target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__)
target_link_libraries(mixxx-lib PRIVATE ${QTKEYCHAIN_LIBRARIES})
target_include_directories(mixxx-lib SYSTEM PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS})
Expand Down

0 comments on commit b2c2218

Please sign in to comment.