From 9fecb429a37bcaa577aaa972139f6db3ce17ac50 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 13 Sep 2019 00:52:25 +0800 Subject: CMake. It's happening. Added a new build system based on CMake. Minor code cleanups. This probably breaks building with QMake on multiple platforms. And of course the new CMake support isn't tested thoroughly. But it's finally happening. --- .gitmodules | 3 ++ CMakeLists.txt | 26 ++++++++++++ ChangeLog | 10 +++++ README.md | 16 ++++---- core/CMakeLists.txt | 19 +++++++++ core/qmpmidioutrtmidi.cpp | 2 +- core/qmpmidioutrtmidi.hpp | 2 +- midifmt-plugin/CMakeLists.txt | 10 +++++ qmidiplayer-desktop/CMakeLists.txt | 62 +++++++++++++++++++++++++++++ qmidiplayer-desktop/qmidiplayer-desktop.pro | 7 ---- qmidiplayer-desktop/qmpmainwindow.cpp | 1 - sample-plugin/CMakeLists.txt | 10 +++++ simple-visualization/CMakeLists.txt | 22 ++++++++++ visualization/CMakeLists.txt | 38 ++++++++++++++++++ visualization/SMELT | 1 + 15 files changed, 211 insertions(+), 18 deletions(-) create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100644 core/CMakeLists.txt create mode 100644 midifmt-plugin/CMakeLists.txt create mode 100644 qmidiplayer-desktop/CMakeLists.txt create mode 100644 sample-plugin/CMakeLists.txt create mode 100644 simple-visualization/CMakeLists.txt create mode 100644 visualization/CMakeLists.txt create mode 160000 visualization/SMELT diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..62ea702 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "visualization/SMELT"] + path = visualization/SMELT + url = https://github.com/BearKidsTeam/SMELT.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..92ba7f7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.10.0) + +project(QMidiPlayer C CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +include(FindPkgConfig) +find_package(Qt5 COMPONENTS Widgets REQUIRED) +find_package(Threads REQUIRED) +pkg_search_module(fluidsynth REQUIRED fluidsynth>=2.0.0) +pkg_search_module(rtmidi REQUIRED rtmidi) + +option(BUILD_VISUALIZATION "Build visualization plugin" ON) + +add_subdirectory(core) +add_subdirectory(qmidiplayer-desktop) +add_subdirectory(sample-plugin) +add_subdirectory(midifmt-plugin) +add_subdirectory(simple-visualization) +if(BUILD_VISUALIZATION) + add_subdirectory(visualization) +endif() diff --git a/ChangeLog b/ChangeLog index d22e5b6..988aea6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2019-09-13 0.8.7 indev +CMake. It's happening. + +Added a new build system based on CMake. +Minor code cleanups. + +This probably breaks building with QMake on multiple +platforms. And of course the new CMake support isn't tested +thoroughly. But it's finally happening. + 2019-09-10 0.8.7 indev We refactorin', eh? Hell yeah. diff --git a/README.md b/README.md index aca9cca..29bc096 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@ A cross-platform midi file player based on libfluidsynth and Qt. [Project homepage](https://chrisoft.org/QMidiPlayer/) Features: -* Channel mute/solo -* Editing channel parameters on-the-fly -* Playlists -* Editing synthesizer effects -* Rendering midi to wave file (currently fluidsynth only) -* Visualization using SMELT (experimental Windows version now available) -* MIDI mapping (RtMidi and plugins) -* Plugin interface for extending the player easily +- Channel mute/solo +- Editing channel parameters on-the-fly +- Playlists +- Editing synthesizer effects +- Rendering midi to wave file (currently fluidsynth only) +- Visualization using SMELT (experimental Windows version now available) +- MIDI mapping (RtMidi and plugins) +- Plugin interface for extending the player easily Tested on Debian sid and Windows Vista~10. diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt new file mode 100644 index 0000000..2086a30 --- /dev/null +++ b/core/CMakeLists.txt @@ -0,0 +1,19 @@ +set(qmpcore_SOURCES + qmpmidioutfluid.hpp + qmpmidioutfluid.cpp + qmpmidioutrtmidi.hpp + qmpmidioutrtmidi.cpp + qmpmidiplay.hpp + qmpmidiplay.cpp + qmpmidiread.cpp +) + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +include_directories(${fluidsynth_INCLUDE_DIRS}) +include_directories(${rtmidi_INCLUDE_DIRS}) +include_directories(${PROJECT_SOURCE_DIR}/include/) + +add_library(qmpcore STATIC + ${qmpcore_SOURCES} +) diff --git a/core/qmpmidioutrtmidi.cpp b/core/qmpmidioutrtmidi.cpp index 1a18e46..c37fadc 100644 --- a/core/qmpmidioutrtmidi.cpp +++ b/core/qmpmidioutrtmidi.cpp @@ -4,7 +4,7 @@ #include #include #include -#include RT_MIDI_H +#include "rtmidi/RtMidi.h" #include "qmpmidioutrtmidi.hpp" void split(std::string s,char c,std::deque& v) diff --git a/core/qmpmidioutrtmidi.hpp b/core/qmpmidioutrtmidi.hpp index 0c1843c..0a4fd60 100644 --- a/core/qmpmidioutrtmidi.hpp +++ b/core/qmpmidioutrtmidi.hpp @@ -4,7 +4,7 @@ #include #define QMP_MAIN #include "../include/qmpcorepublic.hpp" -#include RT_MIDI_H +#include "rtmidi/RtMidi.h" struct qmpDeviceInitializer { CMidiTrack initseq; diff --git a/midifmt-plugin/CMakeLists.txt b/midifmt-plugin/CMakeLists.txt new file mode 100644 index 0000000..5b1902a --- /dev/null +++ b/midifmt-plugin/CMakeLists.txt @@ -0,0 +1,10 @@ +set(midifmt-plugin_SOURCES + midifmtplugin.hpp + midifmtplugin.cpp +) + +include_directories(${PROJECT_SOURCE_DIR}/include/) + +add_library(midifmt-plugin MODULE + ${midifmt-plugin_SOURCES} +) diff --git a/qmidiplayer-desktop/CMakeLists.txt b/qmidiplayer-desktop/CMakeLists.txt new file mode 100644 index 0000000..1f40a2e --- /dev/null +++ b/qmidiplayer-desktop/CMakeLists.txt @@ -0,0 +1,62 @@ +set(qmpdesktop_SOURCES + qdialskulpturestyle.hpp + qmpchanneleditor.hpp + qmpchannelswindow.hpp + qmpcustomizewindow.hpp + qmpdevpropdialog.hpp + qmpefxwindow.hpp + qmphelpwindow.hpp + qmpinfowindow.hpp + qmpmainwindow.hpp + qmpplistwindow.hpp + qmpplugin.hpp + qmppresetselect.hpp + qmpsettingswindow.hpp + main.cpp + qdialskulpturestyle.cpp + qmpchanneleditor.cpp + qmpchannelswindow.cpp + qmpcustomizewindow.cpp + qmpdevpropdialog.cpp + qmpefxwindow.cpp + qmphelpwindow.cpp + qmpinfowindow.cpp + qmpmainwindow.cpp + qmpplistwindow.cpp + qmpplugin.cpp + qmppresetselect.cpp + qmpsettingswindow.cpp + qmpchanneleditor.ui + qmpchannelswindow.ui + qmpcustomizewindow.ui + qmpdevpropdialog.ui + qmpefxwindow.ui + qmphelpwindow.ui + qmpinfowindow.ui + qmpmainwindow.ui + qmpplistwindow.ui + qmppresetselect.ui + qmpsettingswindow.ui + resources.qrc +) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +include_directories(${fluidsynth_INCLUDE_DIRS}) +include_directories(${rtmidi_INCLUDE_DIRS}) +include_directories(${PROJECT_SOURCE_DIR}/include/) + +add_executable(qmidiplayer + ${qmpdesktop_SOURCES} +) + +target_link_libraries(qmidiplayer + Qt5::Widgets + qmpcore + ${fluidsynth_LIBRARIES} + ${rtmidi_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${CMAKE_DL_LIBS} +) diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro index 193c0e5..53fc7c3 100644 --- a/qmidiplayer-desktop/qmidiplayer-desktop.pro +++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro @@ -77,12 +77,6 @@ unix{ message(Building in packaging mode...) DEFINES += QMP_BUILD_UNIX_PACKAGE } - exists("/usr/include/RtMidi.h") { - DEFINES += RT_MIDI_H=\\\"/usr/include/RtMidi.h\\\" - } - exists("/usr/include/rtmidi/RtMidi.h") { - DEFINES += RT_MIDI_H=\\\"/usr/include/rtmidi/RtMidi.h\\\" - } QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE += -O3 QMAKE_LFLAGS_RELEASE -= -O1 @@ -113,7 +107,6 @@ unix{ LIBS += -lfluidsynth -lrtmidi -ldl } win32{ - DEFINES += RT_MIDI_H=\\\"RtMidi.h\\\" #change these before building... LIBS += -lfluidsynth -lwinmm -lRtMidi RC_FILE = qmidiplayer.rc diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index 95b2da3..e097c62 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -118,7 +118,6 @@ void qmpMainWindow::init() pmgr->scanPlugins();settingsw->updatePluginList(pmgr);pmgr->initPlugins(); ui->vsMasterVol->setValue(qmpSettingsWindow::getSettingsIntf()->value("Audio/Gain",50).toInt()); connect(timer,SIGNAL(timeout()),this,SLOT(updateWidgets())); - connect(timer,SIGNAL(timeout()),chnlw,SLOT(channelWindowsUpdate())); connect(timer,SIGNAL(timeout()),infow,SLOT(updateInfo())); ui->pbNext->setIcon(QIcon(getThemedIcon(":/img/next.svg"))); ui->pbPrev->setIcon(QIcon(getThemedIcon(":/img/prev.svg"))); diff --git a/sample-plugin/CMakeLists.txt b/sample-plugin/CMakeLists.txt new file mode 100644 index 0000000..be8913b --- /dev/null +++ b/sample-plugin/CMakeLists.txt @@ -0,0 +1,10 @@ +set(sampleplugin_SOURCES + sampleplugin.hpp + sampleplugin.cpp +) + +include_directories(${PROJECT_SOURCE_DIR}/include/) + +add_library(sampleplugin MODULE + ${sampleplugin_SOURCES} +) diff --git a/simple-visualization/CMakeLists.txt b/simple-visualization/CMakeLists.txt new file mode 100644 index 0000000..777640f --- /dev/null +++ b/simple-visualization/CMakeLists.txt @@ -0,0 +1,22 @@ +set(simple-visualization_SOURCES + qmpkeyboardwindow.hpp + qmppianowidget.hpp + simplevisualization.hpp + qmpkeyboardwindow.cpp + qmppianowidget.cpp + simplevisualization.cpp +) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +include_directories(${PROJECT_SOURCE_DIR}/include/) + +add_library(simple-visualization MODULE + ${simple-visualization_SOURCES} +) + +target_link_libraries(simple-visualization + Qt5::Widgets +) diff --git a/visualization/CMakeLists.txt b/visualization/CMakeLists.txt new file mode 100644 index 0000000..fb88e10 --- /dev/null +++ b/visualization/CMakeLists.txt @@ -0,0 +1,38 @@ +set(visualization_SOURCES + extrasmeltutils.hpp + qmpvirtualpiano3d.hpp + qmpvisualization.hpp + extrasmeltutils.cpp + qmpvirtualpiano3d.cpp + qmpvisualization.cpp +) + +set(BUILD_DUMB ON) +set(BUILD_EXAMPLE OFF) +add_subdirectory(SMELT) + +find_package(glfw3 REQUIRED) +find_package(GLEW REQUIRED) +find_package(DevIL REQUIRED) +find_package(ZLIB REQUIRED) +find_package(Freetype REQUIRED) +find_package(OpenGL REQUIRED COMPONENTS OpenGL) + +include_directories(${PROJECT_SOURCE_DIR}/include/) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SMELT/include) +include_directories(${FREETYPE_INCLUDE_DIRS}) + +add_library(visualization MODULE + ${visualization_SOURCES} +) + +target_link_libraries(visualization + ${FREETYPE_LIBRARIES} + ${ZLIB_LIBRARIES} + smeltext + smelt + ${IL_LIBRARIES} + glfw + ${GLEW_LIBRARIES} + OpenGL::GL +) diff --git a/visualization/SMELT b/visualization/SMELT new file mode 160000 index 0000000..2836b3d --- /dev/null +++ b/visualization/SMELT @@ -0,0 +1 @@ +Subproject commit 2836b3d1bdb32765950b8e3133a2452d8e7b98d2 -- cgit v1.2.3