From 1b5aa7b97a8ac4fd29cb6370791eb9640c43c700 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 8 Sep 2019 17:24:11 +0200 Subject: [PATCH 001/134] CMake: Add initial CMakeLists.txt --- CMakeLists.txt | 943 +++++++++++++++++++++++++ cmake/modules/FindChromaprint.cmake | 85 +++ cmake/modules/FindFLAC.cmake | 84 +++ cmake/modules/FindHIDAPI.cmake | 85 +++ cmake/modules/FindLAME.cmake | 75 ++ cmake/modules/FindOggVorbis.cmake | 89 +++ cmake/modules/FindPortAudio.cmake | 52 ++ cmake/modules/FindPortMidi.cmake | 77 ++ cmake/modules/FindRubberband.cmake | 84 +++ cmake/modules/FindSndFile.cmake | 85 +++ cmake/modules/FindTaglib.cmake | 133 ++++ cmake/modules/FindUpower.cmake | 85 +++ cmake/modules/Findffmpeg.cmake | 84 +++ src/analyzer/analyzerkey.cpp | 2 +- src/engine/effects/groupfeaturestate.h | 2 +- src/library/searchquery.h | 2 +- src/skin/legacyskinparser.h | 2 +- src/test/keyutilstest.cpp | 2 +- src/test/tableview_test.cpp | 2 +- src/track/beatgrid.h | 2 +- src/track/beatmap.h | 2 +- src/track/keyfactory.h | 2 +- src/track/keys.h | 2 +- src/track/keyutils.h | 2 +- src/track/trackrecord.h | 2 +- src/waveform/waveform.cpp | 2 +- src/widget/wtracktableviewheader.h | 2 +- 27 files changed, 1975 insertions(+), 14 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 cmake/modules/FindChromaprint.cmake create mode 100644 cmake/modules/FindFLAC.cmake create mode 100644 cmake/modules/FindHIDAPI.cmake create mode 100644 cmake/modules/FindLAME.cmake create mode 100644 cmake/modules/FindOggVorbis.cmake create mode 100644 cmake/modules/FindPortAudio.cmake create mode 100644 cmake/modules/FindPortMidi.cmake create mode 100644 cmake/modules/FindRubberband.cmake create mode 100644 cmake/modules/FindSndFile.cmake create mode 100644 cmake/modules/FindTaglib.cmake create mode 100644 cmake/modules/FindUpower.cmake create mode 100644 cmake/modules/Findffmpeg.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000000..860f7cece06 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,943 @@ +cmake_minimum_required(VERSION 3.1.0) +project(mixxx) +cmake_policy(SET CMP0071 NEW) +include(ExternalProject) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +# Get the current working branch +execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE +) +message(STATUS "Git branch: ${GIT_BRANCH}") + +# Get the latest abbreviated commit hash of the working branch +execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +# Check if the worktree is dirty +execute_process( + COMMAND git diff --quiet + RESULT_VARIABLE GIT_WORKTREE_DIRTY + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} +) +if(NOT GIT_WORKTREE_DIRTY EQUAL "0") + set(GIT_COMMIT_HASH "${GIT_COMMIT_HASH}+") +endif() +message(STATUS "Git commit: ${GIT_COMMIT_HASH}") +configure_file( + "${PROJECT_SOURCE_DIR}/src/build.h.template" + "${PROJECT_BINARY_DIR}/src/build.h" +) + +if(CMAKE_VERSION VERSION_LESS "3.7.0") + set(CMAKE_INCLUDE_CURRENT_DIR ON) +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + # using regular Clang or AppleClang + set(CLANG ON) +else() + set(CLANG OFF) +endif() + +# Protobuf +find_package(Protobuf REQUIRED) +protobuf_generate_cpp( + PROTO_SOURCES + PROTO_HEADERS + src/proto/beats.proto + src/proto/headers.proto + src/proto/keys.proto + src/proto/skin.proto + src/proto/waveform.proto +) + +# Mixxx itself +add_library(mixxx-lib STATIC + src/analyzer/analyzerbeats.cpp + src/analyzer/analyzerebur128.cpp + src/analyzer/analyzergain.cpp + src/analyzer/analyzerkey.cpp + src/analyzer/analyzersilence.cpp + src/analyzer/analyzerthread.cpp + src/analyzer/analyzerwaveform.cpp + src/analyzer/plugins/analyzerqueenmarybeats.cpp + src/analyzer/plugins/analyzerqueenmarykey.cpp + src/analyzer/plugins/analyzersoundtouchbeats.cpp + src/analyzer/plugins/buffering_utils.cpp + src/analyzer/trackanalysisscheduler.cpp + src/control/control.cpp + src/control/controlaudiotaperpot.cpp + src/control/controlbehavior.cpp + src/control/controleffectknob.cpp + src/control/controlencoder.cpp + src/control/controlindicator.cpp + src/control/controllinpotmeter.cpp + src/control/controllogpotmeter.cpp + src/control/controlmodel.cpp + src/control/controlobject.cpp + src/control/controlobjectscript.cpp + src/control/controlpotmeter.cpp + src/control/controlproxy.cpp + src/control/controlpushbutton.cpp + src/control/controlttrotary.cpp + src/controllers/colorjsproxy.cpp + src/controllers/controller.cpp + src/controllers/controllerdebug.cpp + src/controllers/controllerengine.cpp + src/controllers/controllerenumerator.cpp + src/controllers/controllerinputmappingtablemodel.cpp + src/controllers/controllerlearningeventfilter.cpp + src/controllers/controllermanager.cpp + src/controllers/controllermappingtablemodel.cpp + src/controllers/controlleroutputmappingtablemodel.cpp + src/controllers/controllerpresetfilehandler.cpp + src/controllers/controllerpresetinfo.cpp + src/controllers/controllerpresetinfoenumerator.cpp + src/controllers/controlpickermenu.cpp + src/controllers/delegates/controldelegate.cpp + src/controllers/delegates/midibytedelegate.cpp + src/controllers/delegates/midichanneldelegate.cpp + src/controllers/delegates/midiopcodedelegate.cpp + src/controllers/delegates/midioptionsdelegate.cpp + src/controllers/dlgcontrollerlearning.cpp + src/controllers/dlgcontrollerlearning.ui + src/controllers/dlgprefcontroller.cpp + src/controllers/dlgprefcontrollerdlg.ui + src/controllers/dlgprefcontrollers.cpp + src/controllers/dlgprefcontrollersdlg.ui + src/controllers/keyboard/keyboardeventfilter.cpp + src/controllers/learningutils.cpp + src/controllers/midi/midicontroller.cpp + src/controllers/midi/midicontrollerpresetfilehandler.cpp + src/controllers/midi/midienumerator.cpp + src/controllers/midi/midimessage.cpp + src/controllers/midi/midioutputhandler.cpp + src/controllers/midi/midiutils.cpp + src/controllers/midi/portmidicontroller.cpp + src/controllers/midi/portmidienumerator.cpp + src/controllers/softtakeover.cpp + src/database/mixxxdb.cpp + src/database/schemamanager.cpp + src/dialog/dlgabout.cpp + src/dialog/dlgaboutdlg.ui + src/dialog/dlgdevelopertools.cpp + src/dialog/dlgdevelopertoolsdlg.ui + src/effects/builtin/autopaneffect.cpp + src/effects/builtin/balanceeffect.cpp + src/effects/builtin/bessel4lvmixeqeffect.cpp + src/effects/builtin/bessel8lvmixeqeffect.cpp + src/effects/builtin/biquadfullkilleqeffect.cpp + src/effects/builtin/bitcrushereffect.cpp + src/effects/builtin/builtinbackend.cpp + src/effects/builtin/echoeffect.cpp + src/effects/builtin/filtereffect.cpp + src/effects/builtin/flangereffect.cpp + src/effects/builtin/graphiceqeffect.cpp + src/effects/builtin/linkwitzriley8eqeffect.cpp + src/effects/builtin/loudnesscontoureffect.cpp + src/effects/builtin/metronomeeffect.cpp + src/effects/builtin/moogladder4filtereffect.cpp + src/effects/builtin/parametriceqeffect.cpp + src/effects/builtin/phasereffect.cpp + src/effects/builtin/reverbeffect.cpp + src/effects/builtin/threebandbiquadeqeffect.cpp + src/effects/builtin/tremoloeffect.cpp + src/effects/effect.cpp + src/effects/effectbuttonparameterslot.cpp + src/effects/effectchain.cpp + src/effects/effectchainmanager.cpp + src/effects/effectchainslot.cpp + src/effects/effectmanifest.cpp + src/effects/effectmanifestparameter.cpp + src/effects/effectparameter.cpp + src/effects/effectparameterslot.cpp + src/effects/effectparameterslotbase.cpp + src/effects/effectrack.cpp + src/effects/effectsbackend.cpp + src/effects/effectslot.cpp + src/effects/effectsmanager.cpp + src/encoder/encoder.cpp + src/encoder/encoderbroadcastsettings.cpp + src/encoder/encoderflacsettings.cpp + src/encoder/encodermp3.cpp + src/encoder/encodermp3settings.cpp + src/encoder/encoderopussettings.cpp + src/encoder/encodersndfileflac.cpp + src/encoder/encodervorbis.cpp + src/encoder/encodervorbissettings.cpp + src/encoder/encoderwave.cpp + src/encoder/encoderwavesettings.cpp + src/engine/bufferscalers/enginebufferscale.cpp + src/engine/bufferscalers/enginebufferscalelinear.cpp + src/engine/bufferscalers/enginebufferscalerubberband.cpp + src/engine/bufferscalers/enginebufferscalest.cpp + src/engine/cachingreader/cachingreader.cpp + src/engine/cachingreader/cachingreaderchunk.cpp + src/engine/cachingreader/cachingreaderworker.cpp + src/engine/channelmixer_autogen.cpp + src/engine/channels/engineaux.cpp + src/engine/channels/enginechannel.cpp + src/engine/channels/enginedeck.cpp + src/engine/channels/enginemicrophone.cpp + src/engine/controls/bpmcontrol.cpp + src/engine/controls/clockcontrol.cpp + src/engine/controls/cuecontrol.cpp + src/engine/controls/enginecontrol.cpp + src/engine/controls/keycontrol.cpp + src/engine/controls/loopingcontrol.cpp + src/engine/controls/quantizecontrol.cpp + src/engine/controls/ratecontrol.cpp + src/engine/effects/engineeffect.cpp + src/engine/effects/engineeffectchain.cpp + src/engine/effects/engineeffectrack.cpp + src/engine/effects/engineeffectsmanager.cpp + src/engine/enginebuffer.cpp + src/engine/enginedelay.cpp + src/engine/enginemaster.cpp + src/engine/engineobject.cpp + src/engine/enginepregain.cpp + src/engine/enginesidechaincompressor.cpp + src/engine/enginetalkoverducking.cpp + src/engine/enginevumeter.cpp + src/engine/engineworker.cpp + src/engine/engineworkerscheduler.cpp + src/engine/enginexfader.cpp + src/engine/filters/enginefilter.cpp + src/engine/filters/enginefilterbessel4.cpp + src/engine/filters/enginefilterbessel8.cpp + src/engine/filters/enginefilterbiquad1.cpp + src/engine/filters/enginefilterbutterworth4.cpp + src/engine/filters/enginefilterbutterworth8.cpp + src/engine/filters/enginefilterlinkwitzriley2.cpp + src/engine/filters/enginefilterlinkwitzriley4.cpp + src/engine/filters/enginefilterlinkwitzriley8.cpp + src/engine/filters/enginefiltermoogladder4.cpp + src/engine/positionscratchcontroller.cpp + src/engine/readaheadmanager.cpp + src/engine/sidechain/enginenetworkstream.cpp + src/engine/sidechain/enginerecord.cpp + src/engine/sidechain/enginesidechain.cpp + src/engine/sidechain/networkinputstreamworker.cpp + src/engine/sidechain/networkoutputstreamworker.cpp + src/engine/sync/basesyncablelistener.cpp + src/engine/sync/enginesync.cpp + src/engine/sync/internalclock.cpp + src/engine/sync/synccontrol.cpp + src/errordialoghandler.cpp + src/library/analysisfeature.cpp + src/library/analysislibrarytablemodel.cpp + src/library/autodj/autodjfeature.cpp + src/library/autodj/autodjprocessor.cpp + src/library/autodj/dlgautodj.cpp + src/library/autodj/dlgautodj.ui + src/library/banshee/bansheedbconnection.cpp + src/library/banshee/bansheefeature.cpp + src/library/banshee/bansheeplaylistmodel.cpp + src/library/baseexternallibraryfeature.cpp + src/library/baseexternalplaylistmodel.cpp + src/library/baseexternaltrackmodel.cpp + src/library/baseplaylistfeature.cpp + src/library/basesqltablemodel.cpp + src/library/basetrackcache.cpp + src/library/bpmdelegate.cpp + src/library/browse/browsefeature.cpp + src/library/browse/browsetablemodel.cpp + src/library/browse/browsethread.cpp + src/library/browse/foldertreemodel.cpp + src/library/columncache.cpp + src/library/coverart.cpp + src/library/coverartcache.cpp + src/library/coverartdelegate.cpp + src/library/coverartutils.cpp + src/library/crate/cratefeature.cpp + src/library/crate/cratefeaturehelper.cpp + src/library/crate/cratestorage.cpp + src/library/crate/cratetablemodel.cpp + src/library/dao/analysisdao.cpp + src/library/dao/autodjcratesdao.cpp + src/library/dao/cuedao.cpp + src/library/dao/directorydao.cpp + src/library/dao/libraryhashdao.cpp + src/library/dao/playlistdao.cpp + src/library/dao/settingsdao.cpp + src/library/dao/trackdao.cpp + src/library/dlganalysis.cpp + src/library/dlganalysis.ui + src/library/dlgcoverartfullsize.cpp + src/library/dlgcoverartfullsize.ui + src/library/dlghidden.cpp + src/library/dlghidden.ui + src/library/dlgmissing.cpp + src/library/dlgmissing.ui + src/library/dlgtagfetcher.cpp + src/library/dlgtagfetcher.ui + src/library/dlgtrackinfo.cpp + src/library/dlgtrackinfo.ui + src/library/dlgtrackmetadataexport.cpp + src/library/export/dlgtrackexport.ui + src/library/export/trackexportdlg.cpp + src/library/export/trackexportwizard.cpp + src/library/export/trackexportworker.cpp + src/library/hiddentablemodel.cpp + src/library/itunes/itunesfeature.cpp + src/library/library.cpp + src/library/librarycontrol.cpp + src/library/libraryfeature.cpp + src/library/librarytablemodel.cpp + src/library/locationdelegate.cpp + src/library/missingtablemodel.cpp + src/library/mixxxlibraryfeature.cpp + src/library/parser.cpp + src/library/parsercsv.cpp + src/library/parserm3u.cpp + src/library/parserpls.cpp + src/library/playlistfeature.cpp + src/library/playlisttablemodel.cpp + src/library/previewbuttondelegate.cpp + src/library/proxytrackmodel.cpp + src/library/recording/dlgrecording.cpp + src/library/recording/dlgrecording.ui + src/library/recording/recordingfeature.cpp + src/library/rhythmbox/rhythmboxfeature.cpp + src/library/scanner/importfilestask.cpp + src/library/scanner/libraryscanner.cpp + src/library/scanner/libraryscannerdlg.cpp + src/library/scanner/recursivescandirectorytask.cpp + src/library/scanner/scannertask.cpp + src/library/searchquery.cpp + src/library/searchqueryparser.cpp + src/library/setlogfeature.cpp + src/library/sidebarmodel.cpp + src/library/songdownloader.cpp + src/library/stardelegate.cpp + src/library/stareditor.cpp + src/library/starrating.cpp + src/library/tableitemdelegate.cpp + src/library/trackcollection.cpp + src/library/traktor/traktorfeature.cpp + src/library/treeitem.cpp + src/library/treeitemmodel.cpp + src/mixer/auxiliary.cpp + src/mixer/baseplayer.cpp + src/mixer/basetrackplayer.cpp + src/mixer/deck.cpp + src/mixer/microphone.cpp + src/mixer/playerinfo.cpp + src/mixer/playermanager.cpp + src/mixer/previewdeck.cpp + src/mixer/sampler.cpp + src/mixer/samplerbank.cpp + src/mixxx.cpp + src/mixxxapplication.cpp + src/musicbrainz/acoustidclient.cpp + src/musicbrainz/chromaprinter.cpp + src/musicbrainz/crc.c + src/musicbrainz/gzip.cpp + src/musicbrainz/musicbrainzclient.cpp + src/musicbrainz/network.cpp + src/musicbrainz/tagfetcher.cpp + src/preferences/broadcastprofile.cpp + src/preferences/broadcastsettings.cpp + src/preferences/broadcastsettings_legacy.cpp + src/preferences/broadcastsettingsmodel.cpp + src/preferences/configobject.cpp + src/preferences/dialog/dlgprefautodj.cpp + src/preferences/dialog/dlgprefautodjdlg.ui + src/preferences/dialog/dlgprefbeats.cpp + src/preferences/dialog/dlgprefbeatsdlg.ui + src/preferences/dialog/dlgprefcrossfader.cpp + src/preferences/dialog/dlgprefcrossfaderdlg.ui + src/preferences/dialog/dlgprefdeck.cpp + src/preferences/dialog/dlgprefdeckdlg.ui + src/preferences/dialog/dlgprefeffects.cpp + src/preferences/dialog/dlgprefeffectsdlg.ui + src/preferences/dialog/dlgprefeq.cpp + src/preferences/dialog/dlgprefeqdlg.ui + src/preferences/dialog/dlgpreferences.cpp + src/preferences/dialog/dlgpreferencesdlg.ui + src/preferences/dialog/dlgprefinterface.cpp + src/preferences/dialog/dlgprefinterfacedlg.ui + src/preferences/dialog/dlgprefkey.cpp + src/preferences/dialog/dlgprefkeydlg.ui + src/preferences/dialog/dlgpreflibrary.cpp + src/preferences/dialog/dlgpreflibrarydlg.ui + src/preferences/dialog/dlgpreflv2dlg.ui + src/preferences/dialog/dlgprefnovinyl.cpp + src/preferences/dialog/dlgprefnovinyldlg.ui + src/preferences/dialog/dlgprefrecord.cpp + src/preferences/dialog/dlgprefrecorddlg.ui + src/preferences/dialog/dlgprefreplaygain.cpp + src/preferences/dialog/dlgprefreplaygaindlg.ui + src/preferences/dialog/dlgprefsound.cpp + src/preferences/dialog/dlgprefsounddlg.ui + src/preferences/dialog/dlgprefsounditem.cpp + src/preferences/dialog/dlgprefsounditem.ui + src/preferences/dialog/dlgprefvinyldlg.ui + src/preferences/dialog/dlgprefwaveform.cpp + src/preferences/dialog/dlgprefwaveformdlg.ui + src/preferences/dlgpreferencepage.cpp + src/preferences/effectsettingsmodel.cpp + src/preferences/replaygainsettings.cpp + src/preferences/settingsmanager.cpp + src/preferences/upgrade.cpp + src/recording/recordingmanager.cpp + src/skin/colorschemeparser.cpp + src/skin/imgcolor.cpp + src/skin/imginvert.cpp + src/skin/imgloader.cpp + src/skin/launchimage.cpp + src/skin/legacyskinparser.cpp + src/skin/pixmapsource.cpp + src/skin/skincontext.cpp + src/skin/skinloader.cpp + src/skin/svgparser.cpp + src/skin/tooltips.cpp + src/soundio/sounddevice.cpp + src/soundio/sounddevicenetwork.cpp + src/soundio/sounddeviceportaudio.cpp + src/soundio/soundmanager.cpp + src/soundio/soundmanagerconfig.cpp + src/soundio/soundmanagerutil.cpp + src/sources/audiosource.cpp + src/sources/audiosourcestereoproxy.cpp + src/sources/metadatasourcetaglib.cpp + src/sources/soundsource.cpp + src/sources/soundsourceflac.cpp + src/sources/soundsourceoggvorbis.cpp + src/sources/soundsourceproviderregistry.cpp + src/sources/soundsourceproxy.cpp + src/sources/soundsourcesndfile.cpp + src/track/albuminfo.cpp + src/track/beatfactory.cpp + src/track/beatgrid.cpp + src/track/beatmap.cpp + src/track/beats.cpp + src/track/beatutils.cpp + src/track/bpm.cpp + src/track/cue.cpp + src/track/globaltrackcache.cpp + src/track/keyfactory.cpp + src/track/keys.cpp + src/track/keyutils.cpp + src/track/playcounter.cpp + src/track/replaygain.cpp + src/track/track.cpp + src/track/trackfile.cpp + src/track/trackinfo.cpp + src/track/trackmetadata.cpp + src/track/trackmetadatataglib.cpp + src/track/tracknumbers.cpp + src/track/trackrecord.cpp + src/track/trackref.cpp + src/util/audiosignal.cpp + src/util/autohidpi.cpp + src/util/battery/battery.cpp + src/util/cmdlineargs.cpp + src/util/color/color.cpp + src/util/color/predefinedcolor.cpp + src/util/console.cpp + src/util/db/dbconnection.cpp + src/util/db/dbconnectionpool.cpp + src/util/db/dbconnectionpooled.cpp + src/util/db/dbconnectionpooler.cpp + src/util/db/dbid.cpp + src/util/db/fwdsqlquery.cpp + src/util/db/fwdsqlqueryselectresult.cpp + src/util/db/sqllikewildcardescaper.cpp + src/util/db/sqlqueryfinisher.cpp + src/util/db/sqlstringformatter.cpp + src/util/db/sqltransaction.cpp + src/util/desktophelper.cpp + src/util/dnd.cpp + src/util/duration.cpp + src/util/experiment.cpp + src/util/file.cpp + src/util/indexrange.cpp + src/util/logger.cpp + src/util/logging.cpp + src/util/mac.cpp + src/util/movinginterquartilemean.cpp + src/util/performancetimer.cpp + src/util/readaheadsamplebuffer.cpp + src/util/rlimit.cpp + src/util/rotary.cpp + src/util/sample.cpp + src/util/samplebuffer.cpp + src/util/sandbox.cpp + src/util/screensaver.cpp + src/util/sleepableqthread.cpp + src/util/stat.cpp + src/util/statmodel.cpp + src/util/statsmanager.cpp + src/util/tapfilter.cpp + src/util/task.cpp + src/util/threadcputimer.cpp + src/util/time.cpp + src/util/timer.cpp + src/util/valuetransformer.cpp + src/util/version.cpp + src/util/widgethider.cpp + src/util/widgetrendertimer.cpp + 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/waveformmarkproperties.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/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/wcombobox.cpp + src/widget/wcoverart.cpp + src/widget/wcoverartlabel.cpp + src/widget/wcoverartmenu.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/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/wsearchlineedit.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/wtrackproperty.cpp + src/widget/wtracktableview.cpp + src/widget/wtracktableviewheader.cpp + src/widget/wtracktext.cpp + src/widget/wvumeter.cpp + src/widget/wwaveformviewer.cpp + src/widget/wwidget.cpp + src/widget/wwidgetgroup.cpp + src/widget/wwidgetstack.cpp + ${PROTO_SOURCES} + ${PROTO_HEADERS}) +set_target_properties(mixxx-lib PROPERTIES AUTOMOC ON AUTOUIC ON) +target_include_directories(mixxx-lib PUBLIC src "${PROJECT_BINARY_DIR}/src") +target_compile_definitions(mixxx-lib PRIVATE SETTINGS_FILE="mixxx.cfg") +if(UNIX AND NOT APPLE) + target_compile_definitions(mixxx-lib PRIVATE SETTINGS_PATH=".mixxx/") +endif() + +if(WIN32) + target_compile_definitions(mixxx-lib PRIVATE __WINDOWS__) + + # Restrict ATL to XP-compatible SDK functions. + # TODO(rryan): Remove once we ditch XP support. + target_compile_definitions(mixxx-lib PUBLIC _ATL_XP_TARGETING) + + # Helps prevent duplicate symbols + target_compile_definitions(mixxx-lib PUBLIC _ATL_MIN_CRT) + + # Need this on Windows until we have UTF16 support in Mixxx use stl min max + # defines + # http://connect.microsoft.com/VisualStudio/feedback/details/553420/std-cpp- + # max-and-std-cpp-min-not-available-in-visual-c-2010 + target_compile_definitions(mixxx-lib PUBLIC NOMINMAX UNICODE) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + target_compile_definitions(mixxx-lib PUBLIC WIN32) + else() + target_compile_definitions(mixxx-lib PUBLIC WIN64) + endif() + + target_link_libraries(mixxx-lib PUBLIC shell32) + + # Causes the cmath headers to declare M_PI and friends. + # http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx We could define this + # in our headers but then include order matters since headers we don't control + # may include cmath first. + target_compile_definitions(mixxx-lib PUBLIC _USE_MATH_DEFINES) +elseif(UNIX) + target_compile_definitions(mixxx-lib PRIVATE __UNIX__) + if(APPLE) + target_compile_definitions(mixxx-lib PUBLIC __APPLE__) + else() + target_compile_definitions( + mixxx-lib PUBLIC UNIX_SHARE_PATH="${CMAKE_INSTALL_PREFIX}/share/mixxx/") + target_compile_definitions( + mixxx-lib PUBLIC UNIX_LIB_PATH="${CMAKE_INSTALL_PREFIX}/lib/mixxx/") + if(CMAKE_SYSTEM_NAME STREQUAL Linux) + target_compile_definitions(mixxx-lib PUBLIC __LINUX__) + elseif(CMAKE_SYSTEM_NAME MATCHES "^.*BSD$") + target_compile_definitions(mixxx-lib PUBLIC __BSD__) + endif() + endif() +endif() + +# The mixxx executable +add_executable(mixxx src/main.cpp ${PROTO_HEADERS}) +target_link_libraries(mixxx PUBLIC mixxx-lib) + +add_library(mixxx-qrc STATIC res/mixxx.cc res/mixxx.qrc) +set_target_properties(mixxx-qrc PROPERTIES AUTOMOC ON AUTOUIC ON) +target_link_libraries(mixxx-lib PUBLIC mixxx-qrc) + +target_include_directories(mixxx-lib PUBLIC + ${PROTOBUF_INCLUDE_DIRS} + "${CMAKE_CURRENT_BINARY_DIR}" +) + +# +# Dependencies +# + +# Chromaprint +find_package(Chromaprint REQUIRED) +target_link_libraries(mixxx-lib PUBLIC Chromaprint::Chromaprint) + +# Ebur128Mit +ExternalProject_Add(libebur128 + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" + INSTALL_COMMAND "" +) +add_dependencies(mixxx-lib libebur128) +target_include_directories(mixxx-lib PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" +) +target_link_directories(mixxx-lib PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" +) +target_link_libraries(mixxx-lib PUBLIC "ebur128") + +# FidLib +add_library(fidlib OBJECT lib/fidlib/fidlib.c) +if(MSVC) + target_compile_definitions(fidlib PRIVATE T_MSVC) +elseif(MINGW) + target_compile_definitions(fidlib PRIVATE T_MINGW) +else() + target_compile_definitions(fidlib PRIVATE T_LINUX) +endif() +target_include_directories(mixxx-lib PUBLIC lib/fidlib) +target_link_libraries(mixxx-lib PUBLIC fidlib) + +# FLAC +find_package(FLAC REQUIRED) +target_link_libraries(mixxx-lib PUBLIC FLAC::FLAC) + +# FpClassify This is a wrapper around the fpclassify function that prevents +# inlining It is compiled without optimization and allows to use these function +# from -ffast-math optimized objects +add_library(FpClassify STATIC src/util/fpclassify.cpp) +target_link_libraries(mixxx-lib PUBLIC FpClassify) + +# gtest +target_include_directories(mixxx-lib PUBLIC lib/gtest-1.7.0/include) + +# HIDAPI +find_package(HIDAPI REQUIRED) +target_sources(mixxx-lib PRIVATE + src/controllers/hid/hidcontroller.cpp + src/controllers/hid/hidenumerator.cpp + src/controllers/hid/hidcontrollerpresetfilehandler.cpp +) +target_link_libraries(mixxx-lib PUBLIC HIDAPI::LibUSB) + +# LAME +find_package(LAME REQUIRED) +target_link_libraries(mixxx-lib PUBLIC LAME::LAME) + +# OpenGL +set(OpenGL_GL_PREFERENCE "GLVND") +find_package(OpenGL REQUIRED) +target_include_directories(mixxx-lib PUBLIC OpenGL) +target_link_libraries(mixxx-lib PUBLIC OpenGL) + +# Ogg Vorbis +find_package(OggVorbis REQUIRED) +target_include_directories(mixxx-lib PUBLIC ${OggVorbis_INCLUDE_DIRS}) +target_link_libraries(mixxx-lib PUBLIC ${OggVorbis_LIBRARIES}) + +# PortAudio +find_package(PortAudio REQUIRED) +target_include_directories(mixxx-lib PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) +target_link_libraries(mixxx-lib PUBLIC ${PORTAUDIO_LIBRARIES}) + +# PortAudio Ring Buffer +add_library(PortAudioRingBuffer STATIC lib/portaudio/pa_ringbuffer.c) +target_include_directories(mixxx-lib PUBLIC lib/portaudio) +target_link_libraries(mixxx-lib PUBLIC PortAudioRingBuffer) + +# PortMidi +find_package(PortMidi REQUIRED) +target_include_directories(mixxx-lib PUBLIC ${PortMidi_INCLUDE_DIRS}) +target_link_libraries(mixxx-lib PUBLIC ${PortMidi_LIBRARIES}) + +# Protobuf +target_include_directories(mixxx-lib PUBLIC ${PROTOBUF_INCLUDE_DIRS}) +target_link_libraries(mixxx-lib PUBLIC ${PROTOBUF_LIBRARIES}) + +# Qt +find_package(Qt5 + COMPONENTS + Concurrent + Core + Gui + Network + OpenGL + Script + ScriptTools + Sql + Svg + Test + Widgets + Xml + REQUIRED +) +target_link_libraries(mixxx-lib PUBLIC + Qt5::Concurrent + Qt5::Core + Qt5::Gui + Qt5::Network + Qt5::OpenGL + Qt5::Script + Qt5::ScriptTools + Qt5::Sql + Qt5::Svg + Qt5::Test + Qt5::Widgets + Qt5::Xml) +if(UNIX AND NOT APPLE) + find_package(X11 REQUIRED) + find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED) + target_link_libraries(mixxx-lib PUBLIC X11 Qt5::X11Extras Qt5::DBus) +elseif(WIN32) + find_package(Qt5 + COMPONENTS + AccessibilitySupport + EventDispatcherSupport + FontDatabaseSupport + ThemeSupport + WindowsUIAutomationSupport + REQUIRED + ) + target_link_libraries(mixxx-lib PUBLIC + Qt5::AccessibilitySupport + Qt5::EventDispatcherSupport + Qt5::FontDatabaseSupport + Qt5::ThemeSupport + Qt5::WindowsUIAutomationSupport + ) +endif() + +# QtScriptByteArray +add_library(QtScriptByteArray STATIC + lib/qtscript-bytearray/bytearrayclass.cpp + lib/qtscript-bytearray/bytearrayprototype.cpp +) +set_target_properties(QtScriptByteArray PROPERTIES AUTOMOC ON) +target_link_libraries(QtScriptByteArray Qt5::Core) +target_include_directories(mixxx-lib PUBLIC lib/qtscript-bytearray) +target_link_libraries(mixxx-lib PUBLIC QtScriptByteArray) + +# Queen Mary DSP +add_library(QueenMaryDsp STATIC + # lib/qm-dsp/base/KaiserWindow.cpp + lib/qm-dsp/base/Pitch.cpp + # lib/qm-dsp/base/SincWindow.cpp + lib/qm-dsp/dsp/chromagram/Chromagram.cpp + lib/qm-dsp/dsp/chromagram/ConstantQ.cpp + lib/qm-dsp/dsp/keydetection/GetKeyMode.cpp + # lib/qm-dsp/dsp/mfcc/MFCC.cpp + lib/qm-dsp/dsp/onsets/DetectionFunction.cpp + lib/qm-dsp/dsp/onsets/PeakPicking.cpp + lib/qm-dsp/dsp/phasevocoder/PhaseVocoder.cpp + lib/qm-dsp/dsp/rateconversion/Decimator.cpp + # lib/qm-dsp/dsp/rateconversion/DecimatorB.cpp + # lib/qm-dsp/dsp/rateconversion/Resampler.cpp + # lib/qm-dsp/dsp/rhythm/BeatSpectrum.cpp + # lib/qm-dsp/dsp/segmentation/ClusterMeltSegmenter.cpp + # lib/qm-dsp/dsp/segmentation/Segmenter.cpp + # lib/qm-dsp/dsp/segmentation/cluster_melt.c + # lib/qm-dsp/dsp/segmentation/cluster_segmenter.c + lib/qm-dsp/dsp/signalconditioning/DFProcess.cpp + lib/qm-dsp/dsp/signalconditioning/FiltFilt.cpp + lib/qm-dsp/dsp/signalconditioning/Filter.cpp + lib/qm-dsp/dsp/signalconditioning/Framer.cpp + lib/qm-dsp/dsp/tempotracking/DownBeat.cpp + lib/qm-dsp/dsp/tempotracking/TempoTrack.cpp + lib/qm-dsp/dsp/tempotracking/TempoTrackV2.cpp + lib/qm-dsp/dsp/tonal/ChangeDetectionFunction.cpp + lib/qm-dsp/dsp/tonal/TCSgram.cpp + lib/qm-dsp/dsp/tonal/TonalEstimator.cpp + lib/qm-dsp/dsp/transforms/FFT.cpp + # lib/qm-dsp/dsp/wavelet/Wavelet.cpp + lib/qm-dsp/ext/kissfft/kiss_fft.c + lib/qm-dsp/ext/kissfft/tools/kiss_fftr.c + # lib/qm-dsp/hmm/hmm.c + lib/qm-dsp/maths/Correlation.cpp + # lib/qm-dsp/maths/CosineDistance.cpp + lib/qm-dsp/maths/KLDivergence.cpp lib/qm-dsp/maths/MathUtilities.cpp + # lib/qm-dsp/maths/pca/pca.c + # lib/qm-dsp/thread/Thread.cpp +) +target_compile_definitions(QueenMaryDsp PRIVATE kiss_fft_scalar=double) +if(UNIX) + target_compile_definitions(QueenMaryDsp PRIVATE USE_PTHREADS) +endif() +# build.env.Append(CPPPATH="#lib/qm-dsp") +target_include_directories(QueenMaryDsp PRIVATE lib/qm-dsp) +target_include_directories(mixxx-lib PRIVATE lib/qm-dsp lib/qm-dsp/include) +target_link_libraries(mixxx-lib PUBLIC QueenMaryDsp) + +# ReplayGain +add_library(ReplayGain STATIC lib/replaygain/replaygain.cpp) +target_include_directories(mixxx-lib PRIVATE lib/replaygain) +target_link_libraries(mixxx-lib PRIVATE ReplayGain) + +# Reverb +add_library(Reverb STATIC lib/reverb/Reverb.cc) +target_include_directories(Reverb PRIVATE src) +target_link_libraries(Reverb PUBLIC Qt5::Core) +target_include_directories(mixxx-lib PRIVATE lib/reverb) +target_link_libraries(mixxx-lib PUBLIC Reverb) + +# Rubberband +find_package(Rubberband REQUIRED) +target_link_libraries(mixxx-lib PUBLIC Rubberband::Rubberband) + +# SndFile +find_package(SndFile REQUIRED) +target_link_libraries(mixxx-lib PUBLIC SndFile::SndFile) + +# SoundTouch +add_library(SoundTouch STATIC + lib/soundtouch/AAFilter.cpp + lib/soundtouch/BPMDetect.cpp + lib/soundtouch/FIFOSampleBuffer.cpp + lib/soundtouch/FIRFilter.cpp + lib/soundtouch/InterpolateCubic.cpp + lib/soundtouch/InterpolateLinear.cpp + lib/soundtouch/InterpolateShannon.cpp + lib/soundtouch/PeakFinder.cpp + lib/soundtouch/RateTransposer.cpp + lib/soundtouch/SoundTouch.cpp + lib/soundtouch/TDStretch.cpp + lib/soundtouch/cpu_detect_x86.cpp + lib/soundtouch/mmx_optimized.cpp + lib/soundtouch/sse_optimized.cpp +) +target_include_directories(SoundTouch PUBLIC lib/soundtouch) +target_link_libraries(mixxx-lib PUBLIC SoundTouch) + +# TagLib +find_package(Taglib REQUIRED) +target_include_directories(mixxx-lib PUBLIC ${TAGLIB_INCLUDE_DIRS}) +target_link_libraries(mixxx-lib PUBLIC ${TAGLIB_LIBRARIES}) + +# Upower +if(UNIX AND NOT APPLE) + find_package(GLIB COMPONENTS gobject REQUIRED) + find_package(Upower REQUIRED) + target_include_directories(mixxx-lib PUBLIC ${GLIB_INCLUDE_DIRS}) + target_link_libraries(mixxx-lib PUBLIC ${GLIB_LIBRARIES} ${GLIB_GOBJECT_LIBRARIES}) + target_link_libraries(mixxx-lib PUBLIC Upower::Upower) +endif() + +# iOS/OS X Frameworks +if(APPLE) + # The iOS/OS X security framework is used to implement sandboxing. + find_library(SECURITY_LIBRARY Security REQUIRED) + target_link_libraries(mixxx-lib PUBLIC ${SECURITY_LIBRARY}) + + find_library(CORESERVICES_LIBRARY CoreServices REQUIRED) + target_link_libraries(mixxx-lib PUBLIC ${CORESERVICES_LIBRARY}) + + find_library(FOUNDATION_LIBRARY Foundation REQUIRED) + target_link_libraries(mixxx-lib PUBLIC ${FOUNDATION_LIBRARY}) + + # Used for battery measurements and controlling the screensaver on OS X and iOS. + find_library(IOKIT_LIBRARY IOKit REQUIRED) + target_link_libraries(mixxx-lib PUBLIC ${IOKIT_LIBRARY}) +endif() diff --git a/cmake/modules/FindChromaprint.cmake b/cmake/modules/FindChromaprint.cmake new file mode 100644 index 00000000000..fe13ff921b7 --- /dev/null +++ b/cmake/modules/FindChromaprint.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindChromaprint +--------------- + +Finds the Chromaprint library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Chromaprint::Chromaprint`` + The Chromaprint library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Chromaprint_FOUND`` + True if the system has the Chromaprint library. +``Chromaprint_INCLUDE_DIRS`` + Include directories needed to use Chromaprint. +``Chromaprint_LIBRARIES`` + Libraries needed to link to Chromaprint. +``Chromaprint_DEFINITIONS`` + Compile defitions needed to use Chromaprint. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Chromaprint_INCLUDE_DIR`` + The directory containing ``chromaprint.h``. +``Chromaprint_LIBRARY`` + The path to the Chromaprint library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_CHROMAPRINT QUIET libchromaprint) + +find_path(Chromaprint_INCLUDE_DIR + NAMES chromaprint.h + PATHS ${PC_Chromaprint_INCLUDE_DIRS} + PATH_SUFFIXES chromaprint + DOC "Chromaprint include directory") +mark_as_advanced(Chromaprint_INCLUDE_DIR) + +find_library(Chromaprint_LIBRARY + NAMES chromaprint + PATHS ${PC_Chromaprint_LIBRARY_DIRS} + DOC "Chromaprint library" +) +mark_as_advanced(Chromaprint_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Chromaprint + DEFAULT_MSG + Chromaprint_LIBRARY + Chromaprint_INCLUDE_DIR +) + +if(Chromaprint_FOUND) + set(Chromaprint_LIBRARIES "${Chromaprint_LIBRARY}") + set(Chromaprint_INCLUDE_DIRS "${Chromaprint_INCLUDE_DIR}") + set(Chromaprint_DEFINITIONS ${PC_Chromaprint_CFLAGS_OTHER}) + + if(NOT TARGET Chromaprint::Chromaprint) + add_library(Chromaprint::Chromaprint UNKNOWN IMPORTED) + set_target_properties(Chromaprint::Chromaprint + PROPERTIES + IMPORTED_LOCATION "${Chromaprint_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Chromaprint_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Chromaprint_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindFLAC.cmake b/cmake/modules/FindFLAC.cmake new file mode 100644 index 00000000000..09d16343d56 --- /dev/null +++ b/cmake/modules/FindFLAC.cmake @@ -0,0 +1,84 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindFLAC +-------- + +Finds the FLAC library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``FLAC::FLAC`` + The FLAC library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``FLAC_FOUND`` + True if the system has the FLAC library. +``FLAC_INCLUDE_DIRS`` + Include directories needed to use FLAC. +``FLAC_LIBRARIES`` + Libraries needed to link to FLAC. +``FLAC_DEFINITIONS`` + Compile defitions needed to use FLAC. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``FLAC_INCLUDE_DIR`` + The directory containing ``FLAC/all.h``. +``FLAC_LIBRARY`` + The path to the FLAC library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_FLAC QUIET flac) + +find_path(FLAC_INCLUDE_DIR + NAMES FLAC/all.h + PATHS ${PC_FLAC_INCLUDE_DIRS} + DOC "FLAC include directory") +mark_as_advanced(FLAC_INCLUDE_DIR) + +find_library(FLAC_LIBRARY + NAMES FLAC + PATHS ${PC_FLAC_LIBRARY_DIRS} + DOC "FLAC library" +) +mark_as_advanced(FLAC_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + FLAC + DEFAULT_MSG + FLAC_LIBRARY + FLAC_INCLUDE_DIR +) + +if(FLAC_FOUND) + set(FLAC_LIBRARIES "${FLAC_LIBRARY}") + set(FLAC_INCLUDE_DIRS "${FLAC_INCLUDE_DIR}") + set(FLAC_DEFINITIONS ${PC_FLAC_CFLAGS_OTHER}) + + if(NOT TARGET FLAC::FLAC) + add_library(FLAC::FLAC UNKNOWN IMPORTED) + set_target_properties(FLAC::FLAC + PROPERTIES + IMPORTED_LOCATION "${FLAC_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_FLAC_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindHIDAPI.cmake b/cmake/modules/FindHIDAPI.cmake new file mode 100644 index 00000000000..86e3ca66703 --- /dev/null +++ b/cmake/modules/FindHIDAPI.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindHIDAPI +---------- + +Finds the HIDAPI library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``HIDAPI::libusb`` + The hidapi-libusb library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``HIDAPI_FOUND`` + True if the system has the HIDAPI library. +``HIDAPI_INCLUDE_DIRS`` + Include directories needed to use HIDAPI. +``HIDAPI_LIBRARIES`` + Libraries needed to link to HIDAPI. +``HIDAPI_DEFINITIONS`` + Compile defitions needed to use HIDAPI. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``HIDAPI_INCLUDE_DIR`` + The directory containing ``hidapi/hidapi.h``. +``HIDAPI_LIBRARY`` + The path to the hidapi-lbusb library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_HIDAPI QUIET hidapi-libusb) + +find_path(HIDAPI_INCLUDE_DIR + NAMES hidapi.h + PATHS ${PC_HIDAPI_INCLUDE_DIRS} + PATH_SUFFIXES hidapi + DOC "HIDAPI include directory") +mark_as_advanced(HIDAPI_INCLUDE_DIR) + +find_library(HIDAPI_LIBRARY + NAMES hidapi-libusb + PATHS ${PC_HIDAPI_LIBRARY_DIRS} + DOC "HIDAPI library" +) +mark_as_advanced(HIDAPI_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + HIDAPI + DEFAULT_MSG + HIDAPI_LIBRARY + HIDAPI_INCLUDE_DIR +) + +if(HIDAPI_FOUND) + set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}") + set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}") + set(HIDAPI_DEFINITIONS ${PC_HIDAPI_CFLAGS_OTHER}) + + if(NOT TARGET HIDAPI::LibUSB) + add_library(HIDAPI::LibUSB UNKNOWN IMPORTED) + set_target_properties(HIDAPI::LibUSB + PROPERTIES + IMPORTED_LOCATION "${HIDAPI_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_HIDAPI_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${HIDAPI_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindLAME.cmake b/cmake/modules/FindLAME.cmake new file mode 100644 index 00000000000..95e1ee453e6 --- /dev/null +++ b/cmake/modules/FindLAME.cmake @@ -0,0 +1,75 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindLAME +-------- + +Finds the LAME library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``LAME::LAME`` + The LAME library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``LAME_FOUND`` + True if the system has the LAME library. +``LAME_INCLUDE_DIRS`` + Include directories needed to use LAME. +``LAME_LIBRARIES`` + Libraries needed to link to LAME. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``LAME_INCLUDE_DIR`` + The directory containing ``lame/lame.h``. +``LAME_LIBRARY`` + The path to the LAME library. + +#]=======================================================================] + +find_path(LAME_INCLUDE_DIR + NAMES lame/lame.h + DOC "LAME include directory") +mark_as_advanced(LAME_INCLUDE_DIR) + +find_library(LAME_LIBRARY + NAMES mp3lame mp3lame-static + DOC "LAME library" +) +mark_as_advanced(LAME_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + LAME + DEFAULT_MSG + LAME_LIBRARY + LAME_INCLUDE_DIR +) + +if(LAME_FOUND) + set(LAME_LIBRARIES "${LAME_LIBRARY}") + set(LAME_INCLUDE_DIRS "${LAME_INCLUDE_DIR}") + + if(NOT TARGET LAME::LAME) + add_library(LAME::LAME UNKNOWN IMPORTED) + set_target_properties(LAME::LAME + PROPERTIES + IMPORTED_LOCATION "${LAME_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LAME_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindOggVorbis.cmake b/cmake/modules/FindOggVorbis.cmake new file mode 100644 index 00000000000..82b7922bd95 --- /dev/null +++ b/cmake/modules/FindOggVorbis.cmake @@ -0,0 +1,89 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindOggVorbis +--------------- + +Finds the OggVorbis library. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``OggVorbis_FOUND`` + True if the system has the OggVorbis library. +``OggVorbis_INCLUDE_DIRS`` + Include directories needed to use OggVorbis. +``OggVorbis_LIBRARIES`` + Libraries needed to link to OggVorbis. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Ogg_INCLUDE_DIR`` + The directory containing ``ogg/ogg.h``. +``Ogg_LIBRARY`` + The path to the OggVorbis library. +``Vorbis_INCLUDE_DIR`` + The directory containing ``vorbis/vorbisfile.h``. +``Vorbis_LIBRARY`` + The path to the vorbis library. +``VorbisFile_LIBRARY`` + The path to the vorbisfile library. +``VorbisEnc_LIBRARY`` + The path to the vorbisenc library. +``Vorbis_LIBRARIES`` + Libraries needed to link to vorbis. + +#]=======================================================================] +find_path(Ogg_INCLUDE_DIR NAMES ogg/ogg.h DOC "Ogg include directory") +mark_as_advanced(Ogg_INCLUDE_DIR) + +find_library(Ogg_LIBRARY NAMES ogg DOC "Ogg library") +mark_as_advanced(Ogg_LIBRARY) + +find_path(Vorbis_INCLUDE_DIR + NAMES vorbis/vorbisfile.h + DOC "Vorbis include directory" +) +mark_as_advanced(Vorbis_INCLUDE_DIR) + +find_library(Vorbis_LIBRARY NAMES vorbis DOC "Vorbis library") +mark_as_advanced(Vorbis_LIBRARY) + +find_library(VorbisFile_LIBRARY NAMES vorbisfile DOC "Vorbisfile library") +mark_as_advanced(VorbisFile_LIBRARY) + +if(NOT MSVC) + find_library(VorbisEnc_LIBRARY NAMES vorbisenc DOC "Vorbisenc library") + mark_as_advanced(VorbisEnc_LIBRARY) + set(Vorbis_LIBRARIES + ${VorbisEnc_LIBRARY} + ${VorbisFile_LIBRARY} + ${Vorbis_LIBRARY} + ) +else() + set(Vorbis_LIBRARIES ${VorbisFile_LIBRARY} ${Vorbis_LIBRARY}) +endif() +mark_as_advanced(Vorbis_LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + OggVorbis + REQUIRED_VARS + Ogg_INCLUDE_DIR + Vorbis_INCLUDE_DIR + Ogg_LIBRARY + Vorbis_LIBRARIES +) + +if(OggVorbis_FOUND) + set(OggVorbis_LIBRARIES ${Ogg_LIBRARY} ${Vorbis_LIBRARIES}) + set(OggVorbis_INCLUDE_DIRS ${Ogg_INCLUDE_DIR} ${Vorbis_INCLUDE_DIR}) +endif() diff --git a/cmake/modules/FindPortAudio.cmake b/cmake/modules/FindPortAudio.cmake new file mode 100644 index 00000000000..8aa17d4448f --- /dev/null +++ b/cmake/modules/FindPortAudio.cmake @@ -0,0 +1,52 @@ +# - Try to find Portaudio +# Once done this will define +# +# PORTAUDIO_FOUND - system has Portaudio +# PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory +# PORTAUDIO_LIBRARIES - Link these to use Portaudio + +include(FindPkgConfig) +pkg_check_modules(PC_PORTAUDIO portaudio-2.0) + +find_path(PORTAUDIO_INCLUDE_DIRS + NAMES + portaudio.h + PATHS + /usr/local/include + /usr/include + HINTS + ${PC_PORTAUDIO_INCLUDEDIR} +) + +find_library(PORTAUDIO_LIBRARIES + NAMES + portaudio + PATHS + /usr/local/lib + /usr/lib + /usr/lib64 + HINTS + ${PC_PORTAUDIO_LIBDIR} +) + +mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) + +# Found PORTAUDIO, but it may be version 18 which is not acceptable. +if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_INCLUDES_SAVED ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${PORTAUDIO_INCLUDE_DIRS}) + CHECK_CXX_SOURCE_COMPILES( + "#include \nPaDeviceIndex pa_find_device_by_name(const char *name); int main () {return 0;}" + PORTAUDIO2_FOUND) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVED}) + unset(CMAKE_REQUIRED_INCLUDES_SAVED) + if(PORTAUDIO2_FOUND) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) + else(PORTAUDIO2_FOUND) + message(STATUS + " portaudio.h not compatible (requires API 2.0)") + set(PORTAUDIO_FOUND FALSE) + endif(PORTAUDIO2_FOUND) +endif() diff --git a/cmake/modules/FindPortMidi.cmake b/cmake/modules/FindPortMidi.cmake new file mode 100644 index 00000000000..9f9b705664f --- /dev/null +++ b/cmake/modules/FindPortMidi.cmake @@ -0,0 +1,77 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindPortMidi +--------------- + +Finds the PortMidi library. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``PortMidi_FOUND`` + True if the system has the PortMidi library. +``PortMidi_INCLUDE_DIRS`` + Include directories needed to use PortMidi. +``PortMidi_LIBRARIES`` + Libraries needed to link to PortMidi. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``PortMidi_INCLUDE_DIR`` + The directory containing ``portmidi.h``. +``PortTime_INCLUDE_DIR`` + The directory containing ``porttime.h``. +``PortMidi_LIBRARY`` + The path to the PortMidi library. +``PortTime_LIBRARY`` + The path to the PortTime library. + +#]=======================================================================] + +find_path(PortMidi_INCLUDE_DIR + NAMES portmidi.h + PATH_SUFFIXES portmidi + DOC "PortMidi include directory") +mark_as_advanced(PortMidi_INCLUDE_DIR) + +find_path(PortTime_INCLUDE_DIR + NAMES porttime.h + PATH_SUFFIXES portmidi porttime + DOC "PortTime include directory") +mark_as_advanced(PortTime_INCLUDE_DIR) + +find_library(PortMidi_LIBRARY + NAMES portmidi portmidi_s + DOC "PortMidi library" +) +mark_as_advanced(PortMidi_LIBRARY) + +find_library(PortTime_LIBRARY + NAMES porttime + DOC "PortTime library" +) +mark_as_advanced(PortTime_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + PortMidi + DEFAULT_MSG + PortMidi_LIBRARY + PortMidi_INCLUDE_DIR + PortTime_LIBRARY + PortTime_INCLUDE_DIR +) + +if(PortMidi_FOUND) + set(PortMidi_LIBRARIES ${PortMidi_LIBRARY} ${PortTime_LIBRARY}) + set(PortMidi_INCLUDE_DIRS ${PortMidi_INCLUDE_DIR} ${PortTime_INCLUDE_DIR}) +endif() diff --git a/cmake/modules/FindRubberband.cmake b/cmake/modules/FindRubberband.cmake new file mode 100644 index 00000000000..548cd4c0fb1 --- /dev/null +++ b/cmake/modules/FindRubberband.cmake @@ -0,0 +1,84 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindRubberband +-------------- + +Finds the Rubberband library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Rubberband::Rubberband`` + The Rubberband library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Rubberband_FOUND`` + True if the system has the Rubberband library. +``Rubberband_INCLUDE_DIRS`` + Include directories needed to use Rubberband. +``Rubberband_LIBRARIES`` + Libraries needed to link to Rubberband. +``Rubberband_DEFINITIONS`` + Compile defitions needed to use Rubberband. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Rubberband_INCLUDE_DIR`` + The directory containing ``rubberband/RubberBandStretcher.h``. +``Rubberband_LIBRARY`` + The path to the Rubberband library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Rubberband QUIET rubberband) + +find_path(Rubberband_INCLUDE_DIR + NAMES rubberband/RubberBandStretcher.h + PATHS ${PC_Rubberband_INCLUDE_DIRS} + DOC "Rubberband include directory") +mark_as_advanced(Rubberband_INCLUDE_DIR) + +find_library(Rubberband_LIBRARY + NAMES rubberband + PATHS ${PC_Rubberband_LIBRARY_DIRS} + DOC "Rubberband library" +) +mark_as_advanced(Rubberband_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Rubberband + DEFAULT_MSG + Rubberband_LIBRARY + Rubberband_INCLUDE_DIR +) + +if(Rubberband_FOUND) + set(Rubberband_LIBRARIES "${Rubberband_LIBRARY}") + set(Rubberband_INCLUDE_DIRS "${Rubberband_INCLUDE_DIR}") + set(Rubberband_DEFINITIONS ${PC_Rubberband_CFLAGS_OTHER}) + + if(NOT TARGET Rubberband::Rubberband) + add_library(Rubberband::Rubberband UNKNOWN IMPORTED) + set_target_properties(Rubberband::Rubberband + PROPERTIES + IMPORTED_LOCATION "${Rubberband_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Rubberband_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Rubberband_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindSndFile.cmake b/cmake/modules/FindSndFile.cmake new file mode 100644 index 00000000000..843ae15633e --- /dev/null +++ b/cmake/modules/FindSndFile.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindSndFile +----------- + +Finds the SndFile library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``SndFile::SndFile`` + The SndFile library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``SndFile_FOUND`` + True if the system has the SndFile library. +``SndFile_INCLUDE_DIRS`` + Include directories needed to use SndFile. +``SndFile_LIBRARIES`` + Libraries needed to link to SndFile. +``SndFile_DEFINITIONS`` + Compile defitions needed to use SndFile. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``SndFile_INCLUDE_DIR`` + The directory containing ``sndfile.h``. +``SndFile_LIBRARY`` + The path to the SndFile library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_SndFile QUIET sndfile) + +find_path(SndFile_INCLUDE_DIR + NAMES sndfile.h + PATHS ${PC_SndFile_INCLUDE_DIRS} + PATH_SUFFIXES sndfile + DOC "SndFile include directory") +mark_as_advanced(SndFile_INCLUDE_DIR) + +find_library(SndFile_LIBRARY + NAMES sndfile sndfile-1 + PATHS ${PC_SndFile_LIBRARY_DIRS} + DOC "SndFile library" +) +mark_as_advanced(SndFile_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + SndFile + DEFAULT_MSG + SndFile_LIBRARY + SndFile_INCLUDE_DIR +) + +if(SndFile_FOUND) + set(SndFile_LIBRARIES "${SndFile_LIBRARY}") + set(SndFile_INCLUDE_DIRS "${SndFile_INCLUDE_DIR}") + set(SndFile_DEFINITIONS ${PC_SndFile_CFLAGS_OTHER}) + + if(NOT TARGET SndFile::SndFile) + add_library(SndFile::SndFile UNKNOWN IMPORTED) + set_target_properties(SndFile::SndFile + PROPERTIES + IMPORTED_LOCATION "${SndFile_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_SndFile_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${SndFile_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindTaglib.cmake b/cmake/modules/FindTaglib.cmake new file mode 100644 index 00000000000..958f0d02d28 --- /dev/null +++ b/cmake/modules/FindTaglib.cmake @@ -0,0 +1,133 @@ +# - Try to find the Taglib library +# Once done this will define +# +# TAGLIB_FOUND - system has the taglib library +# TAGLIB_CFLAGS - the taglib cflags +# TAGLIB_LIBRARIES - The libraries needed to use taglib + +# Copyright (c) 2006, Laurent Montel, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if(NOT TAGLIB_MIN_VERSION) + set(TAGLIB_MIN_VERSION "1.7") +endif() + +if(NOT WIN32) + find_program(TAGLIBCONFIG_EXECUTABLE + NAMES taglib-config + PATHS ${BIN_INSTALL_DIR} + ) +endif() + +#reset vars +set(TAGLIB_LIBRARIES) +set(TAGLIB_CFLAGS) + +# if taglib-config has been found +if(TAGLIBCONFIG_EXECUTABLE) + + exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION) + + if(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}") + message(STATUS "TagLib version too old: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}") + set(TAGLIB_FOUND FALSE) + else() + + exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES) + + exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS) + + if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS) + set(TAGLIB_FOUND TRUE) + endif() + + string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDE_DIRS "${TAGLIB_CFLAGS}") + string(SUBSTRING ${TAGLIB_INCLUDE_DIRS} 0 -1 TAGLIB_INCLUDE_DIRS) #we remove the initial ; +endif() + +mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES) + +else() + + find_path(TAGLIB_INCLUDE_DIRS + NAMES tag.h + PATH_SUFFIXES taglib + PATHS ${INCLUDE_INSTALL_DIR} + ) + + if(NOT WIN32) + # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX + find_library(TAGLIB_LIBRARIES tag PATHS ${LIB_INSTALL_DIR}) + + else() + + # 1. get all possible libnames + set(args PATHS ${LIB_INSTALL_DIR}) + set(newargs "") + set(libnames_release "") + set(libnames_debug "") + + list(LENGTH args listCount) + + # just one name + list(APPEND libnames_release "tag") + list(APPEND libnames_debug "tagd") + + set(newargs ${args}) + + # search the release lib + find_library(TAGLIB_LIBRARIES_RELEASE + NAMES ${libnames_release} + ${newargs} + ) + + # search the debug lib + find_library(TAGLIB_LIBRARIES_DEBUG + NAMES ${libnames_debug} + ${newargs} + ) + + if(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG) + + # both libs found + set(TAGLIB_LIBRARIES optimized ${TAGLIB_LIBRARIES_RELEASE} + debug ${TAGLIB_LIBRARIES_DEBUG} + ) + + else() + + if(TAGLIB_LIBRARIES_RELEASE) + # only release found + set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_RELEASE}) + + else() + # only debug (or nothing) found + set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_DEBUG}) + + endif() + + endif() + + mark_as_advanced(TAGLIB_LIBRARIES_RELEASE) + mark_as_advanced(TAGLIB_LIBRARIES_DEBUG) + + endif() + + include(FindPackageMessage) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_INCLUDE_DIRS_ TAGLIB_LIBRARIES) + +endif() + + +if(TAGLIB_FOUND) + if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE) + message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}") + endif() +else() + if(Taglib_FIND_REQUIRED) + message(FATAL_ERROR "Could not find Taglib") + endif() +endif() diff --git a/cmake/modules/FindUpower.cmake b/cmake/modules/FindUpower.cmake new file mode 100644 index 00000000000..4d7b91aa9c3 --- /dev/null +++ b/cmake/modules/FindUpower.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindUpower +---------- + +Finds the Upower library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Upower::Upower`` + The Upower library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Upower_FOUND`` + True if the system has the Upower library. +``Upower_INCLUDE_DIRS`` + Include directories needed to use Upower. +``Upower_LIBRARIES`` + Libraries needed to link to Upower. +``Upower_DEFINITIONS`` + Compile defitions needed to use Upower. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Upower_INCLUDE_DIR`` + The directory containing ``libupower-glib/upower.h``. +``Upower_LIBRARY`` + The path to the Upower library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Upower QUIET upower-glib) + +find_path(Upower_INCLUDE_DIR + NAMES upower.h + PATH_SUFFIXES upower-glib libupower-glib + PATHS ${PC_Upower_INCLUDE_DIRS} + DOC "Upower include directory") +mark_as_advanced(Upower_INCLUDE_DIR) + +find_library(Upower_LIBRARY + NAMES upower-glib + PATHS ${PC_Upower_LIBRARY_DIRS} + DOC "Upower library" +) +mark_as_advanced(Upower_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Upower + DEFAULT_MSG + Upower_LIBRARY + Upower_INCLUDE_DIR +) + +if(Upower_FOUND) + set(Upower_LIBRARIES "${Upower_LIBRARY}") + set(Upower_INCLUDE_DIRS "${Upower_INCLUDE_DIR}") + set(Upower_DEFINITIONS ${PC_Upower_CFLAGS_OTHER}) + + if(NOT TARGET Upower::Upower) + add_library(Upower::Upower UNKNOWN IMPORTED) + set_target_properties(Upower::Upower + PROPERTIES + IMPORTED_LOCATION "${Upower_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Upower_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Upower_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/Findffmpeg.cmake b/cmake/modules/Findffmpeg.cmake new file mode 100644 index 00000000000..52637a2b959 --- /dev/null +++ b/cmake/modules/Findffmpeg.cmake @@ -0,0 +1,84 @@ +# Copyright (c) 2014 Andrew Kelley +# This file is MIT licensed. +# See http://opensource.org/licenses/MIT + +# FFMPEG_FOUND +# FFMPEG_INCLUDE_DIRS +# FFMPEG_LIBRARIES + +# AVFILTER_FOUND +# AVFILTER_INCLUDE_DIRS +# AVFILTER_LIBRARIES + +# AVFORMAT_FOUND +# AVFORMAT_INCLUDE_DIRS +# AVFORMAT_LIBRARIES + +# AVCODEC_FOUND +# AVCODEC_INCLUDE_DIRS +# AVCODEC_LIBRARIES + +# AVUTIL_FOUND +# AVUTIL_INCLUDE_DIRS +# AVUTIL_LIBRARIES + +find_path(AVFILTER_INCLUDE_DIRS NAMES libavfilter/avfilter.h) +find_library(AVFILTER_LIBRARIES NAMES avfilter) +if(AVFILTER_LIBRARIES AND AVFILTER_INCLUDE_DIRS) + set(AVFILTER_FOUND TRUE) +else() + set(AVFILTER_FOUND FALSE) +endif() + +find_path(AVFORMAT_INCLUDE_DIRS NAMES libavformat/avformat.h) +find_library(AVFORMAT_LIBRARIES NAMES avformat) +if(AVFORMAT_LIBRARIES AND AVFORMAT_INCLUDE_DIRS) + set(AVFORMAT_FOUND TRUE) +else() + set(AVFORMAT_FOUND FALSE) +endif() + +find_path(AVCODEC_INCLUDE_DIRS NAMES libavcodec/avcodec.h) +find_library(AVCODEC_LIBRARIES NAMES avcodec) +if(AVCODEC_LIBRARIES AND AVCODEC_INCLUDE_DIRS) + set(AVCODEC_FOUND TRUE) +else() + set(AVCODEC_FOUND FALSE) +endif() + +find_path(AVUTIL_INCLUDE_DIRS NAMES libavutil/avutil.h) +find_library(AVUTIL_LIBRARIES NAMES avutil) +if(AVUTIL_LIBRARIES AND AVUTIL_INCLUDE_DIRS) + set(AVUTIL_FOUND TRUE) +else() + set(AVUTIL_FOUND FALSE) +endif() + +if(AVFILTER_FOUND AND AVFORMAT_FOUND AND AVCODEC_FOUND AND AVUTIL_FOUND) + set(FFMPEG_FOUND TRUE) + set(FFMPEG_INCLUDE_DIRS + ${AVFILTER_INCLUDE_DIRS} + ${AVFORMAT_INCLUDE_DIRS} + ${AVCODEC_INCLUDE_DIRS} + ${AVUTIL_INCLUDE_DIRS}) + set(FFMPEG_LIBRARIES + ${AVFILTER_LIBRARIES} + ${AVFORMAT_LIBRARIES} + ${AVCODEC_LIBRARIES} + ${AVUTIL_LIBRARIES}) +else() + set(FFMPEG_FOUND FALSE) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FFMPEG DEFAULT_MSG + AVFILTER_LIBRARIES AVFILTER_INCLUDE_DIRS + AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIRS + AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIRS + AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIRS) + +mark_as_advanced( + AVFILTER_INCLUDE_DIRS AVFILTER_LIBRARIES + AVFORMAT_INCLUDE_DIRS AVFORMAT_LIBRARIES + AVCODEC_INCLUDE_DIRS AVCODEC_LIBRARIES + AVUTIL_INCLUDE_DIRS AVUTIL_LIBRARIES) diff --git a/src/analyzer/analyzerkey.cpp b/src/analyzer/analyzerkey.cpp index cba32abf0b9..e5530b5a88f 100644 --- a/src/analyzer/analyzerkey.cpp +++ b/src/analyzer/analyzerkey.cpp @@ -5,7 +5,7 @@ #include "analyzer/constants.h" #include "analyzer/plugins/analyzerqueenmarykey.h" -#include "proto/keys.pb.h" +#include "keys.pb.h" #include "track/keyfactory.h" // static diff --git a/src/engine/effects/groupfeaturestate.h b/src/engine/effects/groupfeaturestate.h index 9096caf83a0..f36282ff7df 100644 --- a/src/engine/effects/groupfeaturestate.h +++ b/src/engine/effects/groupfeaturestate.h @@ -1,7 +1,7 @@ #ifndef GROUPFEATURESTATE_H #define GROUPFEATURESTATE_H -#include "proto/keys.pb.h" +#include "keys.pb.h" struct GroupFeatureState { GroupFeatureState() diff --git a/src/library/searchquery.h b/src/library/searchquery.h index a26f046bbb3..c78dafe6ab2 100644 --- a/src/library/searchquery.h +++ b/src/library/searchquery.h @@ -11,7 +11,7 @@ #include #include "track/track.h" -#include "proto/keys.pb.h" +#include "keys.pb.h" #include "util/assert.h" #include "util/memory.h" #include "library/crate/cratestorage.h" diff --git a/src/skin/legacyskinparser.h b/src/skin/legacyskinparser.h index ad685462540..0440bd536fe 100644 --- a/src/skin/legacyskinparser.h +++ b/src/skin/legacyskinparser.h @@ -11,7 +11,7 @@ #include "skin/skinparser.h" #include "vinylcontrol/vinylcontrolmanager.h" #include "skin/tooltips.h" -#include "proto/skin.pb.h" +#include "skin.pb.h" #include "util/memory.h" class WBaseWidget; diff --git a/src/test/keyutilstest.cpp b/src/test/keyutilstest.cpp index cd876b0fa9a..ceb5ccd0e2b 100644 --- a/src/test/keyutilstest.cpp +++ b/src/test/keyutilstest.cpp @@ -3,7 +3,7 @@ #include #include "track/keyutils.h" -#include "proto/keys.pb.h" +#include "keys.pb.h" using ::testing::ElementsAre; diff --git a/src/test/tableview_test.cpp b/src/test/tableview_test.cpp index 34f638a1d69..4de8f88a4a0 100644 --- a/src/test/tableview_test.cpp +++ b/src/test/tableview_test.cpp @@ -4,7 +4,7 @@ #include #include -#include "proto/headers.pb.h" +#include "headers.pb.h" #include "widget/wtracktableviewheader.h" class HeaderViewStateTest : public testing::Test { diff --git a/src/track/beatgrid.h b/src/track/beatgrid.h index 90ad5ca0c85..a109d3c0616 100644 --- a/src/track/beatgrid.h +++ b/src/track/beatgrid.h @@ -5,7 +5,7 @@ #include "track/track.h" #include "track/beats.h" -#include "proto/beats.pb.h" +#include "beats.pb.h" #define BEAT_GRID_1_VERSION "BeatGrid-1.0" #define BEAT_GRID_2_VERSION "BeatGrid-2.0" diff --git a/src/track/beatmap.h b/src/track/beatmap.h index 184e28d35ca..c101a668831 100644 --- a/src/track/beatmap.h +++ b/src/track/beatmap.h @@ -12,7 +12,7 @@ #include "track/track.h" #include "track/beats.h" -#include "proto/beats.pb.h" +#include "beats.pb.h" #define BEAT_MAP_VERSION "BeatMap-1.0" diff --git a/src/track/keyfactory.h b/src/track/keyfactory.h index fbd64bee663..b267f657b1d 100644 --- a/src/track/keyfactory.h +++ b/src/track/keyfactory.h @@ -6,7 +6,7 @@ #include #include "track/keys.h" -#include "proto/keys.pb.h" +#include "keys.pb.h" #include "track/track.h" class KeyFactory { diff --git a/src/track/keys.h b/src/track/keys.h index faa0f2f7b4d..8d34f1e87cc 100644 --- a/src/track/keys.h +++ b/src/track/keys.h @@ -5,7 +5,7 @@ #include #include -#include "proto/keys.pb.h" +#include "keys.pb.h" #define KEY_MAP_VERSION "KeyMap-1.0" diff --git a/src/track/keyutils.h b/src/track/keyutils.h index b23f999dae7..b286d17de74 100644 --- a/src/track/keyutils.h +++ b/src/track/keyutils.h @@ -6,7 +6,7 @@ #include #include "control/controlproxy.h" -#include "proto/keys.pb.h" +#include "keys.pb.h" #include "track/keys.h" #include "util/math.h" diff --git a/src/track/trackrecord.h b/src/track/trackrecord.h index 54d9d5f25c0..cea479040b3 100644 --- a/src/track/trackrecord.h +++ b/src/track/trackrecord.h @@ -1,6 +1,6 @@ #pragma once -#include "proto/keys.pb.h" +#include "keys.pb.h" #include "track/trackid.h" #include "track/cue.h" diff --git a/src/waveform/waveform.cpp b/src/waveform/waveform.cpp index 177b3570608..e9e7a2b83bd 100644 --- a/src/waveform/waveform.cpp +++ b/src/waveform/waveform.cpp @@ -1,7 +1,7 @@ #include #include "waveform/waveform.h" -#include "proto/waveform.pb.h" +#include "waveform.pb.h" using namespace mixxx::track; diff --git a/src/widget/wtracktableviewheader.h b/src/widget/wtracktableviewheader.h index 7fa38e7a44a..94fc138f361 100644 --- a/src/widget/wtracktableviewheader.h +++ b/src/widget/wtracktableviewheader.h @@ -12,7 +12,7 @@ #include #include -#include "proto/headers.pb.h" +#include "headers.pb.h" class TrackModel; From c277f5c8f476287bb9d89a7dcaed5a708c1cf1e1 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 23:33:25 +0200 Subject: [PATCH 002/134] CMake: Add missing FindGLIB.cmake module --- cmake/modules/FindGLIB.cmake | 122 +++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 cmake/modules/FindGLIB.cmake diff --git a/cmake/modules/FindGLIB.cmake b/cmake/modules/FindGLIB.cmake new file mode 100644 index 00000000000..71c982cd4c1 --- /dev/null +++ b/cmake/modules/FindGLIB.cmake @@ -0,0 +1,122 @@ +# - Try to find Glib and its components (gio, gobject etc) +# Once done, this will define +# +# GLIB_FOUND - system has Glib +# GLIB_INCLUDE_DIRS - the Glib include directories +# GLIB_LIBRARIES - link these to use Glib +# +# Optionally, the COMPONENTS keyword can be passed to find_package() +# and Glib components can be looked for. Currently, the following +# components can be used, and they define the following variables if +# found: +# +# gio: GLIB_GIO_LIBRARIES +# gobject: GLIB_GOBJECT_LIBRARIES +# gmodule: GLIB_GMODULE_LIBRARIES +# gthread: GLIB_GTHREAD_LIBRARIES +# +# Note that the respective _INCLUDE_DIR variables are not set, since +# all headers are in the same directory as GLIB_INCLUDE_DIRS. +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +find_package(PkgConfig) +pkg_check_modules(PC_GLIB QUIET glib-2.0) + +find_library(GLIB_LIBRARIES + NAMES glib-2.0 + HINTS ${PC_GLIB_LIBDIR} + ${PC_GLIB_LIBRARY_DIRS} +) + +# Files in glib's main include path may include glibconfig.h, which, +# for some odd reason, is normally in $LIBDIR/glib-2.0/include. +get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH) +find_path(GLIBCONFIG_INCLUDE_DIR + NAMES glibconfig.h + HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR} + ${PC_GLIB_INCLUDEDIR} ${PC_GLIB_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0/include +) + +find_path(GLIB_INCLUDE_DIR + NAMES glib.h + HINTS ${PC_GLIB_INCLUDEDIR} + ${PC_GLIB_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0 +) + +set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR}) + +# Version detection +if (EXISTS "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h") + file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS) + string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") + set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}") + string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") + set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}") + string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") + set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}") + set(GLIB_VERSION "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}") +endif () + +# Additional Glib components. We only look for libraries, as not all of them +# have corresponding headers and all headers are installed alongside the main +# glib ones. +foreach (_component ${GLIB_FIND_COMPONENTS}) + if (${_component} STREQUAL "gio") + find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES) + elseif (${_component} STREQUAL "gobject") + find_library(GLIB_GOBJECT_LIBRARIES NAMES gobject-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GOBJECT_LIBRARIES) + elseif (${_component} STREQUAL "gmodule") + find_library(GLIB_GMODULE_LIBRARIES NAMES gmodule-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GMODULE_LIBRARIES) + elseif (${_component} STREQUAL "gthread") + find_library(GLIB_GTHREAD_LIBRARIES NAMES gthread-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GTHREAD_LIBRARIES) + elseif (${_component} STREQUAL "gio-unix") + # gio-unix is compiled as part of the gio library, but the include paths + # are separate from the shared glib ones. Since this is currently only used + # by WebKitGTK we don't go to extraordinary measures beyond pkg-config. + pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0) + endif () +endforeach () + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLIB REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS} + VERSION_VAR GLIB_VERSION) + +mark_as_advanced( + GLIBCONFIG_INCLUDE_DIR + GLIB_GIO_LIBRARIES + GLIB_GIO_UNIX_LIBRARIES + GLIB_GMODULE_LIBRARIES + GLIB_GOBJECT_LIBRARIES + GLIB_GTHREAD_LIBRARIES + GLIB_INCLUDE_DIR + GLIB_INCLUDE_DIRS + GLIB_LIBRARIES +) From 0d5609fd66ce10480a72a1ac25ded66e423c01ad Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 23:19:04 +0200 Subject: [PATCH 003/134] CMake: Add optional features --- CMakeLists.txt | 311 ++++++++++++++++++++++++ cmake/modules/FindGPerfTools.cmake | 120 +++++++++ cmake/modules/FindHSS1394.cmake | 75 ++++++ cmake/modules/FindID3Tag.cmake | 85 +++++++ cmake/modules/FindLibUSB.cmake | 86 +++++++ cmake/modules/FindLilv.cmake | 85 +++++++ cmake/modules/FindMAD.cmake | 85 +++++++ cmake/modules/FindMP4.cmake | 84 +++++++ cmake/modules/FindMP4v2.cmake | 84 +++++++ cmake/modules/FindMediaFoundation.cmake | 20 ++ cmake/modules/FindModplug.cmake | 84 +++++++ cmake/modules/FindOpus.cmake | 87 +++++++ cmake/modules/FindSQLite3.cmake | 85 +++++++ cmake/modules/FindShout.cmake | 84 +++++++ cmake/modules/FindWavPack.cmake | 84 +++++++ 15 files changed, 1459 insertions(+) create mode 100644 cmake/modules/FindGPerfTools.cmake create mode 100644 cmake/modules/FindHSS1394.cmake create mode 100644 cmake/modules/FindID3Tag.cmake create mode 100644 cmake/modules/FindLibUSB.cmake create mode 100644 cmake/modules/FindLilv.cmake create mode 100644 cmake/modules/FindMAD.cmake create mode 100644 cmake/modules/FindMP4.cmake create mode 100644 cmake/modules/FindMP4v2.cmake create mode 100644 cmake/modules/FindMediaFoundation.cmake create mode 100644 cmake/modules/FindModplug.cmake create mode 100644 cmake/modules/FindOpus.cmake create mode 100644 cmake/modules/FindSQLite3.cmake create mode 100644 cmake/modules/FindShout.cmake create mode 100644 cmake/modules/FindWavPack.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 860f7cece06..c27a88ae020 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -941,3 +941,314 @@ if(APPLE) find_library(IOKIT_LIBRARY IOKit REQUIRED) target_link_libraries(mixxx-lib PUBLIC ${IOKIT_LIBRARY}) endif() + +# +# Features +# + +# Battery meter +if(WIN32 OR UNIX) + set(BATTERY_SUPPORTED ON) +else() + set(BATTERY_SUPPORTED OFF) +endif() +option(BATTERY_ENABLED "Battery meter support" "${BATTERY_SUPPORTED}") +if(BATTERY_ENABLED) + if(WIN32) + target_sources(mixxx-lib PRIVATE src/util/battery/batterywindows.cpp) + elseif(APPLE) + target_sources(mixxx-lib PRIVATE src/util/battery/batterymac.cpp) + elseif(UNIX) + target_sources(mixxx-lib PRIVATE src/util/battery/batterylinux.cpp) + else() + message(FATAL_ERROR "Battery support is not implemented for the target platform.") + endif() + target_compile_definitions(mixxx-lib PUBLIC __BATTERY__) +endif() + + +# Build Time +option(BUILDTIME_ENABLED "Use __DATE__ and __TIME__" ON) +if(NOT BUILDTIME_ENABLED) + # Distributions like openSUSE use tools (e. g. build-compare) to detect + # whether a built binary differs from a former build to avoid unneeded + # publishing of packages. + # If __DATE__ and __TIME__ are used the built binary differs always but + # the tools cannot detect the root and publish a new package although + # the only change is caused by __DATE__ and __TIME__. + target_compile_definitions(mixxx-lib PUBLIC DISABLE_BUILDTIME) +endif() + +# Clang Color Diagnostics +option(CLANG_COLORDIAG_ENABLED "Clang color diagnostics" OFF) +if(CLANG_COLORDIAG_ENABLED) + if(NOT CLANG) + message(FATAL_ERROR "Color Diagnostics are only available when using Clang.") + endif() + target_compile_options(mixxx-lib PUBLIC -fcolor-diagnostics) +endif() + +# Clang Sanitizers +set(CLANG_SANITIZERS "") +option(CLANG_ASAN_ENABLED "Clang Address Sanitizer" OFF) +if(CLANG_ASAN_ENABLED) + list(APPEND CLANG_SANITIZERS "address") +endif() +option(CLANG_UBSAN_ENABLED "Clang Undefined Behaviour Sanitizer" OFF) +if(CLANG_UBSAN_ENABLED) + list(APPEND CLANG_SANITIZERS "undefined") +endif() +option(CLANG_TSAN_ENABLED "Clang Thread Sanitizer" OFF) +if(CLANG_TSAN_ENABLED) + list(APPEND CLANG_SANITIZERS "thread") +endif() +if(NOT CLANG_SANITIZERS STREQUAL "") + if(NOT CLANG) + message(FATAL_ERROR "Clang Sanitizers are only available when using Clang.") + endif() + list(JOIN CLANG_SANITIZERS "," CLANG_SANITZERS_JOINED) + target_compile_options(mixxx-lib PUBLIC -fsanitize=${CLANG_SANITZERS_JOINED}) +endif() + +# CoreAudio MP3/AAC Decoder +option(COREAUDIO_ENABLED "CoreAudio MP3/AAC Decoder" "${APPLE}") +if(COREAUDIO_ENABLED) + target_sources(mixxx-lib PRIVATE + src/sources/soundsourcecoreaudio.cpp + src/sources/v1/legacyaudiosourceadapter.cpp + lib/apple/CAStreamBasicDescription.cpp + ) + find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox REQUIRED) + find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED) + target_link_libraries(mixxx-lib PUBLIC + ${AUDIOTOOLBOX_LIBRARY} + ${COREFOUNDATION_LIBRARY} + ) + target_compile_definitions(mixxx-lib PRIVATE __COREAUDIO__) +endif() + +# FAAD AAC audio file decoder plugin +find_package(MP4) +find_package(MP4v2) +if(MP4_FOUND OR MP4v2_FOUND) + set(FAAD_ENABLED_DEFAULT ON) +else() + set(FAAD_ENABLED_DEFAULT OFF) +endif() +option(FAAD_ENABLED + "FAAD AAC audio file decoder support" + "${FAAD_ENABLED_DEFAULT}" +) +if(FAAD_ENABLED) + if(NOT MP4_FOUND AND NOT MP4v2_FOUND) + message(FATAL_ERROR "FAAD AAC audio support requires libmp4 or libmp4v2.") + endif() + target_sources(mixxx-lib PRIVATE + src/sources/soundsourcem4a.cpp + src/sources/libfaadloader.cpp + ) + target_compile_definitions(mixxx-lib PRIVATE __FAAD__) + if(MP4v2_FOUND) + target_compile_definitions(mixxx-lib PRIVATE __MP4V2__) + target_link_libraries(mixxx-lib PUBLIC MP4v2::MP4v2) + else() + target_link_libraries(mixxx-lib PUBLIC MP4::MP4) + endif() +endif() + +# Google PerfTools +option(GPERFTOOLS_ENABLED "Google PerfTools libtcmalloc linkage" OFF) +option(GPERFTOOLSPROFILER_ENABLED "Google PerfTools libprofiler linkage" OFF) +if(GPERFTOOLS_ENABLED OR GPERFTOOLSPROFILER_ENABLED) + find_package(GPerfTools REQUIRED) + if(GPERFTOOLS_ENABLED) + target_link_libraries(mixxx-lib PUBLIC GPerfTools::tcmalloc) + endif() + if(PERFTOOLSPROFILER_ENABLED) + target_link_libraries(mixxx-lib PUBLIC GPerfTools::profiler) + endif() +endif() + +# HSS1394 MIDI device +find_package(HSS1394) +option(HSS1394_ENABLED "HSS1394 MIDI device support" "${HSS1394_FOUND}") +if(HSS1394_ENABLED) + target_sources(mixxx-lib PRIVATE + src/controllers/midi/hss1394controller.cpp + src/controllers/midi/hss1394enumerator.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __HSS1394__) + target_link_libraries(mixxx-lib PUBLIC HSS1394::HSS1394) +endif() + +# Lilv (LV2) +find_package(Lilv) +option(LILV_ENABLED "Lilv (LV2) support" "${Lilv_FOUND}") +if(LILV_ENABLED) + target_sources(mixxx-lib PRIVATE + src/effects/lv2/lv2backend.cpp + src/effects/lv2/lv2effectprocessor.cpp + src/effects/lv2/lv2manifest.cpp + src/preferences/dialog/dlgpreflv2.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __LILV__) + target_link_libraries(mixxx-lib PUBLIC Lilv::Lilv) +endif() + +# Live Broadcasting (Shoutcast) +find_package(Shout) +option(BROADCAST_ENABLED "Live Broadcasting (Shoutcast) support" "${Shout_FOUND}") +if(BROADCAST_ENABLED) + target_sources(mixxx-lib PRIVATE + src/preferences/dialog/dlgprefbroadcastdlg.ui + src/preferences/dialog/dlgprefbroadcast.cpp + src/broadcast/broadcastmanager.cpp + src/engine/sidechain/shoutconnection.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __BROADCAST__) + target_link_libraries(mixxx-lib PUBLIC Shout::Shout) +endif() + +# Locale Aware Compare for SQLite +find_package(SQLite3) +option(LOCALECOMPARE_ENABLED "Locale Aware Compare support for SQLite" "${SQLite3_FOUND}") +if(LOCALECOMPARE_ENABLED) + target_compile_definitions(mixxx-lib PUBLIC __SQLITE3__) + target_include_directories(mixxx-lib PRIVATE ${SQLite3_INCLUDE_DIRS}) + target_link_libraries(mixxx-lib PUBLIC ${SQLite3_LIBRARIES}) +endif() + +# Opus (RFC 6716) +find_package(Opus) +option(OPUS_ENABLED "Opus (RFC 6716) support" "${Opus_FOUND}") +if(OPUS_ENABLED) + target_sources(mixxx-lib PRIVATE + src/sources/soundsourceopus.cpp + src/encoder/encoderopus.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __OPUS__) + target_include_directories(mixxx-lib PUBLIC ${Opus_INCLUDE_DIRS}) + target_link_libraries(mixxx-lib PUBLIC ${Opus_LIBRARIES}) +endif() + +# MAD MP3 Decoder +find_package(MAD) +find_package(ID3Tag) +if(MAD_FOUND AND ID3Tag_FOUND) + set(MAD_ENABLED_DEFAULT ON) +else() + set(MAD_ENABLED_DEFAULT OFF) +endif() +option(MAD_ENABLED "MAD MP3 Decoder" "${MAD_ENABLED_DEFAULT}") +if(MAD_ENABLED) + target_sources(mixxx-lib PRIVATE src/sources/soundsourcemp3.cpp) + target_compile_definitions(mixxx-lib PUBLIC __MAD__) + target_link_libraries(mixxx-lib PUBLIC MAD::MAD ID3Tag::ID3Tag) +endif() + +# Mac App Store +if(APPLE) + option(MACAPPSTORE_ENABLED "Build for Mac App Store" OFF) + if(MACAPPSTORE_ENABLED) + target_compile_definitions(mixxx-lib PUBLIC __MACAPPSTORE__) + endif() +endif() + +# Media Foundation AAC Decoder Plugin +if(WIN32) + find_package(MediaFoundation) + option(MEDIAFOUNDATION_ENABLED "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" "${MEDIAFOUNDATION_FOUND}") + if(MEDIAFOUNDATION_ENABLED) + target_sources(mixxx-lib PRIVATE + src/sources/soundsourcemediafoundation.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __MEDIAFOUNDATION__) + target_include_directories(mixxx-lib PRIVATE + ${MEDIAFOUNDATION_INCLUDE_DIRS} + ) + target_link_libraries(mixxx-lib PUBLIC + ${MEDIAFOUNDATION_LIBRARIES} + ) + endif() +endif() + +# Modplug support +find_package(Modplug) +option(MODPLUG_ENABLED "Modplug module decoder support" "${Modplug_FOUND}") +if(MODPLUG_ENABLED) + target_sources(mixxx-lib PRIVATE + src/preferences/dialog/dlgprefmodplugdlg.ui + src/sources/soundsourcemodplug.cpp + src/preferences/dialog/dlgprefmodplug.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __MODPLUG__) + target_link_libraries(mixxx-lib PUBLIC Modplug::Modplug) +endif() + +# Profiling +if(UNIX AND NOT APPLE) + option(PROFILING_ENABLED "Profiling (e.g. gprof) support" OFF) + if(PROFILING_ENABLED) + target_compile_options(mixxx-lib PUBLIC -pg) + target_link_options(mixxx-lib PUBLIC -pg) + endif() +endif() + +# QtKeychain +find_package(Qt5 COMPONENTS Keychain) +option(QTKEYCHAIN_ENABLED "Secure credentials storage support for Live Broadcasting profiles" OFF) +if(QTKEYCHAIN_ENABLED) + target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__) + target_link_libraries(mixxx-lib PUBLIC Qt5::Keychain) +endif() + +# USB Bulk controller support +find_package(LibUSB) +option(BULK_ENABLED "USB Bulk controller support" "${LibUSB_FOUND}") +if(BULK_ENABLED) + target_sources(mixxx-lib PRIVATE + src/controllers/bulk/bulkcontroller.cpp + src/controllers/bulk/bulkenumerator.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __BULK__) + target_link_libraries(mixxx-lib PUBLIC LibUSB::LibUSB) +endif() + +# Vinyl Control +option(VINYLCONTROL_ENABLED "Vinyl Control support" ON) +if(VINYLCONTROL_ENABLED) + if(MACAPPSTORE_ENABLED) + message(FATAL_ERROR "Mac App Store and Vinyl Control support are mutually exclusive due to licensing issues.") + endif() + + target_sources(mixxx-lib PRIVATE + src/vinylcontrol/vinylcontrol.cpp + src/vinylcontrol/vinylcontrolxwax.cpp + src/preferences/dialog/dlgprefvinyl.cpp + src/vinylcontrol/vinylcontrolsignalwidget.cpp + src/vinylcontrol/vinylcontrolmanager.cpp + src/vinylcontrol/vinylcontrolprocessor.cpp + src/vinylcontrol/steadypitch.cpp + src/engine/controls/vinylcontrolcontrol.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __VINYLCONTROL__) + + # Internal xwax library + add_library(mixxx-xwax STATIC) + if(WIN32) + target_sources(mixxx-xwax PRIVATE lib/xwax/timecoder_win32.cpp lib/xwax/lut_win32.cpp) + else() + target_sources(mixxx-xwax PRIVATE lib/xwax/timecoder.c lib/xwax/lut.c) + endif() + target_include_directories(mixxx-xwax PUBLIC lib/xwax) + target_link_libraries(mixxx-lib PUBLIC mixxx-xwax) +endif() + +# WavPack audio file support +find_package(WavPack) +option(WAVPACK_ENABLED "WavPack audio file support" "${WavPack_FOUND}") +if(WAVPACK_ENABLED) + target_sources(mixxx-lib PRIVATE src/sources/soundsourcewv.cpp) + target_compile_definitions(mixxx-lib PUBLIC __WV__) + target_link_libraries(mixxx-lib PUBLIC WavPack::WavPack) +endif() diff --git a/cmake/modules/FindGPerfTools.cmake b/cmake/modules/FindGPerfTools.cmake new file mode 100644 index 00000000000..370f061c875 --- /dev/null +++ b/cmake/modules/FindGPerfTools.cmake @@ -0,0 +1,120 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindGPerfTools +-------------- + +Finds the GPerfTools library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``GPerfTools::tcmalloc`` + The GPerfTools tcmalloc library +``GPerfTools::profiler`` + The GPerfTools profiler library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``GPerfTools_FOUND`` + True if the system has the GPerfTools library. +``GPerfTools_INCLUDE_DIRS`` + Include directories needed to use GPerfTools. +``GPerfTools_LIBRARIES`` + Libraries needed to link to GPerfTools. +``GPerfTools_DEFINITIONS`` + Compile defitions needed to use GPerfTools. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``GPerfTools_TCMALLOC_INCLUDE_DIR`` + The directory containing ``gperftools/tcmalloc.h``. +``GPerfTools_TCMALLOC_LIBRARY`` + The path to the GPerfTools tcmalloc library. +``GPerfTools_PROFILER_INCLUDE_DIR`` + The directory containing ``gperftools/profiler.h``. +``GPerfTools_PROFILER_LIBRARY`` + The path to the GPerfTools profiler library. + +#]=======================================================================] + +find_package(PkgConfig) + +pkg_check_modules(PC_GPerfTools_TCMALLOC QUIET libtcmalloc) +find_path(GPerfTools_TCMALLOC_INCLUDE_DIR + NAMES gperftools/tcmalloc.h + PATHS ${PC_GPerfTools_TCMALLOC_INCLUDE_DIRS} + DOC "tcmalloc include directory") +mark_as_advanced(GPerfTools_TCMALLOC_INCLUDE_DIR) + +find_library(GPerfTools_TCMALLOC_LIBRARY + NAMES tcmalloc + PATHS ${PC_GPerfTools_TCMALLOC_LIBRARY_DIRS} + DOC "tcmalloc library" +) +mark_as_advanced(GPerfTools_TCMALLOC_LIBRARY) + +pkg_check_modules(PC_GPerfTools_PROFILER QUIET libprofiler) +find_path(GPerfTools_PROFILER_INCLUDE_DIR + NAMES gperftools/profiler.h + PATHS ${PC_GPerfTools_PROFILER_INCLUDE_DIRS} + DOC "profiler include directory") +mark_as_advanced(GPerfTools_PROFILER_INCLUDE_DIR) + +find_library(GPerfTools_PROFILER_LIBRARY + NAMES profiler + PATHS ${PC_GPerfTools_PROFILER_LIBRARY_DIRS} + DOC "profiler library" +) +mark_as_advanced(GPerfTools_PROFILER_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + GPerfTools + DEFAULT_MSG + GPerfTools_TCMALLOC_LIBRARY + GPerfTools_TCMALLOC_INCLUDE_DIR + GPerfTools_PROFILER_LIBRARY + GPerfTools_PROFILER_INCLUDE_DIR +) + +if(GPerfTools_FOUND) + set(GPerfTools_LIBRARIES + ${GPerfTools_TCMALLOC_LIBRARY} + ${GPerfTools_PROFILER_LIBRARY} + ) + set(GPerfTools_INCLUDE_DIRS + ${GPerfTools_TCMALLOC_INCLUDE_DIR} + ${GPerfTools_PROFILER_INCLUDE_DIR} + ) + set(GPerfTools_DEFINITIONS + ${PC_GPerfTools_TCMALLOC_CFLAGS_OTHER} + ${PC_GPerfTools_PROFILER_CFLAGS_OTHER} + ) + + if (NOT TARGET GPerfTools::tcmalloc) + add_library(GPerfTools::tcmalloc UNKNOWN IMPORTED) + set_target_properties(GPerfTools::tcmalloc PROPERTIES + IMPORTED_LOCATION ${GPerfTools_TCMALLOC_LIBRARY} + INTERFACE_COMPILE_OPTIONS "${PC_GPerfTools_TCMALLOC_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${GPerfTools_TCMALLOC_INCLUDE_DIR}") + endif() + if (NOT TARGET GPerfTools::profiler) + add_library(GPerfTools::profiler UNKNOWN IMPORTED) + set_target_properties(GPerfTools::profiler PROPERTIES + IMPORTED_LOCATION "${GPerfTools_PROFILER_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_GPerfTools_PROFILER_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${GPerfTools_PROFILER_INCLUDE_DIR}") + endif() +endif() diff --git a/cmake/modules/FindHSS1394.cmake b/cmake/modules/FindHSS1394.cmake new file mode 100644 index 00000000000..3030706849d --- /dev/null +++ b/cmake/modules/FindHSS1394.cmake @@ -0,0 +1,75 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindHSS1394 +----------- + +Finds the HSS1394 library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``HSS1394::HSS1394`` + The HSS1304 library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``HSS1394_FOUND`` + True if the system has the HSS1394 library. +``HSS1394_INCLUDE_DIRS`` + Include directories needed to use HSS1394. +``HSS1394_LIBRARIES`` + Libraries needed to link to HSS1394. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``HSS1394_INCLUDE_DIR`` + The directory containing ``HSS1394/HSS1394.h``. +``HSS1394_LIBRARY`` + The path to the HSS1394 library. + +#]=======================================================================] + +find_path(HSS1394_INCLUDE_DIR + NAMES HSS1394/HSS1394.h + DOC "HSS1394 include directory") +mark_as_advanced(HSS1394_INCLUDE_DIR) + +find_library(HSS1394_LIBRARY + NAMES hss1394 + DOC "HSS1394 library" +) +mark_as_advanced(HSS1394_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + HSS1394 + DEFAULT_MSG + HSS1394_LIBRARY + HSS1394_INCLUDE_DIR +) + +if(HSS1394_FOUND) + set(HSS1394_LIBRARIES "${HSS1394_LIBRARY}") + set(HSS1394_INCLUDE_DIRS "${HSS1394_INCLUDE_DIR}") + + if(NOT TARGET HSS1394::HSS1394) + add_library(HSS1394::HSS1394 UNKNOWN IMPORTED) + set_target_properties(HSS1394::HSS1394 + PROPERTIES + IMPORTED_LOCATION "${HSS1394_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${HSS1394_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindID3Tag.cmake b/cmake/modules/FindID3Tag.cmake new file mode 100644 index 00000000000..b97d8f33b2a --- /dev/null +++ b/cmake/modules/FindID3Tag.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindID3Tag +---------- + +Finds the ID3Tag library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``ID3Tag::ID3Tag`` + The ID3Tag library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``ID3Tag_FOUND`` + True if the system has the ID3Tag library. +``ID3Tag_INCLUDE_DIRS`` + Include directories needed to use ID3Tag. +``ID3Tag_LIBRARIES`` + Libraries needed to link to ID3Tag. +``ID3Tag_DEFINITIONS`` + Compile defitions needed to use ID3Tag. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``ID3Tag_INCLUDE_DIR`` + The directory containing ``id3tag.h``. +``ID3Tag_LIBRARY`` + The path to the ID3Tag library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_ID3Tag QUIET id3tag) + +find_path(ID3Tag_INCLUDE_DIR + NAMES id3tag.h + PATHS ${PC_ID3Tag_INCLUDE_DIRS} + PATH_SUFFIXES id3tag + DOC "ID3Tag include directory") +mark_as_advanced(ID3Tag_INCLUDE_DIR) + +find_library(ID3Tag_LIBRARY + NAMES id3tag + PATHS ${PC_ID3Tag_LIBRARY_DIRS} + DOC "ID3Tag library" +) +mark_as_advanced(ID3Tag_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + ID3Tag + DEFAULT_MSG + ID3Tag_LIBRARY + ID3Tag_INCLUDE_DIR +) + +if(ID3Tag_FOUND) + set(ID3Tag_LIBRARIES "${ID3Tag_LIBRARY}") + set(ID3Tag_INCLUDE_DIRS "${ID3Tag_INCLUDE_DIR}") + set(ID3Tag_DEFINITIONS ${PC_ID3Tag_CFLAGS_OTHER}) + + if(NOT TARGET ID3Tag::ID3Tag) + add_library(ID3Tag::ID3Tag UNKNOWN IMPORTED) + set_target_properties(ID3Tag::ID3Tag + PROPERTIES + IMPORTED_LOCATION "${ID3Tag_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_ID3Tag_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${ID3Tag_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindLibUSB.cmake b/cmake/modules/FindLibUSB.cmake new file mode 100644 index 00000000000..39c6e39fe13 --- /dev/null +++ b/cmake/modules/FindLibUSB.cmake @@ -0,0 +1,86 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindLibUSB +---------- + +Finds the LibUSB library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``LibUSB::LibUSB`` + The LibUSB library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``LibUSB_FOUND`` + True if the system has the LibUSB library. +``LibUSB_INCLUDE_DIRS`` + Include directories needed to use LibUSB. +``LibUSB_LIBRARIES`` + Libraries needed to link to LibUSB. +``LibUSB_DEFINITIONS`` + Compile defitions needed to use LibUSB. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``LibUSB_INCLUDE_DIR`` + The directory containing ``libusb-1.0/libusb.h``. +``LibUSB_LIBRARY`` + The path to the LibUSB library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_LibUSB QUIET libusb-1.0) + +find_path(LibUSB_INCLUDE_DIR + NAMES libusb.h + PATH_SUFFIXES libusb libusb-1.0 + PATHS ${PC_LibUSB_INCLUDE_DIRS} + DOC "LibUSB include directory" +) +mark_as_advanced(LibUSB_INCLUDE_DIR) + +find_library(LibUSB_LIBRARY + NAMES usb-1.0 + PATHS ${PC_LibUSB_LIBRARY_DIRS} + DOC "LibUSB library" +) +mark_as_advanced(LibUSB_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + LibUSB + DEFAULT_MSG + LibUSB_LIBRARY + LibUSB_INCLUDE_DIR +) + +if(LibUSB_FOUND) + set(LibUSB_LIBRARIES "${LibUSB_LIBRARY}") + set(LibUSB_INCLUDE_DIRS "${LibUSB_INCLUDE_DIR}") + set(LibUSB_DEFINITIONS ${PC_LibUSB_CFLAGS_OTHER}) + + if(NOT TARGET LibUSB::LibUSB) + add_library(LibUSB::LibUSB UNKNOWN IMPORTED) + set_target_properties(LibUSB::LibUSB + PROPERTIES + IMPORTED_LOCATION "${LibUSB_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_LibUSB_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${LibUSB_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindLilv.cmake b/cmake/modules/FindLilv.cmake new file mode 100644 index 00000000000..a4ff766c008 --- /dev/null +++ b/cmake/modules/FindLilv.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindLilv +-------- + +Finds the Lilv library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Lilv::Lilv`` + The Lilv library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Lilv_FOUND`` + True if the system has the Lilv library. +``Lilv_INCLUDE_DIRS`` + Include directories needed to use Lilv. +``Lilv_LIBRARIES`` + Libraries needed to link to Lilv. +``Lilv_DEFINITIONS`` + Compile defitions needed to use Lilv. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Lilv_INCLUDE_DIR`` + The directory containing ``lilv-0/lilb/lilv.h``. +``Lilv_LIBRARY`` + The path to the Lilv library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Lilv QUIET lilv-0) + +find_path(Lilv_INCLUDE_DIR + NAMES lilv-0/lilv/lilv.h + PATHS ${PC_Lilv_INCLUDE_DIRS} + DOC "Lilv include directory" +) +mark_as_advanced(Lilv_INCLUDE_DIR) + +find_library(Lilv_LIBRARY + NAMES lilv-0 + PATHS ${PC_Lilv_LIBRARY_DIRS} + DOC "Lilv library" +) +mark_as_advanced(Lilv_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Lilv + DEFAULT_MSG + Lilv_LIBRARY + Lilv_INCLUDE_DIR +) + +if(Lilv_FOUND) + set(Lilv_LIBRARIES "${Lilv_LIBRARY}") + set(Lilv_INCLUDE_DIRS "${Lilv_INCLUDE_DIR}") + set(Lilv_DEFINITIONS ${PC_Lilv_CFLAGS_OTHER}) + + if(NOT TARGET Lilv::Lilv) + add_library(Lilv::Lilv UNKNOWN IMPORTED) + set_target_properties(Lilv::Lilv + PROPERTIES + IMPORTED_LOCATION "${Lilv_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Lilv_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Lilv_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindMAD.cmake b/cmake/modules/FindMAD.cmake new file mode 100644 index 00000000000..1e7cf7a2f36 --- /dev/null +++ b/cmake/modules/FindMAD.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindMAD +------- + +Finds the MAD library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``MAD::MAD`` + The MAD library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``MAD_FOUND`` + True if the system has the MAD library. +``MAD_INCLUDE_DIRS`` + Include directories needed to use MAD. +``MAD_LIBRARIES`` + Libraries needed to link to MAD. +``MAD_DEFINITIONS`` + Compile defitions needed to use MAD. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``MAD_INCLUDE_DIR`` + The directory containing ``mad.h``. +``MAD_LIBRARY`` + The path to the MAD library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_MAD QUIET mad) + +find_path(MAD_INCLUDE_DIR + NAMES mad.h + PATHS ${PC_MAD_INCLUDE_DIRS} + PATH_SUFFIXES mad + DOC "MAD include directory") +mark_as_advanced(MAD_INCLUDE_DIR) + +find_library(MAD_LIBRARY + NAMES mad + PATHS ${PC_MAD_LIBRARY_DIRS} + DOC "MAD library" +) +mark_as_advanced(MAD_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + MAD + DEFAULT_MSG + MAD_LIBRARY + MAD_INCLUDE_DIR +) + +if(MAD_FOUND) + set(MAD_LIBRARIES "${MAD_LIBRARY}") + set(MAD_INCLUDE_DIRS "${MAD_INCLUDE_DIR}") + set(MAD_DEFINITIONS ${PC_MAD_CFLAGS_OTHER}) + + if(NOT TARGET MAD::MAD) + add_library(MAD::MAD UNKNOWN IMPORTED) + set_target_properties(MAD::MAD + PROPERTIES + IMPORTED_LOCATION "${MAD_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_MAD_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MAD_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindMP4.cmake b/cmake/modules/FindMP4.cmake new file mode 100644 index 00000000000..dff3e6c0534 --- /dev/null +++ b/cmake/modules/FindMP4.cmake @@ -0,0 +1,84 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindMP4 +------- + +Finds the MP4 library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``MP4::MP4`` + The MP4 library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``MP4_FOUND`` + True if the system has the MP4 library. +``MP4_INCLUDE_DIRS`` + Include directories needed to use MP4. +``MP4_LIBRARIES`` + Libraries needed to link to MP4. +``MP4_DEFINITIONS`` + Compile defitions needed to use MP4. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``MP4_INCLUDE_DIR`` + The directory containing ``mp4/mp4.h``. +``MP4_LIBRARY`` + The path to the MP4 library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_MP4 QUIET mp4) + +find_path(MP4_INCLUDE_DIR + NAMES mp4/mp4.h + PATHS ${PC_MP4_INCLUDE_DIRS} + DOC "MP4 include directory") +mark_as_advanced(MP4_INCLUDE_DIR) + +find_library(MP4_LIBRARY + NAMES mp4 + PATHS ${PC_MP4_LIBRARY_DIRS} + DOC "MP4 library" +) +mark_as_advanced(MP4_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + MP4 + DEFAULT_MSG + MP4_LIBRARY + MP4_INCLUDE_DIR +) + +if(MP4_FOUND) + set(MP4_LIBRARIES "${MP4_LIBRARY}") + set(MP4_INCLUDE_DIRS "${MP4_INCLUDE_DIR}") + set(MP4_DEFINITIONS ${PC_MP4_CFLAGS_OTHER}) + + if(NOT TARGET MP4::MP4) + add_library(MP4::MP4 UNKNOWN IMPORTED) + set_target_properties(MP4::MP4 + PROPERTIES + IMPORTED_LOCATION "${MP4_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_MP4_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MP4_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindMP4v2.cmake b/cmake/modules/FindMP4v2.cmake new file mode 100644 index 00000000000..798710fa390 --- /dev/null +++ b/cmake/modules/FindMP4v2.cmake @@ -0,0 +1,84 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindMP4v2 +--------- + +Finds the MP4v2 library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``MP4v2::MP4v2`` + The MP4v2 library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``MP4v2_FOUND`` + True if the system has the MP4v2 library. +``MP4v2_INCLUDE_DIRS`` + Include directories needed to use MP4v2. +``MP4v2_LIBRARIES`` + Libraries needed to link to MP4v2. +``MP4v2_DEFINITIONS`` + Compile defitions needed to use MP4v2. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``MP4v2_INCLUDE_DIR`` + The directory containing ``mp4v2/mp4v2.h``. +``MP4v2_LIBRARY`` + The path to the MP4v2 library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_MP4v2 QUIET mp4v2) + +find_path(MP4v2_INCLUDE_DIR + NAMES mp4v2/mp4v2.h + PATHS ${PC_MP4v2_INCLUDE_DIRS} + DOC "MP4v2 include directory") +mark_as_advanced(MP4v2_INCLUDE_DIR) + +find_library(MP4v2_LIBRARY + NAMES mp4v2 + PATHS ${PC_MP4v2_LIBRARY_DIRS} + DOC "MP4v2 library" +) +mark_as_advanced(MP4v2_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + MP4v2 + DEFAULT_MSG + MP4v2_LIBRARY + MP4v2_INCLUDE_DIR +) + +if(MP4v2_FOUND) + set(MP4v2_LIBRARIES "${MP4v2_LIBRARY}") + set(MP4v2_INCLUDE_DIRS "${MP4v2_INCLUDE_DIR}") + set(MP4v2_DEFINITIONS ${PC_MP4v2_CFLAGS_OTHER}) + + if(NOT TARGET MP4v2::MP4v2) + add_library(MP4v2::MP4v2 UNKNOWN IMPORTED) + set_target_properties(MP4v2::MP4v2 + PROPERTIES + IMPORTED_LOCATION "${MP4v2_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_MP4v2_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MP4v2_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindMediaFoundation.cmake b/cmake/modules/FindMediaFoundation.cmake new file mode 100644 index 00000000000..0d8f47a8219 --- /dev/null +++ b/cmake/modules/FindMediaFoundation.cmake @@ -0,0 +1,20 @@ +# - Find MediaFoundation +# Find the Windows SDK MediaFoundation libraries +# +# MediaFoundation_LIBRARIES - List of libraries when using MediaFoundation +# MediaFoundation_FOUND - True if MediaFoundation found + +IF (MSVC) + SET( MediaFoundation_LIBRARIES mf.lib mfplat.lib mfreadwrite.lib mfuuid.lib strmiids.lib ) + SET( MediaFoundation_FOUND true ) +ENDIF (MSVC) + +IF (MediaFoundation_FOUND) + IF (NOT MediaFoundation_FIND_QUIETLY) + MESSAGE(STATUS "Found MediaFoundation: ${MediaFoundation_LIBRARIES}") + ENDIF (NOT MediaFoundation_FIND_QUIETLY) +ELSE (MediaFoundation_FOUND) + IF (MediaFoundation_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find MediaFoundation") + ENDIF (MediaFoundation_FIND_REQUIRED) +ENDIF (MediaFoundation_FOUND) diff --git a/cmake/modules/FindModplug.cmake b/cmake/modules/FindModplug.cmake new file mode 100644 index 00000000000..171950d2a44 --- /dev/null +++ b/cmake/modules/FindModplug.cmake @@ -0,0 +1,84 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindModplug +----------- + +Finds the Modplug library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Modplug::Modplug`` + The Modplug library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Modplug_FOUND`` + True if the system has the Modplug library. +``Modplug_INCLUDE_DIRS`` + Include directories needed to use Modplug. +``Modplug_LIBRARIES`` + Libraries needed to link to Modplug. +``Modplug_DEFINITIONS`` + Compile defitions needed to use Modplug. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Modplug_INCLUDE_DIR`` + The directory containing ``modplug.h``. +``Modplug_LIBRARY`` + The path to the Modplug library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Modplug QUIET libmodplug) + +find_path(Modplug_INCLUDE_DIR + NAMES libmodplug/modplug.h + PATHS ${PC_Modplug_INCLUDE_DIRS} + DOC "Modplug include directory") +mark_as_advanced(Modplug_INCLUDE_DIR) + +find_library(Modplug_LIBRARY + NAMES modplug + PATHS ${PC_Modplug_LIBRARY_DIRS} + DOC "Modplug library" +) +mark_as_advanced(Modplug_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Modplug + DEFAULT_MSG + Modplug_LIBRARY + Modplug_INCLUDE_DIR +) + +if(Modplug_FOUND) + set(Modplug_LIBRARIES "${Modplug_LIBRARY}") + set(Modplug_INCLUDE_DIRS "${Modplug_INCLUDE_DIR}") + set(Modplug_DEFINITIONS ${PC_Modplug_CFLAGS_OTHER}) + + if(NOT TARGET Modplug::Modplug) + add_library(Modplug::Modplug UNKNOWN IMPORTED) + set_target_properties(Modplug::Modplug + PROPERTIES + IMPORTED_LOCATION "${Modplug_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Modplug_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Modplug_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindOpus.cmake b/cmake/modules/FindOpus.cmake new file mode 100644 index 00000000000..61ce265cecc --- /dev/null +++ b/cmake/modules/FindOpus.cmake @@ -0,0 +1,87 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindOpus +-------- + +Finds the Opus library. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Opus_FOUND`` + True if the system has the Opus library. +``Opus_INCLUDE_DIRS`` + Include directories needed to use Opus. +``Opus_LIBRARIES`` + Libraries needed to link to Opus. +``Opus_DEFINITIONS`` + Compile defitions needed to use Opus. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Opus_INCLUDE_DIR`` + The directory containing ``opus.h``. +``Opus_LIBRARY`` + The path to the Opus library. +``OpusFile_INCLUDE_DIR`` + The directory containing ``opusfile.h``. +``OpusFile_LIBRARY`` + The path to the Opus library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Opus QUIET opus) +pkg_check_modules(PC_OpusFile QUIET opusfile) + +find_path(Opus_INCLUDE_DIR + NAMES opus/opus.h + PATHS ${PC_Opus_INCLUDE_DIRS} + DOC "Opus include directory") +mark_as_advanced(Opus_INCLUDE_DIR) + +find_library(Opus_LIBRARY + NAMES opus + PATHS ${PC_Opus_LIBRARY_DIRS} + DOC "Opus library" +) +mark_as_advanced(Opus_LIBRARY) + +find_path(OpusFile_INCLUDE_DIR + NAMES opusfile.h + PATH_SUFFIXES opus + PATHS ${PC_OpusFile_INCLUDE_DIRS} + DOC "Opusfile include directory") +mark_as_advanced(OpusFile_INCLUDE_DIR) + +find_library(OpusFile_LIBRARY + NAMES opusfile + PATHS ${PC_OpusFile_LIBRARY_DIRS} + DOC "Opusfile library" +) +mark_as_advanced(OpusFile_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Opus + DEFAULT_MSG + Opus_LIBRARY + Opus_INCLUDE_DIR + OpusFile_LIBRARY + OpusFile_INCLUDE_DIR +) + +if(Opus_FOUND) + set(Opus_LIBRARIES ${Opus_LIBRARY} ${OpusFile_LIBRARY}) + set(Opus_INCLUDE_DIRS ${Opus_INCLUDE_DIR} ${OpusFile_INCLUDE_DIR}) + set(Opus_DEFINITIONS ${PC_Opus_CFLAGS_OTHER} ${PC_OpusFile_CFLAGS_OTHER}) +endif() diff --git a/cmake/modules/FindSQLite3.cmake b/cmake/modules/FindSQLite3.cmake new file mode 100644 index 00000000000..fc7c0012d6e --- /dev/null +++ b/cmake/modules/FindSQLite3.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindSQLite3 +----------- + +Finds the SQLite3 library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``SQLite3::SQLite3`` + The SQLite3 library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``SQLite3_FOUND`` + True if the system has the SQLite3 library. +``SQLite3_INCLUDE_DIRS`` + Include directories needed to use SQLite3. +``SQLite3_LIBRARIES`` + Libraries needed to link to SQLite3. +``SQLite3_DEFINITIONS`` + Compile defitions needed to use SQLite3. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``SQLite3_INCLUDE_DIR`` + The directory containing ``sqlite3.h``. +``SQLite3_LIBRARY`` + The path to the SQLite3 library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_SQLite3 QUIET sqlite3) + +find_path(SQLite3_INCLUDE_DIR + NAMES sqlite3.h + PATHS ${PC_SQLite3_INCLUDE_DIRS} + PATH_SUFFIXES sqlite sqlite3 + DOC "SQLite3 include directory") +mark_as_advanced(SQLite3_INCLUDE_DIR) + +find_library(SQLite3_LIBRARY + NAMES sqlite3 + PATHS ${PC_SQLite3_LIBRARY_DIRS} + DOC "SQLite3 library" +) +mark_as_advanced(SQLite3_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + SQLite3 + DEFAULT_MSG + SQLite3_LIBRARY + SQLite3_INCLUDE_DIR +) + +if(SQLite3_FOUND) + set(SQLite3_LIBRARIES "${SQLite3_LIBRARY}") + set(SQLite3_INCLUDE_DIRS "${SQLite3_INCLUDE_DIR}") + set(SQLite3_DEFINITIONS ${PC_SQLite3_CFLAGS_OTHER}) + + if(NOT TARGET SQLite3::SQLite3) + add_library(SQLite3::SQLite3 UNKNOWN IMPORTED) + set_target_properties(SQLite3::SQLite3 + PROPERTIES + IMPORTED_LOCATION "${SQLite3_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_SQLite3_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindShout.cmake b/cmake/modules/FindShout.cmake new file mode 100644 index 00000000000..ebf6c1f7344 --- /dev/null +++ b/cmake/modules/FindShout.cmake @@ -0,0 +1,84 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindShout +--------- + +Finds the Shout library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Shout::Shout`` + The Shout library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Shout_FOUND`` + True if the system has the Shout library. +``Shout_INCLUDE_DIRS`` + Include directories needed to use Shout. +``Shout_LIBRARIES`` + Libraries needed to link to Shout. +``Shout_DEFINITIONS`` + Compile defitions needed to use Shout. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Shout_INCLUDE_DIR`` + The directory containing ``shout/shout.h``. +``Shout_LIBRARY`` + The path to the Shout library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_Shout QUIET shout) + +find_path(Shout_INCLUDE_DIR + NAMES shout/shout.h + PATHS ${PC_Shout_INCLUDE_DIRS} + DOC "Shout include directory") +mark_as_advanced(Shout_INCLUDE_DIR) + +find_library(Shout_LIBRARY + NAMES shout + PATHS ${PC_Shout_LIBRARY_DIRS} + DOC "Shout library" +) +mark_as_advanced(Shout_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Shout + DEFAULT_MSG + Shout_LIBRARY + Shout_INCLUDE_DIR +) + +if(Shout_FOUND) + set(Shout_LIBRARIES "${Shout_LIBRARY}") + set(Shout_INCLUDE_DIRS "${Shout_INCLUDE_DIR}") + set(Shout_DEFINITIONS ${PC_Shout_CFLAGS_OTHER}) + + if(NOT TARGET Shout::Shout) + add_library(Shout::Shout UNKNOWN IMPORTED) + set_target_properties(Shout::Shout + PROPERTIES + IMPORTED_LOCATION "${Shout_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Shout_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Shout_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindWavPack.cmake b/cmake/modules/FindWavPack.cmake new file mode 100644 index 00000000000..5a897b9abba --- /dev/null +++ b/cmake/modules/FindWavPack.cmake @@ -0,0 +1,84 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindWavPack +----------- + +Finds the WavPack library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``WavPack::WavPack`` + The WavPack library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``WavPack_FOUND`` + True if the system has the WavPack library. +``WavPack_INCLUDE_DIRS`` + Include directories needed to use WavPack. +``WavPack_LIBRARIES`` + Libraries needed to link to WavPack. +``WavPack_DEFINITIONS`` + Compile defitions needed to use WavPack. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``WavPack_INCLUDE_DIR`` + The directory containing ``wavpack/wavpack.h``. +``WavPack_LIBRARY`` + The path to the WavPack library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_WavPack QUIET wavpack) + +find_path(WavPack_INCLUDE_DIR + NAMES wavpack/wavpack.h + PATHS ${PC_WavPack_INCLUDE_DIRS} + DOC "WavPack include directory") +mark_as_advanced(WavPack_INCLUDE_DIR) + +find_library(WavPack_LIBRARY + NAMES wavpack wv + PATHS ${PC_WavPack_LIBRARY_DIRS} + DOC "WavPack library" +) +mark_as_advanced(WavPack_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + WavPack + DEFAULT_MSG + WavPack_LIBRARY + WavPack_INCLUDE_DIR +) + +if(WavPack_FOUND) + set(WavPack_LIBRARIES "${WavPack_LIBRARY}") + set(WavPack_INCLUDE_DIRS "${WavPack_INCLUDE_DIR}") + set(WavPack_DEFINITIONS ${PC_WavPack_CFLAGS_OTHER}) + + if(NOT TARGET WavPack::WavPack) + add_library(WavPack::WavPack UNKNOWN IMPORTED) + set_target_properties(WavPack::WavPack + PROPERTIES + IMPORTED_LOCATION "${WavPack_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_WavPack_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${WavPack_INCLUDE_DIR}" + ) + endif() +endif() From 8eda976909a4df6008088ec998f16e8398603483 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 16:31:17 +0200 Subject: [PATCH 004/134] CMake: Clean up probuf handling a bit --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c27a88ae020..34ea9f1e932 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -608,6 +608,11 @@ if(UNIX AND NOT APPLE) target_compile_definitions(mixxx-lib PRIVATE SETTINGS_PATH=".mixxx/") endif() +target_include_directories(mixxx-lib PUBLIC + ${PROTOBUF_INCLUDE_DIRS} + "${CMAKE_CURRENT_BINARY_DIR}" +) + if(WIN32) target_compile_definitions(mixxx-lib PRIVATE __WINDOWS__) @@ -655,16 +660,13 @@ elseif(UNIX) endif() # The mixxx executable -add_executable(mixxx src/main.cpp ${PROTO_HEADERS}) +add_executable(mixxx src/main.cpp) target_link_libraries(mixxx PUBLIC mixxx-lib) add_library(mixxx-qrc STATIC res/mixxx.cc res/mixxx.qrc) set_target_properties(mixxx-qrc PROPERTIES AUTOMOC ON AUTOUIC ON) target_link_libraries(mixxx-lib PUBLIC mixxx-qrc) -target_include_directories(mixxx-lib PUBLIC - ${PROTOBUF_INCLUDE_DIRS} - "${CMAKE_CURRENT_BINARY_DIR}" ) # From cd938689f988b5bbe1433c0ab418d495ecc49c51 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 16:32:00 +0200 Subject: [PATCH 005/134] CMake: Add project information --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34ea9f1e932..3eb3eec37bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.1.0) -project(mixxx) +project(mixxx + VERSION 2.3.0 + DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes." + HOMEPAGE_URL "https://www.mixxx.org" +) cmake_policy(SET CMP0071 NEW) include(ExternalProject) From 2541209c831aa0045a1461efbfb8a37d3fec3cba Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 16:32:36 +0200 Subject: [PATCH 006/134] CMake: Make sure that ebur128 is linked statically --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eb3eec37bc..7ddc727e634 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -686,6 +686,7 @@ ExternalProject_Add(libebur128 SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" INSTALL_COMMAND "" + CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON" ) add_dependencies(mixxx-lib libebur128) target_include_directories(mixxx-lib PUBLIC @@ -694,7 +695,7 @@ target_include_directories(mixxx-lib PUBLIC target_link_directories(mixxx-lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" ) -target_link_libraries(mixxx-lib PUBLIC "ebur128") +target_link_libraries(mixxx-lib PUBLIC "${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") # FidLib add_library(fidlib OBJECT lib/fidlib/fidlib.c) From 864554731ee60cb2f56f884b2128dc944a162130 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 16:41:44 +0200 Subject: [PATCH 007/134] CMake: Fix mixxx-qrc target --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ddc727e634..245c61bdf54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -667,8 +667,8 @@ endif() add_executable(mixxx src/main.cpp) target_link_libraries(mixxx PUBLIC mixxx-lib) -add_library(mixxx-qrc STATIC res/mixxx.cc res/mixxx.qrc) -set_target_properties(mixxx-qrc PROPERTIES AUTOMOC ON AUTOUIC ON) +add_library(mixxx-qrc OBJECT res/mixxx.qrc) +set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) target_link_libraries(mixxx-lib PUBLIC mixxx-qrc) ) From 1c5b86ae976cf9f7439a6a80f2d34e343effd2e6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 16:42:17 +0200 Subject: [PATCH 008/134] CMake: Add installation and packaging instructions --- CMakeLists.txt | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 245c61bdf54..24c01fd259b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,8 +671,80 @@ add_library(mixxx-qrc OBJECT res/mixxx.qrc) set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) target_link_libraries(mixxx-lib PUBLIC mixxx-qrc) +# +# Installation and Packaging +# +include(GNUInstallDirs) +install(TARGETS mixxx) + +# Skins +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/skins + DESTINATION ${CMAKE_INSTALL_DATADIR}/mixxx ) +# Controller mappings +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/controllers + DESTINATION ${CMAKE_INSTALL_DATADIR}/mixxx +) + +# Translation files +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/translations + DESTINATION ${CMAKE_INSTALL_DATADIR}/mixxx + FILES_MATCHING PATTERN "*.qm" +) +# Font files +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/fonts + DESTINATION ${CMAKE_INSTALL_DATADIR}/mixxx +) + +# Keyboard mapping(s) +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/keyboard + DESTINATION ${CMAKE_INSTALL_DATADIR}/mixxx +) + +# Documentation +install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE + ${CMAKE_CURRENT_SOURCE_DIR}/README + ${CMAKE_CURRENT_SOURCE_DIR}/Mixxx-Manual.pdf + DESTINATION ${CMAKE_INSTALL_DOCDIR}/mixxx +) + +# .desktop file for KDE/GNOME menu +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/mixxx +) + +# Icon file for menu entry +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/images/mixxx_icon.svg + DESTINATION ${CMAKE_INSTALL_DATADIR}/pixmaps/rules.d +) + +# .appdata.xml file for KDE/GNOME AppStream initiative +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx.appdata.xml + DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata +) + +# udev rule file for USB HID and Bulk controllers +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx.usb.rules + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/udev/rules.d +) + +# Packaging +set(CPACK_PACKAGE_VENDOR "Mixxx Project") +set(CPACK_PACKAGE_CONTACT "RJ Skerry-Ryan ") +include(CPack) + # # Dependencies # From 70064a1e9d45e170ea9df866d43380b73120da63 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 12 Sep 2019 16:42:37 +0200 Subject: [PATCH 009/134] CMake: Add tests --- CMakeLists.txt | 148 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24c01fd259b..f723019b73b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1331,3 +1331,151 @@ if(WAVPACK_ENABLED) target_compile_definitions(mixxx-lib PUBLIC __WV__) target_link_libraries(mixxx-lib PUBLIC WavPack::WavPack) endif() + +# +# Tests +# +add_executable(mixxx-test EXCLUDE_FROM_ALL + src/test/analyserwaveformtest.cpp + src/test/analyzersilence_test.cpp + src/test/audiotaperpot_test.cpp + src/test/autodjprocessor_test.cpp + src/test/baseeffecttest.cpp + src/test/beatgridtest.cpp + src/test/beatmaptest.cpp + src/test/beatstranslatetest.cpp + src/test/bpmcontrol_test.cpp + src/test/broadcastprofile_test.cpp + src/test/broadcastsettings_test.cpp + src/test/channelhandle_test.cpp + src/test/configobject_test.cpp + src/test/controllerengine_test.cpp + src/test/controller_preset_validation_test.cpp + src/test/controlobjecttest.cpp + src/test/coverartcache_test.cpp + src/test/coverartutils_test.cpp + src/test/cratestorage_test.cpp + src/test/cuecontrol_test.cpp + src/test/dbconnectionpool_test.cpp + src/test/dbidtest.cpp + src/test/directorydaotest.cpp + src/test/duration_test.cpp + src/test/durationutiltest.cpp + src/test/effectchainslottest.cpp + src/test/effectslottest.cpp + src/test/effectsmanagertest.cpp + src/test/enginebufferscalelineartest.cpp + src/test/enginebuffertest.cpp + src/test/enginefilterbiquadtest.cpp + src/test/enginemastertest.cpp + src/test/enginemicrophonetest.cpp + src/test/enginesynctest.cpp + src/test/globaltrackcache_test.cpp + src/test/indexrange_test.cpp + src/test/keyutilstest.cpp + src/test/lcstest.cpp + src/test/learningutilstest.cpp + src/test/libraryscannertest.cpp + src/test/looping_control_test.cpp + src/test/mathutiltest.cpp + src/test/metadatatest.cpp + src/test/metaknob_link_test.cpp + src/test/midicontrollertest.cpp + src/test/mixxxtest.cpp + src/test/movinginterquartilemean_test.cpp + src/test/mpscfifotest.cpp + src/test/nativeeffects_test.cpp + src/test/performancetimer_test.cpp + src/test/playcountertest.cpp + src/test/playlisttest.cpp + src/test/portmidicontroller_test.cpp + src/test/portmidienumeratortest.cpp + src/test/queryutiltest.cpp + src/test/readaheadmanager_test.cpp + src/test/replaygaintest.cpp + src/test/rescalertest.cpp + src/test/samplebuffertest.cpp + src/test/sampleutiltest.cpp + src/test/schemamanager_test.cpp + src/test/searchqueryparsertest.cpp + src/test/signalpathtest.cpp + src/test/skincontext_test.cpp + src/test/softtakeover_test.cpp + src/test/soundproxy_test.cpp + src/test/soundsourceproviderregistrytest.cpp + src/test/sqliteliketest.cpp + src/test/synccontroltest.cpp + src/test/tableview_test.cpp + src/test/taglibtest.cpp + src/test/trackdao_test.cpp + src/test/trackexport_test.cpp + src/test/tracknumberstest.cpp + src/test/trackreftest.cpp + src/test/trackupdate_test.cpp + src/test/wpushbutton_test.cpp + src/test/wwidgetstack_test.cpp + src/test/main.cpp +) +set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) +target_link_libraries(mixxx-test PUBLIC mixxx-lib mixxx-qrc) + +# gtest +ExternalProject_Add(mixxx-gtest + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" + INSTALL_COMMAND "" +) +set_target_properties(mixxx-gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) +add_dependencies(mixxx-test mixxx-gtest) +target_include_directories(mixxx-test PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0/include" +) +target_link_directories(mixxx-test PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" +) +target_link_libraries(mixxx-test PUBLIC "gtest") + +# gmock +ExternalProject_Add(mixxx-gmock + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" + INSTALL_COMMAND "" +) +set_target_properties(mixxx-gmock PROPERTIES EXCLUDE_FROM_ALL TRUE) +add_dependencies(mixxx-test mixxx-gmock) +target_include_directories(mixxx-test PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0/include" +) +target_link_directories(mixxx-test PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" +) +target_link_libraries(mixxx-test PUBLIC "gmock") + +# Benchmark +add_library(benchmark STATIC EXCLUDE_FROM_ALL + lib/benchmark/src/benchmark.cc + lib/benchmark/src/colorprint.cc + lib/benchmark/src/commandlineflags.cc + lib/benchmark/src/console_reporter.cc + lib/benchmark/src/csv_reporter.cc + lib/benchmark/src/json_reporter.cc + lib/benchmark/src/log.cc + lib/benchmark/src/reporter.cc + lib/benchmark/src/sleep.cc + lib/benchmark/src/string_util.cc + lib/benchmark/src/sysinfo.cc + lib/benchmark/src/walltime.cc + lib/benchmark/src/re_std.cc +) +target_compile_definitions(benchmark PRIVATE HAVE_STD_REGEX) +find_package(Threads REQUIRED) +target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT}) +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + target_link_libraries(benchmark Shlwapi) +endif() +target_include_directories(benchmark PUBLIC lib/benchmark/include) +target_link_libraries(mixxx-test PUBLIC benchmark) + +include(GoogleTest) +enable_testing() +gtest_add_tests(TARGET mixxx-test) From 3cc198a8ec7452890da44c64a09664bd7cfd74fb Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 00:41:10 +0200 Subject: [PATCH 010/134] CMake: Add missing build.h.template file --- src/build.h.template | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/build.h.template diff --git a/src/build.h.template b/src/build.h.template new file mode 100644 index 00000000000..ec29745ab9b --- /dev/null +++ b/src/build.h.template @@ -0,0 +1,7 @@ +#ifndef BUILD_H +#define BUILD_H + +#define BUILD_BRANCH "@GIT_BRANCH@" +#define BUILD_REV "@GIT_COMMIT_HASH@" + +#endif // BUILD_H From 8f16f54e5dc4d0ab3624fda7554875470e2c733f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 00:55:21 +0200 Subject: [PATCH 011/134] CMake: Improve backwards compatibility with older CMake versions --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f723019b73b..c99f4200852 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -675,7 +675,10 @@ target_link_libraries(mixxx-lib PUBLIC mixxx-qrc) # Installation and Packaging # include(GNUInstallDirs) -install(TARGETS mixxx) +install( + TARGETS mixxx + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) # Skins install( @@ -764,10 +767,7 @@ add_dependencies(mixxx-lib libebur128) target_include_directories(mixxx-lib PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" ) -target_link_directories(mixxx-lib PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" -) -target_link_libraries(mixxx-lib PUBLIC "${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") +target_link_libraries(mixxx-lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") # FidLib add_library(fidlib OBJECT lib/fidlib/fidlib.c) From 7d07c34661ab7eea41c413c371a9c7cdc9a20c91 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 13:28:29 +0200 Subject: [PATCH 012/134] CMake: Fix indentation in cmake/modules/Find*.cmake --- cmake/modules/FindLilv.cmake | 14 +++++++------- cmake/modules/FindMAD.cmake | 14 +++++++------- cmake/modules/FindMP4.cmake | 14 +++++++------- cmake/modules/FindMP4v2.cmake | 14 +++++++------- cmake/modules/FindModplug.cmake | 14 +++++++------- cmake/modules/FindRubberband.cmake | 14 +++++++------- cmake/modules/FindSQLite3.cmake | 14 +++++++------- cmake/modules/FindShout.cmake | 14 +++++++------- cmake/modules/FindSndFile.cmake | 14 +++++++------- cmake/modules/FindWavPack.cmake | 14 +++++++------- 10 files changed, 70 insertions(+), 70 deletions(-) diff --git a/cmake/modules/FindLilv.cmake b/cmake/modules/FindLilv.cmake index a4ff766c008..f4ccfb13fc0 100644 --- a/cmake/modules/FindLilv.cmake +++ b/cmake/modules/FindLilv.cmake @@ -74,12 +74,12 @@ if(Lilv_FOUND) set(Lilv_DEFINITIONS ${PC_Lilv_CFLAGS_OTHER}) if(NOT TARGET Lilv::Lilv) - add_library(Lilv::Lilv UNKNOWN IMPORTED) - set_target_properties(Lilv::Lilv - PROPERTIES - IMPORTED_LOCATION "${Lilv_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_Lilv_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${Lilv_INCLUDE_DIR}" - ) + add_library(Lilv::Lilv UNKNOWN IMPORTED) + set_target_properties(Lilv::Lilv + PROPERTIES + IMPORTED_LOCATION "${Lilv_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Lilv_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Lilv_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindMAD.cmake b/cmake/modules/FindMAD.cmake index 1e7cf7a2f36..3d838df78aa 100644 --- a/cmake/modules/FindMAD.cmake +++ b/cmake/modules/FindMAD.cmake @@ -74,12 +74,12 @@ if(MAD_FOUND) set(MAD_DEFINITIONS ${PC_MAD_CFLAGS_OTHER}) if(NOT TARGET MAD::MAD) - add_library(MAD::MAD UNKNOWN IMPORTED) - set_target_properties(MAD::MAD - PROPERTIES - IMPORTED_LOCATION "${MAD_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_MAD_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${MAD_INCLUDE_DIR}" - ) + add_library(MAD::MAD UNKNOWN IMPORTED) + set_target_properties(MAD::MAD + PROPERTIES + IMPORTED_LOCATION "${MAD_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_MAD_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MAD_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindMP4.cmake b/cmake/modules/FindMP4.cmake index dff3e6c0534..bc26a67a8b1 100644 --- a/cmake/modules/FindMP4.cmake +++ b/cmake/modules/FindMP4.cmake @@ -73,12 +73,12 @@ if(MP4_FOUND) set(MP4_DEFINITIONS ${PC_MP4_CFLAGS_OTHER}) if(NOT TARGET MP4::MP4) - add_library(MP4::MP4 UNKNOWN IMPORTED) - set_target_properties(MP4::MP4 - PROPERTIES - IMPORTED_LOCATION "${MP4_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_MP4_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${MP4_INCLUDE_DIR}" - ) + add_library(MP4::MP4 UNKNOWN IMPORTED) + set_target_properties(MP4::MP4 + PROPERTIES + IMPORTED_LOCATION "${MP4_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_MP4_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MP4_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindMP4v2.cmake b/cmake/modules/FindMP4v2.cmake index 798710fa390..b2304c5daf1 100644 --- a/cmake/modules/FindMP4v2.cmake +++ b/cmake/modules/FindMP4v2.cmake @@ -73,12 +73,12 @@ if(MP4v2_FOUND) set(MP4v2_DEFINITIONS ${PC_MP4v2_CFLAGS_OTHER}) if(NOT TARGET MP4v2::MP4v2) - add_library(MP4v2::MP4v2 UNKNOWN IMPORTED) - set_target_properties(MP4v2::MP4v2 - PROPERTIES - IMPORTED_LOCATION "${MP4v2_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_MP4v2_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${MP4v2_INCLUDE_DIR}" - ) + add_library(MP4v2::MP4v2 UNKNOWN IMPORTED) + set_target_properties(MP4v2::MP4v2 + PROPERTIES + IMPORTED_LOCATION "${MP4v2_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_MP4v2_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MP4v2_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindModplug.cmake b/cmake/modules/FindModplug.cmake index 171950d2a44..6e8fce7c654 100644 --- a/cmake/modules/FindModplug.cmake +++ b/cmake/modules/FindModplug.cmake @@ -73,12 +73,12 @@ if(Modplug_FOUND) set(Modplug_DEFINITIONS ${PC_Modplug_CFLAGS_OTHER}) if(NOT TARGET Modplug::Modplug) - add_library(Modplug::Modplug UNKNOWN IMPORTED) - set_target_properties(Modplug::Modplug - PROPERTIES - IMPORTED_LOCATION "${Modplug_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_Modplug_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${Modplug_INCLUDE_DIR}" - ) + add_library(Modplug::Modplug UNKNOWN IMPORTED) + set_target_properties(Modplug::Modplug + PROPERTIES + IMPORTED_LOCATION "${Modplug_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Modplug_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Modplug_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindRubberband.cmake b/cmake/modules/FindRubberband.cmake index 548cd4c0fb1..cc1c9560536 100644 --- a/cmake/modules/FindRubberband.cmake +++ b/cmake/modules/FindRubberband.cmake @@ -73,12 +73,12 @@ if(Rubberband_FOUND) set(Rubberband_DEFINITIONS ${PC_Rubberband_CFLAGS_OTHER}) if(NOT TARGET Rubberband::Rubberband) - add_library(Rubberband::Rubberband UNKNOWN IMPORTED) - set_target_properties(Rubberband::Rubberband - PROPERTIES - IMPORTED_LOCATION "${Rubberband_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_Rubberband_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${Rubberband_INCLUDE_DIR}" - ) + add_library(Rubberband::Rubberband UNKNOWN IMPORTED) + set_target_properties(Rubberband::Rubberband + PROPERTIES + IMPORTED_LOCATION "${Rubberband_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Rubberband_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Rubberband_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindSQLite3.cmake b/cmake/modules/FindSQLite3.cmake index fc7c0012d6e..53d66f20584 100644 --- a/cmake/modules/FindSQLite3.cmake +++ b/cmake/modules/FindSQLite3.cmake @@ -74,12 +74,12 @@ if(SQLite3_FOUND) set(SQLite3_DEFINITIONS ${PC_SQLite3_CFLAGS_OTHER}) if(NOT TARGET SQLite3::SQLite3) - add_library(SQLite3::SQLite3 UNKNOWN IMPORTED) - set_target_properties(SQLite3::SQLite3 - PROPERTIES - IMPORTED_LOCATION "${SQLite3_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_SQLite3_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}" - ) + add_library(SQLite3::SQLite3 UNKNOWN IMPORTED) + set_target_properties(SQLite3::SQLite3 + PROPERTIES + IMPORTED_LOCATION "${SQLite3_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_SQLite3_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindShout.cmake b/cmake/modules/FindShout.cmake index ebf6c1f7344..24934ce7181 100644 --- a/cmake/modules/FindShout.cmake +++ b/cmake/modules/FindShout.cmake @@ -73,12 +73,12 @@ if(Shout_FOUND) set(Shout_DEFINITIONS ${PC_Shout_CFLAGS_OTHER}) if(NOT TARGET Shout::Shout) - add_library(Shout::Shout UNKNOWN IMPORTED) - set_target_properties(Shout::Shout - PROPERTIES - IMPORTED_LOCATION "${Shout_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_Shout_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${Shout_INCLUDE_DIR}" - ) + add_library(Shout::Shout UNKNOWN IMPORTED) + set_target_properties(Shout::Shout + PROPERTIES + IMPORTED_LOCATION "${Shout_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Shout_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Shout_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindSndFile.cmake b/cmake/modules/FindSndFile.cmake index 843ae15633e..6568589168a 100644 --- a/cmake/modules/FindSndFile.cmake +++ b/cmake/modules/FindSndFile.cmake @@ -74,12 +74,12 @@ if(SndFile_FOUND) set(SndFile_DEFINITIONS ${PC_SndFile_CFLAGS_OTHER}) if(NOT TARGET SndFile::SndFile) - add_library(SndFile::SndFile UNKNOWN IMPORTED) - set_target_properties(SndFile::SndFile - PROPERTIES - IMPORTED_LOCATION "${SndFile_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_SndFile_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${SndFile_INCLUDE_DIR}" - ) + add_library(SndFile::SndFile UNKNOWN IMPORTED) + set_target_properties(SndFile::SndFile + PROPERTIES + IMPORTED_LOCATION "${SndFile_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_SndFile_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${SndFile_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindWavPack.cmake b/cmake/modules/FindWavPack.cmake index 5a897b9abba..4bafc81f25c 100644 --- a/cmake/modules/FindWavPack.cmake +++ b/cmake/modules/FindWavPack.cmake @@ -73,12 +73,12 @@ if(WavPack_FOUND) set(WavPack_DEFINITIONS ${PC_WavPack_CFLAGS_OTHER}) if(NOT TARGET WavPack::WavPack) - add_library(WavPack::WavPack UNKNOWN IMPORTED) - set_target_properties(WavPack::WavPack - PROPERTIES - IMPORTED_LOCATION "${WavPack_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_WavPack_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${WavPack_INCLUDE_DIR}" - ) + add_library(WavPack::WavPack UNKNOWN IMPORTED) + set_target_properties(WavPack::WavPack + PROPERTIES + IMPORTED_LOCATION "${WavPack_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_WavPack_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${WavPack_INCLUDE_DIR}" + ) endif() endif() From dc96c3be215075fb0a350f3a27b23b706e78ca11 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 13:45:02 +0200 Subject: [PATCH 013/134] CMake: Use git commit count instead of commit hash as BUILD_REV --- CMakeLists.txt | 14 ++++++++++++-- src/build.h.template | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c99f4200852..15f9c54105a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,15 @@ execute_process( OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) +message(STATUS "Git commit: ${GIT_COMMIT_HASH}") + +# Get the number of commits on the working branch +execute_process( + COMMAND git rev-list --count --first-parent HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_COUNT + OUTPUT_STRIP_TRAILING_WHITESPACE +) # Check if the worktree is dirty execute_process( @@ -33,9 +42,10 @@ execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) if(NOT GIT_WORKTREE_DIRTY EQUAL "0") - set(GIT_COMMIT_HASH "${GIT_COMMIT_HASH}+") + set(GIT_COMMIT_COUNT "${GIT_COMMIT_COUNT}+") endif() -message(STATUS "Git commit: ${GIT_COMMIT_HASH}") +message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") + configure_file( "${PROJECT_SOURCE_DIR}/src/build.h.template" "${PROJECT_BINARY_DIR}/src/build.h" diff --git a/src/build.h.template b/src/build.h.template index ec29745ab9b..96634ff1b65 100644 --- a/src/build.h.template +++ b/src/build.h.template @@ -2,6 +2,6 @@ #define BUILD_H #define BUILD_BRANCH "@GIT_BRANCH@" -#define BUILD_REV "@GIT_COMMIT_HASH@" +#define BUILD_REV "@GIT_COMMIT_COUNT@" #endif // BUILD_H From fce3d1e1d20a4b9fb3bfe7a9f8bb587230ec3a26 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 14:04:58 +0200 Subject: [PATCH 014/134] CMake: Fix MediaFoundation variable case --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15f9c54105a..0ee0faea3c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1246,7 +1246,7 @@ endif() # Media Foundation AAC Decoder Plugin if(WIN32) find_package(MediaFoundation) - option(MEDIAFOUNDATION_ENABLED "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" "${MEDIAFOUNDATION_FOUND}") + option(MEDIAFOUNDATION_ENABLED "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" "${MediaFoundation_FOUND}") if(MEDIAFOUNDATION_ENABLED) target_sources(mixxx-lib PRIVATE src/sources/soundsourcemediafoundation.cpp From f0d230ef727f8554bbb5bdc1654d19b1ee753130 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 14:06:33 +0200 Subject: [PATCH 015/134] CMake: Print error message if library for optional feature is missing --- CMakeLists.txt | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ee0faea3c8..b659828edd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1130,7 +1130,7 @@ option(FAAD_ENABLED ) if(FAAD_ENABLED) if(NOT MP4_FOUND AND NOT MP4v2_FOUND) - message(FATAL_ERROR "FAAD AAC audio support requires libmp4 or libmp4v2.") + message(FATAL_ERROR "FAAD AAC audio support requires libmp4 or libmp4v2 with development headers.") endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourcem4a.cpp @@ -1162,6 +1162,9 @@ endif() find_package(HSS1394) option(HSS1394_ENABLED "HSS1394 MIDI device support" "${HSS1394_FOUND}") if(HSS1394_ENABLED) + if(NOT HSS1394_FOUND) + message(FATAL_ERROR "HSS1394 MIDI device support requires the libhss1394 and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/controllers/midi/hss1394controller.cpp src/controllers/midi/hss1394enumerator.cpp @@ -1174,6 +1177,9 @@ endif() find_package(Lilv) option(LILV_ENABLED "Lilv (LV2) support" "${Lilv_FOUND}") if(LILV_ENABLED) + if(NOT Lilv_FOUND) + message(FATAL_ERROR "Lilv (LV2) support requires the liblilv-0 and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/effects/lv2/lv2backend.cpp src/effects/lv2/lv2effectprocessor.cpp @@ -1188,6 +1194,9 @@ endif() find_package(Shout) option(BROADCAST_ENABLED "Live Broadcasting (Shoutcast) support" "${Shout_FOUND}") if(BROADCAST_ENABLED) + if(NOT Shout_FOUND) + message(FATAL_ERROR "Live Broadcasting support requires the libshout and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/preferences/dialog/dlgprefbroadcastdlg.ui src/preferences/dialog/dlgprefbroadcast.cpp @@ -1202,6 +1211,9 @@ endif() find_package(SQLite3) option(LOCALECOMPARE_ENABLED "Locale Aware Compare support for SQLite" "${SQLite3_FOUND}") if(LOCALECOMPARE_ENABLED) + if(NOT SQLite3_FOUND) + message(FATAL_ERROR "Locale Aware Compare for SQLite requires libsqlite and its development headers.") + endif() target_compile_definitions(mixxx-lib PUBLIC __SQLITE3__) target_include_directories(mixxx-lib PRIVATE ${SQLite3_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${SQLite3_LIBRARIES}) @@ -1211,6 +1223,9 @@ endif() find_package(Opus) option(OPUS_ENABLED "Opus (RFC 6716) support" "${Opus_FOUND}") if(OPUS_ENABLED) + if(NOT Opus_FOUND) + message(FATAL_ERROR "Opus support requires libopus and libopusfile with development headers.") + endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourceopus.cpp src/encoder/encoderopus.cpp @@ -1230,6 +1245,12 @@ else() endif() option(MAD_ENABLED "MAD MP3 Decoder" "${MAD_ENABLED_DEFAULT}") if(MAD_ENABLED) + if(NOT MAD_FOUND) + message(FATAL_ERROR "MAD support requires libmad and its development headers.") + endif() + if(NOT ID3Tag_FOUND) + message(FATAL_ERROR "ID3Tag support requires libid3tag and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourcemp3.cpp) target_compile_definitions(mixxx-lib PUBLIC __MAD__) target_link_libraries(mixxx-lib PUBLIC MAD::MAD ID3Tag::ID3Tag) @@ -1248,6 +1269,9 @@ if(WIN32) find_package(MediaFoundation) option(MEDIAFOUNDATION_ENABLED "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" "${MediaFoundation_FOUND}") if(MEDIAFOUNDATION_ENABLED) + if(NOT MediaFoundation_FOUND) + message(FATAL_ERROR "MediaFoundation support requires the MediaFoundation libraries and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourcemediafoundation.cpp ) @@ -1265,6 +1289,9 @@ endif() find_package(Modplug) option(MODPLUG_ENABLED "Modplug module decoder support" "${Modplug_FOUND}") if(MODPLUG_ENABLED) + if(NOT Modplug_FOUND) + message(FATAL_ERROR "Modplug module decoder support requires libmodplug and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/preferences/dialog/dlgprefmodplugdlg.ui src/sources/soundsourcemodplug.cpp @@ -1295,6 +1322,9 @@ endif() find_package(LibUSB) option(BULK_ENABLED "USB Bulk controller support" "${LibUSB_FOUND}") if(BULK_ENABLED) + if(NOT LibUSB_FOUND) + message(FATAL_ERROR "USB Bulk controller support requires libusb 1.0 and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/controllers/bulk/bulkcontroller.cpp src/controllers/bulk/bulkenumerator.cpp @@ -1337,6 +1367,9 @@ endif() find_package(WavPack) option(WAVPACK_ENABLED "WavPack audio file support" "${WavPack_FOUND}") if(WAVPACK_ENABLED) + if(NOT WavPack_FOUND) + message(FATAL_ERROR "WavPack audio file support requires libwv and its development headers.") + endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourcewv.cpp) target_compile_definitions(mixxx-lib PUBLIC __WV__) target_link_libraries(mixxx-lib PUBLIC WavPack::WavPack) From 475cb5ae4f67158ca62a69fb8513047180063081 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 15:31:01 +0200 Subject: [PATCH 016/134] CMake: Move protoc compiler output back to previous location --- CMakeLists.txt | 26 ++++---------------------- src/analyzer/analyzerkey.cpp | 2 +- src/engine/effects/groupfeaturestate.h | 2 +- src/library/searchquery.h | 2 +- src/proto/CMakeLists.txt | 13 +++++++++++++ src/skin/legacyskinparser.h | 2 +- src/test/keyutilstest.cpp | 2 +- src/test/tableview_test.cpp | 2 +- src/track/beatgrid.h | 2 +- src/track/beatmap.h | 2 +- src/track/keyfactory.h | 2 +- src/track/keys.h | 2 +- src/track/keyutils.h | 2 +- src/track/trackrecord.h | 2 +- src/waveform/waveform.cpp | 2 +- src/widget/wtracktableviewheader.h | 2 +- 16 files changed, 31 insertions(+), 36 deletions(-) create mode 100644 src/proto/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index b659828edd4..2212920b4d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,18 +62,6 @@ else() set(CLANG OFF) endif() -# Protobuf -find_package(Protobuf REQUIRED) -protobuf_generate_cpp( - PROTO_SOURCES - PROTO_HEADERS - src/proto/beats.proto - src/proto/headers.proto - src/proto/keys.proto - src/proto/skin.proto - src/proto/waveform.proto -) - # Mixxx itself add_library(mixxx-lib STATIC src/analyzer/analyzerbeats.cpp @@ -613,20 +601,14 @@ add_library(mixxx-lib STATIC src/widget/wwidget.cpp src/widget/wwidgetgroup.cpp src/widget/wwidgetstack.cpp - ${PROTO_SOURCES} - ${PROTO_HEADERS}) +) set_target_properties(mixxx-lib PROPERTIES AUTOMOC ON AUTOUIC ON) -target_include_directories(mixxx-lib PUBLIC src "${PROJECT_BINARY_DIR}/src") +target_include_directories(mixxx-lib PUBLIC src "${CMAKE_CURRENT_BINARY_DIR}/src") target_compile_definitions(mixxx-lib PRIVATE SETTINGS_FILE="mixxx.cfg") if(UNIX AND NOT APPLE) target_compile_definitions(mixxx-lib PRIVATE SETTINGS_PATH=".mixxx/") endif() -target_include_directories(mixxx-lib PUBLIC - ${PROTOBUF_INCLUDE_DIRS} - "${CMAKE_CURRENT_BINARY_DIR}" -) - if(WIN32) target_compile_definitions(mixxx-lib PRIVATE __WINDOWS__) @@ -844,8 +826,8 @@ target_include_directories(mixxx-lib PUBLIC ${PortMidi_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${PortMidi_LIBRARIES}) # Protobuf -target_include_directories(mixxx-lib PUBLIC ${PROTOBUF_INCLUDE_DIRS}) -target_link_libraries(mixxx-lib PUBLIC ${PROTOBUF_LIBRARIES}) +add_subdirectory(src/proto) +target_link_libraries(mixxx-lib PUBLIC mixxx-proto) # Qt find_package(Qt5 diff --git a/src/analyzer/analyzerkey.cpp b/src/analyzer/analyzerkey.cpp index e5530b5a88f..cba32abf0b9 100644 --- a/src/analyzer/analyzerkey.cpp +++ b/src/analyzer/analyzerkey.cpp @@ -5,7 +5,7 @@ #include "analyzer/constants.h" #include "analyzer/plugins/analyzerqueenmarykey.h" -#include "keys.pb.h" +#include "proto/keys.pb.h" #include "track/keyfactory.h" // static diff --git a/src/engine/effects/groupfeaturestate.h b/src/engine/effects/groupfeaturestate.h index f36282ff7df..9096caf83a0 100644 --- a/src/engine/effects/groupfeaturestate.h +++ b/src/engine/effects/groupfeaturestate.h @@ -1,7 +1,7 @@ #ifndef GROUPFEATURESTATE_H #define GROUPFEATURESTATE_H -#include "keys.pb.h" +#include "proto/keys.pb.h" struct GroupFeatureState { GroupFeatureState() diff --git a/src/library/searchquery.h b/src/library/searchquery.h index c78dafe6ab2..a26f046bbb3 100644 --- a/src/library/searchquery.h +++ b/src/library/searchquery.h @@ -11,7 +11,7 @@ #include #include "track/track.h" -#include "keys.pb.h" +#include "proto/keys.pb.h" #include "util/assert.h" #include "util/memory.h" #include "library/crate/cratestorage.h" diff --git a/src/proto/CMakeLists.txt b/src/proto/CMakeLists.txt new file mode 100644 index 00000000000..cfe859db2a3 --- /dev/null +++ b/src/proto/CMakeLists.txt @@ -0,0 +1,13 @@ +# Protobuf +find_package(Protobuf REQUIRED) +protobuf_generate_cpp( + PROTO_SOURCES + PROTO_HEADERS + beats.proto + headers.proto + keys.proto + skin.proto + waveform.proto +) +add_library(mixxx-proto OBJECT ${PROTO_SOURCES} ${PROTO_HEADERS}) +target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf) diff --git a/src/skin/legacyskinparser.h b/src/skin/legacyskinparser.h index 0440bd536fe..ad685462540 100644 --- a/src/skin/legacyskinparser.h +++ b/src/skin/legacyskinparser.h @@ -11,7 +11,7 @@ #include "skin/skinparser.h" #include "vinylcontrol/vinylcontrolmanager.h" #include "skin/tooltips.h" -#include "skin.pb.h" +#include "proto/skin.pb.h" #include "util/memory.h" class WBaseWidget; diff --git a/src/test/keyutilstest.cpp b/src/test/keyutilstest.cpp index ceb5ccd0e2b..cd876b0fa9a 100644 --- a/src/test/keyutilstest.cpp +++ b/src/test/keyutilstest.cpp @@ -3,7 +3,7 @@ #include #include "track/keyutils.h" -#include "keys.pb.h" +#include "proto/keys.pb.h" using ::testing::ElementsAre; diff --git a/src/test/tableview_test.cpp b/src/test/tableview_test.cpp index 4de8f88a4a0..34f638a1d69 100644 --- a/src/test/tableview_test.cpp +++ b/src/test/tableview_test.cpp @@ -4,7 +4,7 @@ #include #include -#include "headers.pb.h" +#include "proto/headers.pb.h" #include "widget/wtracktableviewheader.h" class HeaderViewStateTest : public testing::Test { diff --git a/src/track/beatgrid.h b/src/track/beatgrid.h index a109d3c0616..90ad5ca0c85 100644 --- a/src/track/beatgrid.h +++ b/src/track/beatgrid.h @@ -5,7 +5,7 @@ #include "track/track.h" #include "track/beats.h" -#include "beats.pb.h" +#include "proto/beats.pb.h" #define BEAT_GRID_1_VERSION "BeatGrid-1.0" #define BEAT_GRID_2_VERSION "BeatGrid-2.0" diff --git a/src/track/beatmap.h b/src/track/beatmap.h index c101a668831..184e28d35ca 100644 --- a/src/track/beatmap.h +++ b/src/track/beatmap.h @@ -12,7 +12,7 @@ #include "track/track.h" #include "track/beats.h" -#include "beats.pb.h" +#include "proto/beats.pb.h" #define BEAT_MAP_VERSION "BeatMap-1.0" diff --git a/src/track/keyfactory.h b/src/track/keyfactory.h index b267f657b1d..fbd64bee663 100644 --- a/src/track/keyfactory.h +++ b/src/track/keyfactory.h @@ -6,7 +6,7 @@ #include #include "track/keys.h" -#include "keys.pb.h" +#include "proto/keys.pb.h" #include "track/track.h" class KeyFactory { diff --git a/src/track/keys.h b/src/track/keys.h index 8d34f1e87cc..faa0f2f7b4d 100644 --- a/src/track/keys.h +++ b/src/track/keys.h @@ -5,7 +5,7 @@ #include #include -#include "keys.pb.h" +#include "proto/keys.pb.h" #define KEY_MAP_VERSION "KeyMap-1.0" diff --git a/src/track/keyutils.h b/src/track/keyutils.h index b286d17de74..b23f999dae7 100644 --- a/src/track/keyutils.h +++ b/src/track/keyutils.h @@ -6,7 +6,7 @@ #include #include "control/controlproxy.h" -#include "keys.pb.h" +#include "proto/keys.pb.h" #include "track/keys.h" #include "util/math.h" diff --git a/src/track/trackrecord.h b/src/track/trackrecord.h index cea479040b3..54d9d5f25c0 100644 --- a/src/track/trackrecord.h +++ b/src/track/trackrecord.h @@ -1,6 +1,6 @@ #pragma once -#include "keys.pb.h" +#include "proto/keys.pb.h" #include "track/trackid.h" #include "track/cue.h" diff --git a/src/waveform/waveform.cpp b/src/waveform/waveform.cpp index e9e7a2b83bd..177b3570608 100644 --- a/src/waveform/waveform.cpp +++ b/src/waveform/waveform.cpp @@ -1,7 +1,7 @@ #include #include "waveform/waveform.h" -#include "waveform.pb.h" +#include "proto/waveform.pb.h" using namespace mixxx::track; diff --git a/src/widget/wtracktableviewheader.h b/src/widget/wtracktableviewheader.h index 94fc138f361..7fa38e7a44a 100644 --- a/src/widget/wtracktableviewheader.h +++ b/src/widget/wtracktableviewheader.h @@ -12,7 +12,7 @@ #include #include -#include "headers.pb.h" +#include "proto/headers.pb.h" class TrackModel; From 164410c93692cf46536529c306815ca1e302e9f5 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 16:05:42 +0200 Subject: [PATCH 017/134] CMake: Add option to switch between static/dynamic linking of libebur128 --- CMakeLists.txt | 37 +++++++++----- cmake/modules/FindEbur128.cmake | 85 +++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 12 deletions(-) create mode 100644 cmake/modules/FindEbur128.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2212920b4d4..8184edd69d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -748,18 +748,31 @@ include(CPack) find_package(Chromaprint REQUIRED) target_link_libraries(mixxx-lib PUBLIC Chromaprint::Chromaprint) -# Ebur128Mit -ExternalProject_Add(libebur128 - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" - INSTALL_COMMAND "" - CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON" -) -add_dependencies(mixxx-lib libebur128) -target_include_directories(mixxx-lib PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" -) -target_link_libraries(mixxx-lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") +# Ebur128 +find_package(Ebur128) +if(Ebur128_FOUND) + set(EBUR128_STATIC_DEFAULT OFF) +else() + set(EBUR128_STATIC_DEFAULT ON) +endif() +option(EBUR128_STATIC "Link libebur128 statically" "${EBUR128_STATIC_DEFAULT}") +if(EBUR128_STATIC) + message(STATUS "Linking internal libebur128 statically") + ExternalProject_Add(libebur128 + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" + INSTALL_COMMAND "" + CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON" + ) + add_dependencies(mixxx-lib libebur128) + target_include_directories(mixxx-lib PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" + ) + target_link_libraries(mixxx-lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") +else() + message(STATUS "Linking libebur128 dynamically") + target_link_libraries(mixxx-lib PUBLIC Ebur128::Ebur128) +endif() # FidLib add_library(fidlib OBJECT lib/fidlib/fidlib.c) diff --git a/cmake/modules/FindEbur128.cmake b/cmake/modules/FindEbur128.cmake new file mode 100644 index 00000000000..0e1e9914d82 --- /dev/null +++ b/cmake/modules/FindEbur128.cmake @@ -0,0 +1,85 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindEbur128 +----------- + +Finds the Ebur128 library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Ebur128::Ebur128`` + The Ebur128 library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Ebur128_FOUND`` + True if the system has the Ebur128 library. +``Ebur128_INCLUDE_DIRS`` + Include directories needed to use Ebur128. +``Ebur128_LIBRARIES`` + Libraries needed to link to Ebur128. +``Ebur128_DEFINITIONS`` + Compile defitions needed to use Ebur128. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Ebur128_INCLUDE_DIR`` + The directory containing ``ebur128.h``. +``Ebur128_LIBRARY`` + The path to the Ebur128 library. + +#]=======================================================================] + +find_package(PkgConfig) +pkg_check_modules(PC_CHROMAPRINT QUIET libebur128) + +find_path(Ebur128_INCLUDE_DIR + NAMES ebur128.h + PATHS ${PC_Ebur128_INCLUDE_DIRS} + PATH_SUFFIXES ebur128 + DOC "Ebur128 include directory") +mark_as_advanced(Ebur128_INCLUDE_DIR) + +find_library(Ebur128_LIBRARY + NAMES ebur128 + PATHS ${PC_Ebur128_LIBRARY_DIRS} + DOC "Ebur128 library" +) +mark_as_advanced(Ebur128_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Ebur128 + DEFAULT_MSG + Ebur128_LIBRARY + Ebur128_INCLUDE_DIR +) + +if(Ebur128_FOUND) + set(Ebur128_LIBRARIES "${Ebur128_LIBRARY}") + set(Ebur128_INCLUDE_DIRS "${Ebur128_INCLUDE_DIR}") + set(Ebur128_DEFINITIONS ${PC_Ebur128_CFLAGS_OTHER}) + + if(NOT TARGET Ebur128::Ebur128) + add_library(Ebur128::Ebur128 UNKNOWN IMPORTED) + set_target_properties(Ebur128::Ebur128 + PROPERTIES + IMPORTED_LOCATION "${Ebur128_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Ebur128_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Ebur128_INCLUDE_DIR}" + ) + endif() +endif() From ce74c93f8aa7af73af20095e5616c7ba01d2713d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 17:19:10 +0200 Subject: [PATCH 018/134] CMake: Make HID support optional and allow static linking --- CMakeLists.txt | 52 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8184edd69d7..1b96eda59af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -799,15 +799,6 @@ target_link_libraries(mixxx-lib PUBLIC FpClassify) # gtest target_include_directories(mixxx-lib PUBLIC lib/gtest-1.7.0/include) -# HIDAPI -find_package(HIDAPI REQUIRED) -target_sources(mixxx-lib PRIVATE - src/controllers/hid/hidcontroller.cpp - src/controllers/hid/hidenumerator.cpp - src/controllers/hid/hidcontrollerpresetfilehandler.cpp -) -target_link_libraries(mixxx-lib PUBLIC HIDAPI::LibUSB) - # LAME find_package(LAME REQUIRED) target_link_libraries(mixxx-lib PUBLIC LAME::LAME) @@ -1328,6 +1319,49 @@ if(BULK_ENABLED) target_link_libraries(mixxx-lib PUBLIC LibUSB::LibUSB) endif() +# USB HID controller support +find_package(HIDAPI) +option(HID_ENABLED "USB HID controller support" "ON") +if(HIDAPI_FOUND) + set(HIDAPI_STATIC_DEFAULT OFF) +else() + set(HIDAPI_STATIC_DEFAULT ON) +endif() +option(HIDAPI_STATIC "Link HIDAPI library statically" "${HID_STATIC_DEFAULT}") +if(HID_ENABLED) + target_sources(mixxx-lib PRIVATE + src/controllers/hid/hidcontroller.cpp + src/controllers/hid/hidenumerator.cpp + src/controllers/hid/hidcontrollerpresetfilehandler.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __HID__) + if(HIDAPI_STATIC) + message(STATUS "Linking internal libhidapi statically") + add_library(mixxx-hidapi OBJECT) + target_include_directories(mixxx-hidapi PUBLIC lib/hidapi-0.8.0-rc1/hidapi) + if(WIN32) + target_sources(mixxx-hidapi PRIVATE lib/hidapi-0.8.0-rc1/windows/hid.c) + elseif(APPLE) + target_sources(mixxx-hidapi PRIVATE lib/hidapi-0.8.0-rc1/mac/hid.c) + elseif(UNIX) + if(NOT LibUSB_FOUND) + message(FATAL_ERROR "USB HID controller support on Unix with statically linked libhidapi-libusb requires libusb 1.0 and its development headers.") + endif() + target_sources(mixxx-hidapi PRIVATE lib/hidapi-0.8.0-rc1/libusb/hid.c) + target_link_libraries(mixxx-hidapi PRIVATE LibUSB::LibUSB) + else() + message(FATAL_ERROR "USB HID controller support only possible on Windows/Mac OS/Linux/BSD.") + endif() + target_link_libraries(mixxx-lib PUBLIC mixxx-hidapi) + else() + message(STATUS "Linking libhidapi dynamically") + if(NOT HIDAPI_FOUND) + message(FATAL_ERROR "USB HID controller support requires libhidapi-libusb and its development headers.") + endif() + target_link_libraries(mixxx-lib PUBLIC HIDAPI::LibUSB) + endif() +endif() + # Vinyl Control option(VINYLCONTROL_ENABLED "Vinyl Control support" ON) if(VINYLCONTROL_ENABLED) From 6a1254dadcb25f212d74d45faaf1d8550bc0de76 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 17:36:01 +0200 Subject: [PATCH 019/134] CMake: Assume statically linked PortTime if only porttime.h was found --- cmake/modules/FindPortMidi.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindPortMidi.cmake b/cmake/modules/FindPortMidi.cmake index 9f9b705664f..2b204b6f326 100644 --- a/cmake/modules/FindPortMidi.cmake +++ b/cmake/modules/FindPortMidi.cmake @@ -67,11 +67,15 @@ find_package_handle_standard_args( DEFAULT_MSG PortMidi_LIBRARY PortMidi_INCLUDE_DIR - PortTime_LIBRARY PortTime_INCLUDE_DIR ) if(PortMidi_FOUND) - set(PortMidi_LIBRARIES ${PortMidi_LIBRARY} ${PortTime_LIBRARY}) + set(PortMidi_LIBRARIES ${PortMidi_LIBRARY}) + # Depending on the library configuration PortTime might be statically + # linked with PortMidi. + if(PortTime_LIBRARY) + list(APPEND PortMidi_LIBRARIES ${PortTime_LIBRARY}) + endif() set(PortMidi_INCLUDE_DIRS ${PortMidi_INCLUDE_DIR} ${PortTime_INCLUDE_DIR}) endif() From cac8dfc68e5a471c50df94118ee2564e8b4332be Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 17:54:46 +0200 Subject: [PATCH 020/134] CMake: Only link HSS1394 on Windows or Mac OS --- CMakeLists.txt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b96eda59af..72b3e98a14e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1145,18 +1145,25 @@ if(GPERFTOOLS_ENABLED OR GPERFTOOLSPROFILER_ENABLED) endif() # HSS1394 MIDI device -find_package(HSS1394) -option(HSS1394_ENABLED "HSS1394 MIDI device support" "${HSS1394_FOUND}") +if(WIN32 OR APPLE) + find_package(HSS1394) + set(HSS1394_ENABLED_DEFAULT "${HSS1394_FOUND}") +else() + set(HSS1394_ENABLED_DEFAULT "ON") +endif() +option(HSS1394_ENABLED "HSS1394 MIDI device support" "${HSS1394_ENABLED_DEFAULT}") if(HSS1394_ENABLED) - if(NOT HSS1394_FOUND) - message(FATAL_ERROR "HSS1394 MIDI device support requires the libhss1394 and its development headers.") - endif() target_sources(mixxx-lib PRIVATE src/controllers/midi/hss1394controller.cpp src/controllers/midi/hss1394enumerator.cpp ) target_compile_definitions(mixxx-lib PUBLIC __HSS1394__) - target_link_libraries(mixxx-lib PUBLIC HSS1394::HSS1394) + if(WIN32 OR APPLE) + if(NOT HSS1394_FOUND) + message(FATAL_ERROR "HSS1394 MIDI device support requires the libhss1394 and its development headers.") + endif() + target_link_libraries(mixxx-lib PUBLIC HSS1394::HSS1394) + endif() endif() # Lilv (LV2) From 5d0c897e8d7fa648a9fec5c521c4793c20238a32 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 19:20:41 +0200 Subject: [PATCH 021/134] CMake: Disable HSS1394 on non-Windows/Mac systems by default --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72b3e98a14e..f4ba8cab13f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1149,7 +1149,7 @@ if(WIN32 OR APPLE) find_package(HSS1394) set(HSS1394_ENABLED_DEFAULT "${HSS1394_FOUND}") else() - set(HSS1394_ENABLED_DEFAULT "ON") + set(HSS1394_ENABLED_DEFAULT "OFF") endif() option(HSS1394_ENABLED "HSS1394 MIDI device support" "${HSS1394_ENABLED_DEFAULT}") if(HSS1394_ENABLED) From 2c4e7327eae5b2095f9f322642afffc6b3d5dfc7 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 17:59:19 +0200 Subject: [PATCH 022/134] CMake: Fix typo in HIDAPI_STATIC_DEFAULT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4ba8cab13f..ae17194b8f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1334,7 +1334,7 @@ if(HIDAPI_FOUND) else() set(HIDAPI_STATIC_DEFAULT ON) endif() -option(HIDAPI_STATIC "Link HIDAPI library statically" "${HID_STATIC_DEFAULT}") +option(HIDAPI_STATIC "Link HIDAPI library statically" "${HIDAPI_STATIC_DEFAULT}") if(HID_ENABLED) target_sources(mixxx-lib PRIVATE src/controllers/hid/hidcontroller.cpp From 7f8507c2803f2f15d52ab0d7ddff7089cd25526f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 18:14:51 +0200 Subject: [PATCH 023/134] CMake: Remove usage of target_link_directores() and use full paths instead --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae17194b8f8..a006ce1b69b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1509,10 +1509,9 @@ add_dependencies(mixxx-test mixxx-gtest) target_include_directories(mixxx-test PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0/include" ) -target_link_directories(mixxx-test PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" +target_link_libraries(mixxx-test PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" ) -target_link_libraries(mixxx-test PUBLIC "gtest") # gmock ExternalProject_Add(mixxx-gmock @@ -1525,10 +1524,9 @@ add_dependencies(mixxx-test mixxx-gmock) target_include_directories(mixxx-test PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0/include" ) -target_link_directories(mixxx-test PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" +target_link_libraries(mixxx-test PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}" ) -target_link_libraries(mixxx-test PUBLIC "gmock") # Benchmark add_library(benchmark STATIC EXCLUDE_FROM_ALL From 2f2bbe12d712acce0e9a9e8f498141d7c2eeffc8 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 19:33:34 +0200 Subject: [PATCH 024/134] CMake: Remove project(DESCRIPTION) parameter --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a006ce1b69b..3fc6575729e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 3.1.0) project(mixxx VERSION 2.3.0 - DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes." HOMEPAGE_URL "https://www.mixxx.org" ) +set(CMAKE_PROJECT_DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes.") cmake_policy(SET CMP0071 NEW) include(ExternalProject) From 8904b25f5cb270443e87354ada4d9ef5f6833d1a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 18:31:02 +0200 Subject: [PATCH 025/134] CMake: Set CXX standard --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fc6575729e..c0324efa0f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ project(mixxx ) set(CMAKE_PROJECT_DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes.") cmake_policy(SET CMP0071 NEW) +set(CMAKE_CXX_STANDARD 14) include(ExternalProject) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") From 4b8c1bc158adccc1fb6e8ebc9b1e3cb5a7de3a38 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 21:14:52 +0200 Subject: [PATCH 026/134] CMake: Make pkg-config optional in FindXXX modules --- cmake/modules/FindChromaprint.cmake | 6 ++++-- cmake/modules/FindEbur128.cmake | 6 ++++-- cmake/modules/FindFLAC.cmake | 6 ++++-- cmake/modules/FindGLIB.cmake | 6 ++++-- cmake/modules/FindGPerfTools.cmake | 8 +++++--- cmake/modules/FindHIDAPI.cmake | 6 ++++-- cmake/modules/FindID3Tag.cmake | 6 ++++-- cmake/modules/FindLibUSB.cmake | 6 ++++-- cmake/modules/FindLilv.cmake | 6 ++++-- cmake/modules/FindMAD.cmake | 6 ++++-- cmake/modules/FindMP4.cmake | 6 ++++-- cmake/modules/FindMP4v2.cmake | 6 ++++-- cmake/modules/FindModplug.cmake | 6 ++++-- cmake/modules/FindOpus.cmake | 8 +++++--- cmake/modules/FindPortAudio.cmake | 6 ++++-- cmake/modules/FindRubberband.cmake | 6 ++++-- cmake/modules/FindSQLite3.cmake | 6 ++++-- cmake/modules/FindShout.cmake | 6 ++++-- cmake/modules/FindSndFile.cmake | 6 ++++-- cmake/modules/FindUpower.cmake | 6 ++++-- cmake/modules/FindWavPack.cmake | 6 ++++-- 21 files changed, 86 insertions(+), 44 deletions(-) diff --git a/cmake/modules/FindChromaprint.cmake b/cmake/modules/FindChromaprint.cmake index fe13ff921b7..65c68397aae 100644 --- a/cmake/modules/FindChromaprint.cmake +++ b/cmake/modules/FindChromaprint.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_CHROMAPRINT QUIET libchromaprint) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Chromaprint QUIET libchromaprint) +endif() find_path(Chromaprint_INCLUDE_DIR NAMES chromaprint.h diff --git a/cmake/modules/FindEbur128.cmake b/cmake/modules/FindEbur128.cmake index 0e1e9914d82..fd76f0a4887 100644 --- a/cmake/modules/FindEbur128.cmake +++ b/cmake/modules/FindEbur128.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_CHROMAPRINT QUIET libebur128) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Ebur128 QUIET libebur128) +endif() find_path(Ebur128_INCLUDE_DIR NAMES ebur128.h diff --git a/cmake/modules/FindFLAC.cmake b/cmake/modules/FindFLAC.cmake index 09d16343d56..6b17592b0b2 100644 --- a/cmake/modules/FindFLAC.cmake +++ b/cmake/modules/FindFLAC.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_FLAC QUIET flac) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_FLAC QUIET flac) +endif() find_path(FLAC_INCLUDE_DIR NAMES FLAC/all.h diff --git a/cmake/modules/FindGLIB.cmake b/cmake/modules/FindGLIB.cmake index 71c982cd4c1..e7e3dac05ee 100644 --- a/cmake/modules/FindGLIB.cmake +++ b/cmake/modules/FindGLIB.cmake @@ -41,8 +41,10 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -find_package(PkgConfig) -pkg_check_modules(PC_GLIB QUIET glib-2.0) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_GLIB QUIET glib-2.0) +endif() find_library(GLIB_LIBRARIES NAMES glib-2.0 diff --git a/cmake/modules/FindGPerfTools.cmake b/cmake/modules/FindGPerfTools.cmake index 370f061c875..b8f659b093c 100644 --- a/cmake/modules/FindGPerfTools.cmake +++ b/cmake/modules/FindGPerfTools.cmake @@ -49,9 +49,12 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_GPerfTools_TCMALLOC QUIET libtcmalloc) + pkg_check_modules(PC_GPerfTools_PROFILER QUIET libprofiler) +endif() -pkg_check_modules(PC_GPerfTools_TCMALLOC QUIET libtcmalloc) find_path(GPerfTools_TCMALLOC_INCLUDE_DIR NAMES gperftools/tcmalloc.h PATHS ${PC_GPerfTools_TCMALLOC_INCLUDE_DIRS} @@ -65,7 +68,6 @@ find_library(GPerfTools_TCMALLOC_LIBRARY ) mark_as_advanced(GPerfTools_TCMALLOC_LIBRARY) -pkg_check_modules(PC_GPerfTools_PROFILER QUIET libprofiler) find_path(GPerfTools_PROFILER_INCLUDE_DIR NAMES gperftools/profiler.h PATHS ${PC_GPerfTools_PROFILER_INCLUDE_DIRS} diff --git a/cmake/modules/FindHIDAPI.cmake b/cmake/modules/FindHIDAPI.cmake index 86e3ca66703..fcf37d1d2b6 100644 --- a/cmake/modules/FindHIDAPI.cmake +++ b/cmake/modules/FindHIDAPI.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_HIDAPI QUIET hidapi-libusb) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_HIDAPI QUIET hidapi-libusb) +endif() find_path(HIDAPI_INCLUDE_DIR NAMES hidapi.h diff --git a/cmake/modules/FindID3Tag.cmake b/cmake/modules/FindID3Tag.cmake index b97d8f33b2a..aca75e7daab 100644 --- a/cmake/modules/FindID3Tag.cmake +++ b/cmake/modules/FindID3Tag.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_ID3Tag QUIET id3tag) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_ID3Tag QUIET id3tag) +endif() find_path(ID3Tag_INCLUDE_DIR NAMES id3tag.h diff --git a/cmake/modules/FindLibUSB.cmake b/cmake/modules/FindLibUSB.cmake index 39c6e39fe13..f227327f72e 100644 --- a/cmake/modules/FindLibUSB.cmake +++ b/cmake/modules/FindLibUSB.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_LibUSB QUIET libusb-1.0) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_LibUSB QUIET libusb-1.0) +endif() find_path(LibUSB_INCLUDE_DIR NAMES libusb.h diff --git a/cmake/modules/FindLilv.cmake b/cmake/modules/FindLilv.cmake index f4ccfb13fc0..95848c430ed 100644 --- a/cmake/modules/FindLilv.cmake +++ b/cmake/modules/FindLilv.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_Lilv QUIET lilv-0) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Lilv QUIET lilv-0) +endif() find_path(Lilv_INCLUDE_DIR NAMES lilv-0/lilv/lilv.h diff --git a/cmake/modules/FindMAD.cmake b/cmake/modules/FindMAD.cmake index 3d838df78aa..0974ace10ce 100644 --- a/cmake/modules/FindMAD.cmake +++ b/cmake/modules/FindMAD.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_MAD QUIET mad) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_MAD QUIET mad) +endif() find_path(MAD_INCLUDE_DIR NAMES mad.h diff --git a/cmake/modules/FindMP4.cmake b/cmake/modules/FindMP4.cmake index bc26a67a8b1..b66cb56648a 100644 --- a/cmake/modules/FindMP4.cmake +++ b/cmake/modules/FindMP4.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_MP4 QUIET mp4) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_MP4 QUIET mp4) +endif() find_path(MP4_INCLUDE_DIR NAMES mp4/mp4.h diff --git a/cmake/modules/FindMP4v2.cmake b/cmake/modules/FindMP4v2.cmake index b2304c5daf1..fc39d5e79d2 100644 --- a/cmake/modules/FindMP4v2.cmake +++ b/cmake/modules/FindMP4v2.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_MP4v2 QUIET mp4v2) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_MP4v2 QUIET mp4v2) +endif() find_path(MP4v2_INCLUDE_DIR NAMES mp4v2/mp4v2.h diff --git a/cmake/modules/FindModplug.cmake b/cmake/modules/FindModplug.cmake index 6e8fce7c654..b99d8bdfc59 100644 --- a/cmake/modules/FindModplug.cmake +++ b/cmake/modules/FindModplug.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_Modplug QUIET libmodplug) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Modplug QUIET libmodplug) +endif() find_path(Modplug_INCLUDE_DIR NAMES libmodplug/modplug.h diff --git a/cmake/modules/FindOpus.cmake b/cmake/modules/FindOpus.cmake index 61ce265cecc..67d2a8562d1 100644 --- a/cmake/modules/FindOpus.cmake +++ b/cmake/modules/FindOpus.cmake @@ -39,9 +39,11 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_Opus QUIET opus) -pkg_check_modules(PC_OpusFile QUIET opusfile) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Opus QUIET opus) + pkg_check_modules(PC_OpusFile QUIET opusfile) +endif() find_path(Opus_INCLUDE_DIR NAMES opus/opus.h diff --git a/cmake/modules/FindPortAudio.cmake b/cmake/modules/FindPortAudio.cmake index 8aa17d4448f..eb4e465ba3f 100644 --- a/cmake/modules/FindPortAudio.cmake +++ b/cmake/modules/FindPortAudio.cmake @@ -5,8 +5,10 @@ # PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory # PORTAUDIO_LIBRARIES - Link these to use Portaudio -include(FindPkgConfig) -pkg_check_modules(PC_PORTAUDIO portaudio-2.0) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_PORTAUDIO portaudio-2.0) +endif() find_path(PORTAUDIO_INCLUDE_DIRS NAMES diff --git a/cmake/modules/FindRubberband.cmake b/cmake/modules/FindRubberband.cmake index cc1c9560536..7331388949b 100644 --- a/cmake/modules/FindRubberband.cmake +++ b/cmake/modules/FindRubberband.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_Rubberband QUIET rubberband) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Rubberband QUIET rubberband) +endif() find_path(Rubberband_INCLUDE_DIR NAMES rubberband/RubberBandStretcher.h diff --git a/cmake/modules/FindSQLite3.cmake b/cmake/modules/FindSQLite3.cmake index 53d66f20584..9a6eae403da 100644 --- a/cmake/modules/FindSQLite3.cmake +++ b/cmake/modules/FindSQLite3.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_SQLite3 QUIET sqlite3) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_SQLite3 QUIET sqlite3) +endif() find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h diff --git a/cmake/modules/FindShout.cmake b/cmake/modules/FindShout.cmake index 24934ce7181..dc302a24298 100644 --- a/cmake/modules/FindShout.cmake +++ b/cmake/modules/FindShout.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_Shout QUIET shout) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Shout QUIET shout) +endif() find_path(Shout_INCLUDE_DIR NAMES shout/shout.h diff --git a/cmake/modules/FindSndFile.cmake b/cmake/modules/FindSndFile.cmake index 6568589168a..6f8e340c8ca 100644 --- a/cmake/modules/FindSndFile.cmake +++ b/cmake/modules/FindSndFile.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_SndFile QUIET sndfile) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_SndFile QUIET sndfile) +endif() find_path(SndFile_INCLUDE_DIR NAMES sndfile.h diff --git a/cmake/modules/FindUpower.cmake b/cmake/modules/FindUpower.cmake index 4d7b91aa9c3..5e45d719b6a 100644 --- a/cmake/modules/FindUpower.cmake +++ b/cmake/modules/FindUpower.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_Upower QUIET upower-glib) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Upower QUIET upower-glib) +endif() find_path(Upower_INCLUDE_DIR NAMES upower.h diff --git a/cmake/modules/FindWavPack.cmake b/cmake/modules/FindWavPack.cmake index 4bafc81f25c..420c97465a2 100644 --- a/cmake/modules/FindWavPack.cmake +++ b/cmake/modules/FindWavPack.cmake @@ -43,8 +43,10 @@ The following cache variables may also be set: #]=======================================================================] -find_package(PkgConfig) -pkg_check_modules(PC_WavPack QUIET wavpack) +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_WavPack QUIET wavpack) +endif() find_path(WavPack_INCLUDE_DIR NAMES wavpack/wavpack.h From aeb053774d4bc8bfa7113520c05253d7723821ec Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 19:57:51 +0200 Subject: [PATCH 027/134] CMake: Fix OpenGL linker instructions --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0324efa0f4..e53f2712339 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -807,8 +807,7 @@ target_link_libraries(mixxx-lib PUBLIC LAME::LAME) # OpenGL set(OpenGL_GL_PREFERENCE "GLVND") find_package(OpenGL REQUIRED) -target_include_directories(mixxx-lib PUBLIC OpenGL) -target_link_libraries(mixxx-lib PUBLIC OpenGL) +target_link_libraries(mixxx-lib PUBLIC OpenGL::GL) # Ogg Vorbis find_package(OggVorbis REQUIRED) From a97d2e861de37cddd1b2d46289c627128ce5eaef Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 20:22:38 +0200 Subject: [PATCH 028/134] CMake: Always add thread support --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e53f2712339..70549fe295b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -991,6 +991,10 @@ find_package(Taglib REQUIRED) target_include_directories(mixxx-lib PUBLIC ${TAGLIB_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${TAGLIB_LIBRARIES}) +# Threads +find_package(Threads REQUIRED) +target_link_libraries(mixxx-lib PUBLIC Threads::Threads) + # Upower if(UNIX AND NOT APPLE) find_package(GLIB COMPONENTS gobject REQUIRED) From 287fe8caa762c337b88e0dccae756be9fbea5542 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 13 Sep 2019 22:43:38 +0200 Subject: [PATCH 029/134] CMake: Make Qt5::Keychain an *optional* component --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70549fe295b..e7613070651 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1308,9 +1308,12 @@ if(UNIX AND NOT APPLE) endif() # QtKeychain -find_package(Qt5 COMPONENTS Keychain) +find_package(Qt5 OPTIONAL_COMPONENTS Keychain) option(QTKEYCHAIN_ENABLED "Secure credentials storage support for Live Broadcasting profiles" OFF) if(QTKEYCHAIN_ENABLED) + if(NOT Qt5_Keychain_FOUND) + message(FATAL_ERROR "Secure credential storage support requires the Qt5::Keychain component.") + endif() target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__) target_link_libraries(mixxx-lib PUBLIC Qt5::Keychain) endif() From 971e34a2e82e649d92ba50b7b3daa62b967601fb Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 14 Sep 2019 12:56:11 +0200 Subject: [PATCH 030/134] CMake: Fix QRC resource linking --- CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7613070651..860e0a84973 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -660,10 +660,6 @@ endif() add_executable(mixxx src/main.cpp) target_link_libraries(mixxx PUBLIC mixxx-lib) -add_library(mixxx-qrc OBJECT res/mixxx.qrc) -set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) -target_link_libraries(mixxx-lib PUBLIC mixxx-qrc) - # # Installation and Packaging # @@ -1563,3 +1559,16 @@ target_link_libraries(mixxx-test PUBLIC benchmark) include(GoogleTest) enable_testing() gtest_add_tests(TARGET mixxx-test) + +# +# Resources +# +add_library(mixxx-qrc OBJECT res/mixxx.qrc) +set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) + +# Add resources to mixxx and mixxx-test binaries, not the mixxx-lib static +# library. Doing this would require initialization using Q_INIT_RESOURCE() +# calls that are not present at the moment. Further information can be found +# at: https://doc.qt.io/qt5/resources.html#using-resources-in-a-library +target_link_libraries(mixxx PUBLIC mixxx-qrc) +target_link_libraries(mixxx-test PUBLIC mixxx-qrc) From f538f5ad16278df1a2e9f0782ddb4e1389bb47c1 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 14 Sep 2019 23:31:50 +0200 Subject: [PATCH 031/134] CMake: Add benchmark test --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 860e0a84973..6b393e9194e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1556,9 +1556,23 @@ endif() target_include_directories(benchmark PUBLIC lib/benchmark/include) target_link_libraries(mixxx-test PUBLIC benchmark) +# Test Suite include(GoogleTest) enable_testing() -gtest_add_tests(TARGET mixxx-test) +gtest_add_tests( + TARGET mixxx-test + TEST_LIST testsuite +) +set_tests_properties(${testsuite} PROPERTIES TIMEOUT 10) + +# Benchmarking +gtest_add_tests( + TARGET mixxx-test + TEST_PREFIX benchmark. + EXTRA_ARGS --benchmark + TEST_LIST benchmark +) +set_tests_properties(${benchmark} PROPERTIES TIMEOUT 10) # # Resources From 66083c56d1bc0661c63e2202b1aac5b356450301 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 00:43:28 +0200 Subject: [PATCH 032/134] CMake: Only set CMD0071 to NEW if that policy exists in that cmake version --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b393e9194e..0397953fe33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,12 @@ project(mixxx HOMEPAGE_URL "https://www.mixxx.org" ) set(CMAKE_PROJECT_DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes.") -cmake_policy(SET CMP0071 NEW) + +# Let AUTOMOC and AUTOUIC process GENERATED files +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + set(CMAKE_CXX_STANDARD 14) include(ExternalProject) From 3b9b4932c25f608e6840e986696e3f93c6960b54 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 00:18:49 +0200 Subject: [PATCH 033/134] CMake: Run tests from source directory --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0397953fe33..3028467b3a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1566,6 +1566,7 @@ include(GoogleTest) enable_testing() gtest_add_tests( TARGET mixxx-test + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" TEST_LIST testsuite ) set_tests_properties(${testsuite} PROPERTIES TIMEOUT 10) @@ -1575,6 +1576,7 @@ gtest_add_tests( TARGET mixxx-test TEST_PREFIX benchmark. EXTRA_ARGS --benchmark + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" TEST_LIST benchmark ) set_tests_properties(${benchmark} PROPERTIES TIMEOUT 10) From 6c600568b63086e8641d7f04adefdea6c0742cb6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 13:21:52 +0200 Subject: [PATCH 034/134] CMake: Add __SNDFILE__ compile definition --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3028467b3a6..d15fffb3ff7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -966,6 +966,7 @@ target_link_libraries(mixxx-lib PUBLIC Rubberband::Rubberband) # SndFile find_package(SndFile REQUIRED) target_link_libraries(mixxx-lib PUBLIC SndFile::SndFile) +target_compile_definitions(mixxx-lib PUBLIC __SNDFILE__) # SoundTouch add_library(SoundTouch STATIC From 8f186d589178af9730ae25881bc42c90b407e3f8 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 13:29:01 +0200 Subject: [PATCH 035/134] CMake: Do not define __UNIX__ if we're compiling for Mac OS X --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d15fffb3ff7..f467744a86a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -645,10 +645,10 @@ if(WIN32) # may include cmath first. target_compile_definitions(mixxx-lib PUBLIC _USE_MATH_DEFINES) elseif(UNIX) - target_compile_definitions(mixxx-lib PRIVATE __UNIX__) if(APPLE) target_compile_definitions(mixxx-lib PUBLIC __APPLE__) else() + target_compile_definitions(mixxx-lib PRIVATE __UNIX__) target_compile_definitions( mixxx-lib PUBLIC UNIX_SHARE_PATH="${CMAKE_INSTALL_PREFIX}/share/mixxx/") target_compile_definitions( From 8a2fcd1cc6ebd4f247d97db99fc01a2101039a7a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 14:08:58 +0200 Subject: [PATCH 036/134] CMake: Add include directory for CoreAudio support --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f467744a86a..ee466d9295e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1106,6 +1106,7 @@ if(COREAUDIO_ENABLED) ${COREFOUNDATION_LIBRARY} ) target_compile_definitions(mixxx-lib PRIVATE __COREAUDIO__) + target_include_directories(mixxx-lib PUBLIC lib/apple) endif() # FAAD AAC audio file decoder plugin From 4061c9d9b2ed41f3f490e320f6670fd9ac33b228 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 24 Oct 2019 19:06:10 +0200 Subject: [PATCH 037/134] CMake: Fix benchmarking tests --- CMakeLists.txt | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee466d9295e..0977fcd7ccb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1539,7 +1539,7 @@ target_link_libraries(mixxx-test PUBLIC ) # Benchmark -add_library(benchmark STATIC EXCLUDE_FROM_ALL +add_library(gbenchmark STATIC EXCLUDE_FROM_ALL lib/benchmark/src/benchmark.cc lib/benchmark/src/colorprint.cc lib/benchmark/src/commandlineflags.cc @@ -1554,14 +1554,14 @@ add_library(benchmark STATIC EXCLUDE_FROM_ALL lib/benchmark/src/walltime.cc lib/benchmark/src/re_std.cc ) -target_compile_definitions(benchmark PRIVATE HAVE_STD_REGEX) +target_compile_definitions(gbenchmark PRIVATE HAVE_STD_REGEX) find_package(Threads REQUIRED) -target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(gbenchmark ${CMAKE_THREAD_LIBS_INIT}) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - target_link_libraries(benchmark Shlwapi) + target_link_libraries(gbenchmark Shlwapi) endif() -target_include_directories(benchmark PUBLIC lib/benchmark/include) -target_link_libraries(mixxx-test PUBLIC benchmark) +target_include_directories(gbenchmark PUBLIC lib/benchmark/include) +target_link_libraries(mixxx-test PUBLIC gbenchmark) # Test Suite include(GoogleTest) @@ -1574,14 +1574,13 @@ gtest_add_tests( set_tests_properties(${testsuite} PROPERTIES TIMEOUT 10) # Benchmarking -gtest_add_tests( - TARGET mixxx-test - TEST_PREFIX benchmark. - EXTRA_ARGS --benchmark +add_custom_target(benchmark + COMMAND $ --benchmark WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - TEST_LIST benchmark + COMMENT "Mixxx Benchmarks" + VERBATIM ) -set_tests_properties(${benchmark} PROPERTIES TIMEOUT 10) +add_dependencies(benchmark mixxx-test) # # Resources From f20f7bfdb3456ba63f9e64175e662e7c22e9ed0f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 21:32:30 +0200 Subject: [PATCH 038/134] CMake: Increase test timeout to 30 seconds per test --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0977fcd7ccb..41790b60838 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1571,7 +1571,7 @@ gtest_add_tests( WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" TEST_LIST testsuite ) -set_tests_properties(${testsuite} PROPERTIES TIMEOUT 10) +set_tests_properties(${testsuite} PROPERTIES TIMEOUT 30) # Benchmarking add_custom_target(benchmark From 5c1dd3df8df03aed828ef18d643bac54a4c206f6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 21:42:43 +0200 Subject: [PATCH 039/134] CMake: Fix X11 link target --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41790b60838..de2a7b6e677 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -867,7 +867,7 @@ target_link_libraries(mixxx-lib PUBLIC if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED) - target_link_libraries(mixxx-lib PUBLIC X11 Qt5::X11Extras Qt5::DBus) + target_link_libraries(mixxx-lib PUBLIC X11::X11 Qt5::X11Extras Qt5::DBus) elseif(WIN32) find_package(Qt5 COMPONENTS From 59ef197ad4754cec7b784f99396ee855bc884a02 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 21:59:48 +0200 Subject: [PATCH 040/134] CMake: Fix compatibility with CMake 3.1.0's FindX11 module --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de2a7b6e677..d78c9caadd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -867,7 +867,12 @@ target_link_libraries(mixxx-lib PUBLIC if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED) - target_link_libraries(mixxx-lib PUBLIC X11::X11 Qt5::X11Extras Qt5::DBus) + target_include_directories(mixxx-lib PUBLIC "${X11_INCLUDE_DIR}") + target_link_libraries(mixxx-lib PUBLIC + "${X11_LIBRARIES}" + Qt5::X11Extras + Qt5::DBus + ) elseif(WIN32) find_package(Qt5 COMPONENTS From df8a79529dabd41106c278607d36e5af4679e21b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 22:31:06 +0200 Subject: [PATCH 041/134] CMake: Add chromaprint_p library name for libchromaprint --- cmake/modules/FindChromaprint.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindChromaprint.cmake b/cmake/modules/FindChromaprint.cmake index 65c68397aae..a4da8f24596 100644 --- a/cmake/modules/FindChromaprint.cmake +++ b/cmake/modules/FindChromaprint.cmake @@ -56,7 +56,7 @@ find_path(Chromaprint_INCLUDE_DIR mark_as_advanced(Chromaprint_INCLUDE_DIR) find_library(Chromaprint_LIBRARY - NAMES chromaprint + NAMES chromaprint chromaprint_p PATHS ${PC_Chromaprint_LIBRARY_DIRS} DOC "Chromaprint library" ) From 0faa0f3c8981e6ecc593d06ba42beb903fb2491b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 23:23:38 +0200 Subject: [PATCH 042/134] CMake: Allow protobuf-lite libraries --- src/proto/CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/proto/CMakeLists.txt b/src/proto/CMakeLists.txt index cfe859db2a3..156e9fb09b3 100644 --- a/src/proto/CMakeLists.txt +++ b/src/proto/CMakeLists.txt @@ -1,5 +1,5 @@ # Protobuf -find_package(Protobuf REQUIRED) +find_package(Protobuf) protobuf_generate_cpp( PROTO_SOURCES PROTO_HEADERS @@ -9,5 +9,15 @@ protobuf_generate_cpp( skin.proto waveform.proto ) -add_library(mixxx-proto OBJECT ${PROTO_SOURCES} ${PROTO_HEADERS}) -target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf) + +add_library(mixxx-proto STATIC ${PROTO_SOURCES} ${PROTO_HEADERS}) + +# Use uppercase PROTOBUF_ prefix for backwards compatibility for CMake < 3.6.0 +target_include_directories(mixxx-proto PUBLIC ${PROTOBUF_INCLUDE_DIR}) +if(PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARIES) + target_link_libraries(mixxx-proto PUBLIC ${PROTOBUF_LIBRARIES}) +elseif(PROTOBUF_INCLUDE_DIR AND PROTOBUF_LITE_LIBRARY) + target_link_libraries(mixxx-proto PUBLIC ${PROTOBUF_LITE_LIBRARY}) +else() + message(FATAL_ERROR "Protobuf or Protobuf-lite libraries are required to compile Mixxx.") +endif() From 4418dc7aa808f2798d82ab0c7852f9e4c5430d8a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 15 Sep 2019 22:48:13 +0200 Subject: [PATCH 043/134] CMake: Use CMAKE_PROJECT_HOMEPAGE_URL to fix CMake 3.1.0 compatibility --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d78c9caadd5..9ff51902817 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.1.0) -project(mixxx - VERSION 2.3.0 - HOMEPAGE_URL "https://www.mixxx.org" -) +project(mixxx VERSION 2.3.0) +set(CMAKE_PROJECT_HOMEPAGE_URL "https://www.mixxx.org") set(CMAKE_PROJECT_DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes.") # Let AUTOMOC and AUTOUIC process GENERATED files From 02c98e3ceeab9d5c6bef952c3e954265999c58fc Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 16 Sep 2019 09:57:24 +0200 Subject: [PATCH 044/134] CMake: Do no link OBJECT libraries --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ff51902817..4ae9ea08b5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -775,7 +775,7 @@ else() endif() # FidLib -add_library(fidlib OBJECT lib/fidlib/fidlib.c) +add_library(fidlib STATIC lib/fidlib/fidlib.c) if(MSVC) target_compile_definitions(fidlib PRIVATE T_MSVC) elseif(MINGW) @@ -1357,7 +1357,7 @@ if(HID_ENABLED) target_compile_definitions(mixxx-lib PUBLIC __HID__) if(HIDAPI_STATIC) message(STATUS "Linking internal libhidapi statically") - add_library(mixxx-hidapi OBJECT) + add_library(mixxx-hidapi STATIC) target_include_directories(mixxx-hidapi PUBLIC lib/hidapi-0.8.0-rc1/hidapi) if(WIN32) target_sources(mixxx-hidapi PRIVATE lib/hidapi-0.8.0-rc1/windows/hid.c) @@ -1509,7 +1509,7 @@ add_executable(mixxx-test EXCLUDE_FROM_ALL src/test/main.cpp ) set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) -target_link_libraries(mixxx-test PUBLIC mixxx-lib mixxx-qrc) +target_link_libraries(mixxx-test PUBLIC mixxx-lib) # gtest ExternalProject_Add(mixxx-gtest @@ -1595,5 +1595,5 @@ set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) # library. Doing this would require initialization using Q_INIT_RESOURCE() # calls that are not present at the moment. Further information can be found # at: https://doc.qt.io/qt5/resources.html#using-resources-in-a-library -target_link_libraries(mixxx PUBLIC mixxx-qrc) -target_link_libraries(mixxx-test PUBLIC mixxx-qrc) +target_sources(mixxx PRIVATE $) +target_sources(mixxx-test PRIVATE $) From cc5990b41af637f3cca820808af888badd2aefe5 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 16 Sep 2019 10:13:32 +0200 Subject: [PATCH 045/134] CMake: Add support for IN_LIST if() operator --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ae9ea08b5c..a867492d850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,11 @@ project(mixxx VERSION 2.3.0) set(CMAKE_PROJECT_HOMEPAGE_URL "https://www.mixxx.org") set(CMAKE_PROJECT_DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes.") +# Support new IN_LIST if() operator +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) +endif() + # Let AUTOMOC and AUTOUIC process GENERATED files if(POLICY CMP0071) cmake_policy(SET CMP0071 NEW) From 2e6bbc8f7f021139b7bf561282546d6ea4007a91 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 16 Sep 2019 10:16:09 +0200 Subject: [PATCH 046/134] CMake: Fixup lib prefixes (second attempt) --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a867492d850..162c3bfd090 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,13 @@ include(ExternalProject) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") +message(STATUS "CMAKE_FIND_LIBRARY_PREFIXES: ${CMAKE_FIND_LIBRARY_PREFIXES}") +if(WIN32) + # Add support for lib prefix on Windows + set(CMAKE_FIND_LIBRARY_PREFIXES "" "lib") +endif() +message(STATUS "CMAKE_FIND_LIBRARY_PREFIXES: ${CMAKE_FIND_LIBRARY_PREFIXES}") + # Get the current working branch execute_process( COMMAND git rev-parse --abbrev-ref HEAD From 0578ddbcff2dc8a21669f0bf8a32cffe560ac988 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 12:35:29 +0200 Subject: [PATCH 047/134] CMake: Enable libebur128's internal queue if necessary --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 162c3bfd090..1e0320ceca4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ endif() set(CMAKE_CXX_STANDARD 14) include(ExternalProject) +include(CheckSymbolExists) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") @@ -770,11 +771,16 @@ endif() option(EBUR128_STATIC "Link libebur128 statically" "${EBUR128_STATIC_DEFAULT}") if(EBUR128_STATIC) message(STATUS "Linking internal libebur128 statically") + set(EBUR128_CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON") + check_symbol_exists(STAILQ_HEAD sys/queue.h HAVE_STAILQ) + if(NOT HAVE_STAILQ) + list(APPEND EBUR128_CMAKE_ARGS "-DENABLE_INTERNAL_QUEUE_H=ON") + endif() ExternalProject_Add(libebur128 SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" INSTALL_COMMAND "" - CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON" + CMAKE_ARGS ${EBUR128_CMAKE_ARGS} ) add_dependencies(mixxx-lib libebur128) target_include_directories(mixxx-lib PUBLIC From 3893eeb63688293df4f2cd1dc98186cd4ff65c66 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 13:42:48 +0200 Subject: [PATCH 048/134] CMake: Only use Qt::WinExtras on Windows --- CMakeLists.txt | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e0320ceca4..9d817b41dc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -890,22 +890,8 @@ if(UNIX AND NOT APPLE) Qt5::DBus ) elseif(WIN32) - find_package(Qt5 - COMPONENTS - AccessibilitySupport - EventDispatcherSupport - FontDatabaseSupport - ThemeSupport - WindowsUIAutomationSupport - REQUIRED - ) - target_link_libraries(mixxx-lib PUBLIC - Qt5::AccessibilitySupport - Qt5::EventDispatcherSupport - Qt5::FontDatabaseSupport - Qt5::ThemeSupport - Qt5::WindowsUIAutomationSupport - ) + find_package(Qt5 COMPONENTS WinExtras REQUIRED) + target_link_libraries(mixxx-lib PUBLIC Qt5::WinExtras) endif() # QtScriptByteArray From a4764a88ae391a05323f5799ec886910d9e9f65d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 14:15:04 +0200 Subject: [PATCH 049/134] CMake: Call find_package(HSS1394) independently of platform --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d817b41dc8..20f6cbf0561 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1159,8 +1159,8 @@ if(GPERFTOOLS_ENABLED OR GPERFTOOLSPROFILER_ENABLED) endif() # HSS1394 MIDI device +find_package(HSS1394) if(WIN32 OR APPLE) - find_package(HSS1394) set(HSS1394_ENABLED_DEFAULT "${HSS1394_FOUND}") else() set(HSS1394_ENABLED_DEFAULT "OFF") From 3d1e65b31907021750240eb8d8ae9d231a8dd930 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 14:20:41 +0200 Subject: [PATCH 050/134] CMake: Fix typo in FindTaglib.cmake module --- cmake/modules/FindTaglib.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindTaglib.cmake b/cmake/modules/FindTaglib.cmake index 958f0d02d28..36833d5eca4 100644 --- a/cmake/modules/FindTaglib.cmake +++ b/cmake/modules/FindTaglib.cmake @@ -117,7 +117,7 @@ else() include(FindPackageMessage) include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_INCLUDE_DIRS_ TAGLIB_LIBRARIES) + find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_INCLUDE_DIRS TAGLIB_LIBRARIES) endif() From b635a5f4d1b0197d3f2afeee6f685dd54282ba60 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 15:46:37 +0200 Subject: [PATCH 051/134] CMake: Set _USE_MATH_DEFINES for QueenMaryDsp --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20f6cbf0561..4190fc507ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -649,12 +649,6 @@ if(WIN32) endif() target_link_libraries(mixxx-lib PUBLIC shell32) - - # Causes the cmath headers to declare M_PI and friends. - # http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx We could define this - # in our headers but then include order matters since headers we don't control - # may include cmath first. - target_compile_definitions(mixxx-lib PUBLIC _USE_MATH_DEFINES) elseif(UNIX) if(APPLE) target_compile_definitions(mixxx-lib PUBLIC __APPLE__) @@ -948,6 +942,12 @@ add_library(QueenMaryDsp STATIC target_compile_definitions(QueenMaryDsp PRIVATE kiss_fft_scalar=double) if(UNIX) target_compile_definitions(QueenMaryDsp PRIVATE USE_PTHREADS) +elseif(MSVC) + # Causes the cmath headers to declare M_PI and friends. + # http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx We could define this + # in our headers but then include order matters since headers we don't control + # may include cmath first. + target_compile_definitions(QueenMaryDsp PUBLIC _USE_MATH_DEFINES) endif() # build.env.Append(CPPPATH="#lib/qm-dsp") target_include_directories(QueenMaryDsp PRIVATE lib/qm-dsp) From 012b545e30057f0e08af1ba2a11a49fafbb478fc Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 15:03:17 +0200 Subject: [PATCH 052/134] CMake: Fix QueenMaryDsp include directories --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4190fc507ab..4b54bea4d37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -949,9 +949,7 @@ elseif(MSVC) # may include cmath first. target_compile_definitions(QueenMaryDsp PUBLIC _USE_MATH_DEFINES) endif() -# build.env.Append(CPPPATH="#lib/qm-dsp") -target_include_directories(QueenMaryDsp PRIVATE lib/qm-dsp) -target_include_directories(mixxx-lib PRIVATE lib/qm-dsp lib/qm-dsp/include) +target_include_directories(QueenMaryDsp PUBLIC lib/qm-dsp lib/qm-dsp/include) target_link_libraries(mixxx-lib PUBLIC QueenMaryDsp) # ReplayGain From c25b9cc260105006ad281a933837c248aae64e2a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 22:08:29 +0200 Subject: [PATCH 053/134] CMake: Remove superfluous message() statements --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b54bea4d37..059d15c75cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,12 +19,10 @@ include(CheckSymbolExists) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") -message(STATUS "CMAKE_FIND_LIBRARY_PREFIXES: ${CMAKE_FIND_LIBRARY_PREFIXES}") if(WIN32) # Add support for lib prefix on Windows set(CMAKE_FIND_LIBRARY_PREFIXES "" "lib") endif() -message(STATUS "CMAKE_FIND_LIBRARY_PREFIXES: ${CMAKE_FIND_LIBRARY_PREFIXES}") # Get the current working branch execute_process( From fff93bd5ccf367d2c9003fa6260909e753d91eed Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Sep 2019 23:42:56 +0200 Subject: [PATCH 054/134] CMake: Improve CPack packaging --- CMakeLists.txt | 7 +++++ cmake/cpack_package_description.txt | 42 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 cmake/cpack_package_description.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 059d15c75cf..d437aae6fa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -743,6 +743,13 @@ install( # Packaging set(CPACK_PACKAGE_VENDOR "Mixxx Project") set(CPACK_PACKAGE_CONTACT "RJ Skerry-Ryan ") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack_package_description.txt") +set(CPACK_DEBIAN_PACKAGE_SECTION "sound") +set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +set(CPACK_DEBIAN_PACKAGE_SUGGESTS "pdf-viewer") +set(CPACK_DEBIAN_PACKAGE_REPLACES "mixxx-data") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5opengl5, libqt5svg5, libqt5xml5, libqt5sql5, libqt5sql5-sqlite") +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) include(CPack) # diff --git a/cmake/cpack_package_description.txt b/cmake/cpack_package_description.txt new file mode 100644 index 00000000000..8ac37422d84 --- /dev/null +++ b/cmake/cpack_package_description.txt @@ -0,0 +1,42 @@ +Free Digital DJ software. Start making live DJ mixes today. +Mixxx is free DJ software that gives you everything you need to perform live DJ +mixes. Blend songs together with automatic BPM matching and remix on-the-fly +with looping and hot cues. Whether you're a pro DJ or just getting started, +Mixxx has you covered. + +Mixxx works with ALSA, JACK, OSS and supports many popular DJ controllers. + +Features include: + - Parallel or split scratchable waveform displays + - Waveform summaries + - Spinning vinyl widgets + - MP3, OGG, WAVE, FLAC, and optional unprotected aac (m4a) playback + - Extra playback formats through plugins + - Wave and Ogg recording with optional MP3 support + - Fast, database-powered library + - Crates and playlists for organizing your music + - Reads iTunes, Traktor, and Rhythmbox libraries + - History section keeps track of your setlists + - Internet Broadcasting with Shoutcast and Icecast + - Microphone Support + - Automatic crossfading with Auto DJ + - Pitch-independent time stretch (key lock) + - Adjustable pitch range + - Ramping pitchbend controls + - ReplayGain volume normalization + - Quantized loops, hotcues, and beatloops + - Synchronization and auto-beatmatching + - BPM detection and estimation + - Bulk BPM analysis + - Adjustable EQ shelves + - Crossfader curve control + - Sampler Decks + - Vinyl emulation with Serato, Traktor, and Mixvibes timecode support + - Multichannel soundcard support (playback and capture) + - Headphone cueing with multiple soundcard support + - Skinnable interface with several skins bundled + - Support for many DJ MIDI and HID controllers out-of-the-box + - Advanced MIDI/HID scripting engine + - Multiple simultaneous MIDI/HID controllers + - Multi-core CPU support + - 24-bit/96000 Hz playback and capture From 812a0e88ae7a381c4296dd78d875bd85fbd73922 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 18 Sep 2019 13:18:11 +0200 Subject: [PATCH 055/134] CMake: Add FFmpeg support --- CMakeLists.txt | 34 ++++++ cmake/modules/FindFFmpeg.cmake | 204 +++++++++++++++++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 cmake/modules/FindFFmpeg.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d437aae6fa0..5f42ab4488e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1148,6 +1148,40 @@ if(FAAD_ENABLED) endif() endif() +# FFmpeg 4.x support +# FFmpeg is multimedia library that can be found http://ffmpeg.org/ +find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWRESAMPLE) +option(FFMPEG_ENABLED "FFmpeg 4.x support" "OFF") +if(UNIX) + if(NOT AVCODEC_FOUND OR AVCODEC_VERSION VERSION_LESS 58) + message(FATAL_ERROR "FFmpeg support requires libavcodec (at least v58) and its development headers.") + endif() + if(NOT AVFORMAT_FOUND OR AVFORMAT_VERSION VERSION_LESS 58) + message(FATAL_ERROR "FFmpeg support requires libavformat (at least v58) and its development headers.") + endif() + if(NOT AVUTIL_FOUND) + message(FATAL_ERROR "FFmpeg support requires libavutil and its development headers.") + endif() + if(NOT SWRESAMPLE_FOUND OR SWRESAMPLE_VERSION VERSION_LESS 3.1) + message(FATAL_ERROR "FFmpeg support requires libswresample (at least v3.1) and its development headers.") + endif() + + target_sources(mixxx-lib PRIVATE src/sources/soundsourceffmpeg.cpp) + target_compile_definitions(mixxx-lib PUBLIC + __FFMPEG__ + # Needed to build new FFmpeg + __STDC_CONSTANT_MACROS + __STDC_LIMIT_MACROS + __STDC_FORMAT_MACROS + ) + target_link_libraries(mixxx-lib PUBLIC + FFmpeg::avcodec + FFmpeg::avformat + FFmpeg::avutil + FFmpeg::swresample + ) +endif() + # Google PerfTools option(GPERFTOOLS_ENABLED "Google PerfTools libtcmalloc linkage" OFF) option(GPERFTOOLSPROFILER_ENABLED "Google PerfTools libprofiler linkage" OFF) diff --git a/cmake/modules/FindFFmpeg.cmake b/cmake/modules/FindFFmpeg.cmake new file mode 100644 index 00000000000..9d589e5ec81 --- /dev/null +++ b/cmake/modules/FindFFmpeg.cmake @@ -0,0 +1,204 @@ +#.rst: +# FindFFmpeg +# ---------- +# +# Try to find the required ffmpeg components (default: AVFORMAT, AVUTIL, AVCODEC) +# +# Next variables can be used to hint FFmpeg libs search: +# +# :: +# +# PC__LIBRARY_DIRS +# PC_FFMPEG_LIBRARY_DIRS +# PC__INCLUDE_DIRS +# PC_FFMPEG_INCLUDE_DIRS +# +# Once done this will define +# +# :: +# +# FFMPEG_FOUND - System has the all required components. +# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers. +# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components. +# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components. +# +# For each of the components it will additionally set. +# +# :: +# +# AVCODEC +# AVDEVICE +# AVFORMAT +# AVFILTER +# AVUTIL +# POSTPROC +# SWSCALE +# +# the following variables will be defined +# +# :: +# +# _FOUND - System has +# _INCLUDE_DIRS - Include directory necessary for using the headers +# _LIBRARIES - Link these to use +# _DEFINITIONS - Compiler switches required for using +# _VERSION - The components version +# +# the following import targets is created +# +# :: +# +# FFmpeg::FFmpeg - for all components +# FFmpeg:: - where in lower case (FFmpeg::avcodec) for each components +# +# Copyright (c) 2006, Matthias Kretz, +# Copyright (c) 2008, Alexander Neundorf, +# Copyright (c) 2011, Michael Jansen, +# Copyright (c) 2017, Alexander Drozdov, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +include(FindPackageHandleStandardArgs) + +# The default components were taken from a survey over other FindFFMPEG.cmake files +if (NOT FFmpeg_FIND_COMPONENTS) + set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL) +endif () + +# +### Macro: set_component_found +# +# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present. +# +macro(set_component_found _component ) + if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) + # message(STATUS " - ${_component} found.") + set(${_component}_FOUND TRUE) + else () + # message(STATUS " - ${_component} not found.") + endif () +endmacro() + +# +### Macro: find_component +# +# Checks for the given component by invoking pkgconfig and then looking up the libraries and +# include directories. +# +macro(find_component _component _pkgconfig _library _header) + + #if (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_${_component} REQUIRED ${_pkgconfig}) + endif () + #endif (NOT WIN32) + + find_path(${_component}_INCLUDE_DIRS ${_header} + HINTS + ${PC_${_component}_INCLUDEDIR} + ${PC_${_component}_INCLUDE_DIRS} + ${PC_FFMPEG_INCLUDE_DIRS} + PATH_SUFFIXES + ffmpeg + ) + + find_library(${_component}_LIBRARIES NAMES ${PC_${_component}_LIBRARIES} ${_library} + HINTS + ${PC_${_component}_LIBDIR} + ${PC_${_component}_LIBRARY_DIRS} + ${PC_FFMPEG_LIBRARY_DIRS} + ) + + #message(STATUS ${${_component}_LIBRARIES}) + #message(STATUS ${PC_${_component}_LIBRARIES}) + + set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.") + set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.") + + set_component_found(${_component}) + + mark_as_advanced( + ${_component}_INCLUDE_DIRS + ${_component}_LIBRARIES + ${_component}_DEFINITIONS + ${_component}_VERSION) + +endmacro() + + +# Check for cached results. If there are skip the costly part. +if (NOT FFMPEG_LIBRARIES) + + # Check for all possible component. + find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) + find_component(AVFORMAT libavformat avformat libavformat/avformat.h) + find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) + find_component(AVUTIL libavutil avutil libavutil/avutil.h) + find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) + find_component(SWSCALE libswscale swscale libswscale/swscale.h) + find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) + find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) + + # Check if the required components were found and add their stuff to the FFMPEG_* vars. + foreach (_component ${FFmpeg_FIND_COMPONENTS}) + if (${_component}_FOUND) + # message(STATUS "Required component ${_component} present.") + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES}) + set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS}) + list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS}) + + string(TOLOWER ${_component} _lowerComponent) + if (NOT TARGET FFmpeg::${_lowerComponent}) + add_library(FFmpeg::${_lowerComponent} INTERFACE IMPORTED) + set_target_properties(FFmpeg::${_lowerComponent} PROPERTIES + INTERFACE_COMPILE_OPTIONS "${${_component}_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES ${${_component}_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES "${${_component}_LIBRARIES}") + endif() + + else () + # message(STATUS "Required component ${_component} missing.") + endif () + endforeach () + + # Build the include path with duplicates removed. + if (FFMPEG_INCLUDE_DIRS) + list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) + endif () + + # cache the vars. + set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE) + set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE) + + mark_as_advanced(FFMPEG_INCLUDE_DIRS + FFMPEG_LIBRARIES + FFMPEG_DEFINITIONS) + +endif () + +if (NOT TARGET FFmpeg::FFmpeg) + add_library(FFmpeg::FFmpeg INTERFACE IMPORTED) + set_target_properties(FFmpeg::FFmpeg PROPERTIES + INTERFACE_COMPILE_OPTIONS "${FFMPEG_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES ${FFMPEG_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES "${FFMPEG_LIBRARIES}") +endif() + +# Now set the noncached _FOUND vars for the components. +foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE) + set_component_found(${_component}) +endforeach () + +# Compile the list of required vars +set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) +foreach (_component ${FFmpeg_FIND_COMPONENTS}) + list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS) +endforeach () + +# Give a nice error message if some of the required vars are missing. +find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS}) From 52a1476426ba20edef8b481047fc6a4e461577f9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 18 Sep 2019 15:19:33 +0200 Subject: [PATCH 056/134] CMake: Add improvements for FindFFmpeg.cmake --- cmake/modules/FindFFmpeg.cmake | 128 ++++++++++++++------------------- 1 file changed, 54 insertions(+), 74 deletions(-) diff --git a/cmake/modules/FindFFmpeg.cmake b/cmake/modules/FindFFmpeg.cmake index 9d589e5ec81..94539a81802 100644 --- a/cmake/modules/FindFFmpeg.cmake +++ b/cmake/modules/FindFFmpeg.cmake @@ -55,6 +55,7 @@ # Copyright (c) 2008, Alexander Neundorf, # Copyright (c) 2011, Michael Jansen, # Copyright (c) 2017, Alexander Drozdov, +# Copyright (c) 2019, Jan Holthuis, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. @@ -66,20 +67,6 @@ if (NOT FFmpeg_FIND_COMPONENTS) set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL) endif () -# -### Macro: set_component_found -# -# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present. -# -macro(set_component_found _component ) - if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) - # message(STATUS " - ${_component} found.") - set(${_component}_FOUND TRUE) - else () - # message(STATUS " - ${_component} not found.") - endif () -endmacro() - # ### Macro: find_component # @@ -88,14 +75,12 @@ endmacro() # macro(find_component _component _pkgconfig _library _header) - #if (NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_${_component} REQUIRED ${_pkgconfig}) - endif () - #endif (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig QUIET) + if (PkgConfig_FOUND) + pkg_check_modules(PC_${_component} QUIET ${_pkgconfig}) + endif () find_path(${_component}_INCLUDE_DIRS ${_header} HINTS @@ -119,7 +104,12 @@ macro(find_component _component _pkgconfig _library _header) set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.") set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.") - set_component_found(${_component}) + if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) + # message(STATUS " - ${_component} found.") + set(${_component}_FOUND TRUE) + else () + # message(STATUS " - ${_component} not found.") + endif () mark_as_advanced( ${_component}_INCLUDE_DIRS @@ -130,57 +120,52 @@ macro(find_component _component _pkgconfig _library _header) endmacro() -# Check for cached results. If there are skip the costly part. -if (NOT FFMPEG_LIBRARIES) - - # Check for all possible component. - find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) - find_component(AVFORMAT libavformat avformat libavformat/avformat.h) - find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) - find_component(AVUTIL libavutil avutil libavutil/avutil.h) - find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) - find_component(SWSCALE libswscale swscale libswscale/swscale.h) - find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) - find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) - - # Check if the required components were found and add their stuff to the FFMPEG_* vars. - foreach (_component ${FFmpeg_FIND_COMPONENTS}) - if (${_component}_FOUND) - # message(STATUS "Required component ${_component} present.") - set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES}) - set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS}) - list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS}) - - string(TOLOWER ${_component} _lowerComponent) - if (NOT TARGET FFmpeg::${_lowerComponent}) - add_library(FFmpeg::${_lowerComponent} INTERFACE IMPORTED) - set_target_properties(FFmpeg::${_lowerComponent} PROPERTIES - INTERFACE_COMPILE_OPTIONS "${${_component}_DEFINITIONS}" - INTERFACE_INCLUDE_DIRECTORIES ${${_component}_INCLUDE_DIRS} - INTERFACE_LINK_LIBRARIES "${${_component}_LIBRARIES}") - endif() - - else () - # message(STATUS "Required component ${_component} missing.") - endif () - endforeach () - - # Build the include path with duplicates removed. - if (FFMPEG_INCLUDE_DIRS) - list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) - endif () +# Check for all possible component. +find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) +find_component(AVFORMAT libavformat avformat libavformat/avformat.h) +find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) +find_component(AVUTIL libavutil avutil libavutil/avutil.h) +find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) +find_component(SWSCALE libswscale swscale libswscale/swscale.h) +find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) +find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) - # cache the vars. - set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE) - set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE) - set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE) +# Check if the required components were found and add their stuff to the FFMPEG_* vars. +foreach (_component ${FFmpeg_FIND_COMPONENTS}) + if (${_component}_FOUND) + # message(STATUS "Required component ${_component} present.") + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES}) + set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS}) + list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS}) + + string(TOLOWER ${_component} _lowerComponent) + if (NOT TARGET FFmpeg::${_lowerComponent}) + add_library(FFmpeg::${_lowerComponent} INTERFACE IMPORTED) + set_target_properties(FFmpeg::${_lowerComponent} PROPERTIES + INTERFACE_COMPILE_OPTIONS "${${_component}_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES ${${_component}_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES "${${_component}_LIBRARIES}") + endif() - mark_as_advanced(FFMPEG_INCLUDE_DIRS - FFMPEG_LIBRARIES - FFMPEG_DEFINITIONS) + else () + # message(STATUS "Required component ${_component} missing.") + endif () +endforeach () +# Build the include path with duplicates removed. +if (FFMPEG_INCLUDE_DIRS) + list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) endif () +# cache the vars. +set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE) +set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE) +set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE) + +mark_as_advanced(FFMPEG_INCLUDE_DIRS + FFMPEG_LIBRARIES + FFMPEG_DEFINITIONS) + if (NOT TARGET FFmpeg::FFmpeg) add_library(FFmpeg::FFmpeg INTERFACE IMPORTED) set_target_properties(FFmpeg::FFmpeg PROPERTIES @@ -189,11 +174,6 @@ if (NOT TARGET FFmpeg::FFmpeg) INTERFACE_LINK_LIBRARIES "${FFMPEG_LIBRARIES}") endif() -# Now set the noncached _FOUND vars for the components. -foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE) - set_component_found(${_component}) -endforeach () - # Compile the list of required vars set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) foreach (_component ${FFmpeg_FIND_COMPONENTS}) From bd7133edeef36e577bf87c0421f1ed6a0d068142 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 18 Sep 2019 16:10:42 +0200 Subject: [PATCH 057/134] CMake: Improve FFmpeg checks --- CMakeLists.txt | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f42ab4488e..b4412aeb81e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1152,18 +1152,26 @@ endif() # FFmpeg is multimedia library that can be found http://ffmpeg.org/ find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWRESAMPLE) option(FFMPEG_ENABLED "FFmpeg 4.x support" "OFF") -if(UNIX) - if(NOT AVCODEC_FOUND OR AVCODEC_VERSION VERSION_LESS 58) - message(FATAL_ERROR "FFmpeg support requires libavcodec (at least v58) and its development headers.") +if(FFMPEG_ENABLED) + if(NOT AVCODEC_FOUND) + message(FATAL_ERROR "FFmpeg support requires libavcodec and its development headers.") + elseif(AVCODEC_VERSION VERSION_LESS 58) + message(FATAL_ERROR "FFmpeg support requires at least version 58 of libavcodec (found: ${AVCODEC_VERSION}).") endif() - if(NOT AVFORMAT_FOUND OR AVFORMAT_VERSION VERSION_LESS 58) - message(FATAL_ERROR "FFmpeg support requires libavformat (at least v58) and its development headers.") + if(NOT AVFORMAT_FOUND) + message(FATAL_ERROR "FFmpeg support requires libavformat and its development headers.") + elseif(AVFORMAT_VERSION VERSION_LESS 58) + message(FATAL_ERROR "FFmpeg support requires at least version 58 of libavformat (found: ${AVFORMAT_VERSION}).") endif() if(NOT AVUTIL_FOUND) message(FATAL_ERROR "FFmpeg support requires libavutil and its development headers.") + elseif(AVUTIL_VERSION VERSION_LESS 56) + message(FATAL_ERROR "FFmpeg support requires at least version 56 of libavutil (found: ${AVUTIL_VERSION}).") endif() - if(NOT SWRESAMPLE_FOUND OR SWRESAMPLE_VERSION VERSION_LESS 3.1) - message(FATAL_ERROR "FFmpeg support requires libswresample (at least v3.1) and its development headers.") + if(NOT SWRESAMPLE_FOUND) + message(FATAL_ERROR "FFmpeg support requires libswresample and its development headers.") + elseif(SWRESAMPLE_VERSION VERSION_LESS 3.1) + message(FATAL_ERROR "FFmpeg support requires at least version 3.1 of libswresample (found: ${SWRESAMPLE_VERSION}).") endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourceffmpeg.cpp) From 2f126bcde4982808b40d52c8dfdb140a583779b9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 18 Sep 2019 14:55:47 +0200 Subject: [PATCH 058/134] CMake: Add optimization options --- CMakeLists.txt | 144 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4412aeb81e..35df61e2915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1473,6 +1473,150 @@ if(WAVPACK_ENABLED) target_link_libraries(mixxx-lib PUBLIC WavPack::WavPack) endif() +# +# Optimizations +# +set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy, fastbuild)") +message(STATUS "Optimization level: ${OPTIMIZE}") +if(NOT OPTIMIZE STREQUAL "off") + if(MSVC) + # Use the fastest floating point math library + # http://msdn.microsoft.com/en-us/library/e7s85ffb.aspx + # http://msdn.microsoft.com/en-us/library/ms235601.aspx + target_compile_options(mixxx-lib PUBLIC "/fp:fast") + + # Suggested for unused code removal + # http://msdn.microsoft.com/en-us/library/ms235601.aspx + # http://msdn.microsoft.com/en-us/library/xsa71f43.aspx + # http://msdn.microsoft.com/en-us/library/bxwfs976.aspx + target_compile_options(mixxx-lib PUBLIC "/Gy") + target_link_options(mixxx-lib PUBLIC "/OPT:REF" "/OPT:ICF") + + # Don't worry about aligning code on 4KB boundaries + # ALBERT: NOWIN98 is not supported in MSVC 2010. + #target_link_options(mixxx-lib PUBLIC "/OPT:NOWIN98") + + # http://msdn.microsoft.com/en-us/library/59a3b321.aspx + # In general, you should pick /O2 over /Ox + target_compile_options(mixxx-lib PUBLIC "/O2") + + if(OPTIMIZE STREQUAL "fastbuild") + # /GL : http://msdn.microsoft.com/en-us/library/0zza0de8.aspx + # !!! /GL is incompatible with /ZI, which is set by mscvdebug + target_compile_options(mixxx-lib PUBLIC "/GL-") + + # Do link-time code generation (and don't show a progress indicator + # -- this relies on ANSI control characters and tends to overwhelm + # Jenkins logs) Should we turn on PGO ? + # http://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx + target_link_options(mixxx-lib PUBLIC "/LTCG:OFF") + else() + target_compile_options(mixxx-lib PUBLIC "/GL") + target_link_options(mixxx-lib PUBLIC "/LTCG:NOSTATUS") + endif() + + if(OPTIMIZE STREQUAL "portable" OR OPTIMIZE STREQUAL "fastbuild") + message(STATUS "Enabling SS2 CPU optimizations (>= Pentium 4)") + # SSE and SSE2 are core instructions on x64 + # and consequently raise a warning message from compiler with this flag on x64. + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + target_compile_options(mixxx-lib PUBLIC "/arch:SSE2") + endif() + target_compile_definitions(mixxx-lib PUBLIC "__SSE__" "__SSE2__") + elseif(OPTIMIZE STREQUAL "native") + message("Enabling native optimizations for ${CMAKE_SYSTEM_PROCESSOR}") + target_compile_options(mixxx-lib PUBLIC "/favor:${CMAKE_SYSTEM_PROCESSOR}") + elseif(OPTIMIZE STREQUAL "legacy") + message("Enabling pure i386 code") + else() + message(FATAL_ERROR "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}") + endif() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # Common flags to all optimizations. + # -ffast-math will prevent a performance penalty by denormals + # (floating point values almost Zero are treated as Zero) + # unfortunately that work only on 64 bit CPUs or with sse2 enabled + # The following optimisation flags makes the engine code ~3 times + # faster, measured on a Atom CPU. + target_compile_options(mixxx-lib PUBLIC + "-O3" + "-ffast-math" + "-funroll-loops" + ) + + # set -fomit-frame-pointer when we don't profile and are not using + # Clang sanitizers. + # Note: It is only included in -O on machines where it does not + # interfere with debugging + if(NOT PROFILING_ENABLED AND NOT CLANG_SANITIZERS) + target_compile_options(mixxx-lib PUBLIC "-fomit-frame-pointer") + endif() + + if(OPTIMIZE STREQUAL "portable" OR OPTIMIZE STREQUAL "fastbuild") + # portable: sse2 CPU (>= Pentium 4) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3456]86|x86|x64|x86_64|AMD64)$") + message(STATUS "Enabling SS2 CPU optimizations (>= Pentium 4)") + target_compile_options(mixxx-lib PUBLIC "-mtune=generic") + # -mtune=generic pick the most common, but compatible options. + # on arm platforms equivalent to -march=arch + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + # the sse flags are not set by default on 32 bit builds + # but are not supported on arm builds + target_compile_options(mixxx-lib PUBLIC "-msse" "-mfpmath=sse") + endif() + # TODO(rryan): macOS can use SSE3, and possibly SSE 4.1 once + # we require macOS 10.12. + # https://stackoverflow.com/questions/45917280/mac-osx-minumum-support-sse-version + elseif(CMAKE_SYSTEM_PROCESSOR EQUAL "arm") + target_compile_options(mixxx-lib PUBLIC + "-mflat-abi=hard" + "-mfpu=neon" + ) + endif() + # this sets macros __SSE2_MATH__ __SSE_MATH__ __SSE2__ __SSE__ + # This should be our default build for distribution + # It's a little sketchy, but turning on SSE2 will gain + # 100% performance in our filter code and allows us to + # turns on denormal zeroing. + # We don't really support CPU's earlier than Pentium 4, + # which is the class of CPUs this decision affects. + # The downside of this is that we aren't truly + # i386 compatible, so builds that claim 'i386' will crash. + # -- rryan 2/2011 + # Note: SSE2 is a core part of x64 CPUs + elseif(OPTIMIZE STREQUAL "native") + message("Enabling native optimizations for ${CMAKE_SYSTEM_PROCESSOR}") + target_compile_options(mixxx-lib PUBLIC "-march=native") + # http://en.chys.info/2010/04/what-exactly-marchnative-means/ + # Note: requires gcc >= 4.2.0 + # macros like __SSE2_MATH__ __SSE_MATH__ __SSE2__ __SSE__ + # are set automatically + if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3456]86|x86|x64|x86_64|AMD64)$" + AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + # For 32 bit builds using gcc < 5.0, the mfpmath=sse is + # not set by default (not supported on arm builds) + # If -msse is not implicitly set, it falls back to mfpmath=387 + # and a compiler warning is issued (tested with gcc 4.8.4) + target_compile_options(mixxx-lib PUBLIC "-mfpmath=sse") + elseif(CMAKE_SYSTEM_PROCESSOR EQUAL "arm") + target_compile_options(mixxx-lib PUBLIC + "-mfloat-abi=hard" + "-mfpu=neon" + ) + endif() + elseif(OPTIMIZE STREQUAL "legacy") + if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3456]86|x86|x64|x86_64|AMD64)$") + message("Enabling pure i386 code") + target_compile_options(mixxx-lib PUBLIC "-mtune=generic") + # -mtune=generic pick the most common, but compatible options. + # on arm platforms equivalent to -march=arch + endif() + else() + message(FATAL_ERROR "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}") + endif() + endif() +endif() + # # Tests # From 6dff834ef1b7c23e168a86cd78f432422e6d6146 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 18 Sep 2019 18:16:50 +0200 Subject: [PATCH 059/134] CMake: Add EXCLUDE_FROM_ALL to non-primary targets --- CMakeLists.txt | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35df61e2915..da1637621a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,7 @@ else() endif() # Mixxx itself -add_library(mixxx-lib STATIC +add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/analyzer/analyzerbeats.cpp src/analyzer/analyzerebur128.cpp src/analyzer/analyzergain.cpp @@ -781,6 +781,7 @@ if(EBUR128_STATIC) INSTALL_COMMAND "" CMAKE_ARGS ${EBUR128_CMAKE_ARGS} ) + set_target_properties(libebur128 PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(mixxx-lib libebur128) target_include_directories(mixxx-lib PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" @@ -792,7 +793,7 @@ else() endif() # FidLib -add_library(fidlib STATIC lib/fidlib/fidlib.c) +add_library(fidlib STATIC EXCLUDE_FROM_ALL lib/fidlib/fidlib.c) if(MSVC) target_compile_definitions(fidlib PRIVATE T_MSVC) elseif(MINGW) @@ -810,7 +811,7 @@ target_link_libraries(mixxx-lib PUBLIC FLAC::FLAC) # FpClassify This is a wrapper around the fpclassify function that prevents # inlining It is compiled without optimization and allows to use these function # from -ffast-math optimized objects -add_library(FpClassify STATIC src/util/fpclassify.cpp) +add_library(FpClassify STATIC EXCLUDE_FROM_ALL src/util/fpclassify.cpp) target_link_libraries(mixxx-lib PUBLIC FpClassify) # gtest @@ -836,7 +837,9 @@ target_include_directories(mixxx-lib PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${PORTAUDIO_LIBRARIES}) # PortAudio Ring Buffer -add_library(PortAudioRingBuffer STATIC lib/portaudio/pa_ringbuffer.c) +add_library(PortAudioRingBuffer STATIC EXCLUDE_FROM_ALL + lib/portaudio/pa_ringbuffer.c +) target_include_directories(mixxx-lib PUBLIC lib/portaudio) target_link_libraries(mixxx-lib PUBLIC PortAudioRingBuffer) @@ -894,7 +897,7 @@ elseif(WIN32) endif() # QtScriptByteArray -add_library(QtScriptByteArray STATIC +add_library(QtScriptByteArray STATIC EXCLUDE_FROM_ALL lib/qtscript-bytearray/bytearrayclass.cpp lib/qtscript-bytearray/bytearrayprototype.cpp ) @@ -904,7 +907,7 @@ target_include_directories(mixxx-lib PUBLIC lib/qtscript-bytearray) target_link_libraries(mixxx-lib PUBLIC QtScriptByteArray) # Queen Mary DSP -add_library(QueenMaryDsp STATIC +add_library(QueenMaryDsp STATIC EXCLUDE_FROM_ALL # lib/qm-dsp/base/KaiserWindow.cpp lib/qm-dsp/base/Pitch.cpp # lib/qm-dsp/base/SincWindow.cpp @@ -958,12 +961,14 @@ target_include_directories(QueenMaryDsp PUBLIC lib/qm-dsp lib/qm-dsp/include) target_link_libraries(mixxx-lib PUBLIC QueenMaryDsp) # ReplayGain -add_library(ReplayGain STATIC lib/replaygain/replaygain.cpp) +add_library(ReplayGain STATIC EXCLUDE_FROM_ALL + lib/replaygain/replaygain.cpp +) target_include_directories(mixxx-lib PRIVATE lib/replaygain) target_link_libraries(mixxx-lib PRIVATE ReplayGain) # Reverb -add_library(Reverb STATIC lib/reverb/Reverb.cc) +add_library(Reverb STATIC EXCLUDE_FROM_ALL lib/reverb/Reverb.cc) target_include_directories(Reverb PRIVATE src) target_link_libraries(Reverb PUBLIC Qt5::Core) target_include_directories(mixxx-lib PRIVATE lib/reverb) @@ -979,7 +984,7 @@ target_link_libraries(mixxx-lib PUBLIC SndFile::SndFile) target_compile_definitions(mixxx-lib PUBLIC __SNDFILE__) # SoundTouch -add_library(SoundTouch STATIC +add_library(SoundTouch STATIC EXCLUDE_FROM_ALL lib/soundtouch/AAFilter.cpp lib/soundtouch/BPMDetect.cpp lib/soundtouch/FIFOSampleBuffer.cpp @@ -1406,7 +1411,7 @@ if(HID_ENABLED) target_compile_definitions(mixxx-lib PUBLIC __HID__) if(HIDAPI_STATIC) message(STATUS "Linking internal libhidapi statically") - add_library(mixxx-hidapi STATIC) + add_library(mixxx-hidapi STATIC EXCLUDE_FROM_ALL) target_include_directories(mixxx-hidapi PUBLIC lib/hidapi-0.8.0-rc1/hidapi) if(WIN32) target_sources(mixxx-hidapi PRIVATE lib/hidapi-0.8.0-rc1/windows/hid.c) @@ -1451,7 +1456,7 @@ if(VINYLCONTROL_ENABLED) target_compile_definitions(mixxx-lib PUBLIC __VINYLCONTROL__) # Internal xwax library - add_library(mixxx-xwax STATIC) + add_library(mixxx-xwax STATIC EXCLUDE_FROM_ALL) if(WIN32) target_sources(mixxx-xwax PRIVATE lib/xwax/timecoder_win32.cpp lib/xwax/lut_win32.cpp) else() @@ -1781,7 +1786,7 @@ add_dependencies(benchmark mixxx-test) # # Resources # -add_library(mixxx-qrc OBJECT res/mixxx.qrc) +add_library(mixxx-qrc OBJECT EXCLUDE_FROM_ALL res/mixxx.qrc) set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) # Add resources to mixxx and mixxx-test binaries, not the mixxx-lib static From c7baa69e0e967290477d655e982c2ff62a5220c9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 18 Sep 2019 18:18:43 +0200 Subject: [PATCH 060/134] CMake: Set GIT_* vars to "unknown" if git command fails --- CMakeLists.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da1637621a9..a45d0ff8168 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,11 @@ execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET ) +if(NOT GIT_BRANCH) + set(GIT_BRANCH "unknown") +endif() message(STATUS "Git branch: ${GIT_BRANCH}") # Get the latest abbreviated commit hash of the working branch @@ -39,7 +43,11 @@ execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET ) +if(NOT GIT_COMMIT_HASH) + set(GIT_COMMIT_HASH "unknown") +endif() message(STATUS "Git commit: ${GIT_COMMIT_HASH}") # Get the number of commits on the working branch @@ -48,16 +56,21 @@ execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET ) +if(NOT GIT_COMMIT_COUNT) + set(GIT_COMMIT_COUNT "unknown") +endif() # Check if the worktree is dirty execute_process( COMMAND git diff --quiet RESULT_VARIABLE GIT_WORKTREE_DIRTY WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ERROR_QUIET ) -if(NOT GIT_WORKTREE_DIRTY EQUAL "0") - set(GIT_COMMIT_COUNT "${GIT_COMMIT_COUNT}+") +if(GIT_WORKTREE_DIRTY EQUAL "1") + set(GIT_COMMIT_COUNT "${GIT_COMMIT_COUNT}+") endif() message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") From c8858fdd7bb7a59a15ac5fd9a230c3258a038632 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 21 Sep 2019 13:32:46 +0200 Subject: [PATCH 061/134] CMake: Add DEBUG_ASSERTIONS_FATAL option and add rls/dbg compile defs --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a45d0ff8168..ef5d94990eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -637,6 +637,17 @@ if(UNIX AND NOT APPLE) target_compile_definitions(mixxx-lib PRIVATE SETTINGS_PATH=".mixxx/") endif() +option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF) +target_compile_definitions(mixxx-lib PUBLIC + $<$:MIXXX_BUILD_DEBUG> + $<$>:MIXXX_BUILD_RELEASE> + # Disable assert.h assertions in release mode. Some libraries use + # this as a signal for when to enable code that should be disabled + # in release mode. + $<$>:NDEBUG> + $<$:MIXXX_DEBUG_ASSERTIONS_FATAL> +) + if(WIN32) target_compile_definitions(mixxx-lib PRIVATE __WINDOWS__) From 435b60e37dff5f125c911a56ff202183cf9e2b05 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 1 Oct 2019 12:16:24 +0200 Subject: [PATCH 062/134] CMake: Attempt to fix issues when linking libebur128 statically The issues was reported by rrrapha: https://github.com/mixxxdj/mixxx/pull/2280#issuecomment-535643580 --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef5d94990eb..464b00ed2d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -806,11 +806,14 @@ if(EBUR128_STATIC) CMAKE_ARGS ${EBUR128_CMAKE_ARGS} ) set_target_properties(libebur128 PROPERTIES EXCLUDE_FROM_ALL TRUE) - add_dependencies(mixxx-lib libebur128) - target_include_directories(mixxx-lib PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" + + add_library(mixxx-libebur128 STATIC IMPORTED) + add_dependencies(mixxx-libebur128 libebur128) + set_target_properties(mixxx-libebur128 PROPERTIES + IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" ) - target_link_libraries(mixxx-lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") + target_link_libraries(mixxx-lib PUBLIC mixxx-libebur128) else() message(STATUS "Linking libebur128 dynamically") target_link_libraries(mixxx-lib PUBLIC Ebur128::Ebur128) From db4d1696e76a716ce4ed303de3942da4598bb5c9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 2 Oct 2019 14:01:23 +0200 Subject: [PATCH 063/134] CMake: Update sources for mixxx-lib and mixxx-test --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 464b00ed2d9..0d3bf27714a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -317,6 +317,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/library/export/trackexportdlg.cpp src/library/export/trackexportwizard.cpp src/library/export/trackexportworker.cpp + src/library/externaltrackcollection.cpp src/library/hiddentablemodel.cpp src/library/itunes/itunesfeature.cpp src/library/library.cpp @@ -1666,8 +1667,8 @@ add_executable(mixxx-test EXCLUDE_FROM_ALL src/test/broadcastsettings_test.cpp src/test/channelhandle_test.cpp src/test/configobject_test.cpp - src/test/controllerengine_test.cpp src/test/controller_preset_validation_test.cpp + src/test/controllerengine_test.cpp src/test/controlobjecttest.cpp src/test/coverartcache_test.cpp src/test/coverartutils_test.cpp @@ -1693,7 +1694,9 @@ add_executable(mixxx-test EXCLUDE_FROM_ALL src/test/lcstest.cpp src/test/learningutilstest.cpp src/test/libraryscannertest.cpp + src/test/librarytest.cpp src/test/looping_control_test.cpp + src/test/main.cpp src/test/mathutiltest.cpp src/test/metadatatest.cpp src/test/metaknob_link_test.cpp @@ -1726,12 +1729,12 @@ add_executable(mixxx-test EXCLUDE_FROM_ALL src/test/taglibtest.cpp src/test/trackdao_test.cpp src/test/trackexport_test.cpp + src/test/trackmetadata_test.cpp src/test/tracknumberstest.cpp src/test/trackreftest.cpp src/test/trackupdate_test.cpp src/test/wpushbutton_test.cpp src/test/wwidgetstack_test.cpp - src/test/main.cpp ) set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) target_link_libraries(mixxx-test PUBLIC mixxx-lib) From c52dd70334155444bd85e5d43ba6df868bb0738b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 2 Oct 2019 14:12:54 +0200 Subject: [PATCH 064/134] CMake: Fix quoting issue in FindFFmpeg.cmake --- cmake/modules/FindFFmpeg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindFFmpeg.cmake b/cmake/modules/FindFFmpeg.cmake index 94539a81802..89c908cb0d5 100644 --- a/cmake/modules/FindFFmpeg.cmake +++ b/cmake/modules/FindFFmpeg.cmake @@ -170,7 +170,7 @@ if (NOT TARGET FFmpeg::FFmpeg) add_library(FFmpeg::FFmpeg INTERFACE IMPORTED) set_target_properties(FFmpeg::FFmpeg PROPERTIES INTERFACE_COMPILE_OPTIONS "${FFMPEG_DEFINITIONS}" - INTERFACE_INCLUDE_DIRECTORIES ${FFMPEG_INCLUDE_DIRS} + INTERFACE_INCLUDE_DIRECTORIES "${FFMPEG_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${FFMPEG_LIBRARIES}") endif() From bb4057757b8fec391e507323d5f20a9e739b72d2 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 22 Sep 2019 10:25:08 +0200 Subject: [PATCH 065/134] CMake: Fix incompatibility between /O2 and /RTC1 --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d3bf27714a..0f2fb89eb66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1531,7 +1531,14 @@ if(NOT OPTIMIZE STREQUAL "off") # http://msdn.microsoft.com/en-us/library/59a3b321.aspx # In general, you should pick /O2 over /Ox - target_compile_options(mixxx-lib PUBLIC "/O2") + target_compile_options(mixxx-lib PUBLIC $<$>:/O2>) + + # Remove /RTC1 flag (conflicts with /O2) + string(REGEX REPLACE "/RTC[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + + # Re-add /RTC1 for Debug builds + target_compile_options(mixxx-lib PRIVATE $<$:/RTC1>) + if(OPTIMIZE STREQUAL "fastbuild") # /GL : http://msdn.microsoft.com/en-us/library/0zza0de8.aspx From 8dd8b489c517bb4cb19c95f97a66972a6e4030d5 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 3 Oct 2019 22:48:17 +0200 Subject: [PATCH 066/134] CMake: Replace PROJECT_*_DIR with CMAKE_CURRENT_*_DIR --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f2fb89eb66..cdad02b5370 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,8 +75,8 @@ endif() message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") configure_file( - "${PROJECT_SOURCE_DIR}/src/build.h.template" - "${PROJECT_BINARY_DIR}/src/build.h" + "${CMAKE_CURRENT_SOURCE_DIR}/src/build.h.template" + "${CMAKE_CURRENT_BINARY_DIR}/src/build.h" ) if(CMAKE_VERSION VERSION_LESS "3.7.0") From 0053021dc89fe01ba4536abec25449d47e1265ea Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 3 Oct 2019 17:16:21 +0200 Subject: [PATCH 067/134] CMake: Fix library path for internal libebur128 --- CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdad02b5370..2990a432850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ endif() set(CMAKE_CXX_STANDARD 14) include(ExternalProject) include(CheckSymbolExists) +include(GNUInstallDirs) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") @@ -794,7 +795,6 @@ else() endif() option(EBUR128_STATIC "Link libebur128 statically" "${EBUR128_STATIC_DEFAULT}") if(EBUR128_STATIC) - message(STATUS "Linking internal libebur128 statically") set(EBUR128_CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON") check_symbol_exists(STAILQ_HEAD sys/queue.h HAVE_STAILQ) if(NOT HAVE_STAILQ) @@ -803,15 +803,21 @@ if(EBUR128_STATIC) ExternalProject_Add(libebur128 SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" - INSTALL_COMMAND "" - CMAKE_ARGS ${EBUR128_CMAKE_ARGS} + INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= ${EBUR128_CMAKE_ARGS} ) set_target_properties(libebur128 PROPERTIES EXCLUDE_FROM_ALL TRUE) add_library(mixxx-libebur128 STATIC IMPORTED) add_dependencies(mixxx-libebur128 libebur128) + if(MSVC) + set(EBUR128_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128_static${CMAKE_STATIC_LIBRARY_SUFFIX}") + else() + set(EBUR128_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") + endif() + message(STATUS "Linking internal libebur128 statically: ${EBUR128_LIBRARY}") set_target_properties(mixxx-libebur128 PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${EBUR128_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" ) target_link_libraries(mixxx-lib PUBLIC mixxx-libebur128) From 92444fea0341cae738e4db489942f4bcf4dbb319 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 3 Oct 2019 20:26:35 +0200 Subject: [PATCH 068/134] CMake: Add support for Windows-only mixxx.rc file --- CMakeLists.txt | 40 +++++++++++++++++++++++++++++++++++ src/mixxx.rc.include.template | 11 ++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/mixxx.rc.include.template diff --git a/CMakeLists.txt b/CMakeLists.txt index 2990a432850..5b21628da10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1838,3 +1838,43 @@ set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) # at: https://doc.qt.io/qt5/resources.html#using-resources-in-a-library target_sources(mixxx PRIVATE $) target_sources(mixxx-test PRIVATE $) + +# Windows-only resource file +if(WIN32) + string(TIMESTAMP MIXXX_YEAR "%Y") + + file(READ src/_version.h MIXXX_VERSION_FILECONTENT) + string(REGEX REPLACE "^.*#define MIXXX_VERSION \"(.*)\".*$" "\\1" MIXXX_VERSION "${MIXXX_VERSION_FILECONTENT}") + + # Remove anything after ~ or - in the version number and replace the dots with commas + string(REGEX REPLACE "^([^~-]+).*$" "\\1" MIXXX_FILEVERSION "${MIXXX_VERSION}") + string(REPLACE "." "," MIXXX_FILEVERSION "${MIXXX_FILEVERSION}") + if(NOT GIT_COMMIT_COUNT STREQUAL "unknown") + set(MIXXX_FILEVERSION "${MIXXX_FILEVERSION},${GIT_COMMIT_COUNT}") + string(REPLACE "+" "" MIXXX_FILEVERSION "${MIXXX_FILEVERSION}") + endif() + set(MIXXX_PRODUCTVERSION "${MIXXX_FILEVERSION}") + + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(MIXXX_DEBUG 1) + else() + set(MIXXX_DEBUG 0) + endif() + + string(FIND "${MIXXX_VERSION}" "pre" MIXXX_PRERELEASE_POSITION) + if(MIXXX_PRERELEASE_POSITION EQUAL -1) + set(MIXXX_PRERELEASE 0) + else() + set(MIXXX_PRERELEASE 1) + endif() + + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/src/mixxx.rc.include.template" + "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" + ) + target_sources(mixxx PRIVATE + src/mixxx.rc + "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" + ) + target_include_directories(mixxx PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") +endif() diff --git a/src/mixxx.rc.include.template b/src/mixxx.rc.include.template new file mode 100644 index 00000000000..a5171be0911 --- /dev/null +++ b/src/mixxx.rc.include.template @@ -0,0 +1,11 @@ +#define CUR_YEAR "@MIXXX_YEAR@" +#define VER_FILEVERSION @MIXXX_FILEVERSION@ +#define VER_PRODUCTVERSION @MIXXX_PRODUCTVERSION@ + +#if @MIXXX_DEBUG@ + #define DEBUG +#endif + +#if @MIXXX_PRERELEASE@ + #define PRERELEASE +#endif From 5ed4b65261874fbae29530e05db64c4f3ec17d5b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 4 Oct 2019 12:14:14 +0200 Subject: [PATCH 069/134] CMake: Use QUIET when finding Qt5Keychain --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b21628da10..dc50e41dc2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1402,7 +1402,7 @@ if(UNIX AND NOT APPLE) endif() # QtKeychain -find_package(Qt5 OPTIONAL_COMPONENTS Keychain) +find_package(Qt5 QUIET OPTIONAL_COMPONENTS Keychain) option(QTKEYCHAIN_ENABLED "Secure credentials storage support for Live Broadcasting profiles" OFF) if(QTKEYCHAIN_ENABLED) if(NOT Qt5_Keychain_FOUND) From 4cefe256ccbef237b0d702a69c761b3d95c35f5c Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 4 Oct 2019 14:11:01 +0200 Subject: [PATCH 070/134] CMake: Copy or symlink resources to build folder --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc50e41dc2d..1700710e23a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1839,6 +1839,19 @@ set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) target_sources(mixxx PRIVATE $) target_sources(mixxx-test PRIVATE $) +if(UNIX) + add_custom_target(mixxx-res + COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/res" + COMMENT "Symlinking resources to build directory..." + ) +else() + add_custom_target(mixxx-res + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/" + COMMENT "Copying resources to build directory..." + ) +endif() +add_dependencies(mixxx mixxx-res) + # Windows-only resource file if(WIN32) string(TIMESTAMP MIXXX_YEAR "%Y") From 75efd383507b568b770282b64a7e1f186b78adad Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 4 Oct 2019 13:18:25 +0200 Subject: [PATCH 071/134] CMake: Add static QT5 dependencies on windows --- CMakeLists.txt | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1700710e23a..bbf2e946beb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -928,6 +928,78 @@ if(UNIX AND NOT APPLE) elseif(WIN32) find_package(Qt5 COMPONENTS WinExtras REQUIRED) target_link_libraries(mixxx-lib PUBLIC Qt5::WinExtras) + + get_target_property(QT5_TYPE Qt5::Core TYPE) + if(QT5_TYPE STREQUAL "STATIC_LIBRARY") + target_link_libraries(mixxx-lib PUBLIC + # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf + # QtCore + kernel32 + user32 # QtGui, QtOpenGL, libHSS1394 + shell32 + uuid + ole32 # QtGui, + advapi32 # QtGui, portaudio, portmidi + ws2_32 # QtGui, QtNetwork, libshout + # QtGui + gdi32 # QtOpenGL, libshout + comdlg32 + oleaut32 + imm32 + winmm + winspool + # QtOpenGL + glu32 + opengl32 + + # QtNetwork openssl-linked + crypt32 + + # New libraries required by Qt5. + dwmapi # qtwindows + iphlpapi # qt5network + #libEGL # qt5opengl + #libGLESv2 # qt5opengl + mpr # qt5core + netapi32 # qt5core + userenv # qt5core + uxtheme # ? + version # ? + wtsapi32 # ? + + #qtfreetype + #qtharfbuzz + #qtlibpng + #qtpcre2 + + # NOTE(rryan): If you are adding a plugin here, you must also + # update src/mixxxapplication.cpp to define a Q_IMPORT_PLUGIN + # for it. Not all imageformats plugins are built as .libs when + # building Qt statically on Windows. Check the build environment + # to see exactly what's available as a standalone .lib vs linked + # into Qt .libs by default. + + # iconengines plugins + Qt5::QSvgIconPlugin + + # imageformats plugins + #Qt5::QTgaPlugin + #Qt5::QIcoPlugin + Qt5::QSvgPlugin + #Qt5::QTgaPlugin + #Qt5::QGifPlugin + #Qt5::QJpegPlugin + + # platform plugins (new in Qt5 for Windows) + Qt5::QWindowsIntegrationPlugin + + # styles (new in Qt5 for Windows) + Qt5::QWindowsVistaStylePlugin + + # sqldrivers (new in Qt5? or did we just start enabling them) + Qt5::QSQLiteDriverPlugin + ) + endif() endif() # QtScriptByteArray From 72ad1cbe240d666276f2e4287ebf6996b12a46d9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 7 Oct 2019 21:42:25 +0200 Subject: [PATCH 072/134] CMake: Bump cmake_minimum_required to 3.9.0 due to GoogleTest module --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbf2e946beb..7f4fea7cb03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.9.0) project(mixxx VERSION 2.3.0) set(CMAKE_PROJECT_HOMEPAGE_URL "https://www.mixxx.org") set(CMAKE_PROJECT_DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes.") From 086312b4ec5df178bac70e8520bc4c1fa73dac51 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 7 Oct 2019 21:43:02 +0200 Subject: [PATCH 073/134] CMake: Add set WIN32_EXECUTABLE property on mixxx executable --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f4fea7cb03..8c6a1a075f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -691,7 +691,7 @@ elseif(UNIX) endif() # The mixxx executable -add_executable(mixxx src/main.cpp) +add_executable(mixxx WIN32 src/main.cpp) target_link_libraries(mixxx PUBLIC mixxx-lib) # From 5d6d4bdf78d9507c30fafdf175781f577fb30aa4 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 24 Oct 2019 18:59:56 +0200 Subject: [PATCH 074/134] CMake: Do not exclude mixxx-test from ALL target --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c6a1a075f2..7ade72deba0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1738,7 +1738,7 @@ endif() # # Tests # -add_executable(mixxx-test EXCLUDE_FROM_ALL +add_executable(mixxx-test src/test/analyserwaveformtest.cpp src/test/analyzersilence_test.cpp src/test/audiotaperpot_test.cpp From 55c4c5bb16170265f31bf5a14b3360874e7678a5 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 7 Oct 2019 23:54:29 +0200 Subject: [PATCH 075/134] CMake: Swap arguments in FindTaglib.cmake module --- cmake/modules/FindTaglib.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindTaglib.cmake b/cmake/modules/FindTaglib.cmake index 36833d5eca4..0ed3b3d39fd 100644 --- a/cmake/modules/FindTaglib.cmake +++ b/cmake/modules/FindTaglib.cmake @@ -117,7 +117,7 @@ else() include(FindPackageMessage) include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_INCLUDE_DIRS TAGLIB_LIBRARIES) + find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_LIBRARIES TAGLIB_INCLUDE_DIRS) endif() From df8f1c50038716e02ffc1cffd73474077512d784 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 8 Oct 2019 00:10:30 +0200 Subject: [PATCH 076/134] CMake: Add missing Qt libraries on static build --- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ade72deba0..a3fe5c82215 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -967,11 +967,6 @@ elseif(WIN32) version # ? wtsapi32 # ? - #qtfreetype - #qtharfbuzz - #qtlibpng - #qtpcre2 - # NOTE(rryan): If you are adding a plugin here, you must also # update src/mixxxapplication.cpp to define a Q_IMPORT_PLUGIN # for it. Not all imageformats plugins are built as .libs when @@ -999,6 +994,15 @@ elseif(WIN32) # sqldrivers (new in Qt5? or did we just start enabling them) Qt5::QSQLiteDriverPlugin ) + + find_library(QTFREETYPE_LIBRARY qtfreetype) + target_link_libraries(mixxx-lib PUBLIC "${QTFREETYPE_LIBRARY}") + find_library(QTHARFBUZZ_LIBRARY qtharfbuzz) + target_link_libraries(mixxx-lib PUBLIC "${QTHARFBUZZ_LIBRARY}") + find_library(QTLIBPNG_LIBRARY qtlibpng) + target_link_libraries(mixxx-lib PUBLIC "${QTLIBPNG_LIBRARY}") + find_library(QTPCRE2_LIBRARY qtpcre2) + target_link_libraries(mixxx-lib PUBLIC "${QTPCRE2_LIBRARY}") endif() endif() From 2c05ec4b4fed67dff9c684f49011ff76a9819c57 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 8 Oct 2019 18:06:53 +0200 Subject: [PATCH 077/134] CMake: Fix MediaFoundation libraries --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3fe5c82215..5b1193a02d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1444,10 +1444,10 @@ if(WIN32) ) target_compile_definitions(mixxx-lib PUBLIC __MEDIAFOUNDATION__) target_include_directories(mixxx-lib PRIVATE - ${MEDIAFOUNDATION_INCLUDE_DIRS} + ${MediaFoundation_INCLUDE_DIRS} ) target_link_libraries(mixxx-lib PUBLIC - ${MEDIAFOUNDATION_LIBRARIES} + ${MediaFoundation_LIBRARIES} ) endif() endif() From 7a253bdfaedfe8c61515899edf1d83ec48788dab Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 8 Oct 2019 18:54:38 +0200 Subject: [PATCH 078/134] CMake: Add definitions for static dependencies --- CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b1193a02d4..cba8970f6f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -781,10 +781,16 @@ include(CPack) # # Dependencies # +option(STATIC_DEPS "Link dependencies statically" OFF) # Chromaprint find_package(Chromaprint REQUIRED) target_link_libraries(mixxx-lib PUBLIC Chromaprint::Chromaprint) +if(WIN32 AND STATIC_DEPS) + target_compile_definitions(mixxx-lib PUBLIC CHROMAPRINT_NODLL) + find_package(FFTW REQUIRED) + target_link_libraries(mixxx-lib PUBLIC FFTW::FFTW) +endif() # Ebur128 find_package(Ebur128) @@ -841,6 +847,9 @@ target_link_libraries(mixxx-lib PUBLIC fidlib) # FLAC find_package(FLAC REQUIRED) target_link_libraries(mixxx-lib PUBLIC FLAC::FLAC) +if(WIN32 AND STATIC_DEPS) + target_compile_definitions(mixxx-lib PUBLIC FLAC__NO_DLL) +endif() # FpClassify This is a wrapper around the fpclassify function that prevents # inlining It is compiled without optimization and allows to use these function @@ -885,6 +894,9 @@ target_link_libraries(mixxx-lib PUBLIC ${PortMidi_LIBRARIES}) # Protobuf add_subdirectory(src/proto) target_link_libraries(mixxx-lib PUBLIC mixxx-proto) +if(WIN32 AND NOT STATIC_DEPS) + target_compile_definitions(mixxx-lib PUBLIC PROTOBUF_USE_DLLS) +endif() # Qt find_package(Qt5 @@ -1117,6 +1129,9 @@ target_link_libraries(mixxx-lib PUBLIC SoundTouch) find_package(Taglib REQUIRED) target_include_directories(mixxx-lib PUBLIC ${TAGLIB_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${TAGLIB_LIBRARIES}) +if(WIN32 AND STATIC_DEPS) + target_compile_definitions(mixxx-lib PUBLIC TAGLIB_STATIC) +endif() # Threads find_package(Threads REQUIRED) From ebb5d396f8cd023470e3a47e12307ef872a2877b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 8 Oct 2019 18:59:52 +0200 Subject: [PATCH 079/134] CMake: Add missing dependencies when using static deps on Windows --- CMakeLists.txt | 17 ++++++ cmake/modules/FindCelt.cmake | 63 ++++++++++++++++++++ cmake/modules/FindFFTW.cmake | 75 +++++++++++++++++++++++ cmake/modules/FindG72X.cmake | 63 ++++++++++++++++++++ cmake/modules/FindSilk.cmake | 111 +++++++++++++++++++++++++++++++++++ 5 files changed, 329 insertions(+) create mode 100644 cmake/modules/FindCelt.cmake create mode 100644 cmake/modules/FindFFTW.cmake create mode 100644 cmake/modules/FindG72X.cmake create mode 100644 cmake/modules/FindSilk.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cba8970f6f9..8fc4b0ffd91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1104,6 +1104,10 @@ target_link_libraries(mixxx-lib PUBLIC Rubberband::Rubberband) find_package(SndFile REQUIRED) target_link_libraries(mixxx-lib PUBLIC SndFile::SndFile) target_compile_definitions(mixxx-lib PUBLIC __SNDFILE__) +if(WIN32 AND STATIC_DEPS) + find_package(G72X REQUIRED) + target_link_libraries(mixxx-lib PUBLIC G72X::G72X) +endif() # SoundTouch add_library(SoundTouch STATIC EXCLUDE_FROM_ALL @@ -1403,6 +1407,8 @@ endif() # Opus (RFC 6716) find_package(Opus) +find_package(Celt) +find_package(Silk) option(OPUS_ENABLED "Opus (RFC 6716) support" "${Opus_FOUND}") if(OPUS_ENABLED) if(NOT Opus_FOUND) @@ -1415,6 +1421,17 @@ if(OPUS_ENABLED) target_compile_definitions(mixxx-lib PUBLIC __OPUS__) target_include_directories(mixxx-lib PUBLIC ${Opus_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${Opus_LIBRARIES}) + if(WIN32 AND STATIC_DEPS) + if(NOT Celt_FOUND) + message(FATAL_ERROR "Opus support with static dependencies requires the celt library.") + endif() + target_link_libraries(mixxx-lib PUBLIC Celt::Celt) + + if(NOT Silk_FOUND) + message(FATAL_ERROR "Opus support with static dependencies requires the silk library.") + endif() + target_link_libraries(mixxx-lib PUBLIC Silk::Float) + endif() endif() # MAD MP3 Decoder diff --git a/cmake/modules/FindCelt.cmake b/cmake/modules/FindCelt.cmake new file mode 100644 index 00000000000..5747746437d --- /dev/null +++ b/cmake/modules/FindCelt.cmake @@ -0,0 +1,63 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindCelt +-------- + +Finds the Celt library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Celt::Celt`` + The Celt library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Celt_FOUND`` + True if the system has the Celt library. +``Celt_LIBRARIES`` + Libraries needed to link to Celt. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Celt_LIBRARY`` + The path to the Celt library. + +#]=======================================================================] + +find_library(Celt_LIBRARY + NAMES fftw fftw3 fftw-3.3 + DOC "Celt library" +) +mark_as_advanced(Celt_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Celt + DEFAULT_MSG + Celt_LIBRARY +) + +if(Celt_FOUND) + set(Celt_LIBRARIES "${Celt_LIBRARY}") + + if(NOT TARGET Celt::Celt) + add_library(Celt::Celt UNKNOWN IMPORTED) + set_target_properties(Celt::Celt + PROPERTIES + IMPORTED_LOCATION "${Celt_LIBRARY}" + ) + endif() +endif() diff --git a/cmake/modules/FindFFTW.cmake b/cmake/modules/FindFFTW.cmake new file mode 100644 index 00000000000..58bbc48645c --- /dev/null +++ b/cmake/modules/FindFFTW.cmake @@ -0,0 +1,75 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindFFTW +-------- + +Finds the FFTW library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``FFTW::FFTW`` + The FFTW library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``FFTW_FOUND`` + True if the system has the FFTW library. +``FFTW_INCLUDE_DIRS`` + Include directories needed to use FFTW. +``FFTW_LIBRARIES`` + Libraries needed to link to FFTW. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``FFTW_INCLUDE_DIR`` + The directory containing ``fftw3.h``. +``FFTW_LIBRARY`` + The path to the FFTW library. + +#]=======================================================================] + +find_path(FFTW_INCLUDE_DIR + NAMES fftw3.h + DOC "FFTW include directory") +mark_as_advanced(FFTW_INCLUDE_DIR) + +find_library(FFTW_LIBRARY + NAMES fftw fftw3 fftw-3.3 + DOC "FFTW library" +) +mark_as_advanced(FFTW_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + FFTW + DEFAULT_MSG + FFTW_LIBRARY + FFTW_INCLUDE_DIR +) + +if(FFTW_FOUND) + set(FFTW_LIBRARIES "${FFTW_LIBRARY}") + set(FFTW_INCLUDE_DIRS "${FFTW_INCLUDE_DIR}") + + if(NOT TARGET FFTW::FFTW) + add_library(FFTW::FFTW UNKNOWN IMPORTED) + set_target_properties(FFTW::FFTW + PROPERTIES + IMPORTED_LOCATION "${FFTW_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIR}" + ) + endif() +endif() diff --git a/cmake/modules/FindG72X.cmake b/cmake/modules/FindG72X.cmake new file mode 100644 index 00000000000..45eb9f2f554 --- /dev/null +++ b/cmake/modules/FindG72X.cmake @@ -0,0 +1,63 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindG72X +-------- + +Finds the G72X library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``G72X::G72X`` + The G72X library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``G72X_FOUND`` + True if the system has the G72X library. +``G72X_LIBRARIES`` + Libraries needed to link to G72X. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``G72X_LIBRARY`` + The path to the G72X library. + +#]=======================================================================] + +find_library(G72X_LIBRARY + NAMES g72x + DOC "G72X library" +) +mark_as_advanced(G72X_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + G72X + DEFAULT_MSG + G72X_LIBRARY +) + +if(G72X_FOUND) + set(G72X_LIBRARIES "${G72X_LIBRARY}") + + if(NOT TARGET G72X::G72X) + add_library(G72X::G72X UNKNOWN IMPORTED) + set_target_properties(G72X::G72X + PROPERTIES + IMPORTED_LOCATION "${G72X_LIBRARY}" + ) + endif() +endif() diff --git a/cmake/modules/FindSilk.cmake b/cmake/modules/FindSilk.cmake new file mode 100644 index 00000000000..89e06dec24d --- /dev/null +++ b/cmake/modules/FindSilk.cmake @@ -0,0 +1,111 @@ +# This file is part of Mixxx, Digital DJ'ing software. +# Copyright (C) 2001-2019 Mixxx Development Team +# Distributed under the GNU General Public Licence (GPL) version 2 or any later +# later version. See the LICENSE file for details. + +#[=======================================================================[.rst: +FindSilk +-------- + +Finds the Silk library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``Silk::Common`` + The Silk common library + +``Silk::Fixed`` + The Silk fixed library + +``Silk::Float`` + The Silk float library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``Silk_FOUND`` + True if the system has the Silk library. +``Silk_LIBRARIES`` + Libraries needed to link to Silk. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``Silk_Common_LIBRARY`` + The path to the Silk common library. + +``Silk_Fixed_LIBRARY`` + The path to the Silk fixed library. + +``Silk_Float_LIBRARY`` + The path to the Silk float library. + +#]=======================================================================] + +find_library(Silk_Common_LIBRARY + NAMES silk_common + DOC "Silk common library" +) +mark_as_advanced(Silk_Common_LIBRARY) + +find_library(Silk_Fixed_LIBRARY + NAMES silk_fixed + DOC "Silk fixed library" +) +mark_as_advanced(Silk_Fixed_LIBRARY) + +find_library(Silk_Float_LIBRARY + NAMES silk_float + DOC "Silk float library" +) +mark_as_advanced(Silk_Float_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + Silk + DEFAULT_MSG + Silk_Common_LIBRARY + Silk_Fixed_LIBRARY + Silk_Float_LIBRARY +) + +if(Silk_FOUND) + set(Silk_LIBRARIES + "${Silk_Common_LIBRARY}" + "${Silk_Fixed_LIBRARY}" + "${Silk_Float_LIBRARY}" + ) + + if(NOT TARGET Silk::Common) + add_library(Silk::Common UNKNOWN IMPORTED) + set_target_properties(Silk::Common + PROPERTIES + IMPORTED_LOCATION "${Silk_Common_LIBRARY}" + ) + endif() + + if(NOT TARGET Silk::Fixed) + add_library(Silk::Fixed UNKNOWN IMPORTED) + set_target_properties(Silk::Fixed + PROPERTIES + IMPORTED_LOCATION "${Silk_Fixed_LIBRARY}" + INTERFACE_LINK_LIBRARIES Silk::Common + ) + endif() + + if(NOT TARGET Silk::Float) + add_library(Silk::Float UNKNOWN IMPORTED) + set_target_properties(Silk::Float + PROPERTIES + IMPORTED_LOCATION "${Silk_Float_LIBRARY}" + INTERFACE_LINK_LIBRARIES Silk::Common + ) + endif() +endif() From 213170e9136d96b7771064950829d6337ef126ff Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 8 Oct 2019 22:21:10 +0200 Subject: [PATCH 080/134] CMake: Work around gtest/gmock TR1 namespace deprecation warning on MSVC --- CMakeLists.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fc4b0ffd91..958256f6ce3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -859,6 +859,14 @@ target_link_libraries(mixxx-lib PUBLIC FpClassify) # gtest target_include_directories(mixxx-lib PUBLIC lib/gtest-1.7.0/include) +if(MSVC) + # Since Visual Studio 17 15.5 (Tools Update 2), the use of std::tr1 has + # been deprecated and throws a warning. If /W3 is used, this causes an + # error. This suppresses the warning/error until we pull in the fixes from + # upstream. + # See this for details: https://github.com/google/googletest/issues/1111 + target_compile_definitions(mixxx-lib PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) +endif() # LAME find_package(LAME REQUIRED) @@ -1860,11 +1868,24 @@ add_executable(mixxx-test set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) target_link_libraries(mixxx-test PUBLIC mixxx-lib) +set(GTEST_CMAKE_ARGS "") +set(GMOCK_CMAKE_ARGS "") +if(MSVC) + # Since Visual Studio 17 15.5 (Tools Update 2), the use of std::tr1 has + # been deprecated and throws a warning. If /W3 is used, this causes an + # error. This suppresses the warning/error until we pull in the fixes from + # upstream. + # See this for details: https://github.com/google/googletest/issues/1111 + set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") + set(GMOCK_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") +endif() + # gtest ExternalProject_Add(mixxx-gtest SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" INSTALL_COMMAND "" + CMAKE_ARGS "${GTEST_CMAKE_ARGS}" ) set_target_properties(mixxx-gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(mixxx-test mixxx-gtest) @@ -1880,6 +1901,7 @@ ExternalProject_Add(mixxx-gmock SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" INSTALL_COMMAND "" + CMAKE_ARGS "${GMOCK_CMAKE_ARGS}" ) set_target_properties(mixxx-gmock PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(mixxx-test mixxx-gmock) From 2d0cacb066f67b3874b4104a54545158e2cc06f2 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 8 Oct 2019 23:31:17 +0200 Subject: [PATCH 081/134] CMake: Work around MSVC's Release/Debug output directories for gtest/gmock --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 958256f6ce3..c80f88127d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1878,6 +1878,13 @@ if(MSVC) # See this for details: https://github.com/google/googletest/issues/1111 set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") set(GMOCK_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") + + # Work around the Release/Debug subdirectories on Windows + foreach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER "${OUTPUT_CONFIG}" OUTPUT_CONFIG) + set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0") + set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0") + endforeach() endif() # gtest From 18cd19dfada89dfa251cb8a884fc3a80391128d0 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 9 Oct 2019 13:39:45 +0200 Subject: [PATCH 082/134] CMake: Add some missing compile/link definitions --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c80f88127d9..8302e447143 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -673,6 +673,14 @@ if(WIN32) endif() target_link_libraries(mixxx-lib PUBLIC shell32) + + if(DEBUG OR NOT STATIC_DEPS) + target_link_options(mixxx-lib PUBLIC /nodefaultlib:LIBCMT.lib /nodefaultlib:LIBCMTd.lib) + endif() + target_link_options(mixxx-lib PUBLIC /entry:mainCRTStartup) + # Force MSVS to generate a manifest (MSVC2010) + target_link_options(mixxx-lib PUBLIC /manifest) + elseif(UNIX) if(APPLE) target_compile_definitions(mixxx-lib PUBLIC __APPLE__) @@ -936,6 +944,7 @@ target_link_libraries(mixxx-lib PUBLIC Qt5::Test Qt5::Widgets Qt5::Xml) +target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT) if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED) @@ -951,6 +960,7 @@ elseif(WIN32) get_target_property(QT5_TYPE Qt5::Core TYPE) if(QT5_TYPE STREQUAL "STATIC_LIBRARY") + target_compile_definitions(mixxx-lib PUBLIC QT_NODLL) target_link_libraries(mixxx-lib PUBLIC # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf # QtCore @@ -1023,6 +1033,8 @@ elseif(WIN32) target_link_libraries(mixxx-lib PUBLIC "${QTLIBPNG_LIBRARY}") find_library(QTPCRE2_LIBRARY qtpcre2) target_link_libraries(mixxx-lib PUBLIC "${QTPCRE2_LIBRARY}") + else() + target_compile_definitions(mixxx-lib PUBLIC QT_SHARED) endif() endif() From 7e2b1b1768d503941a18dd141700d8e3e30d2824 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 9 Oct 2019 13:42:33 +0200 Subject: [PATCH 083/134] CMake: Do not add MSVC-specific flags on Windows unconditionally --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8302e447143..d10c0c5da9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -674,13 +674,14 @@ if(WIN32) target_link_libraries(mixxx-lib PUBLIC shell32) - if(DEBUG OR NOT STATIC_DEPS) - target_link_options(mixxx-lib PUBLIC /nodefaultlib:LIBCMT.lib /nodefaultlib:LIBCMTd.lib) + if(MSVC) + if(NOT STATIC_DEPS OR DEBUG) + target_link_options(mixxx-lib PUBLIC /nodefaultlib:LIBCMT.lib /nodefaultlib:LIBCMTd.lib) + endif() + target_link_options(mixxx-lib PUBLIC /entry:mainCRTStartup) + # Force MSVS to generate a manifest (MSVC2010) + target_link_options(mixxx-lib PUBLIC /manifest) endif() - target_link_options(mixxx-lib PUBLIC /entry:mainCRTStartup) - # Force MSVS to generate a manifest (MSVC2010) - target_link_options(mixxx-lib PUBLIC /manifest) - elseif(UNIX) if(APPLE) target_compile_definitions(mixxx-lib PUBLIC __APPLE__) From 9519de003645af8ccf7d5deeb977b88a64f4cad6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 9 Oct 2019 02:35:41 +0200 Subject: [PATCH 084/134] CMake: Use /MD on MSVC --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d10c0c5da9f..c695fe2211d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ if(WIN32) # Add support for lib prefix on Windows set(CMAKE_FIND_LIBRARY_PREFIXES "" "lib") endif() +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") # Get the current working branch execute_process( From 2e9a19531232d537e91faf2aa8f5ed83ab352561 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 10 Oct 2019 12:10:17 +0200 Subject: [PATCH 085/134] CMake: Remove unneeded QtWindowsExtras --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c695fe2211d..d8dc743cd42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -957,9 +957,6 @@ if(UNIX AND NOT APPLE) Qt5::DBus ) elseif(WIN32) - find_package(Qt5 COMPONENTS WinExtras REQUIRED) - target_link_libraries(mixxx-lib PUBLIC Qt5::WinExtras) - get_target_property(QT5_TYPE Qt5::Core TYPE) if(QT5_TYPE STREQUAL "STATIC_LIBRARY") target_compile_definitions(mixxx-lib PUBLIC QT_NODLL) From ffcc1e9cab958b6ef91b965990c04a3d3432532c Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 10 Oct 2019 12:20:33 +0200 Subject: [PATCH 086/134] CMake: Force shared CRT for gtest/gmock on MSVC --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8dc743cd42..c23450aa738 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1890,6 +1890,12 @@ if(MSVC) set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") set(GMOCK_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") + # Use shared CRT when linking gtest to prevent error LNK2038: mismatch + # detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value + # 'MD_DynamicRelease' + set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-Dgtest_force_shared_crt=ON") + set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-Dgtest_force_shared_crt=ON") + # Work around the Release/Debug subdirectories on Windows foreach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER "${OUTPUT_CONFIG}" OUTPUT_CONFIG) From e9367f76a806e08310e6f908628ca3a5b0b0df30 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 10 Oct 2019 18:52:07 +0200 Subject: [PATCH 087/134] CMake: Add missing Qt imageformat plugins --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c23450aa738..0311e20d62f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1007,12 +1007,11 @@ elseif(WIN32) Qt5::QSvgIconPlugin # imageformats plugins - #Qt5::QTgaPlugin - #Qt5::QIcoPlugin + Qt5::QGifPlugin + Qt5::QICOPlugin + Qt5::QJpegPlugin Qt5::QSvgPlugin - #Qt5::QTgaPlugin - #Qt5::QGifPlugin - #Qt5::QJpegPlugin + Qt5::QTgaPlugin # platform plugins (new in Qt5 for Windows) Qt5::QWindowsIntegrationPlugin From a35d43566b0f200d7019dac44ff0623242e2220b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 10 Oct 2019 19:05:04 +0200 Subject: [PATCH 088/134] CMake: Add missing Qt5 windows support components --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0311e20d62f..cb05b2ef1b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1023,6 +1023,11 @@ elseif(WIN32) Qt5::QSQLiteDriverPlugin ) + find_library(QT5FONTDATABASESUPPORT_LIBRARY Qt5FontDatabaseSupport) + target_link_libraries(mixxx-lib PUBLIC "${QT5FONTDATABASESUPPORT_LIBRARY}") + find_library(QT5WINDOWSUIAUTOMATIONSUPPORT_LIBRARY Qt5WindowsUIAutomationSupport) + target_link_libraries(mixxx-lib PUBLIC "${QT5WINDOWSUIAUTOMATIONSUPPORT_LIBRARY}") + find_library(QTFREETYPE_LIBRARY qtfreetype) target_link_libraries(mixxx-lib PUBLIC "${QTFREETYPE_LIBRARY}") find_library(QTHARFBUZZ_LIBRARY qtharfbuzz) From 705faa9246947d7fe6a42f6a2ed62499c4847391 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 10 Oct 2019 20:41:28 +0200 Subject: [PATCH 089/134] CMake: Show more warnings --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb05b2ef1b3..1b740ae1f9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -640,6 +640,12 @@ if(UNIX AND NOT APPLE) target_compile_definitions(mixxx-lib PRIVATE SETTINGS_PATH=".mixxx/") endif() +if(MSVC) + target_compile_options(mixxx-lib PUBLIC /W4) +else() + target_compile_options(mixxx-lib PUBLIC -Wall -Wextra -pedantic) +endif() + option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF) target_compile_definitions(mixxx-lib PUBLIC $<$:MIXXX_BUILD_DEBUG> From bcae0176ab4857528c7b886302e072faddc0ac7c Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 10 Oct 2019 20:41:50 +0200 Subject: [PATCH 090/134] CMake: Add WARNINGS_FATAL option to treat warnigns as errors --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b740ae1f9c..1c588e0e712 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -646,6 +646,15 @@ else() target_compile_options(mixxx-lib PUBLIC -Wall -Wextra -pedantic) endif() +option(WARNINGS_FATAL "Fail if compiler generates a warning" OFF) +if(WARNINGS_FATAL) + if(MSVC) + target_compile_options(mixxx-lib PUBLIC /WX) + else() + target_compile_options(mixxx-lib PUBLIC -Werror) + endif() +endif() + option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF) target_compile_definitions(mixxx-lib PUBLIC $<$:MIXXX_BUILD_DEBUG> From 13864d77e2c02c14440266fb60ba77ed90f00bc1 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 10 Oct 2019 22:53:58 +0200 Subject: [PATCH 091/134] CMake: Add more missing Qt5 libraries --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c588e0e712..b35c46193b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1042,6 +1042,10 @@ elseif(WIN32) target_link_libraries(mixxx-lib PUBLIC "${QT5FONTDATABASESUPPORT_LIBRARY}") find_library(QT5WINDOWSUIAUTOMATIONSUPPORT_LIBRARY Qt5WindowsUIAutomationSupport) target_link_libraries(mixxx-lib PUBLIC "${QT5WINDOWSUIAUTOMATIONSUPPORT_LIBRARY}") + find_library(QT5EVENTDISPATCHERSUPPORT_LIBRARY Qt5EventDispatcherSupport) + target_link_libraries(mixxx-lib PUBLIC "${QT5EVENTDISPATCHERSUPPORT_LIBRARY}") + find_library(QT5THEMESUPPORT_LIBRARY Qt5ThemeSupport) + target_link_libraries(mixxx-lib PUBLIC "${QT5THEMESUPPORT_LIBRARY}") find_library(QTFREETYPE_LIBRARY qtfreetype) target_link_libraries(mixxx-lib PUBLIC "${QTFREETYPE_LIBRARY}") From e25a36882ceb570460b849f782bd700611e964bd Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 11 Oct 2019 00:02:20 +0200 Subject: [PATCH 092/134] CMake: Make pedantic warnings optional --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b35c46193b8..04b48e4175a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -640,10 +640,18 @@ if(UNIX AND NOT APPLE) target_compile_definitions(mixxx-lib PRIVATE SETTINGS_PATH=".mixxx/") endif() +option(WARNINGS_PEDANTIC "Let the compiler show even more warnings" OFF) if(MSVC) - target_compile_options(mixxx-lib PUBLIC /W4) + if(WARNINGS_PEDANTIC) + target_compile_options(mixxx-lib PUBLIC /W4) + else() + target_compile_options(mixxx-lib PUBLIC /W3) + endif() else() - target_compile_options(mixxx-lib PUBLIC -Wall -Wextra -pedantic) + target_compile_options(mixxx-lib PUBLIC -Wall -Wextra) + if(WARNINGS_PEDANTIC) + target_compile_options(mixxx-lib PUBLIC -pedantic) + endif() endif() option(WARNINGS_FATAL "Fail if compiler generates a warning" OFF) From 60da0e2db98a99175ec630e8bc425c77d70783e1 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 11 Oct 2019 12:09:45 +0200 Subject: [PATCH 093/134] CMake: Include CTest --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04b48e4175a..da428f23e64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1993,6 +1993,7 @@ target_include_directories(gbenchmark PUBLIC lib/benchmark/include) target_link_libraries(mixxx-test PUBLIC gbenchmark) # Test Suite +include(CTest) include(GoogleTest) enable_testing() gtest_add_tests( From 6706651d9d74f3573f379ed729c6989240c3c476 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 11 Oct 2019 12:13:08 +0200 Subject: [PATCH 094/134] CMake: Add SYSTEM property to third party include directories --- CMakeLists.txt | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da428f23e64..564feb9d8c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -874,7 +874,7 @@ elseif(MINGW) else() target_compile_definitions(fidlib PRIVATE T_LINUX) endif() -target_include_directories(mixxx-lib PUBLIC lib/fidlib) +target_include_directories(mixxx-lib SYSTEM PUBLIC lib/fidlib) target_link_libraries(mixxx-lib PUBLIC fidlib) # FLAC @@ -891,7 +891,7 @@ add_library(FpClassify STATIC EXCLUDE_FROM_ALL src/util/fpclassify.cpp) target_link_libraries(mixxx-lib PUBLIC FpClassify) # gtest -target_include_directories(mixxx-lib PUBLIC lib/gtest-1.7.0/include) +target_include_directories(mixxx-lib SYSTEM PUBLIC lib/gtest-1.7.0/include) if(MSVC) # Since Visual Studio 17 15.5 (Tools Update 2), the use of std::tr1 has # been deprecated and throws a warning. If /W3 is used, this causes an @@ -912,24 +912,24 @@ target_link_libraries(mixxx-lib PUBLIC OpenGL::GL) # Ogg Vorbis find_package(OggVorbis REQUIRED) -target_include_directories(mixxx-lib PUBLIC ${OggVorbis_INCLUDE_DIRS}) +target_include_directories(mixxx-lib SYSTEM PUBLIC ${OggVorbis_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${OggVorbis_LIBRARIES}) # PortAudio find_package(PortAudio REQUIRED) -target_include_directories(mixxx-lib PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) +target_include_directories(mixxx-lib SYSTEM PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${PORTAUDIO_LIBRARIES}) # PortAudio Ring Buffer add_library(PortAudioRingBuffer STATIC EXCLUDE_FROM_ALL lib/portaudio/pa_ringbuffer.c ) -target_include_directories(mixxx-lib PUBLIC lib/portaudio) +target_include_directories(mixxx-lib SYSTEM PUBLIC lib/portaudio) target_link_libraries(mixxx-lib PUBLIC PortAudioRingBuffer) # PortMidi find_package(PortMidi REQUIRED) -target_include_directories(mixxx-lib PUBLIC ${PortMidi_INCLUDE_DIRS}) +target_include_directories(mixxx-lib SYSTEM PUBLIC ${PortMidi_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${PortMidi_LIBRARIES}) # Protobuf @@ -973,7 +973,7 @@ target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT) if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED) - target_include_directories(mixxx-lib PUBLIC "${X11_INCLUDE_DIR}") + target_include_directories(mixxx-lib SYSTEM PUBLIC "${X11_INCLUDE_DIR}") target_link_libraries(mixxx-lib PUBLIC "${X11_LIBRARIES}" Qt5::X11Extras @@ -1129,21 +1129,21 @@ elseif(MSVC) # may include cmath first. target_compile_definitions(QueenMaryDsp PUBLIC _USE_MATH_DEFINES) endif() -target_include_directories(QueenMaryDsp PUBLIC lib/qm-dsp lib/qm-dsp/include) +target_include_directories(QueenMaryDsp SYSTEM PUBLIC lib/qm-dsp lib/qm-dsp/include) target_link_libraries(mixxx-lib PUBLIC QueenMaryDsp) # ReplayGain add_library(ReplayGain STATIC EXCLUDE_FROM_ALL lib/replaygain/replaygain.cpp ) -target_include_directories(mixxx-lib PRIVATE lib/replaygain) +target_include_directories(mixxx-lib SYSTEM PRIVATE lib/replaygain) target_link_libraries(mixxx-lib PRIVATE ReplayGain) # Reverb add_library(Reverb STATIC EXCLUDE_FROM_ALL lib/reverb/Reverb.cc) target_include_directories(Reverb PRIVATE src) target_link_libraries(Reverb PUBLIC Qt5::Core) -target_include_directories(mixxx-lib PRIVATE lib/reverb) +target_include_directories(mixxx-lib SYSTEM PRIVATE lib/reverb) target_link_libraries(mixxx-lib PUBLIC Reverb) # Rubberband @@ -1176,12 +1176,12 @@ add_library(SoundTouch STATIC EXCLUDE_FROM_ALL lib/soundtouch/mmx_optimized.cpp lib/soundtouch/sse_optimized.cpp ) -target_include_directories(SoundTouch PUBLIC lib/soundtouch) +target_include_directories(SoundTouch SYSTEM PUBLIC lib/soundtouch) target_link_libraries(mixxx-lib PUBLIC SoundTouch) # TagLib find_package(Taglib REQUIRED) -target_include_directories(mixxx-lib PUBLIC ${TAGLIB_INCLUDE_DIRS}) +target_include_directories(mixxx-lib SYSTEM PUBLIC ${TAGLIB_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${TAGLIB_LIBRARIES}) if(WIN32 AND STATIC_DEPS) target_compile_definitions(mixxx-lib PUBLIC TAGLIB_STATIC) @@ -1195,7 +1195,7 @@ target_link_libraries(mixxx-lib PUBLIC Threads::Threads) if(UNIX AND NOT APPLE) find_package(GLIB COMPONENTS gobject REQUIRED) find_package(Upower REQUIRED) - target_include_directories(mixxx-lib PUBLIC ${GLIB_INCLUDE_DIRS}) + target_include_directories(mixxx-lib SYSTEM PUBLIC ${GLIB_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${GLIB_LIBRARIES} ${GLIB_GOBJECT_LIBRARIES}) target_link_libraries(mixxx-lib PUBLIC Upower::Upower) endif() @@ -1300,7 +1300,7 @@ if(COREAUDIO_ENABLED) ${COREFOUNDATION_LIBRARY} ) target_compile_definitions(mixxx-lib PRIVATE __COREAUDIO__) - target_include_directories(mixxx-lib PUBLIC lib/apple) + target_include_directories(mixxx-lib SYSTEM PUBLIC lib/apple) endif() # FAAD AAC audio file decoder plugin @@ -1451,7 +1451,7 @@ if(LOCALECOMPARE_ENABLED) message(FATAL_ERROR "Locale Aware Compare for SQLite requires libsqlite and its development headers.") endif() target_compile_definitions(mixxx-lib PUBLIC __SQLITE3__) - target_include_directories(mixxx-lib PRIVATE ${SQLite3_INCLUDE_DIRS}) + target_include_directories(mixxx-lib SYSTEM PRIVATE ${SQLite3_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${SQLite3_LIBRARIES}) endif() @@ -1469,7 +1469,7 @@ if(OPUS_ENABLED) src/encoder/encoderopus.cpp ) target_compile_definitions(mixxx-lib PUBLIC __OPUS__) - target_include_directories(mixxx-lib PUBLIC ${Opus_INCLUDE_DIRS}) + target_include_directories(mixxx-lib SYSTEM PUBLIC ${Opus_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${Opus_LIBRARIES}) if(WIN32 AND STATIC_DEPS) if(NOT Celt_FOUND) @@ -1525,7 +1525,7 @@ if(WIN32) src/sources/soundsourcemediafoundation.cpp ) target_compile_definitions(mixxx-lib PUBLIC __MEDIAFOUNDATION__) - target_include_directories(mixxx-lib PRIVATE + target_include_directories(mixxx-lib SYSTEM PRIVATE ${MediaFoundation_INCLUDE_DIRS} ) target_link_libraries(mixxx-lib PUBLIC @@ -1604,7 +1604,7 @@ if(HID_ENABLED) if(HIDAPI_STATIC) message(STATUS "Linking internal libhidapi statically") add_library(mixxx-hidapi STATIC EXCLUDE_FROM_ALL) - target_include_directories(mixxx-hidapi PUBLIC lib/hidapi-0.8.0-rc1/hidapi) + target_include_directories(mixxx-hidapi SYSTEM PUBLIC lib/hidapi-0.8.0-rc1/hidapi) if(WIN32) target_sources(mixxx-hidapi PRIVATE lib/hidapi-0.8.0-rc1/windows/hid.c) elseif(APPLE) @@ -1944,7 +1944,7 @@ ExternalProject_Add(mixxx-gtest ) set_target_properties(mixxx-gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(mixxx-test mixxx-gtest) -target_include_directories(mixxx-test PUBLIC +target_include_directories(mixxx-test SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0/include" ) target_link_libraries(mixxx-test PUBLIC @@ -1960,7 +1960,7 @@ ExternalProject_Add(mixxx-gmock ) set_target_properties(mixxx-gmock PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(mixxx-test mixxx-gmock) -target_include_directories(mixxx-test PUBLIC +target_include_directories(mixxx-test SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0/include" ) target_link_libraries(mixxx-test PUBLIC @@ -1989,7 +1989,7 @@ target_link_libraries(gbenchmark ${CMAKE_THREAD_LIBS_INIT}) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(gbenchmark Shlwapi) endif() -target_include_directories(gbenchmark PUBLIC lib/benchmark/include) +target_include_directories(gbenchmark SYSTEM PUBLIC lib/benchmark/include) target_link_libraries(mixxx-test PUBLIC gbenchmark) # Test Suite From 43d25fdb7a878330ed20bb5f2615b8529e8d5aac Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 01:26:41 +0200 Subject: [PATCH 095/134] CMake: Add ccache support --- CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 564feb9d8c5..ad92ba498af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,26 @@ if(GIT_WORKTREE_DIRTY EQUAL "1") endif() message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") +# ccache support +find_program(CCACHE_FOUND "ccache") +option(CCACHE_SUPPORT "Enable ccache support" ON) +if(CCACHE_SUPPORT) + if(MSVC) + message(STATUS "MSVC is not compatible with ccache, support disabled") + elseif(CCACHE_FOUND) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC + OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # without this compiler messages in `make` backend would be uncolored + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto") + endif() + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") + message(STATUS "ccache found, support enabled") + else() + message(STATUS "Could NOT find ccache, support disabled") + endif() +endif() + configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/src/build.h.template" "${CMAKE_CURRENT_BINARY_DIR}/src/build.h" From f5c8b12ef283e7a745109f97eba794159be93e2d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 01:26:41 +0200 Subject: [PATCH 096/134] CMake: Improve ccache support --- CMakeLists.txt | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad92ba498af..5c994046d07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,19 +81,14 @@ find_program(CCACHE_FOUND "ccache") option(CCACHE_SUPPORT "Enable ccache support" ON) if(CCACHE_SUPPORT) if(MSVC) - message(STATUS "MSVC is not compatible with ccache, support disabled") - elseif(CCACHE_FOUND) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC - OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - # without this compiler messages in `make` backend would be uncolored - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto") - endif() - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache") - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") - message(STATUS "ccache found, support enabled") - else() - message(STATUS "Could NOT find ccache, support disabled") + message(FATAL_ERROR "ccache support is incompatible with MSVC.") + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC + OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # without this compiler messages in `make` backend would be uncolored + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto") endif() + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") endif() configure_file( From d9fcb8872119473a2c7423613bbeb5afa87a2a9f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 13:26:57 +0200 Subject: [PATCH 097/134] CMake: Sort includes alphabetically --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c994046d07..e123c5e2809 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,8 @@ if(POLICY CMP0071) endif() set(CMAKE_CXX_STANDARD 14) -include(ExternalProject) include(CheckSymbolExists) +include(ExternalProject) include(GNUInstallDirs) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") From e6a1ecce5c42a4d341e4954a36a33174115222ee Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 17:37:37 +0200 Subject: [PATCH 098/134] CMake: Use cmake_dependent_option to simplify option availability checks --- CMakeLists.txt | 100 ++++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 67 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e123c5e2809..06980a19bdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ if(POLICY CMP0071) endif() set(CMAKE_CXX_STANDARD 14) +include(CMakeDependentOption) include(CheckSymbolExists) include(ExternalProject) include(GNUInstallDirs) @@ -78,7 +79,7 @@ message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") # ccache support find_program(CCACHE_FOUND "ccache") -option(CCACHE_SUPPORT "Enable ccache support" ON) +cmake_dependent_option(CCACHE_SUPPORT "Enable ccache support" ON "CCACHE_FOUND;NOT MSVC" OFF) if(CCACHE_SUPPORT) if(MSVC) message(FATAL_ERROR "ccache support is incompatible with MSVC.") @@ -842,12 +843,7 @@ endif() # Ebur128 find_package(Ebur128) -if(Ebur128_FOUND) - set(EBUR128_STATIC_DEFAULT OFF) -else() - set(EBUR128_STATIC_DEFAULT ON) -endif() -option(EBUR128_STATIC "Link libebur128 statically" "${EBUR128_STATIC_DEFAULT}") +cmake_dependent_option(EBUR128_STATIC "Link libebur128 statically" OFF "Ebur128_FOUND" ON) if(EBUR128_STATIC) set(EBUR128_CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON") check_symbol_exists(STAILQ_HEAD sys/queue.h HAVE_STAILQ) @@ -1237,12 +1233,7 @@ endif() # # Battery meter -if(WIN32 OR UNIX) - set(BATTERY_SUPPORTED ON) -else() - set(BATTERY_SUPPORTED OFF) -endif() -option(BATTERY_ENABLED "Battery meter support" "${BATTERY_SUPPORTED}") +cmake_dependent_option(BATTERY_ENABLED "Battery meter support" ON "WIN32 OR UNIX" OFF) if(BATTERY_ENABLED) if(WIN32) target_sources(mixxx-lib PRIVATE src/util/battery/batterywindows.cpp) @@ -1301,7 +1292,7 @@ if(NOT CLANG_SANITIZERS STREQUAL "") endif() # CoreAudio MP3/AAC Decoder -option(COREAUDIO_ENABLED "CoreAudio MP3/AAC Decoder" "${APPLE}") +cmake_dependent_option(COREAUDIO_ENABLED "CoreAudio MP3/AAC Decoder" ON "APPLE" OFF) if(COREAUDIO_ENABLED) target_sources(mixxx-lib PRIVATE src/sources/soundsourcecoreaudio.cpp @@ -1321,15 +1312,7 @@ endif() # FAAD AAC audio file decoder plugin find_package(MP4) find_package(MP4v2) -if(MP4_FOUND OR MP4v2_FOUND) - set(FAAD_ENABLED_DEFAULT ON) -else() - set(FAAD_ENABLED_DEFAULT OFF) -endif() -option(FAAD_ENABLED - "FAAD AAC audio file decoder support" - "${FAAD_ENABLED_DEFAULT}" -) +cmake_dependent_option(FAAD_ENABLED "FAAD AAC audio file decoder support" ON "MP4_FOUND OR MP4v2_FOUND" OFF) if(FAAD_ENABLED) if(NOT MP4_FOUND AND NOT MP4v2_FOUND) message(FATAL_ERROR "FAAD AAC audio support requires libmp4 or libmp4v2 with development headers.") @@ -1404,12 +1387,7 @@ endif() # HSS1394 MIDI device find_package(HSS1394) -if(WIN32 OR APPLE) - set(HSS1394_ENABLED_DEFAULT "${HSS1394_FOUND}") -else() - set(HSS1394_ENABLED_DEFAULT "OFF") -endif() -option(HSS1394_ENABLED "HSS1394 MIDI device support" "${HSS1394_ENABLED_DEFAULT}") +cmake_dependent_option(HSS1394_ENABLED "HSS1394 MIDI device support" ON "HSS1394_FOUND;WIN32 OR APPLE" OFF) if(HSS1394_ENABLED) target_sources(mixxx-lib PRIVATE src/controllers/midi/hss1394controller.cpp @@ -1426,7 +1404,7 @@ endif() # Lilv (LV2) find_package(Lilv) -option(LILV_ENABLED "Lilv (LV2) support" "${Lilv_FOUND}") +cmake_dependent_option(LILV_ENABLED "Lilv (LV2) support" ON "Lilv_FOUND" OFF) if(LILV_ENABLED) if(NOT Lilv_FOUND) message(FATAL_ERROR "Lilv (LV2) support requires the liblilv-0 and its development headers.") @@ -1443,7 +1421,7 @@ endif() # Live Broadcasting (Shoutcast) find_package(Shout) -option(BROADCAST_ENABLED "Live Broadcasting (Shoutcast) support" "${Shout_FOUND}") +cmake_dependent_option(BROADCAST_ENABLED "Live Broadcasting (Shoutcast) support" ON "Shout_FOUND" OFF) if(BROADCAST_ENABLED) if(NOT Shout_FOUND) message(FATAL_ERROR "Live Broadcasting support requires the libshout and its development headers.") @@ -1460,7 +1438,7 @@ endif() # Locale Aware Compare for SQLite find_package(SQLite3) -option(LOCALECOMPARE_ENABLED "Locale Aware Compare support for SQLite" "${SQLite3_FOUND}") +cmake_dependent_option(LOCALECOMPARE_ENABLED "Locale Aware Compare support for SQLite" ON "SQLite3_FOUND" OFF) if(LOCALECOMPARE_ENABLED) if(NOT SQLite3_FOUND) message(FATAL_ERROR "Locale Aware Compare for SQLite requires libsqlite and its development headers.") @@ -1474,7 +1452,7 @@ endif() find_package(Opus) find_package(Celt) find_package(Silk) -option(OPUS_ENABLED "Opus (RFC 6716) support" "${Opus_FOUND}") +cmake_dependent_option(OPUS_ENABLED "Opus (RFC 6716) support" ON "Opus_FOUND" OFF) if(OPUS_ENABLED) if(NOT Opus_FOUND) message(FATAL_ERROR "Opus support requires libopus and libopusfile with development headers.") @@ -1502,12 +1480,7 @@ endif() # MAD MP3 Decoder find_package(MAD) find_package(ID3Tag) -if(MAD_FOUND AND ID3Tag_FOUND) - set(MAD_ENABLED_DEFAULT ON) -else() - set(MAD_ENABLED_DEFAULT OFF) -endif() -option(MAD_ENABLED "MAD MP3 Decoder" "${MAD_ENABLED_DEFAULT}") +cmake_dependent_option(MAD_ENABLED "MAD MP3 Decoder" ON "MAD_FOUND;ID3Tag_FOUND" OFF) if(MAD_ENABLED) if(NOT MAD_FOUND) message(FATAL_ERROR "MAD support requires libmad and its development headers.") @@ -1529,29 +1502,27 @@ if(APPLE) endif() # Media Foundation AAC Decoder Plugin -if(WIN32) - find_package(MediaFoundation) - option(MEDIAFOUNDATION_ENABLED "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" "${MediaFoundation_FOUND}") - if(MEDIAFOUNDATION_ENABLED) - if(NOT MediaFoundation_FOUND) - message(FATAL_ERROR "MediaFoundation support requires the MediaFoundation libraries and its development headers.") - endif() - target_sources(mixxx-lib PRIVATE - src/sources/soundsourcemediafoundation.cpp - ) - target_compile_definitions(mixxx-lib PUBLIC __MEDIAFOUNDATION__) - target_include_directories(mixxx-lib SYSTEM PRIVATE - ${MediaFoundation_INCLUDE_DIRS} - ) - target_link_libraries(mixxx-lib PUBLIC - ${MediaFoundation_LIBRARIES} - ) +find_package(MediaFoundation) +cmake_dependent_option(MEDIAFOUNDATION_ENABLED "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" ON "MediaFoundation_FOUND" OFF) +if(MEDIAFOUNDATION_ENABLED) + if(NOT MediaFoundation_FOUND) + message(FATAL_ERROR "MediaFoundation support requires the MediaFoundation libraries and its development headers.") endif() + target_sources(mixxx-lib PRIVATE + src/sources/soundsourcemediafoundation.cpp + ) + target_compile_definitions(mixxx-lib PUBLIC __MEDIAFOUNDATION__) + target_include_directories(mixxx-lib SYSTEM PRIVATE + ${MediaFoundation_INCLUDE_DIRS} + ) + target_link_libraries(mixxx-lib PUBLIC + ${MediaFoundation_LIBRARIES} + ) endif() # Modplug support find_package(Modplug) -option(MODPLUG_ENABLED "Modplug module decoder support" "${Modplug_FOUND}") +cmake_dependent_option(MODPLUG_ENABLED "Modplug module decoder support" ON "Modplug_FOUND" OFF) if(MODPLUG_ENABLED) if(NOT Modplug_FOUND) message(FATAL_ERROR "Modplug module decoder support requires libmodplug and its development headers.") @@ -1587,7 +1558,7 @@ endif() # USB Bulk controller support find_package(LibUSB) -option(BULK_ENABLED "USB Bulk controller support" "${LibUSB_FOUND}") +cmake_dependent_option(BULK_ENABLED "USB Bulk controller support" ON "LibUSB_FOUND" OFF) if(BULK_ENABLED) if(NOT LibUSB_FOUND) message(FATAL_ERROR "USB Bulk controller support requires libusb 1.0 and its development headers.") @@ -1602,13 +1573,8 @@ endif() # USB HID controller support find_package(HIDAPI) -option(HID_ENABLED "USB HID controller support" "ON") -if(HIDAPI_FOUND) - set(HIDAPI_STATIC_DEFAULT OFF) -else() - set(HIDAPI_STATIC_DEFAULT ON) -endif() -option(HIDAPI_STATIC "Link HIDAPI library statically" "${HIDAPI_STATIC_DEFAULT}") +option(HID_ENABLED "USB HID controller support" ON) +cmake_dependent_option(HIDAPI_STATIC "Link HIDAPI library statically" OFF "HIDAPI_FOUND" ON) if(HID_ENABLED) target_sources(mixxx-lib PRIVATE src/controllers/hid/hidcontroller.cpp @@ -1644,7 +1610,7 @@ if(HID_ENABLED) endif() # Vinyl Control -option(VINYLCONTROL_ENABLED "Vinyl Control support" ON) +cmake_dependent_option(VINYLCONTROL_ENABLED "Vinyl Control support" ON "NOT MACAPPSTORE_ENABLED" OFF) if(VINYLCONTROL_ENABLED) if(MACAPPSTORE_ENABLED) message(FATAL_ERROR "Mac App Store and Vinyl Control support are mutually exclusive due to licensing issues.") @@ -1675,7 +1641,7 @@ endif() # WavPack audio file support find_package(WavPack) -option(WAVPACK_ENABLED "WavPack audio file support" "${WavPack_FOUND}") +cmake_dependent_option(WAVPACK_ENABLED "WavPack audio file support" ON "WavPack_FOUND" OFF) if(WAVPACK_ENABLED) if(NOT WavPack_FOUND) message(FATAL_ERROR "WavPack audio file support requires libwv and its development headers.") From 8879497c5f4de2a8577fa43c180e4d0a1b857510 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 17:38:39 +0200 Subject: [PATCH 099/134] CMake: Remove quotes around off in FFMPEG_ENABLED option --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06980a19bdf..a4e3414fa3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1333,7 +1333,7 @@ endif() # FFmpeg 4.x support # FFmpeg is multimedia library that can be found http://ffmpeg.org/ find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWRESAMPLE) -option(FFMPEG_ENABLED "FFmpeg 4.x support" "OFF") +option(FFMPEG_ENABLED "FFmpeg 4.x support" OFF) if(FFMPEG_ENABLED) if(NOT AVCODEC_FOUND) message(FATAL_ERROR "FFmpeg support requires libavcodec and its development headers.") From 41ffaa250245d8995fb2d62a392e1b9f33560ef9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 17:40:58 +0200 Subject: [PATCH 100/134] CMake: Add support for clcache on MSVC --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4e3414fa3e..09fb0a0d8f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,17 @@ if(CCACHE_SUPPORT) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") endif() +# clcache support +find_program(CLCACHE_FOUND "clcache") +cmake_dependent_option(CLCACHE_SUPPORT "Enable clcache support" ON "CLCACHE_FOUND;MSVC" OFF) +if(CLCACHE_SUPPORT) + if(NOT MSVC) + message(FATAL_ERROR "clcache support requires MSVC.") + endif() + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "clcache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "clcache") +endif() + configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/src/build.h.template" "${CMAKE_CURRENT_BINARY_DIR}/src/build.h" From 70ee9d7f26086fac0ec9757197f92e75bfe0ac60 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 20:12:50 +0200 Subject: [PATCH 101/134] CMake: Add BUILD_BYPRODUCTS for external projects to fix Ninja errors --- CMakeLists.txt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09fb0a0d8f3..1876d3da005 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -861,24 +861,26 @@ if(EBUR128_STATIC) if(NOT HAVE_STAILQ) list(APPEND EBUR128_CMAKE_ARGS "-DENABLE_INTERNAL_QUEUE_H=ON") endif() + if(MSVC) + set(EBUR128_LIBRARY "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128_static${CMAKE_STATIC_LIBRARY_SUFFIX}") + else() + set(EBUR128_LIBRARY "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") + endif() ExternalProject_Add(libebur128 SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= ${EBUR128_CMAKE_ARGS} + BUILD_BYPRODUCTS /${EBUR128_LIBRARY} ) set_target_properties(libebur128 PROPERTIES EXCLUDE_FROM_ALL TRUE) add_library(mixxx-libebur128 STATIC IMPORTED) add_dependencies(mixxx-libebur128 libebur128) - if(MSVC) - set(EBUR128_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128_static${CMAKE_STATIC_LIBRARY_SUFFIX}") - else() - set(EBUR128_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") - endif() - message(STATUS "Linking internal libebur128 statically: ${EBUR128_LIBRARY}") + set(EBUR128_LIBRARY_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install/${EBUR128_LIBRARY}") + message(STATUS "Linking internal libebur128 statically: ${EBUR128_LIBRARY_LOCATION}") set_target_properties(mixxx-libebur128 PROPERTIES - IMPORTED_LOCATION "${EBUR128_LIBRARY}" + IMPORTED_LOCATION "${EBUR128_LIBRARY_LOCATION}" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" ) target_link_libraries(mixxx-lib PUBLIC mixxx-libebur128) @@ -1933,6 +1935,7 @@ ExternalProject_Add(mixxx-gtest BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" INSTALL_COMMAND "" CMAKE_ARGS "${GTEST_CMAKE_ARGS}" + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" ) set_target_properties(mixxx-gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(mixxx-test mixxx-gtest) @@ -1949,6 +1952,7 @@ ExternalProject_Add(mixxx-gmock BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" INSTALL_COMMAND "" CMAKE_ARGS "${GMOCK_CMAKE_ARGS}" + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}" ) set_target_properties(mixxx-gmock PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(mixxx-test mixxx-gmock) From b8b525bc5e610a389121b30a36cebb4ec5aba671 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 20:37:12 +0200 Subject: [PATCH 102/134] CMake: Fix condition to add /arch:SSE2 instruction on MSVC --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1876d3da005..61cb53b489d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1717,7 +1717,7 @@ if(NOT OPTIMIZE STREQUAL "off") message(STATUS "Enabling SS2 CPU optimizations (>= Pentium 4)") # SSE and SSE2 are core instructions on x64 # and consequently raise a warning message from compiler with this flag on x64. - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) target_compile_options(mixxx-lib PUBLIC "/arch:SSE2") endif() target_compile_definitions(mixxx-lib PUBLIC "__SSE__" "__SSE2__") From 69af138484748fdc2289246d46d1880882d5ea6f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 12 Oct 2019 22:14:54 +0200 Subject: [PATCH 103/134] CMake: Pass CMAKE_BUILD_TYPE to ExternalProject --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61cb53b489d..7b547faf372 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -870,7 +870,7 @@ if(EBUR128_STATIC) SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= ${EBUR128_CMAKE_ARGS} + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX:PATH= ${EBUR128_CMAKE_ARGS} BUILD_BYPRODUCTS /${EBUR128_LIBRARY} ) set_target_properties(libebur128 PROPERTIES EXCLUDE_FROM_ALL TRUE) @@ -1934,7 +1934,7 @@ ExternalProject_Add(mixxx-gtest SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" INSTALL_COMMAND "" - CMAKE_ARGS "${GTEST_CMAKE_ARGS}" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "${GTEST_CMAKE_ARGS}" BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" ) set_target_properties(mixxx-gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) @@ -1951,7 +1951,7 @@ ExternalProject_Add(mixxx-gmock SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" INSTALL_COMMAND "" - CMAKE_ARGS "${GMOCK_CMAKE_ARGS}" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "${GMOCK_CMAKE_ARGS}" BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}" ) set_target_properties(mixxx-gmock PROPERTIES EXCLUDE_FROM_ALL TRUE) From 9365effcaf73e914f08d62415d20154a214d7a9d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 13 Oct 2019 22:07:39 +0200 Subject: [PATCH 104/134] CMake: Add status message regarding internal libebur128 --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b547faf372..e5a4c728cc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -856,6 +856,7 @@ endif() find_package(Ebur128) cmake_dependent_option(EBUR128_STATIC "Link libebur128 statically" OFF "Ebur128_FOUND" ON) if(EBUR128_STATIC) + message(STATUS "Preparing internal Ebur128") set(EBUR128_CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON") check_symbol_exists(STAILQ_HEAD sys/queue.h HAVE_STAILQ) if(NOT HAVE_STAILQ) From 55d7678b46e3f059920eae7aebdb47214dac008b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 13 Oct 2019 22:08:49 +0200 Subject: [PATCH 105/134] CMake: Find Celt/Silk only on MSVC with static deps --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5a4c728cc5..e48e2def8cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1464,8 +1464,6 @@ endif() # Opus (RFC 6716) find_package(Opus) -find_package(Celt) -find_package(Silk) cmake_dependent_option(OPUS_ENABLED "Opus (RFC 6716) support" ON "Opus_FOUND" OFF) if(OPUS_ENABLED) if(NOT Opus_FOUND) @@ -1479,11 +1477,13 @@ if(OPUS_ENABLED) target_include_directories(mixxx-lib SYSTEM PUBLIC ${Opus_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${Opus_LIBRARIES}) if(WIN32 AND STATIC_DEPS) + find_package(Celt) if(NOT Celt_FOUND) message(FATAL_ERROR "Opus support with static dependencies requires the celt library.") endif() target_link_libraries(mixxx-lib PUBLIC Celt::Celt) + find_package(Silk) if(NOT Silk_FOUND) message(FATAL_ERROR "Opus support with static dependencies requires the silk library.") endif() From aa5d881afeb09846c01b224fd292b690da7196c0 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 13 Oct 2019 23:44:56 +0200 Subject: [PATCH 106/134] CMake: Improve ccache/cclache option handling --- CMakeLists.txt | 55 +++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e48e2def8cb..558b5781e36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,33 +76,42 @@ if(GIT_WORKTREE_DIRTY EQUAL "1") set(GIT_COMMIT_COUNT "${GIT_COMMIT_COUNT}+") endif() message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") - -# ccache support -find_program(CCACHE_FOUND "ccache") -cmake_dependent_option(CCACHE_SUPPORT "Enable ccache support" ON "CCACHE_FOUND;NOT MSVC" OFF) -if(CCACHE_SUPPORT) - if(MSVC) - message(FATAL_ERROR "ccache support is incompatible with MSVC.") - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC - OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - # without this compiler messages in `make` backend would be uncolored - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto") +if(MSVC) + # clcache support + find_program(CLCACHE_FOUND "clcache") + if(CLCACHE_FOUND) + message(STATUS "Found clcache: ${CLCACHE_FOUND}") + else() + message(STATUS "Could NOT find clcache (missing executable)") endif() - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache") - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") -endif() - -# clcache support -find_program(CLCACHE_FOUND "clcache") -cmake_dependent_option(CLCACHE_SUPPORT "Enable clcache support" ON "CLCACHE_FOUND;MSVC" OFF) -if(CLCACHE_SUPPORT) - if(NOT MSVC) - message(FATAL_ERROR "clcache support requires MSVC.") + cmake_dependent_option(CLCACHE_SUPPORT "Enable clcache support" ON "CLCACHE_FOUND" OFF) + if(CLCACHE_SUPPORT) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "clcache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "clcache") endif() - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "clcache") - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "clcache") + message(STATUS "Support for clcache: ${CLCACHE_SUPPORT}") +else() + # ccache support + find_program(CCACHE_FOUND "ccache") + if(CCACHE_FOUND) + message(STATUS "Found ccache: ${CCACHE_FOUND}") + else() + message(STATUS "Could NOT find ccache (missing executable)") + endif() + cmake_dependent_option(CCACHE_SUPPORT "Enable ccache support" ON "CCACHE_FOUND" OFF) + if(CCACHE_SUPPORT) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC + OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # without this compiler messages in `make` backend would be uncolored + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto") + endif() + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") + endif() + message(STATUS "Support for ccache: ${CCACHE_SUPPORT}") endif() + configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/src/build.h.template" "${CMAKE_CURRENT_BINARY_DIR}/src/build.h" From c0ec3192db55ce9fe42129282e21ed2f7ff9a54a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 14 Oct 2019 00:09:51 +0200 Subject: [PATCH 107/134] CMake: Rename C[L]CACHE_FOUND to C[L]CACHE_EXECUTABLE --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 558b5781e36..df5a795c6a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,13 +78,13 @@ endif() message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") if(MSVC) # clcache support - find_program(CLCACHE_FOUND "clcache") - if(CLCACHE_FOUND) - message(STATUS "Found clcache: ${CLCACHE_FOUND}") + find_program(CLCACHE_EXECUTABLE "clcache") + if(CLCACHE_EXECUTABLE) + message(STATUS "Found clcache: ${CLCACHE_EXECUTABLE}") else() message(STATUS "Could NOT find clcache (missing executable)") endif() - cmake_dependent_option(CLCACHE_SUPPORT "Enable clcache support" ON "CLCACHE_FOUND" OFF) + cmake_dependent_option(CLCACHE_SUPPORT "Enable clcache support" ON "CLCACHE_EXECUTABLE" OFF) if(CLCACHE_SUPPORT) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "clcache") set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "clcache") @@ -92,13 +92,13 @@ if(MSVC) message(STATUS "Support for clcache: ${CLCACHE_SUPPORT}") else() # ccache support - find_program(CCACHE_FOUND "ccache") - if(CCACHE_FOUND) - message(STATUS "Found ccache: ${CCACHE_FOUND}") + find_program(CCACHE_EXECUTABLE "ccache") + if(CCACHE_EXECUTABLE) + message(STATUS "Found ccache: ${CCACHE_EXECUTABLE}") else() message(STATUS "Could NOT find ccache (missing executable)") endif() - cmake_dependent_option(CCACHE_SUPPORT "Enable ccache support" ON "CCACHE_FOUND" OFF) + cmake_dependent_option(CCACHE_SUPPORT "Enable ccache support" ON "CCACHE_EXECUTABLE" OFF) if(CCACHE_SUPPORT) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") From d476a579950b07d6ec2fffe7dc078a2d9ee4e56a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 24 Oct 2019 19:02:54 +0200 Subject: [PATCH 108/134] CMake: Remove _ENABLED suffix from option names --- CMakeLists.txt | 110 ++++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df5a795c6a5..6d5efdbb644 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1256,8 +1256,8 @@ endif() # # Battery meter -cmake_dependent_option(BATTERY_ENABLED "Battery meter support" ON "WIN32 OR UNIX" OFF) -if(BATTERY_ENABLED) +cmake_dependent_option(BATTERY "Battery meter support" ON "WIN32 OR UNIX" OFF) +if(BATTERY) if(WIN32) target_sources(mixxx-lib PRIVATE src/util/battery/batterywindows.cpp) elseif(APPLE) @@ -1272,8 +1272,8 @@ endif() # Build Time -option(BUILDTIME_ENABLED "Use __DATE__ and __TIME__" ON) -if(NOT BUILDTIME_ENABLED) +option(BUILDTIME "Use __DATE__ and __TIME__" ON) +if(NOT BUILDTIME) # Distributions like openSUSE use tools (e. g. build-compare) to detect # whether a built binary differs from a former build to avoid unneeded # publishing of packages. @@ -1284,8 +1284,8 @@ if(NOT BUILDTIME_ENABLED) endif() # Clang Color Diagnostics -option(CLANG_COLORDIAG_ENABLED "Clang color diagnostics" OFF) -if(CLANG_COLORDIAG_ENABLED) +option(CLANG_COLORDIAG "Clang color diagnostics" OFF) +if(CLANG_COLORDIAG) if(NOT CLANG) message(FATAL_ERROR "Color Diagnostics are only available when using Clang.") endif() @@ -1294,16 +1294,16 @@ endif() # Clang Sanitizers set(CLANG_SANITIZERS "") -option(CLANG_ASAN_ENABLED "Clang Address Sanitizer" OFF) -if(CLANG_ASAN_ENABLED) +option(CLANG_ASAN "Clang Address Sanitizer" OFF) +if(CLANG_ASAN) list(APPEND CLANG_SANITIZERS "address") endif() -option(CLANG_UBSAN_ENABLED "Clang Undefined Behaviour Sanitizer" OFF) -if(CLANG_UBSAN_ENABLED) +option(CLANG_UBSAN "Clang Undefined Behaviour Sanitizer" OFF) +if(CLANG_UBSAN) list(APPEND CLANG_SANITIZERS "undefined") endif() -option(CLANG_TSAN_ENABLED "Clang Thread Sanitizer" OFF) -if(CLANG_TSAN_ENABLED) +option(CLANG_TSAN "Clang Thread Sanitizer" OFF) +if(CLANG_TSAN) list(APPEND CLANG_SANITIZERS "thread") endif() if(NOT CLANG_SANITIZERS STREQUAL "") @@ -1315,8 +1315,8 @@ if(NOT CLANG_SANITIZERS STREQUAL "") endif() # CoreAudio MP3/AAC Decoder -cmake_dependent_option(COREAUDIO_ENABLED "CoreAudio MP3/AAC Decoder" ON "APPLE" OFF) -if(COREAUDIO_ENABLED) +cmake_dependent_option(COREAUDIO "CoreAudio MP3/AAC Decoder" ON "APPLE" OFF) +if(COREAUDIO) target_sources(mixxx-lib PRIVATE src/sources/soundsourcecoreaudio.cpp src/sources/v1/legacyaudiosourceadapter.cpp @@ -1335,8 +1335,8 @@ endif() # FAAD AAC audio file decoder plugin find_package(MP4) find_package(MP4v2) -cmake_dependent_option(FAAD_ENABLED "FAAD AAC audio file decoder support" ON "MP4_FOUND OR MP4v2_FOUND" OFF) -if(FAAD_ENABLED) +cmake_dependent_option(FAAD "FAAD AAC audio file decoder support" ON "MP4_FOUND OR MP4v2_FOUND" OFF) +if(FAAD) if(NOT MP4_FOUND AND NOT MP4v2_FOUND) message(FATAL_ERROR "FAAD AAC audio support requires libmp4 or libmp4v2 with development headers.") endif() @@ -1356,8 +1356,8 @@ endif() # FFmpeg 4.x support # FFmpeg is multimedia library that can be found http://ffmpeg.org/ find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWRESAMPLE) -option(FFMPEG_ENABLED "FFmpeg 4.x support" OFF) -if(FFMPEG_ENABLED) +option(FFMPEG "FFmpeg 4.x support" OFF) +if(FFMPEG) if(NOT AVCODEC_FOUND) message(FATAL_ERROR "FFmpeg support requires libavcodec and its development headers.") elseif(AVCODEC_VERSION VERSION_LESS 58) @@ -1396,22 +1396,22 @@ if(FFMPEG_ENABLED) endif() # Google PerfTools -option(GPERFTOOLS_ENABLED "Google PerfTools libtcmalloc linkage" OFF) -option(GPERFTOOLSPROFILER_ENABLED "Google PerfTools libprofiler linkage" OFF) -if(GPERFTOOLS_ENABLED OR GPERFTOOLSPROFILER_ENABLED) +option(GPERFTOOLS "Google PerfTools libtcmalloc linkage" OFF) +option(GPERFTOOLSPROFILER "Google PerfTools libprofiler linkage" OFF) +if(GPERFTOOLS OR GPERFTOOLSPROFILER) find_package(GPerfTools REQUIRED) - if(GPERFTOOLS_ENABLED) + if(GPERFTOOLS) target_link_libraries(mixxx-lib PUBLIC GPerfTools::tcmalloc) endif() - if(PERFTOOLSPROFILER_ENABLED) + if(PERFTOOLSPROFILER) target_link_libraries(mixxx-lib PUBLIC GPerfTools::profiler) endif() endif() # HSS1394 MIDI device find_package(HSS1394) -cmake_dependent_option(HSS1394_ENABLED "HSS1394 MIDI device support" ON "HSS1394_FOUND;WIN32 OR APPLE" OFF) -if(HSS1394_ENABLED) +cmake_dependent_option(HSS1394 "HSS1394 MIDI device support" ON "HSS1394_FOUND;WIN32 OR APPLE" OFF) +if(HSS1394) target_sources(mixxx-lib PRIVATE src/controllers/midi/hss1394controller.cpp src/controllers/midi/hss1394enumerator.cpp @@ -1427,8 +1427,8 @@ endif() # Lilv (LV2) find_package(Lilv) -cmake_dependent_option(LILV_ENABLED "Lilv (LV2) support" ON "Lilv_FOUND" OFF) -if(LILV_ENABLED) +cmake_dependent_option(LILV "Lilv (LV2) support" ON "Lilv_FOUND" OFF) +if(LILV) if(NOT Lilv_FOUND) message(FATAL_ERROR "Lilv (LV2) support requires the liblilv-0 and its development headers.") endif() @@ -1444,8 +1444,8 @@ endif() # Live Broadcasting (Shoutcast) find_package(Shout) -cmake_dependent_option(BROADCAST_ENABLED "Live Broadcasting (Shoutcast) support" ON "Shout_FOUND" OFF) -if(BROADCAST_ENABLED) +cmake_dependent_option(BROADCAST "Live Broadcasting (Shoutcast) support" ON "Shout_FOUND" OFF) +if(BROADCAST) if(NOT Shout_FOUND) message(FATAL_ERROR "Live Broadcasting support requires the libshout and its development headers.") endif() @@ -1461,8 +1461,8 @@ endif() # Locale Aware Compare for SQLite find_package(SQLite3) -cmake_dependent_option(LOCALECOMPARE_ENABLED "Locale Aware Compare support for SQLite" ON "SQLite3_FOUND" OFF) -if(LOCALECOMPARE_ENABLED) +cmake_dependent_option(LOCALECOMPARE "Locale Aware Compare support for SQLite" ON "SQLite3_FOUND" OFF) +if(LOCALECOMPARE) if(NOT SQLite3_FOUND) message(FATAL_ERROR "Locale Aware Compare for SQLite requires libsqlite and its development headers.") endif() @@ -1473,8 +1473,8 @@ endif() # Opus (RFC 6716) find_package(Opus) -cmake_dependent_option(OPUS_ENABLED "Opus (RFC 6716) support" ON "Opus_FOUND" OFF) -if(OPUS_ENABLED) +cmake_dependent_option(OPUS "Opus (RFC 6716) support" ON "Opus_FOUND" OFF) +if(OPUS) if(NOT Opus_FOUND) message(FATAL_ERROR "Opus support requires libopus and libopusfile with development headers.") endif() @@ -1503,8 +1503,8 @@ endif() # MAD MP3 Decoder find_package(MAD) find_package(ID3Tag) -cmake_dependent_option(MAD_ENABLED "MAD MP3 Decoder" ON "MAD_FOUND;ID3Tag_FOUND" OFF) -if(MAD_ENABLED) +cmake_dependent_option(MAD "MAD MP3 Decoder" ON "MAD_FOUND;ID3Tag_FOUND" OFF) +if(MAD) if(NOT MAD_FOUND) message(FATAL_ERROR "MAD support requires libmad and its development headers.") endif() @@ -1518,16 +1518,16 @@ endif() # Mac App Store if(APPLE) - option(MACAPPSTORE_ENABLED "Build for Mac App Store" OFF) - if(MACAPPSTORE_ENABLED) + option(MACAPPSTORE "Build for Mac App Store" OFF) + if(MACAPPSTORE) target_compile_definitions(mixxx-lib PUBLIC __MACAPPSTORE__) endif() endif() # Media Foundation AAC Decoder Plugin find_package(MediaFoundation) -cmake_dependent_option(MEDIAFOUNDATION_ENABLED "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" ON "MediaFoundation_FOUND" OFF) -if(MEDIAFOUNDATION_ENABLED) +cmake_dependent_option(MEDIAFOUNDATION "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" ON "MediaFoundation_FOUND" OFF) +if(MEDIAFOUNDATION) if(NOT MediaFoundation_FOUND) message(FATAL_ERROR "MediaFoundation support requires the MediaFoundation libraries and its development headers.") endif() @@ -1545,8 +1545,8 @@ endif() # Modplug support find_package(Modplug) -cmake_dependent_option(MODPLUG_ENABLED "Modplug module decoder support" ON "Modplug_FOUND" OFF) -if(MODPLUG_ENABLED) +cmake_dependent_option(MODPLUG "Modplug module decoder support" ON "Modplug_FOUND" OFF) +if(MODPLUG) if(NOT Modplug_FOUND) message(FATAL_ERROR "Modplug module decoder support requires libmodplug and its development headers.") endif() @@ -1561,8 +1561,8 @@ endif() # Profiling if(UNIX AND NOT APPLE) - option(PROFILING_ENABLED "Profiling (e.g. gprof) support" OFF) - if(PROFILING_ENABLED) + option(PROFILING "Profiling (e.g. gprof) support" OFF) + if(PROFILING) target_compile_options(mixxx-lib PUBLIC -pg) target_link_options(mixxx-lib PUBLIC -pg) endif() @@ -1570,8 +1570,8 @@ endif() # QtKeychain find_package(Qt5 QUIET OPTIONAL_COMPONENTS Keychain) -option(QTKEYCHAIN_ENABLED "Secure credentials storage support for Live Broadcasting profiles" OFF) -if(QTKEYCHAIN_ENABLED) +option(QTKEYCHAIN "Secure credentials storage support for Live Broadcasting profiles" OFF) +if(QTKEYCHAIN) if(NOT Qt5_Keychain_FOUND) message(FATAL_ERROR "Secure credential storage support requires the Qt5::Keychain component.") endif() @@ -1581,8 +1581,8 @@ endif() # USB Bulk controller support find_package(LibUSB) -cmake_dependent_option(BULK_ENABLED "USB Bulk controller support" ON "LibUSB_FOUND" OFF) -if(BULK_ENABLED) +cmake_dependent_option(BULK "USB Bulk controller support" ON "LibUSB_FOUND" OFF) +if(BULK) if(NOT LibUSB_FOUND) message(FATAL_ERROR "USB Bulk controller support requires libusb 1.0 and its development headers.") endif() @@ -1596,9 +1596,9 @@ endif() # USB HID controller support find_package(HIDAPI) -option(HID_ENABLED "USB HID controller support" ON) +option(HID "USB HID controller support" ON) cmake_dependent_option(HIDAPI_STATIC "Link HIDAPI library statically" OFF "HIDAPI_FOUND" ON) -if(HID_ENABLED) +if(HID) target_sources(mixxx-lib PRIVATE src/controllers/hid/hidcontroller.cpp src/controllers/hid/hidenumerator.cpp @@ -1633,9 +1633,9 @@ if(HID_ENABLED) endif() # Vinyl Control -cmake_dependent_option(VINYLCONTROL_ENABLED "Vinyl Control support" ON "NOT MACAPPSTORE_ENABLED" OFF) -if(VINYLCONTROL_ENABLED) - if(MACAPPSTORE_ENABLED) +cmake_dependent_option(VINYLCONTROL "Vinyl Control support" ON "NOT MACAPPSTORE" OFF) +if(VINYLCONTROL) + if(MACAPPSTORE) message(FATAL_ERROR "Mac App Store and Vinyl Control support are mutually exclusive due to licensing issues.") endif() @@ -1664,8 +1664,8 @@ endif() # WavPack audio file support find_package(WavPack) -cmake_dependent_option(WAVPACK_ENABLED "WavPack audio file support" ON "WavPack_FOUND" OFF) -if(WAVPACK_ENABLED) +cmake_dependent_option(WAVPACK "WavPack audio file support" ON "WavPack_FOUND" OFF) +if(WAVPACK) if(NOT WavPack_FOUND) message(FATAL_ERROR "WavPack audio file support requires libwv and its development headers.") endif() @@ -1756,7 +1756,7 @@ if(NOT OPTIMIZE STREQUAL "off") # Clang sanitizers. # Note: It is only included in -O on machines where it does not # interfere with debugging - if(NOT PROFILING_ENABLED AND NOT CLANG_SANITIZERS) + if(NOT PROFILING AND NOT CLANG_SANITIZERS) target_compile_options(mixxx-lib PUBLIC "-fomit-frame-pointer") endif() From 166156695acd0d6cb410cdc5339aa9b391fcd4ea Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 19 Oct 2019 12:55:27 +0200 Subject: [PATCH 109/134] CMake: Fix Qt5Keychain detection --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d5efdbb644..05edb774aed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1569,14 +1569,15 @@ if(UNIX AND NOT APPLE) endif() # QtKeychain -find_package(Qt5 QUIET OPTIONAL_COMPONENTS Keychain) +find_package(Qt5Keychain QUIET) option(QTKEYCHAIN "Secure credentials storage support for Live Broadcasting profiles" OFF) if(QTKEYCHAIN) - if(NOT Qt5_Keychain_FOUND) + if(NOT Qt5Keychain_FOUND) message(FATAL_ERROR "Secure credential storage support requires the Qt5::Keychain component.") endif() target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__) - target_link_libraries(mixxx-lib PUBLIC Qt5::Keychain) + target_link_libraries(mixxx-lib PUBLIC ${Qt5Keychain_LIBRARIES}) + target_include_directories(mixxx-lib PUBLIC ${Qt5Keychain_INCLUDE_DIRECTORIES}) endif() # USB Bulk controller support From 816d09bdc92418c7a2b7767532140b8d490a787e Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 19 Oct 2019 13:53:12 +0200 Subject: [PATCH 110/134] CMake: Fix typo in Qt5Keychain variables --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05edb774aed..f3f8c9906db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1576,8 +1576,8 @@ if(QTKEYCHAIN) message(FATAL_ERROR "Secure credential storage support requires the Qt5::Keychain component.") endif() target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__) - target_link_libraries(mixxx-lib PUBLIC ${Qt5Keychain_LIBRARIES}) - target_include_directories(mixxx-lib PUBLIC ${Qt5Keychain_INCLUDE_DIRECTORIES}) + target_link_libraries(mixxx-lib PUBLIC ${QTKEYCHAIN_LIBRARIES}) + target_include_directories(mixxx-lib PUBLIC ${QTKEYCHAIN_INCLUDE_DIRECTORIES}) endif() # USB Bulk controller support From ddc72390c8bfa5af3cbc5d00a6e094e1ddfb108b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 19 Oct 2019 18:47:24 +0200 Subject: [PATCH 111/134] CMake: Fix Qt5Keychain include dirs --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3f8c9906db..1706d727a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1577,7 +1577,7 @@ if(QTKEYCHAIN) endif() target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__) target_link_libraries(mixxx-lib PUBLIC ${QTKEYCHAIN_LIBRARIES}) - target_include_directories(mixxx-lib PUBLIC ${QTKEYCHAIN_INCLUDE_DIRECTORIES}) + target_include_directories(mixxx-lib PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS}) endif() # USB Bulk controller support From 78ead486c625d373ecbe84c8a6ff23e9c6d20d0f Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Fri, 25 Oct 2019 15:29:29 +0200 Subject: [PATCH 112/134] CMake: Fix mixxx-lib dependencies --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1706d727a39..482822678f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -569,7 +569,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp src/waveform/renderers/qtwaveformrenderersimplesignal.cpp src/waveform/renderers/waveformmark.cpp - src/waveform/renderers/waveformmarkproperties.cpp src/waveform/renderers/waveformmarkrange.cpp src/waveform/renderers/waveformmarkset.cpp src/waveform/renderers/waveformrenderbackground.cpp @@ -591,6 +590,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL 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 @@ -607,7 +607,9 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/waveform/widgets/rgbwaveformwidget.cpp src/waveform/widgets/softwarewaveformwidget.cpp src/waveform/widgets/waveformwidgetabstract.cpp + src/widget/colormenu.cpp src/widget/controlwidgetconnection.cpp + src/widget/cuemenu.cpp src/widget/hexspinbox.cpp src/widget/paintable.cpp src/widget/wanalysislibrarytableview.cpp From 8d76cf5ec7e5518faa3e431af516c61f407d0020 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 27 Oct 2019 13:38:55 +0100 Subject: [PATCH 113/134] CMake: Move dependencies and feature options to end of CMakeLists.txt --- CMakeLists.txt | 716 ++++++++++++++++++++++++------------------------- 1 file changed, 358 insertions(+), 358 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 482822678f4..4aab355d0ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -850,120 +850,379 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) include(CPack) # -# Dependencies +# Tests # -option(STATIC_DEPS "Link dependencies statically" OFF) - -# Chromaprint -find_package(Chromaprint REQUIRED) -target_link_libraries(mixxx-lib PUBLIC Chromaprint::Chromaprint) -if(WIN32 AND STATIC_DEPS) - target_compile_definitions(mixxx-lib PUBLIC CHROMAPRINT_NODLL) - find_package(FFTW REQUIRED) - target_link_libraries(mixxx-lib PUBLIC FFTW::FFTW) -endif() - -# Ebur128 -find_package(Ebur128) -cmake_dependent_option(EBUR128_STATIC "Link libebur128 statically" OFF "Ebur128_FOUND" ON) -if(EBUR128_STATIC) - message(STATUS "Preparing internal Ebur128") - set(EBUR128_CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON") - check_symbol_exists(STAILQ_HEAD sys/queue.h HAVE_STAILQ) - if(NOT HAVE_STAILQ) - list(APPEND EBUR128_CMAKE_ARGS "-DENABLE_INTERNAL_QUEUE_H=ON") - endif() - if(MSVC) - set(EBUR128_LIBRARY "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128_static${CMAKE_STATIC_LIBRARY_SUFFIX}") - else() - set(EBUR128_LIBRARY "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") - endif() - ExternalProject_Add(libebur128 - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" - INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install" - CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX:PATH= ${EBUR128_CMAKE_ARGS} - BUILD_BYPRODUCTS /${EBUR128_LIBRARY} - ) - set_target_properties(libebur128 PROPERTIES EXCLUDE_FROM_ALL TRUE) - - add_library(mixxx-libebur128 STATIC IMPORTED) - add_dependencies(mixxx-libebur128 libebur128) - set(EBUR128_LIBRARY_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install/${EBUR128_LIBRARY}") - message(STATUS "Linking internal libebur128 statically: ${EBUR128_LIBRARY_LOCATION}") - set_target_properties(mixxx-libebur128 PROPERTIES - IMPORTED_LOCATION "${EBUR128_LIBRARY_LOCATION}" - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" - ) - target_link_libraries(mixxx-lib PUBLIC mixxx-libebur128) -else() - message(STATUS "Linking libebur128 dynamically") - target_link_libraries(mixxx-lib PUBLIC Ebur128::Ebur128) -endif() - -# FidLib -add_library(fidlib STATIC EXCLUDE_FROM_ALL lib/fidlib/fidlib.c) -if(MSVC) - target_compile_definitions(fidlib PRIVATE T_MSVC) -elseif(MINGW) - target_compile_definitions(fidlib PRIVATE T_MINGW) -else() - target_compile_definitions(fidlib PRIVATE T_LINUX) -endif() -target_include_directories(mixxx-lib SYSTEM PUBLIC lib/fidlib) -target_link_libraries(mixxx-lib PUBLIC fidlib) - -# FLAC -find_package(FLAC REQUIRED) -target_link_libraries(mixxx-lib PUBLIC FLAC::FLAC) -if(WIN32 AND STATIC_DEPS) - target_compile_definitions(mixxx-lib PUBLIC FLAC__NO_DLL) -endif() - -# FpClassify This is a wrapper around the fpclassify function that prevents -# inlining It is compiled without optimization and allows to use these function -# from -ffast-math optimized objects -add_library(FpClassify STATIC EXCLUDE_FROM_ALL src/util/fpclassify.cpp) -target_link_libraries(mixxx-lib PUBLIC FpClassify) +add_executable(mixxx-test + src/test/analyserwaveformtest.cpp + src/test/analyzersilence_test.cpp + src/test/audiotaperpot_test.cpp + src/test/autodjprocessor_test.cpp + src/test/baseeffecttest.cpp + src/test/beatgridtest.cpp + src/test/beatmaptest.cpp + src/test/beatstranslatetest.cpp + src/test/bpmcontrol_test.cpp + src/test/broadcastprofile_test.cpp + src/test/broadcastsettings_test.cpp + src/test/channelhandle_test.cpp + src/test/configobject_test.cpp + src/test/controller_preset_validation_test.cpp + src/test/controllerengine_test.cpp + src/test/controlobjecttest.cpp + src/test/coverartcache_test.cpp + src/test/coverartutils_test.cpp + src/test/cratestorage_test.cpp + src/test/cuecontrol_test.cpp + src/test/dbconnectionpool_test.cpp + src/test/dbidtest.cpp + src/test/directorydaotest.cpp + src/test/duration_test.cpp + src/test/durationutiltest.cpp + src/test/effectchainslottest.cpp + src/test/effectslottest.cpp + src/test/effectsmanagertest.cpp + src/test/enginebufferscalelineartest.cpp + src/test/enginebuffertest.cpp + src/test/enginefilterbiquadtest.cpp + src/test/enginemastertest.cpp + src/test/enginemicrophonetest.cpp + src/test/enginesynctest.cpp + src/test/globaltrackcache_test.cpp + src/test/indexrange_test.cpp + src/test/keyutilstest.cpp + src/test/lcstest.cpp + src/test/learningutilstest.cpp + src/test/libraryscannertest.cpp + src/test/librarytest.cpp + src/test/looping_control_test.cpp + src/test/main.cpp + src/test/mathutiltest.cpp + src/test/metadatatest.cpp + src/test/metaknob_link_test.cpp + src/test/midicontrollertest.cpp + src/test/mixxxtest.cpp + src/test/movinginterquartilemean_test.cpp + src/test/mpscfifotest.cpp + src/test/nativeeffects_test.cpp + src/test/performancetimer_test.cpp + src/test/playcountertest.cpp + src/test/playlisttest.cpp + src/test/portmidicontroller_test.cpp + src/test/portmidienumeratortest.cpp + src/test/queryutiltest.cpp + src/test/readaheadmanager_test.cpp + src/test/replaygaintest.cpp + src/test/rescalertest.cpp + src/test/samplebuffertest.cpp + src/test/sampleutiltest.cpp + src/test/schemamanager_test.cpp + src/test/searchqueryparsertest.cpp + src/test/signalpathtest.cpp + src/test/skincontext_test.cpp + src/test/softtakeover_test.cpp + src/test/soundproxy_test.cpp + src/test/soundsourceproviderregistrytest.cpp + src/test/sqliteliketest.cpp + src/test/synccontroltest.cpp + src/test/tableview_test.cpp + src/test/taglibtest.cpp + src/test/trackdao_test.cpp + src/test/trackexport_test.cpp + src/test/trackmetadata_test.cpp + src/test/tracknumberstest.cpp + src/test/trackreftest.cpp + src/test/trackupdate_test.cpp + src/test/wpushbutton_test.cpp + src/test/wwidgetstack_test.cpp +) +set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) +target_link_libraries(mixxx-test PUBLIC mixxx-lib) -# gtest -target_include_directories(mixxx-lib SYSTEM PUBLIC lib/gtest-1.7.0/include) +set(GTEST_CMAKE_ARGS "") +set(GMOCK_CMAKE_ARGS "") if(MSVC) # Since Visual Studio 17 15.5 (Tools Update 2), the use of std::tr1 has # been deprecated and throws a warning. If /W3 is used, this causes an # error. This suppresses the warning/error until we pull in the fixes from # upstream. # See this for details: https://github.com/google/googletest/issues/1111 - target_compile_definitions(mixxx-lib PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) -endif() + set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") + set(GMOCK_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") -# LAME -find_package(LAME REQUIRED) -target_link_libraries(mixxx-lib PUBLIC LAME::LAME) + # Use shared CRT when linking gtest to prevent error LNK2038: mismatch + # detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value + # 'MD_DynamicRelease' + set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-Dgtest_force_shared_crt=ON") + set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-Dgtest_force_shared_crt=ON") -# OpenGL -set(OpenGL_GL_PREFERENCE "GLVND") -find_package(OpenGL REQUIRED) -target_link_libraries(mixxx-lib PUBLIC OpenGL::GL) + # Work around the Release/Debug subdirectories on Windows + foreach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER "${OUTPUT_CONFIG}" OUTPUT_CONFIG) + set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0") + set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0") + endforeach() +endif() -# Ogg Vorbis -find_package(OggVorbis REQUIRED) -target_include_directories(mixxx-lib SYSTEM PUBLIC ${OggVorbis_INCLUDE_DIRS}) -target_link_libraries(mixxx-lib PUBLIC ${OggVorbis_LIBRARIES}) +# gtest +ExternalProject_Add(mixxx-gtest + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" + INSTALL_COMMAND "" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "${GTEST_CMAKE_ARGS}" + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" +) +set_target_properties(mixxx-gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) +add_dependencies(mixxx-test mixxx-gtest) +target_include_directories(mixxx-test SYSTEM PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0/include" +) +target_link_libraries(mixxx-test PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" +) -# PortAudio -find_package(PortAudio REQUIRED) -target_include_directories(mixxx-lib SYSTEM PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) -target_link_libraries(mixxx-lib PUBLIC ${PORTAUDIO_LIBRARIES}) +# gmock +ExternalProject_Add(mixxx-gmock + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" + INSTALL_COMMAND "" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "${GMOCK_CMAKE_ARGS}" + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}" +) +set_target_properties(mixxx-gmock PROPERTIES EXCLUDE_FROM_ALL TRUE) +add_dependencies(mixxx-test mixxx-gmock) +target_include_directories(mixxx-test SYSTEM PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0/include" +) +target_link_libraries(mixxx-test PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}" +) -# PortAudio Ring Buffer -add_library(PortAudioRingBuffer STATIC EXCLUDE_FROM_ALL - lib/portaudio/pa_ringbuffer.c +# Benchmark +add_library(gbenchmark STATIC EXCLUDE_FROM_ALL + lib/benchmark/src/benchmark.cc + lib/benchmark/src/colorprint.cc + lib/benchmark/src/commandlineflags.cc + lib/benchmark/src/console_reporter.cc + lib/benchmark/src/csv_reporter.cc + lib/benchmark/src/json_reporter.cc + lib/benchmark/src/log.cc + lib/benchmark/src/reporter.cc + lib/benchmark/src/sleep.cc + lib/benchmark/src/string_util.cc + lib/benchmark/src/sysinfo.cc + lib/benchmark/src/walltime.cc + lib/benchmark/src/re_std.cc ) -target_include_directories(mixxx-lib SYSTEM PUBLIC lib/portaudio) -target_link_libraries(mixxx-lib PUBLIC PortAudioRingBuffer) +target_compile_definitions(gbenchmark PRIVATE HAVE_STD_REGEX) +find_package(Threads REQUIRED) +target_link_libraries(gbenchmark ${CMAKE_THREAD_LIBS_INIT}) +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + target_link_libraries(gbenchmark Shlwapi) +endif() +target_include_directories(gbenchmark SYSTEM PUBLIC lib/benchmark/include) +target_link_libraries(mixxx-test PUBLIC gbenchmark) -# PortMidi +# Test Suite +include(CTest) +include(GoogleTest) +enable_testing() +gtest_add_tests( + TARGET mixxx-test + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + TEST_LIST testsuite +) +set_tests_properties(${testsuite} PROPERTIES TIMEOUT 30) + +# Benchmarking +add_custom_target(benchmark + COMMAND $ --benchmark + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Mixxx Benchmarks" + VERBATIM +) +add_dependencies(benchmark mixxx-test) + +# +# Resources +# +add_library(mixxx-qrc OBJECT EXCLUDE_FROM_ALL res/mixxx.qrc) +set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) + +# Add resources to mixxx and mixxx-test binaries, not the mixxx-lib static +# library. Doing this would require initialization using Q_INIT_RESOURCE() +# calls that are not present at the moment. Further information can be found +# at: https://doc.qt.io/qt5/resources.html#using-resources-in-a-library +target_sources(mixxx PRIVATE $) +target_sources(mixxx-test PRIVATE $) + +if(UNIX) + add_custom_target(mixxx-res + COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/res" + COMMENT "Symlinking resources to build directory..." + ) +else() + add_custom_target(mixxx-res + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/" + COMMENT "Copying resources to build directory..." + ) +endif() +add_dependencies(mixxx mixxx-res) + +# Windows-only resource file +if(WIN32) + string(TIMESTAMP MIXXX_YEAR "%Y") + + file(READ src/_version.h MIXXX_VERSION_FILECONTENT) + string(REGEX REPLACE "^.*#define MIXXX_VERSION \"(.*)\".*$" "\\1" MIXXX_VERSION "${MIXXX_VERSION_FILECONTENT}") + + # Remove anything after ~ or - in the version number and replace the dots with commas + string(REGEX REPLACE "^([^~-]+).*$" "\\1" MIXXX_FILEVERSION "${MIXXX_VERSION}") + string(REPLACE "." "," MIXXX_FILEVERSION "${MIXXX_FILEVERSION}") + if(NOT GIT_COMMIT_COUNT STREQUAL "unknown") + set(MIXXX_FILEVERSION "${MIXXX_FILEVERSION},${GIT_COMMIT_COUNT}") + string(REPLACE "+" "" MIXXX_FILEVERSION "${MIXXX_FILEVERSION}") + endif() + set(MIXXX_PRODUCTVERSION "${MIXXX_FILEVERSION}") + + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(MIXXX_DEBUG 1) + else() + set(MIXXX_DEBUG 0) + endif() + + string(FIND "${MIXXX_VERSION}" "pre" MIXXX_PRERELEASE_POSITION) + if(MIXXX_PRERELEASE_POSITION EQUAL -1) + set(MIXXX_PRERELEASE 0) + else() + set(MIXXX_PRERELEASE 1) + endif() + + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/src/mixxx.rc.include.template" + "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" + ) + target_sources(mixxx PRIVATE + src/mixxx.rc + "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" + ) + target_include_directories(mixxx PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") +endif() + +# +# Dependencies +# +option(STATIC_DEPS "Link dependencies statically" OFF) + +# Chromaprint +find_package(Chromaprint REQUIRED) +target_link_libraries(mixxx-lib PUBLIC Chromaprint::Chromaprint) +if(WIN32 AND STATIC_DEPS) + target_compile_definitions(mixxx-lib PUBLIC CHROMAPRINT_NODLL) + find_package(FFTW REQUIRED) + target_link_libraries(mixxx-lib PUBLIC FFTW::FFTW) +endif() + +# Ebur128 +find_package(Ebur128) +cmake_dependent_option(EBUR128_STATIC "Link libebur128 statically" OFF "Ebur128_FOUND" ON) +if(EBUR128_STATIC) + message(STATUS "Preparing internal Ebur128") + set(EBUR128_CMAKE_ARGS "-DBUILD_STATIC_LIBS=ON") + check_symbol_exists(STAILQ_HEAD sys/queue.h HAVE_STAILQ) + if(NOT HAVE_STAILQ) + list(APPEND EBUR128_CMAKE_ARGS "-DENABLE_INTERNAL_QUEUE_H=ON") + endif() + if(MSVC) + set(EBUR128_LIBRARY "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128_static${CMAKE_STATIC_LIBRARY_SUFFIX}") + else() + set(EBUR128_LIBRARY "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ebur128${CMAKE_STATIC_LIBRARY_SUFFIX}") + endif() + ExternalProject_Add(libebur128 + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128" + INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX:PATH= ${EBUR128_CMAKE_ARGS} + BUILD_BYPRODUCTS /${EBUR128_LIBRARY} + ) + set_target_properties(libebur128 PROPERTIES EXCLUDE_FROM_ALL TRUE) + + add_library(mixxx-libebur128 STATIC IMPORTED) + add_dependencies(mixxx-libebur128 libebur128) + set(EBUR128_LIBRARY_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/libebur128-install/${EBUR128_LIBRARY}") + message(STATUS "Linking internal libebur128 statically: ${EBUR128_LIBRARY_LOCATION}") + set_target_properties(mixxx-libebur128 PROPERTIES + IMPORTED_LOCATION "${EBUR128_LIBRARY_LOCATION}" + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libebur128/ebur128" + ) + target_link_libraries(mixxx-lib PUBLIC mixxx-libebur128) +else() + message(STATUS "Linking libebur128 dynamically") + target_link_libraries(mixxx-lib PUBLIC Ebur128::Ebur128) +endif() + +# FidLib +add_library(fidlib STATIC EXCLUDE_FROM_ALL lib/fidlib/fidlib.c) +if(MSVC) + target_compile_definitions(fidlib PRIVATE T_MSVC) +elseif(MINGW) + target_compile_definitions(fidlib PRIVATE T_MINGW) +else() + target_compile_definitions(fidlib PRIVATE T_LINUX) +endif() +target_include_directories(mixxx-lib SYSTEM PUBLIC lib/fidlib) +target_link_libraries(mixxx-lib PUBLIC fidlib) + +# FLAC +find_package(FLAC REQUIRED) +target_link_libraries(mixxx-lib PUBLIC FLAC::FLAC) +if(WIN32 AND STATIC_DEPS) + target_compile_definitions(mixxx-lib PUBLIC FLAC__NO_DLL) +endif() + +# FpClassify This is a wrapper around the fpclassify function that prevents +# inlining It is compiled without optimization and allows to use these function +# from -ffast-math optimized objects +add_library(FpClassify STATIC EXCLUDE_FROM_ALL src/util/fpclassify.cpp) +target_link_libraries(mixxx-lib PUBLIC FpClassify) + +# gtest +target_include_directories(mixxx-lib SYSTEM PUBLIC lib/gtest-1.7.0/include) +if(MSVC) + # Since Visual Studio 17 15.5 (Tools Update 2), the use of std::tr1 has + # been deprecated and throws a warning. If /W3 is used, this causes an + # error. This suppresses the warning/error until we pull in the fixes from + # upstream. + # See this for details: https://github.com/google/googletest/issues/1111 + target_compile_definitions(mixxx-lib PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) +endif() + +# LAME +find_package(LAME REQUIRED) +target_link_libraries(mixxx-lib PUBLIC LAME::LAME) + +# OpenGL +set(OpenGL_GL_PREFERENCE "GLVND") +find_package(OpenGL REQUIRED) +target_link_libraries(mixxx-lib PUBLIC OpenGL::GL) + +# Ogg Vorbis +find_package(OggVorbis REQUIRED) +target_include_directories(mixxx-lib SYSTEM PUBLIC ${OggVorbis_INCLUDE_DIRS}) +target_link_libraries(mixxx-lib PUBLIC ${OggVorbis_LIBRARIES}) + +# PortAudio +find_package(PortAudio REQUIRED) +target_include_directories(mixxx-lib SYSTEM PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) +target_link_libraries(mixxx-lib PUBLIC ${PORTAUDIO_LIBRARIES}) + +# PortAudio Ring Buffer +add_library(PortAudioRingBuffer STATIC EXCLUDE_FROM_ALL + lib/portaudio/pa_ringbuffer.c +) +target_include_directories(mixxx-lib SYSTEM PUBLIC lib/portaudio) +target_link_libraries(mixxx-lib PUBLIC PortAudioRingBuffer) + +# PortMidi find_package(PortMidi REQUIRED) target_include_directories(mixxx-lib SYSTEM PUBLIC ${PortMidi_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PUBLIC ${PortMidi_LIBRARIES}) @@ -1827,262 +2086,3 @@ if(NOT OPTIMIZE STREQUAL "off") endif() endif() endif() - -# -# Tests -# -add_executable(mixxx-test - src/test/analyserwaveformtest.cpp - src/test/analyzersilence_test.cpp - src/test/audiotaperpot_test.cpp - src/test/autodjprocessor_test.cpp - src/test/baseeffecttest.cpp - src/test/beatgridtest.cpp - src/test/beatmaptest.cpp - src/test/beatstranslatetest.cpp - src/test/bpmcontrol_test.cpp - src/test/broadcastprofile_test.cpp - src/test/broadcastsettings_test.cpp - src/test/channelhandle_test.cpp - src/test/configobject_test.cpp - src/test/controller_preset_validation_test.cpp - src/test/controllerengine_test.cpp - src/test/controlobjecttest.cpp - src/test/coverartcache_test.cpp - src/test/coverartutils_test.cpp - src/test/cratestorage_test.cpp - src/test/cuecontrol_test.cpp - src/test/dbconnectionpool_test.cpp - src/test/dbidtest.cpp - src/test/directorydaotest.cpp - src/test/duration_test.cpp - src/test/durationutiltest.cpp - src/test/effectchainslottest.cpp - src/test/effectslottest.cpp - src/test/effectsmanagertest.cpp - src/test/enginebufferscalelineartest.cpp - src/test/enginebuffertest.cpp - src/test/enginefilterbiquadtest.cpp - src/test/enginemastertest.cpp - src/test/enginemicrophonetest.cpp - src/test/enginesynctest.cpp - src/test/globaltrackcache_test.cpp - src/test/indexrange_test.cpp - src/test/keyutilstest.cpp - src/test/lcstest.cpp - src/test/learningutilstest.cpp - src/test/libraryscannertest.cpp - src/test/librarytest.cpp - src/test/looping_control_test.cpp - src/test/main.cpp - src/test/mathutiltest.cpp - src/test/metadatatest.cpp - src/test/metaknob_link_test.cpp - src/test/midicontrollertest.cpp - src/test/mixxxtest.cpp - src/test/movinginterquartilemean_test.cpp - src/test/mpscfifotest.cpp - src/test/nativeeffects_test.cpp - src/test/performancetimer_test.cpp - src/test/playcountertest.cpp - src/test/playlisttest.cpp - src/test/portmidicontroller_test.cpp - src/test/portmidienumeratortest.cpp - src/test/queryutiltest.cpp - src/test/readaheadmanager_test.cpp - src/test/replaygaintest.cpp - src/test/rescalertest.cpp - src/test/samplebuffertest.cpp - src/test/sampleutiltest.cpp - src/test/schemamanager_test.cpp - src/test/searchqueryparsertest.cpp - src/test/signalpathtest.cpp - src/test/skincontext_test.cpp - src/test/softtakeover_test.cpp - src/test/soundproxy_test.cpp - src/test/soundsourceproviderregistrytest.cpp - src/test/sqliteliketest.cpp - src/test/synccontroltest.cpp - src/test/tableview_test.cpp - src/test/taglibtest.cpp - src/test/trackdao_test.cpp - src/test/trackexport_test.cpp - src/test/trackmetadata_test.cpp - src/test/tracknumberstest.cpp - src/test/trackreftest.cpp - src/test/trackupdate_test.cpp - src/test/wpushbutton_test.cpp - src/test/wwidgetstack_test.cpp -) -set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) -target_link_libraries(mixxx-test PUBLIC mixxx-lib) - -set(GTEST_CMAKE_ARGS "") -set(GMOCK_CMAKE_ARGS "") -if(MSVC) - # Since Visual Studio 17 15.5 (Tools Update 2), the use of std::tr1 has - # been deprecated and throws a warning. If /W3 is used, this causes an - # error. This suppresses the warning/error until we pull in the fixes from - # upstream. - # See this for details: https://github.com/google/googletest/issues/1111 - set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") - set(GMOCK_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") - - # Use shared CRT when linking gtest to prevent error LNK2038: mismatch - # detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value - # 'MD_DynamicRelease' - set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-Dgtest_force_shared_crt=ON") - set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-Dgtest_force_shared_crt=ON") - - # Work around the Release/Debug subdirectories on Windows - foreach(OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES}) - string(TOUPPER "${OUTPUT_CONFIG}" OUTPUT_CONFIG) - set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0") - set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0") - endforeach() -endif() - -# gtest -ExternalProject_Add(mixxx-gtest - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0" - INSTALL_COMMAND "" - CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "${GTEST_CMAKE_ARGS}" - BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" -) -set_target_properties(mixxx-gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) -add_dependencies(mixxx-test mixxx-gtest) -target_include_directories(mixxx-test SYSTEM PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/lib/gtest-1.7.0/include" -) -target_link_libraries(mixxx-test PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}" -) - -# gmock -ExternalProject_Add(mixxx-gmock - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0" - INSTALL_COMMAND "" - CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "${GMOCK_CMAKE_ARGS}" - BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}" -) -set_target_properties(mixxx-gmock PROPERTIES EXCLUDE_FROM_ALL TRUE) -add_dependencies(mixxx-test mixxx-gmock) -target_include_directories(mixxx-test SYSTEM PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/lib/gmock-1.7.0/include" -) -target_link_libraries(mixxx-test PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}" -) - -# Benchmark -add_library(gbenchmark STATIC EXCLUDE_FROM_ALL - lib/benchmark/src/benchmark.cc - lib/benchmark/src/colorprint.cc - lib/benchmark/src/commandlineflags.cc - lib/benchmark/src/console_reporter.cc - lib/benchmark/src/csv_reporter.cc - lib/benchmark/src/json_reporter.cc - lib/benchmark/src/log.cc - lib/benchmark/src/reporter.cc - lib/benchmark/src/sleep.cc - lib/benchmark/src/string_util.cc - lib/benchmark/src/sysinfo.cc - lib/benchmark/src/walltime.cc - lib/benchmark/src/re_std.cc -) -target_compile_definitions(gbenchmark PRIVATE HAVE_STD_REGEX) -find_package(Threads REQUIRED) -target_link_libraries(gbenchmark ${CMAKE_THREAD_LIBS_INIT}) -if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - target_link_libraries(gbenchmark Shlwapi) -endif() -target_include_directories(gbenchmark SYSTEM PUBLIC lib/benchmark/include) -target_link_libraries(mixxx-test PUBLIC gbenchmark) - -# Test Suite -include(CTest) -include(GoogleTest) -enable_testing() -gtest_add_tests( - TARGET mixxx-test - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - TEST_LIST testsuite -) -set_tests_properties(${testsuite} PROPERTIES TIMEOUT 30) - -# Benchmarking -add_custom_target(benchmark - COMMAND $ --benchmark - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Mixxx Benchmarks" - VERBATIM -) -add_dependencies(benchmark mixxx-test) - -# -# Resources -# -add_library(mixxx-qrc OBJECT EXCLUDE_FROM_ALL res/mixxx.qrc) -set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) - -# Add resources to mixxx and mixxx-test binaries, not the mixxx-lib static -# library. Doing this would require initialization using Q_INIT_RESOURCE() -# calls that are not present at the moment. Further information can be found -# at: https://doc.qt.io/qt5/resources.html#using-resources-in-a-library -target_sources(mixxx PRIVATE $) -target_sources(mixxx-test PRIVATE $) - -if(UNIX) - add_custom_target(mixxx-res - COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/res" - COMMENT "Symlinking resources to build directory..." - ) -else() - add_custom_target(mixxx-res - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/" - COMMENT "Copying resources to build directory..." - ) -endif() -add_dependencies(mixxx mixxx-res) - -# Windows-only resource file -if(WIN32) - string(TIMESTAMP MIXXX_YEAR "%Y") - - file(READ src/_version.h MIXXX_VERSION_FILECONTENT) - string(REGEX REPLACE "^.*#define MIXXX_VERSION \"(.*)\".*$" "\\1" MIXXX_VERSION "${MIXXX_VERSION_FILECONTENT}") - - # Remove anything after ~ or - in the version number and replace the dots with commas - string(REGEX REPLACE "^([^~-]+).*$" "\\1" MIXXX_FILEVERSION "${MIXXX_VERSION}") - string(REPLACE "." "," MIXXX_FILEVERSION "${MIXXX_FILEVERSION}") - if(NOT GIT_COMMIT_COUNT STREQUAL "unknown") - set(MIXXX_FILEVERSION "${MIXXX_FILEVERSION},${GIT_COMMIT_COUNT}") - string(REPLACE "+" "" MIXXX_FILEVERSION "${MIXXX_FILEVERSION}") - endif() - set(MIXXX_PRODUCTVERSION "${MIXXX_FILEVERSION}") - - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(MIXXX_DEBUG 1) - else() - set(MIXXX_DEBUG 0) - endif() - - string(FIND "${MIXXX_VERSION}" "pre" MIXXX_PRERELEASE_POSITION) - if(MIXXX_PRERELEASE_POSITION EQUAL -1) - set(MIXXX_PRERELEASE 0) - else() - set(MIXXX_PRERELEASE 1) - endif() - - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/src/mixxx.rc.include.template" - "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" - ) - target_sources(mixxx PRIVATE - src/mixxx.rc - "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" - ) - target_include_directories(mixxx PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") -endif() From 7b5d0277215d5c50f2a227f00385f07d7eee70a2 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 27 Oct 2019 13:44:30 +0100 Subject: [PATCH 114/134] CMake: Add symlink to for testdata to build directory --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aab355d0ea..1440f0a6570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1042,6 +1042,19 @@ add_custom_target(benchmark ) add_dependencies(benchmark mixxx-test) +if(UNIX) + add_custom_target(mixxx-testdata + COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/src/test" "${CMAKE_CURRENT_BINARY_DIR}/src/test" + COMMENT "Symlinking test data to build directory..." + ) +else() + add_custom_target(mixxx-testdata + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/src/test" "${CMAKE_CURRENT_BINARY_DIR}/src" + COMMENT "Copying test data to build directory..." + ) +endif() +add_dependencies(mixxx-test mixxx-testdata) + # # Resources # From a384e5ce6f3f65aae1e32537c212b174f05ec0b4 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 27 Oct 2019 13:45:36 +0100 Subject: [PATCH 115/134] CMake: Set mixxx-res as dependency for mixxx-lib instead of mixxx --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1440f0a6570..283e7583a0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1079,7 +1079,7 @@ else() COMMENT "Copying resources to build directory..." ) endif() -add_dependencies(mixxx mixxx-res) +add_dependencies(mixxx-lib mixxx-res) # Windows-only resource file if(WIN32) From 28b850160f223654ca6a488fa5c45b81a815b3f3 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Mon, 28 Oct 2019 14:56:11 +0100 Subject: [PATCH 116/134] Add SeratoMarkers2 files --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 283e7583a0c..29a7ff627f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -499,6 +499,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/track/keyutils.cpp src/track/playcounter.cpp src/track/replaygain.cpp + src/track/seratomarkers2.cpp src/track/track.cpp src/track/trackfile.cpp src/track/trackinfo.cpp @@ -917,6 +918,7 @@ add_executable(mixxx-test src/test/sampleutiltest.cpp src/test/schemamanager_test.cpp src/test/searchqueryparsertest.cpp + src/test/seratomarkers2test.cpp src/test/signalpathtest.cpp src/test/skincontext_test.cpp src/test/softtakeover_test.cpp From 99db595841140a75855babb5f55184f4d2fe1bde Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2019 22:41:54 +0100 Subject: [PATCH 117/134] CMake: Fix DEBUG_ASSERTIONS_FATAL flag --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29a7ff627f6..b0a372966a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -703,6 +703,10 @@ if(WARNINGS_FATAL) endif() option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF) +if(DEBUG_ASSERTIONS_FATAL) + target_compile_definitions(mixxx-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL) +endif() + target_compile_definitions(mixxx-lib PUBLIC $<$:MIXXX_BUILD_DEBUG> $<$>:MIXXX_BUILD_RELEASE> @@ -710,7 +714,6 @@ target_compile_definitions(mixxx-lib PUBLIC # this as a signal for when to enable code that should be disabled # in release mode. $<$>:NDEBUG> - $<$:MIXXX_DEBUG_ASSERTIONS_FATAL> ) if(WIN32) From 6eaa1b698d718f61c97a0ece78909a2109c21903 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2019 22:42:19 +0100 Subject: [PATCH 118/134] CMake: Remove unused Qt5::X11Extras component --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0a372966a0..1e7c0b0d58a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1285,11 +1285,10 @@ target_link_libraries(mixxx-lib PUBLIC target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT) if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) - find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED) + find_package(Qt5 COMPONENTS DBus REQUIRED) target_include_directories(mixxx-lib SYSTEM PUBLIC "${X11_INCLUDE_DIR}") target_link_libraries(mixxx-lib PUBLIC "${X11_LIBRARIES}" - Qt5::X11Extras Qt5::DBus ) elseif(WIN32) From 0c64c4365860a50b5bccf0ce7d54bd8cff2a93cd Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2019 23:18:08 +0100 Subject: [PATCH 119/134] CMake: Add CMAKE_SYSTEM_PROCESSOR as preprocessor definition --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e7c0b0d58a..3ba7955a985 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -708,6 +708,7 @@ if(DEBUG_ASSERTIONS_FATAL) endif() target_compile_definitions(mixxx-lib PUBLIC + "${CMAKE_SYSTEM_PROCESSOR}" $<$:MIXXX_BUILD_DEBUG> $<$>:MIXXX_BUILD_RELEASE> # Disable assert.h assertions in release mode. Some libraries use From 0fc3783847f4d0395a97f7ca6a2eb33ecf13ecb2 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2019 23:19:21 +0100 Subject: [PATCH 120/134] CMake: Remove unused QT_SHARED preprocessor define --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ba7955a985..df124abea4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1376,8 +1376,6 @@ elseif(WIN32) target_link_libraries(mixxx-lib PUBLIC "${QTLIBPNG_LIBRARY}") find_library(QTPCRE2_LIBRARY qtpcre2) target_link_libraries(mixxx-lib PUBLIC "${QTPCRE2_LIBRARY}") - else() - target_compile_definitions(mixxx-lib PUBLIC QT_SHARED) endif() endif() From b64c95aaade263f484fd5cfc92c8b418fc846ad6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2019 23:53:32 +0100 Subject: [PATCH 121/134] CMake: Remove duplicate Findffmpeg cmake module --- cmake/modules/Findffmpeg.cmake | 84 ---------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 cmake/modules/Findffmpeg.cmake diff --git a/cmake/modules/Findffmpeg.cmake b/cmake/modules/Findffmpeg.cmake deleted file mode 100644 index 52637a2b959..00000000000 --- a/cmake/modules/Findffmpeg.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (c) 2014 Andrew Kelley -# This file is MIT licensed. -# See http://opensource.org/licenses/MIT - -# FFMPEG_FOUND -# FFMPEG_INCLUDE_DIRS -# FFMPEG_LIBRARIES - -# AVFILTER_FOUND -# AVFILTER_INCLUDE_DIRS -# AVFILTER_LIBRARIES - -# AVFORMAT_FOUND -# AVFORMAT_INCLUDE_DIRS -# AVFORMAT_LIBRARIES - -# AVCODEC_FOUND -# AVCODEC_INCLUDE_DIRS -# AVCODEC_LIBRARIES - -# AVUTIL_FOUND -# AVUTIL_INCLUDE_DIRS -# AVUTIL_LIBRARIES - -find_path(AVFILTER_INCLUDE_DIRS NAMES libavfilter/avfilter.h) -find_library(AVFILTER_LIBRARIES NAMES avfilter) -if(AVFILTER_LIBRARIES AND AVFILTER_INCLUDE_DIRS) - set(AVFILTER_FOUND TRUE) -else() - set(AVFILTER_FOUND FALSE) -endif() - -find_path(AVFORMAT_INCLUDE_DIRS NAMES libavformat/avformat.h) -find_library(AVFORMAT_LIBRARIES NAMES avformat) -if(AVFORMAT_LIBRARIES AND AVFORMAT_INCLUDE_DIRS) - set(AVFORMAT_FOUND TRUE) -else() - set(AVFORMAT_FOUND FALSE) -endif() - -find_path(AVCODEC_INCLUDE_DIRS NAMES libavcodec/avcodec.h) -find_library(AVCODEC_LIBRARIES NAMES avcodec) -if(AVCODEC_LIBRARIES AND AVCODEC_INCLUDE_DIRS) - set(AVCODEC_FOUND TRUE) -else() - set(AVCODEC_FOUND FALSE) -endif() - -find_path(AVUTIL_INCLUDE_DIRS NAMES libavutil/avutil.h) -find_library(AVUTIL_LIBRARIES NAMES avutil) -if(AVUTIL_LIBRARIES AND AVUTIL_INCLUDE_DIRS) - set(AVUTIL_FOUND TRUE) -else() - set(AVUTIL_FOUND FALSE) -endif() - -if(AVFILTER_FOUND AND AVFORMAT_FOUND AND AVCODEC_FOUND AND AVUTIL_FOUND) - set(FFMPEG_FOUND TRUE) - set(FFMPEG_INCLUDE_DIRS - ${AVFILTER_INCLUDE_DIRS} - ${AVFORMAT_INCLUDE_DIRS} - ${AVCODEC_INCLUDE_DIRS} - ${AVUTIL_INCLUDE_DIRS}) - set(FFMPEG_LIBRARIES - ${AVFILTER_LIBRARIES} - ${AVFORMAT_LIBRARIES} - ${AVCODEC_LIBRARIES} - ${AVUTIL_LIBRARIES}) -else() - set(FFMPEG_FOUND FALSE) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FFMPEG DEFAULT_MSG - AVFILTER_LIBRARIES AVFILTER_INCLUDE_DIRS - AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIRS - AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIRS - AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIRS) - -mark_as_advanced( - AVFILTER_INCLUDE_DIRS AVFILTER_LIBRARIES - AVFORMAT_INCLUDE_DIRS AVFORMAT_LIBRARIES - AVCODEC_INCLUDE_DIRS AVCODEC_LIBRARIES - AVUTIL_INCLUDE_DIRS AVUTIL_LIBRARIES) From af02436ffd9fdf4c301a7082057c855c9afe16bb Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 8 Nov 2019 00:37:56 +0100 Subject: [PATCH 122/134] CMake: Reset FFMPEG_LIBRARIES/DEFINITIONS before appending to them --- cmake/modules/FindFFmpeg.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/modules/FindFFmpeg.cmake b/cmake/modules/FindFFmpeg.cmake index 89c908cb0d5..2126aed73ef 100644 --- a/cmake/modules/FindFFmpeg.cmake +++ b/cmake/modules/FindFFmpeg.cmake @@ -130,6 +130,8 @@ find_component(SWSCALE libswscale swscale libswscale/swscale.h) find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) +set(FFMPEG_LIBRARIES "") +set(FFMPEG_DEFINITIONS "") # Check if the required components were found and add their stuff to the FFMPEG_* vars. foreach (_component ${FFmpeg_FIND_COMPONENTS}) if (${_component}_FOUND) From a078965aa14d0f5dc8a6fd4bc6865c3da5ba795d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 8 Nov 2019 00:46:19 +0100 Subject: [PATCH 123/134] CMake: Disable FAAD by default --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df124abea4c..f237a009826 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1612,7 +1612,7 @@ endif() # FAAD AAC audio file decoder plugin find_package(MP4) find_package(MP4v2) -cmake_dependent_option(FAAD "FAAD AAC audio file decoder support" ON "MP4_FOUND OR MP4v2_FOUND" OFF) +option(FAAD "FAAD AAC audio file decoder support" OFF) if(FAAD) if(NOT MP4_FOUND AND NOT MP4v2_FOUND) message(FATAL_ERROR "FAAD AAC audio support requires libmp4 or libmp4v2 with development headers.") From e35bc3d0d252a5b9dbbac51a8eea569f5324159f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 8 Nov 2019 00:46:32 +0100 Subject: [PATCH 124/134] CMake: Disable WavPack by default --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f237a009826..a0770a13f85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1942,7 +1942,7 @@ endif() # WavPack audio file support find_package(WavPack) -cmake_dependent_option(WAVPACK "WavPack audio file support" ON "WavPack_FOUND" OFF) +option(WAVPACK "WavPack audio file support" OFF) if(WAVPACK) if(NOT WavPack_FOUND) message(FATAL_ERROR "WavPack audio file support requires libwv and its development headers.") From d862dfea801bcc51e700dda3c1991db31075f436 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 8 Nov 2019 01:29:51 +0100 Subject: [PATCH 125/134] CMake: Add SFC_SUPPORTS_SET_COMPRESSION_LEVEL define for SndFile --- CMakeLists.txt | 4 ++++ cmake/modules/FindSndFile.cmake | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0770a13f85..6b664a836e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1465,6 +1465,10 @@ target_link_libraries(mixxx-lib PUBLIC Rubberband::Rubberband) find_package(SndFile REQUIRED) target_link_libraries(mixxx-lib PUBLIC SndFile::SndFile) target_compile_definitions(mixxx-lib PUBLIC __SNDFILE__) +if(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL) + target_compile_definitions(mixxx-lib PUBLIC SFC_SUPPORTS_SET_COMPRESSION_LEVEL) +endif() + if(WIN32 AND STATIC_DEPS) find_package(G72X REQUIRED) target_link_libraries(mixxx-lib PUBLIC G72X::G72X) diff --git a/cmake/modules/FindSndFile.cmake b/cmake/modules/FindSndFile.cmake index 6f8e340c8ca..594ece85bc9 100644 --- a/cmake/modules/FindSndFile.cmake +++ b/cmake/modules/FindSndFile.cmake @@ -70,6 +70,14 @@ find_package_handle_standard_args( SndFile_INCLUDE_DIR ) +file(STRINGS "${SndFile_INCLUDE_DIR}/sndfile.h" SndFile_SUPPORTS_SET_COMPRESSION_LEVEL REGEX ".*SFC_SET_COMPRESSION_LEVEL.*") +if(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL) + set(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL ON) +else() + set(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL OFF) +endif() +mark_as_advanced(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL) + if(SndFile_FOUND) set(SndFile_LIBRARIES "${SndFile_LIBRARY}") set(SndFile_INCLUDE_DIRS "${SndFile_INCLUDE_DIR}") From de78d7b58eda798f97752f4a76c4b4894b781ea6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 8 Nov 2019 01:34:15 +0100 Subject: [PATCH 126/134] CMake: Remove trailing slash in UNIX_SHARE_PATH/UNIX_LIB_PATH definition --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b664a836e9..fe7c1104d91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -755,9 +755,9 @@ elseif(UNIX) else() target_compile_definitions(mixxx-lib PRIVATE __UNIX__) target_compile_definitions( - mixxx-lib PUBLIC UNIX_SHARE_PATH="${CMAKE_INSTALL_PREFIX}/share/mixxx/") + mixxx-lib PUBLIC UNIX_SHARE_PATH="${CMAKE_INSTALL_PREFIX}/share/mixxx") target_compile_definitions( - mixxx-lib PUBLIC UNIX_LIB_PATH="${CMAKE_INSTALL_PREFIX}/lib/mixxx/") + mixxx-lib PUBLIC UNIX_LIB_PATH="${CMAKE_INSTALL_PREFIX}/lib/mixxx") if(CMAKE_SYSTEM_NAME STREQUAL Linux) target_compile_definitions(mixxx-lib PUBLIC __LINUX__) elseif(CMAKE_SYSTEM_NAME MATCHES "^.*BSD$") From a504858b7aafa5f0c13cb34b6163bec422836703 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 8 Nov 2019 12:38:12 +0100 Subject: [PATCH 127/134] CMake: Add -pipe on GNU gcc to speed up builds --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe7c1104d91..1e581ac9eb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,12 @@ if(POLICY CMP0071) endif() set(CMAKE_CXX_STANDARD 14) + +# Speed up builds on HDDs +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # GNU is GNU GCC + add_compile_options(-pipe) +endif() + include(CMakeDependentOption) include(CheckSymbolExists) include(ExternalProject) From 50e5a0c17e903bd0a4425a1d6f894ecbc5a246b0 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 8 Nov 2019 12:39:01 +0100 Subject: [PATCH 128/134] Revert "CMake: Remove unused Qt5::X11Extras component" This reverts commit 6eaa1b698d718f61c97a0ece78909a2109c21903. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e581ac9eb0..9ed51187e2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1292,10 +1292,11 @@ target_link_libraries(mixxx-lib PUBLIC target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT) if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) - find_package(Qt5 COMPONENTS DBus REQUIRED) + find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED) target_include_directories(mixxx-lib SYSTEM PUBLIC "${X11_INCLUDE_DIR}") target_link_libraries(mixxx-lib PUBLIC "${X11_LIBRARIES}" + Qt5::X11Extras Qt5::DBus ) elseif(WIN32) From bbac19320e2f38bdf3c399f94a6c10ec292b54e4 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Tue, 12 Nov 2019 08:14:12 +0100 Subject: [PATCH 129/134] CMake: Add Kaitai for Rekordbox feature --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ed51187e2c..af5cdc2787b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1225,6 +1225,15 @@ endif() find_package(LAME REQUIRED) target_link_libraries(mixxx-lib PUBLIC LAME::LAME) +# Kaitai for reading Rekordbox libraries +add_library(Kaitai STATIC EXCLUDE_FROM_ALL + lib/kaitai/kaitaistream.cpp +) +target_include_directories(Kaitai SYSTEM PRIVATE lib/kaitai) +target_compile_definitions(Kaitai PRIVATE KS_STR_ENCODING_NONE) +target_include_directories(mixxx-lib PUBLIC lib/kaitai) +target_link_libraries(mixxx-lib PUBLIC Kaitai) + # OpenGL set(OpenGL_GL_PREFERENCE "GLVND") find_package(OpenGL REQUIRED) From ffb98771cb5c0219169677cda292acc9b6c1a998 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Tue, 12 Nov 2019 08:40:14 +0100 Subject: [PATCH 130/134] CMake: Add MP3GuessEnc for Rekordbox feature --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index af5cdc2787b..607f7ba210b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1234,6 +1234,16 @@ target_compile_definitions(Kaitai PRIVATE KS_STR_ENCODING_NONE) target_include_directories(mixxx-lib PUBLIC lib/kaitai) target_link_libraries(mixxx-lib PUBLIC Kaitai) +# For determining MP3 timing offset cases in Rekordbox library feature +add_library(MP3GuessEnc STATIC EXCLUDE_FROM_ALL + lib/mp3guessenc-0.27.4/mp3guessenc.c + lib/mp3guessenc-0.27.4/tags.c + lib/mp3guessenc-0.27.4/decode.c + lib/mp3guessenc-0.27.4/bit_utils.c +) +target_include_directories(MP3GuessEnc SYSTEM PUBLIC lib/mp3guessenc-0.27.4) +target_link_libraries(mixxx-lib PUBLIC MP3GuessEnc) + # OpenGL set(OpenGL_GL_PREFERENCE "GLVND") find_package(OpenGL REQUIRED) From 11beede2b7fe1938d928536bbba1bc32436e84d7 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Tue, 12 Nov 2019 07:53:22 +0100 Subject: [PATCH 131/134] CMake: Add Rekordbox feature --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 607f7ba210b..89421cec1e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,6 +382,9 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/library/recording/dlgrecording.cpp src/library/recording/dlgrecording.ui src/library/recording/recordingfeature.cpp + src/library/rekordbox/rekordbox_anlz.cpp + src/library/rekordbox/rekordbox_pdb.cpp + src/library/rekordbox/rekordboxfeature.cpp src/library/rhythmbox/rhythmboxfeature.cpp src/library/scanner/importfilestask.cpp src/library/scanner/libraryscanner.cpp From b17ed12800508e72216e49461b723661721d9d2e Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 12 Nov 2019 15:59:19 +0100 Subject: [PATCH 132/134] CMake: Get rid of duplicate target_include_directories for Katai When an include directory for a target is marked as PUBLIC, it will also be added as to all targets that depend on it (i.e. if the target is a library, all targets that this library is linked to via target_link_libraries will also have this include directory). Hence, there's no need to set this include directory twice. --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89421cec1e3..998ce603276 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1232,9 +1232,8 @@ target_link_libraries(mixxx-lib PUBLIC LAME::LAME) add_library(Kaitai STATIC EXCLUDE_FROM_ALL lib/kaitai/kaitaistream.cpp ) -target_include_directories(Kaitai SYSTEM PRIVATE lib/kaitai) +target_include_directories(Kaitai SYSTEM PUBLIC lib/kaitai) target_compile_definitions(Kaitai PRIVATE KS_STR_ENCODING_NONE) -target_include_directories(mixxx-lib PUBLIC lib/kaitai) target_link_libraries(mixxx-lib PUBLIC Kaitai) # For determining MP3 timing offset cases in Rekordbox library feature From 3452d10585a6d5e0a09370e0a6e700eb12fbf46f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 12 Nov 2019 21:14:18 +0100 Subject: [PATCH 133/134] CMake: Disable deprecated-copy warnings in gmock library --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 998ce603276..6ae8d553a94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -976,6 +976,9 @@ if(MSVC) set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gtest-1.7.0") set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG}=${CMAKE_CURRENT_BINARY_DIR}/lib/gmock-1.7.0") endforeach() +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" + OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(GMOCK_CMAKE_ARGS ${GMOCK_CMAKE_ARGS} "-DCMAKE_CXX_FLAGS=-Wno-deprecated-copy") endif() # gtest From b884fc7e309de7cfc916a9183584eca3aa0f8cca Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 12 Nov 2019 22:27:04 +0100 Subject: [PATCH 134/134] CMake: Disable warnings in generated source files --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ae8d553a94..bf5e4765bd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -688,6 +688,18 @@ if(UNIX AND NOT APPLE) target_compile_definitions(mixxx-lib PRIVATE SETTINGS_PATH=".mixxx/") endif() +# Disable warnings in generated source files +set_property( + SOURCE src/library/rekordbox/rekordbox_anlz.cpp + APPEND_STRING + PROPERTY COMPILE_OPTIONS -Wno-unused-parameter +) +set_property( + SOURCE src/library/rekordbox/rekordbox_pdb.cpp + APPEND_STRING + PROPERTY COMPILE_OPTIONS -Wno-unused-parameter -Wno-switch +) + option(WARNINGS_PEDANTIC "Let the compiler show even more warnings" OFF) if(MSVC) if(WARNINGS_PEDANTIC)