Add yaml-cpp, sqlite3 and libsndfile subprojects.

This commit is contained in:
apoorv569 2021-10-07 12:54:44 +05:30
parent 1a92c58954
commit fe463fe199
15 changed files with 138 additions and 71 deletions

View File

@ -21,12 +21,25 @@ project('SampleHive',
'cpp',
version : 'v0.9.0_alpha.1',
license : 'GPL v3',
meson_version: '>= 0.58.0',
default_options : ['warning_level=1',
'cpp_std=c++11'])
meson_src_root = meson.current_source_dir()
meson_build_root = meson.current_build_dir()
# Create configuration data
config_data = configuration_data()
# Save project information
project_name = meson.project_name()
project_license = meson.project_license()
project_version = meson.project_version()
config_data.set_quoted('NAME', project_name)
config_data.set_quoted('LICENSE', project_license)
config_data.set_quoted('VERSION', project_version)
# Save important directories
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
@ -34,8 +47,6 @@ libdir = prefix / get_option('libdir')
datadir = prefix / get_option('datadir')
samplehive_datadir = datadir / 'SampleHive'
# Create configuration data
config_data = configuration_data()
config_data.set_quoted('PREFIX', prefix)
config_data.set_quoted('BINDIR', bindir)
config_data.set_quoted('LIBDIR', libdir)
@ -76,6 +87,28 @@ taglib_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
'CMAKE_BUILD_TYPE': 'Release',
'CMAKE_CXX_COMPILER': 'g++'})
yaml_opts = cmake.subproject_options()
yaml_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
'CMAKE_INSTALL_PREFIX': prefix,
'CMAKE_BUILD_TYPE': 'Release',
'CMAKE_CXX_COMPILER': 'g++',
'YAML_BUILD_SHARED_LIBS': 'ON',
'YAML_CPP_BUILD_TESTS': 'OFF',
'YAML_CPP_BUILD_CONTRIB': 'ON',
'YAML_CPP_BUILD_TOOLS': 'ON'})
snd_opts = cmake.subproject_options()
snd_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
'CMAKE_INSTALL_PREFIX': prefix,
'CMAKE_BUILD_TYPE': 'Release',
'CMAKE_CXX_COMPILER': 'g++',
'BUILD_SHARED_LIBS': 'ON',
'BUILD_PROGRAMS': 'OFF',
'BUILD_EXAMPLES': 'OFF',
'BUILD_TESTING': 'OFF',
'ENABLE_EXTERNAL_LIBS': 'ON',
'ENABLE_MPEG': 'ON'})
# Source files to be compiled
src = [
@ -128,9 +161,27 @@ else
config_data.set('USE_SYSTEM_INCLUDE_PATH', 1)
endif
sqlite3 = dependency('sqlite3', required: true)
yaml = dependency('yaml-cpp', required: true)
snd = dependency('sndfile', required: true)
sqlite3 = dependency('sqlite3', version: '>=3.31.1', required: false)
if not sqlite3.found()
sqlite3_subproject = subproject('sqlite3')
libsqlite3 = sqlite3_subproject.get_variable('libsqlite3')
sqlite3 = declare_dependency(link_with: libsqlite3)
endif
yaml = dependency('yaml-cpp', version: '>=0.6.2', required: false)
if not yaml.found()
yaml_subproject = cmake.subproject('yaml-cpp', options: yaml_opts)
yaml = yaml_subproject.dependency('yaml-cpp')
endif
snd = dependency('sndfile', version: '>=1.0.28', required: false)
if not snd.found()
snd_subproject = cmake.subproject('libsndfile', options: snd_opts)
snd = snd_subproject.dependency('sndfile')
endif
# Create samplehive-config.h based on configuration
config_h = configure_file(output: 'SampleHiveConfig.hpp',
@ -138,7 +189,8 @@ config_h = configure_file(output: 'SampleHiveConfig.hpp',
install_subdir('assets',
install_dir: samplehive_datadir,
exclude_directories: 'screenshots')
exclude_directories: 'screenshots',
strip_directory: true)
if wx_found
executable('SampleHive',

View File

@ -26,7 +26,7 @@
#include <wx/gdicmn.h>
#include <wx/splash.h>
#define SPLASH_LOGO SAMPLEHIVE_DATADIR "/assets/logo/logo-samplehive_768x432.png"
#define SPLASH_LOGO SAMPLEHIVE_DATADIR "/logo/logo-samplehive_768x432.png"
wxIMPLEMENT_APP(App);
@ -79,7 +79,7 @@ bool App::OnCmdLineParsed(wxCmdLineParser& parser)
if (parser.Found("version"))
{
std::cout << "SampleHive v0.9.0_alpha.1" << std::endl;
std::cout << NAME << ' ' << VERSION << std::endl;
return false;
}

View File

@ -20,11 +20,11 @@
#pragma once
#include "MainFrame.hpp"
#include <wx/app.h>
#include <wx/cmdline.h>
#include "MainFrame.hpp"
class App : public wxApp
{
public:

View File

@ -18,6 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "Database.hpp"
#include <deque>
#include <exception>
@ -29,8 +31,6 @@
#include <wx/stringimpl.h>
#include <wx/variant.h>
#include "Database.hpp"
Database::Database(wxInfoBar& infoBar)
: m_InfoBar(infoBar)
{

View File

@ -18,6 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "Sample.hpp"
#include <string>
#include <vector>
#include <iostream>
@ -31,8 +33,6 @@
#include <sqlite3.h>
#include "Sample.hpp"
class Database
{
public:

View File

@ -41,9 +41,8 @@
#include <wx/filename.h>
// #include <wx/fswatcher.h>
#include <wx/gdicmn.h>
#include <wx/generic/icon.h>
#include <wx/gtk/dataobj2.h>
#include <wx/gtk/dataview.h>
#include <wx/icon.h>
#include <wx/dataobj.h>
#include <wx/headercol.h>
#include <wx/log.h>
#include <wx/menu.h>
@ -68,24 +67,24 @@
#include "SampleHiveConfig.hpp"
// Path to all the assets
#define ICON_HIVE_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-hive_16x16.png"
#define ICON_HIVE_24px SAMPLEHIVE_DATADIR "/assets/icons/icon-hive_24x24.png"
#define ICON_HIVE_32px SAMPLEHIVE_DATADIR "/assets/icons/icon-hive_32x32.png"
#define ICON_HIVE_64px SAMPLEHIVE_DATADIR "/assets/icons/icon-hive_64x64.png"
#define ICON_HIVE_128px SAMPLEHIVE_DATADIR "/assets/icons/icon-hive_128x128.png"
#define ICON_HIVE_256px SAMPLEHIVE_DATADIR "/assets/icons/icon-hive_256x256.png"
#define ICON_STAR_FILLED_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-star_filled_16x16.png"
#define ICON_STAR_EMPTY_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-star_empty_16x16.png"
#define ICON_PLAY_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-play-dark_16x16.png"
#define ICON_STOP_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-stop-dark_16x16.png"
#define ICON_AB_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-ab-dark_16x16.png"
#define ICON_LOOP_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-loop-dark_16x16.png"
#define ICON_MUTE_DARK_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-mute-dark_16x16.png"
#define ICON_PLAY_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-play-light_16x16.png"
#define ICON_STOP_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-stop-light_16x16.png"
#define ICON_AB_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-ab-light_16x16.png"
#define ICON_LOOP_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-loop-light_16x16.png"
#define ICON_MUTE_LIGHT_16px SAMPLEHIVE_DATADIR "/assets/icons/icon-mute-light_16x16.png"
#define ICON_HIVE_16px SAMPLEHIVE_DATADIR "/icons/icon-hive_16x16.png"
#define ICON_HIVE_24px SAMPLEHIVE_DATADIR "/icons/icon-hive_24x24.png"
#define ICON_HIVE_32px SAMPLEHIVE_DATADIR "/icons/icon-hive_32x32.png"
#define ICON_HIVE_64px SAMPLEHIVE_DATADIR "/icons/icon-hive_64x64.png"
#define ICON_HIVE_128px SAMPLEHIVE_DATADIR "/icons/icon-hive_128x128.png"
#define ICON_HIVE_256px SAMPLEHIVE_DATADIR "/icons/icon-hive_256x256.png"
#define ICON_STAR_FILLED_16px SAMPLEHIVE_DATADIR "/icons/icon-star_filled_16x16.png"
#define ICON_STAR_EMPTY_16px SAMPLEHIVE_DATADIR "/icons/icon-star_empty_16x16.png"
#define ICON_PLAY_DARK_16px SAMPLEHIVE_DATADIR "/icons/icon-play-dark_16x16.png"
#define ICON_STOP_DARK_16px SAMPLEHIVE_DATADIR "/icons/icon-stop-dark_16x16.png"
#define ICON_AB_DARK_16px SAMPLEHIVE_DATADIR "/icons/icon-ab-dark_16x16.png"
#define ICON_LOOP_DARK_16px SAMPLEHIVE_DATADIR "/icons/icon-loop-dark_16x16.png"
#define ICON_MUTE_DARK_16px SAMPLEHIVE_DATADIR "/icons/icon-mute-dark_16x16.png"
#define ICON_PLAY_LIGHT_16px SAMPLEHIVE_DATADIR "/icons/icon-play-light_16x16.png"
#define ICON_STOP_LIGHT_16px SAMPLEHIVE_DATADIR "/icons/icon-stop-light_16x16.png"
#define ICON_AB_LIGHT_16px SAMPLEHIVE_DATADIR "/icons/icon-ab-light_16x16.png"
#define ICON_LOOP_LIGHT_16px SAMPLEHIVE_DATADIR "/icons/icon-loop-light_16x16.png"
#define ICON_MUTE_LIGHT_16px SAMPLEHIVE_DATADIR "/icons/icon-mute-light_16x16.png"
#define APP_CONFIG_DIR wxGetHomeDir() + "/.config/SampleHive"
#define APP_DATA_DIR wxGetHomeDir() + "/.local/share/SampleHive"
#define CONFIG_FILEPATH APP_CONFIG_DIR + "/config.yaml"
@ -200,10 +199,10 @@ MainFrame::MainFrame()
m_Notebook = new wxNotebook(m_BottomLeftPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP);
// Initializing wxGenericDirCtrl as one of the wxNotebook page.
m_DirCtrl = new wxDirCtrl(m_Notebook, BC_DirCtrl, wxDirDialogDefaultFolderStr, wxDefaultPosition,
wxDefaultSize, wxDIRCTRL_SHOW_FILTERS,
_("All files|*|Ogg files (*.ogg)|*.ogg|Wav files (*.wav)|*.wav|"
"Flac files (*.flac)|*.flac"), 0);
m_DirCtrl = new wxGenericDirCtrl(m_Notebook, BC_DirCtrl, wxDirDialogDefaultFolderStr, wxDefaultPosition,
wxDefaultSize, wxDIRCTRL_SHOW_FILTERS,
_("All files|*|Ogg files (*.ogg)|*.ogg|Wav files (*.wav)|*.wav|"
"Flac files (*.flac)|*.flac"), 0);
wxString path = wxGetHomeDir();
m_DirCtrl->SetPath(path);
@ -2641,8 +2640,8 @@ void MainFrame::LoadConfigFile()
this->SetMinSize(wxSize(width, height));
this->CenterOnScreen(wxBOTH);
this->SetIcon(wxIcon(ICON_HIVE_256px, wxICON_DEFAULT_TYPE, -1, -1));
this->SetTitle("SampleHive");
this->SetStatusText("SampleHive v0.9.0_alpha.1", 3);
this->SetTitle(NAME);
this->SetStatusText(wxString::Format("%s %s", NAME, VERSION), 3);
this->SetStatusText(_("Stopped"), 1);
}
@ -2884,31 +2883,31 @@ void MainFrame::OnSelectAbout(wxCommandEvent& event)
{
wxAboutDialogInfo aboutInfo;
aboutInfo.SetName("SampleHive");
aboutInfo.SetName(NAME);
aboutInfo.SetIcon(wxIcon(ICON_HIVE_64px));
aboutInfo.AddArtist("Apoorv");
aboutInfo.SetVersion("v0.9.0_alpha.1", _("Version 0.9.0_alpha.1"));
aboutInfo.SetVersion(VERSION, _("Version 0.9.0_alpha.1"));
aboutInfo.SetDescription(_("A simple, modern audio sample browser/manager for GNU/Linux."));
aboutInfo.SetCopyright("(C) 2020-2021");
aboutInfo.SetWebSite("http://samplehive.gitlab.io");
aboutInfo.AddDeveloper("Apoorv");
aboutInfo.SetLicence(wxString::FromAscii(
"SampleHive v0.9.0_alpha.1\n"
aboutInfo.SetLicence(wxString::Format(wxString::FromAscii(
"%s %s\n"
"Copyright (C) 2021 Apoorv Singh\n"
"\n"
"SampleHive is free software: you can redistribute it and/or modify\n"
"%s is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation, either version 3 of the License, or\n"
"(at your option) any later version.\n"
"\n"
"SampleHive is distributed in the hope that it will be useful,\n"
"%s is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with this program. If not, see <https://www.gnu.org/licenses/>.\n"
));
), NAME, VERSION, NAME, NAME));
wxAboutBox(aboutInfo);
}

View File

@ -49,7 +49,6 @@
#include <wx/statbmp.h>
#include <wx/statusbr.h>
#include <wx/string.h>
#include <wx/stringimpl.h>
#include <wx/tglbtn.h>
#include <wx/timer.h>
#include <wx/toplevel.h>
@ -146,7 +145,7 @@ class MainFrame : public wxFrame
wxBoxSizer* m_TrashMainSizer;
wxBoxSizer* m_TrashItemSizer;
wxBoxSizer* m_TrashButtonSizer;
wxDirCtrl* m_DirCtrl;
wxGenericDirCtrl* m_DirCtrl;
wxDataViewTreeCtrl* m_Hives;
wxDataViewItem favorites_hive;
wxTreeItemId trash_root;

View File

@ -18,6 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "Serialize.hpp"
#include <fstream>
#include <sstream>
@ -29,8 +31,6 @@
#include <yaml-cpp/emittermanip.h>
#include <yaml-cpp/node/parse.h>
#include "Serialize.hpp"
Serializer::Serializer(const std::string& filepath)
: m_Filepath(filepath)
{

View File

@ -18,16 +18,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <wx/defs.h>
#include <wx/gdicmn.h>
#include <wx/log.h>
// #include <wx/stdpaths.h>
#include <wx/stringimpl.h>
#include "ControlID_Enums.hpp"
#include "SettingsDialog.hpp"
#include "Serialize.hpp"
#include <wx/defs.h>
#include <wx/gdicmn.h>
#include <wx/log.h>
#include <wx/stringimpl.h>
Settings::Settings(const std::string& configFilepath, const std::string& databaseFilepath)
: m_ConfigFilepath(configFilepath), m_DatabaseFilepath(databaseFilepath)
{

View File

@ -18,6 +18,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ControlID_Enums.hpp"
#include "Database.hpp"
#include "TagEditorDialog.hpp"
#include <wx/defs.h>
#include <wx/gdicmn.h>
#include <wx/log.h>
@ -25,10 +29,6 @@
#include <wx/stringimpl.h>
#include <wx/textdlg.h>
#include "ControlID_Enums.hpp"
#include "Database.hpp"
#include "TagEditorDialog.hpp"
TagEditor::TagEditor(wxWindow* window, const std::string& dbPath, const std::string& filename, wxInfoBar& info_bar)
: wxDialog(window, wxID_ANY, "Edit tags", wxDefaultPosition,
wxSize(640, 360), wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP),

View File

@ -20,6 +20,8 @@
#pragma once
#include "Tags.hpp"
#include <string>
#include <wx/button.h>
@ -34,8 +36,6 @@
#include <wx/toplevel.h>
#include <wx/window.h>
#include "Tags.hpp"
class TagEditor : public wxDialog
{
public:

View File

@ -18,6 +18,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "WaveformViewer.hpp"
#include "Database.hpp"
#include "SettingsDialog.hpp"
#include "Serialize.hpp"
#include "Tags.hpp"
#include "SH_Event.hpp"
#include <vector>
#include <wx/brush.h>
@ -31,13 +38,6 @@
#include <sndfile.hh>
#include "WaveformViewer.hpp"
#include "Database.hpp"
#include "SettingsDialog.hpp"
#include "Serialize.hpp"
#include "Tags.hpp"
#include "SH_Event.hpp"
WaveformViewer::WaveformViewer(wxWindow* parentFrame, wxWindow* window, wxDataViewListCtrl& library,
wxMediaCtrl& mediaCtrl, wxInfoBar& infoBar,
const std::string& configFilepath, const std::string& databaseFilepath)

View File

@ -0,0 +1,3 @@
[wrap-git]
url = https://github.com/libsndfile/libsndfile.git
revision = master

12
subprojects/sqlite3.wrap Normal file
View File

@ -0,0 +1,12 @@
[wrap-file]
directory = sqlite-amalgamation-3340100
source_url = https://www.sqlite.org/2021/sqlite-amalgamation-3340100.zip
source_filename = sqlite-amalgamation-3340100.zip
source_hash = e0b1c0345fe4338b936e17da8e1bd88366cd210e576834546977f040c12a8f68
patch_url = https://wrapdb.mesonbuild.com/v2/sqlite3_3.34.1-1/get_patch
patch_filename = sqlite3-3.34.1-1-wrap.zip
patch_hash = cba9e47bdb4c02f88fadaae8deab357218d32562c6b86ce7ba0c72f107044360
[provide]
sqlite3 = sqlite3_dep

View File

@ -0,0 +1,3 @@
[wrap-git]
url = https://github.com/jbeder/yaml-cpp.git
revision = master