diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000000..bf5e4765bd4b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,2151 @@ +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.") + +# 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) +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) +include(GNUInstallDirs) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +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( + COMMAND git rev-parse --abbrev-ref HEAD + 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 +execute_process( + COMMAND git log -1 --format=%h + 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 +execute_process( + COMMAND git rev-list --count --first-parent HEAD + 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(GIT_WORKTREE_DIRTY EQUAL "1") + set(GIT_COMMIT_COUNT "${GIT_COMMIT_COUNT}+") +endif() +message(STATUS "Git commit count: ${GIT_COMMIT_COUNT}") +if(MSVC) + # clcache support + 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_EXECUTABLE" OFF) + if(CLCACHE_SUPPORT) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "clcache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "clcache") + endif() + message(STATUS "Support for clcache: ${CLCACHE_SUPPORT}") +else() + # ccache support + 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_EXECUTABLE" 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" +) + +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() + +# Mixxx itself +add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL + 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/externaltrackcollection.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/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 + 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/seratomarkers2.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/waveformmarkrange.cpp + src/waveform/renderers/waveformmarkset.cpp + src/waveform/renderers/waveformrenderbackground.cpp + src/waveform/renderers/waveformrenderbeat.cpp + src/waveform/renderers/waveformrendererabstract.cpp + src/waveform/renderers/waveformrendererendoftrack.cpp + src/waveform/renderers/waveformrendererfilteredsignal.cpp + src/waveform/renderers/waveformrendererhsv.cpp + src/waveform/renderers/waveformrendererpreroll.cpp + src/waveform/renderers/waveformrendererrgb.cpp + src/waveform/renderers/waveformrenderersignalbase.cpp + src/waveform/renderers/waveformrendermark.cpp + src/waveform/renderers/waveformrendermarkrange.cpp + src/waveform/renderers/waveformsignalcolors.cpp + src/waveform/renderers/waveformwidgetrenderer.cpp + src/waveform/sharedglcontext.cpp + src/waveform/visualplayposition.cpp + src/waveform/visualsmanager.cpp + src/waveform/vsyncthread.cpp + src/waveform/waveform.cpp + src/waveform/waveformfactory.cpp + src/waveform/waveformmarklabel.cpp + src/waveform/waveformwidgetfactory.cpp + src/waveform/widgets/emptywaveformwidget.cpp + src/waveform/widgets/glrgbwaveformwidget.cpp + src/waveform/widgets/glsimplewaveformwidget.cpp + src/waveform/widgets/glslwaveformwidget.cpp + src/waveform/widgets/glvsynctestwidget.cpp + src/waveform/widgets/glwaveformwidget.cpp + src/waveform/widgets/hsvwaveformwidget.cpp + src/waveform/widgets/qthsvwaveformwidget.cpp + src/waveform/widgets/qtrgbwaveformwidget.cpp + src/waveform/widgets/qtsimplewaveformwidget.cpp + src/waveform/widgets/qtvsynctestwidget.cpp + src/waveform/widgets/qtwaveformwidget.cpp + src/waveform/widgets/rgbwaveformwidget.cpp + src/waveform/widgets/softwarewaveformwidget.cpp + src/waveform/widgets/waveformwidgetabstract.cpp + src/widget/colormenu.cpp + src/widget/controlwidgetconnection.cpp + src/widget/cuemenu.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 +) +set_target_properties(mixxx-lib PROPERTIES AUTOMOC ON AUTOUIC ON) +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() + +# 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) + 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) + if(WARNINGS_PEDANTIC) + target_compile_options(mixxx-lib PUBLIC -pedantic) + endif() +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) +if(DEBUG_ASSERTIONS_FATAL) + target_compile_definitions(mixxx-lib PUBLIC MIXXX_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 + # this as a signal for when to enable code that should be disabled + # in release mode. + $<$>:NDEBUG> +) + +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) + + 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() +elseif(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( + 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 WIN32 src/main.cpp) +target_link_libraries(mixxx PUBLIC mixxx-lib) + +# +# Installation and Packaging +# +include(GNUInstallDirs) +install( + TARGETS mixxx + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +# 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 ") +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) + +# +# 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/seratomarkers2test.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() +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 +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) + +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 +# +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-lib 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) + +# Kaitai for reading Rekordbox libraries +add_library(Kaitai STATIC EXCLUDE_FROM_ALL + lib/kaitai/kaitaistream.cpp +) +target_include_directories(Kaitai SYSTEM PUBLIC lib/kaitai) +target_compile_definitions(Kaitai PRIVATE KS_STR_ENCODING_NONE) +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) +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}) + +# 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 + 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) +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 SYSTEM PUBLIC "${X11_INCLUDE_DIR}") + target_link_libraries(mixxx-lib PUBLIC + "${X11_LIBRARIES}" + Qt5::X11Extras + Qt5::DBus + ) +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 + 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 # ? + + # 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::QGifPlugin + Qt5::QICOPlugin + Qt5::QJpegPlugin + Qt5::QSvgPlugin + Qt5::QTgaPlugin + + # 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 + ) + + 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(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}") + 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() + +# QtScriptByteArray +add_library(QtScriptByteArray STATIC EXCLUDE_FROM_ALL + 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 EXCLUDE_FROM_ALL + # 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) +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() +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 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 SYSTEM 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) +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) +endif() + +# SoundTouch +add_library(SoundTouch STATIC EXCLUDE_FROM_ALL + 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 SYSTEM PUBLIC lib/soundtouch) +target_link_libraries(mixxx-lib PUBLIC SoundTouch) + +# TagLib +find_package(Taglib REQUIRED) +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) +endif() + +# 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) + find_package(Upower REQUIRED) + 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() + +# 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() + +# +# Features +# + +# Battery meter +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) + 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 "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. + # 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 "Clang color diagnostics" OFF) +if(CLANG_COLORDIAG) + 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 "Clang Address Sanitizer" OFF) +if(CLANG_ASAN) + list(APPEND CLANG_SANITIZERS "address") +endif() +option(CLANG_UBSAN "Clang Undefined Behaviour Sanitizer" OFF) +if(CLANG_UBSAN) + list(APPEND CLANG_SANITIZERS "undefined") +endif() +option(CLANG_TSAN "Clang Thread Sanitizer" OFF) +if(CLANG_TSAN) + 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 +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 + 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__) + target_include_directories(mixxx-lib SYSTEM PUBLIC lib/apple) +endif() + +# FAAD AAC audio file decoder plugin +find_package(MP4) +find_package(MP4v2) +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.") + 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() + +# 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 "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) + message(FATAL_ERROR "FFmpeg support requires at least version 58 of libavcodec (found: ${AVCODEC_VERSION}).") + endif() + 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) + 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) + 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 "Google PerfTools libtcmalloc linkage" OFF) +option(GPERFTOOLSPROFILER "Google PerfTools libprofiler linkage" OFF) +if(GPERFTOOLS OR GPERFTOOLSPROFILER) + find_package(GPerfTools REQUIRED) + if(GPERFTOOLS) + target_link_libraries(mixxx-lib PUBLIC GPerfTools::tcmalloc) + endif() + if(PERFTOOLSPROFILER) + target_link_libraries(mixxx-lib PUBLIC GPerfTools::profiler) + endif() +endif() + +# HSS1394 MIDI device +find_package(HSS1394) +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 + ) + target_compile_definitions(mixxx-lib PUBLIC __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) +find_package(Lilv) +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() + 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) +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() + 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) +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() + target_compile_definitions(mixxx-lib PUBLIC __SQLITE3__) + target_include_directories(mixxx-lib SYSTEM PRIVATE ${SQLite3_INCLUDE_DIRS}) + target_link_libraries(mixxx-lib PUBLIC ${SQLite3_LIBRARIES}) +endif() + +# Opus (RFC 6716) +find_package(Opus) +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() + 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 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() + target_link_libraries(mixxx-lib PUBLIC Silk::Float) + endif() +endif() + +# MAD MP3 Decoder +find_package(MAD) +find_package(ID3Tag) +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() + 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) +endif() + +# Mac App Store +if(APPLE) + 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 "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() + 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) +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() + 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 "Profiling (e.g. gprof) support" OFF) + if(PROFILING) + target_compile_options(mixxx-lib PUBLIC -pg) + target_link_options(mixxx-lib PUBLIC -pg) + endif() +endif() + +# QtKeychain +find_package(Qt5Keychain QUIET) +option(QTKEYCHAIN "Secure credentials storage support for Live Broadcasting profiles" OFF) +if(QTKEYCHAIN) + 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 ${QTKEYCHAIN_LIBRARIES}) + target_include_directories(mixxx-lib PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS}) +endif() + +# USB Bulk controller support +find_package(LibUSB) +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() + 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() + +# USB HID controller support +find_package(HIDAPI) +option(HID "USB HID controller support" ON) +cmake_dependent_option(HIDAPI_STATIC "Link HIDAPI library statically" OFF "HIDAPI_FOUND" ON) +if(HID) + 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 STATIC EXCLUDE_FROM_ALL) + 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) + 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 +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() + + 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 EXCLUDE_FROM_ALL) + 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 "WavPack audio file support" OFF) +if(WAVPACK) + 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) +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>) + + # 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 + # !!! /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(NOT 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 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() diff --git a/cmake/cpack_package_description.txt b/cmake/cpack_package_description.txt new file mode 100644 index 000000000000..8ac37422d84c --- /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 diff --git a/cmake/modules/FindCelt.cmake b/cmake/modules/FindCelt.cmake new file mode 100644 index 000000000000..5747746437d3 --- /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/FindChromaprint.cmake b/cmake/modules/FindChromaprint.cmake new file mode 100644 index 000000000000..a4da8f245968 --- /dev/null +++ b/cmake/modules/FindChromaprint.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Chromaprint QUIET libchromaprint) +endif() + +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 chromaprint_p + 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/FindEbur128.cmake b/cmake/modules/FindEbur128.cmake new file mode 100644 index 000000000000..fd76f0a48872 --- /dev/null +++ b/cmake/modules/FindEbur128.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Ebur128 QUIET libebur128) +endif() + +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() diff --git a/cmake/modules/FindFFTW.cmake b/cmake/modules/FindFFTW.cmake new file mode 100644 index 000000000000..58bbc48645c2 --- /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/FindFFmpeg.cmake b/cmake/modules/FindFFmpeg.cmake new file mode 100644 index 000000000000..2126aed73ef6 --- /dev/null +++ b/cmake/modules/FindFFmpeg.cmake @@ -0,0 +1,186 @@ +#.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, +# 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. + +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: 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) + + # 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 + ${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.") + + 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 + ${_component}_LIBRARIES + ${_component}_DEFINITIONS + ${_component}_VERSION) + +endmacro() + + +# 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) + +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) + # 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) + +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() + +# 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}) diff --git a/cmake/modules/FindFLAC.cmake b/cmake/modules/FindFLAC.cmake new file mode 100644 index 000000000000..6b17592b0b2a --- /dev/null +++ b/cmake/modules/FindFLAC.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_FLAC QUIET flac) +endif() + +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/FindG72X.cmake b/cmake/modules/FindG72X.cmake new file mode 100644 index 000000000000..45eb9f2f5545 --- /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/FindGLIB.cmake b/cmake/modules/FindGLIB.cmake new file mode 100644 index 000000000000..e7e3dac05eef --- /dev/null +++ b/cmake/modules/FindGLIB.cmake @@ -0,0 +1,124 @@ +# - 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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_GLIB QUIET glib-2.0) +endif() + +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 +) diff --git a/cmake/modules/FindGPerfTools.cmake b/cmake/modules/FindGPerfTools.cmake new file mode 100644 index 000000000000..b8f659b093c0 --- /dev/null +++ b/cmake/modules/FindGPerfTools.cmake @@ -0,0 +1,122 @@ +# 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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_GPerfTools_TCMALLOC QUIET libtcmalloc) + pkg_check_modules(PC_GPerfTools_PROFILER QUIET libprofiler) +endif() + +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) + +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/FindHIDAPI.cmake b/cmake/modules/FindHIDAPI.cmake new file mode 100644 index 000000000000..fcf37d1d2b60 --- /dev/null +++ b/cmake/modules/FindHIDAPI.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_HIDAPI QUIET hidapi-libusb) +endif() + +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/FindHSS1394.cmake b/cmake/modules/FindHSS1394.cmake new file mode 100644 index 000000000000..3030706849d5 --- /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 000000000000..aca75e7daabd --- /dev/null +++ b/cmake/modules/FindID3Tag.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_ID3Tag QUIET id3tag) +endif() + +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/FindLAME.cmake b/cmake/modules/FindLAME.cmake new file mode 100644 index 000000000000..95e1ee453e6a --- /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/FindLibUSB.cmake b/cmake/modules/FindLibUSB.cmake new file mode 100644 index 000000000000..f227327f72e2 --- /dev/null +++ b/cmake/modules/FindLibUSB.cmake @@ -0,0 +1,88 @@ +# 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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_LibUSB QUIET libusb-1.0) +endif() + +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 000000000000..95848c430edf --- /dev/null +++ b/cmake/modules/FindLilv.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Lilv QUIET lilv-0) +endif() + +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 000000000000..0974ace10cea --- /dev/null +++ b/cmake/modules/FindMAD.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_MAD QUIET mad) +endif() + +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 000000000000..b66cb56648a9 --- /dev/null +++ b/cmake/modules/FindMP4.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_MP4 QUIET mp4) +endif() + +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 000000000000..fc39d5e79d23 --- /dev/null +++ b/cmake/modules/FindMP4v2.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_MP4v2 QUIET mp4v2) +endif() + +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 000000000000..0d8f47a82197 --- /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 000000000000..b99d8bdfc599 --- /dev/null +++ b/cmake/modules/FindModplug.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Modplug QUIET libmodplug) +endif() + +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/FindOggVorbis.cmake b/cmake/modules/FindOggVorbis.cmake new file mode 100644 index 000000000000..82b7922bd952 --- /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/FindOpus.cmake b/cmake/modules/FindOpus.cmake new file mode 100644 index 000000000000..67d2a8562d1a --- /dev/null +++ b/cmake/modules/FindOpus.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: +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 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 + 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/FindPortAudio.cmake b/cmake/modules/FindPortAudio.cmake new file mode 100644 index 000000000000..eb4e465ba3ff --- /dev/null +++ b/cmake/modules/FindPortAudio.cmake @@ -0,0 +1,54 @@ +# - 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 + +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_PORTAUDIO portaudio-2.0) +endif() + +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 000000000000..2b204b6f3262 --- /dev/null +++ b/cmake/modules/FindPortMidi.cmake @@ -0,0 +1,81 @@ +# 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_INCLUDE_DIR +) + +if(PortMidi_FOUND) + 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() diff --git a/cmake/modules/FindRubberband.cmake b/cmake/modules/FindRubberband.cmake new file mode 100644 index 000000000000..7331388949bd --- /dev/null +++ b/cmake/modules/FindRubberband.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Rubberband QUIET rubberband) +endif() + +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/FindSQLite3.cmake b/cmake/modules/FindSQLite3.cmake new file mode 100644 index 000000000000..9a6eae403daf --- /dev/null +++ b/cmake/modules/FindSQLite3.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_SQLite3 QUIET sqlite3) +endif() + +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 000000000000..dc302a242984 --- /dev/null +++ b/cmake/modules/FindShout.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Shout QUIET shout) +endif() + +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/FindSilk.cmake b/cmake/modules/FindSilk.cmake new file mode 100644 index 000000000000..89e06dec24dd --- /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() diff --git a/cmake/modules/FindSndFile.cmake b/cmake/modules/FindSndFile.cmake new file mode 100644 index 000000000000..594ece85bc93 --- /dev/null +++ b/cmake/modules/FindSndFile.cmake @@ -0,0 +1,95 @@ +# 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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_SndFile QUIET sndfile) +endif() + +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 +) + +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}") + 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 000000000000..0ed3b3d39fd6 --- /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_LIBRARIES TAGLIB_INCLUDE_DIRS) + +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 000000000000..5e45d719b6a6 --- /dev/null +++ b/cmake/modules/FindUpower.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_Upower QUIET upower-glib) +endif() + +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/FindWavPack.cmake b/cmake/modules/FindWavPack.cmake new file mode 100644 index 000000000000..420c97465a22 --- /dev/null +++ b/cmake/modules/FindWavPack.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: +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 QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(PC_WavPack QUIET wavpack) +endif() + +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() diff --git a/src/build.h.template b/src/build.h.template new file mode 100644 index 000000000000..96634ff1b65c --- /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_COUNT@" + +#endif // BUILD_H diff --git a/src/mixxx.rc.include.template b/src/mixxx.rc.include.template new file mode 100644 index 000000000000..a5171be09117 --- /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 diff --git a/src/proto/CMakeLists.txt b/src/proto/CMakeLists.txt new file mode 100644 index 000000000000..156e9fb09b3e --- /dev/null +++ b/src/proto/CMakeLists.txt @@ -0,0 +1,23 @@ +# Protobuf +find_package(Protobuf) +protobuf_generate_cpp( + PROTO_SOURCES + PROTO_HEADERS + beats.proto + headers.proto + keys.proto + skin.proto + waveform.proto +) + +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()