Add build type define and minor meson build file update.

This commit is contained in:
apoorv569 2022-09-16 01:13:54 +05:30
parent 6d0f66d144
commit 491852a756
4 changed files with 25 additions and 5 deletions

View File

@ -10,7 +10,7 @@
(projectile-project-name . "SampleHive") (projectile-project-name . "SampleHive")
(projectile-project-run-cmd . "~/repos/sample-hive/build/SampleHive") (projectile-project-run-cmd . "~/repos/sample-hive/build/SampleHive")
;; (projectile-project-run-cmd . "/tmp/SampleHive/bin/SampleHive") ;; (projectile-project-run-cmd . "/tmp/SampleHive/bin/SampleHive")
(compile-command . "cd .. && ninja -C build install") (compile-command . "ninja -C ~/repos/sample-hive/build")
(fill-column . 110) (fill-column . 110)
;; Setup dap debugging template for the project ;; Setup dap debugging template for the project
(setq dap-debug-template-configurations (setq dap-debug-template-configurations

View File

@ -77,6 +77,12 @@ config_data.set_quoted('LIBDIR', libdir)
config_data.set_quoted('DATADIR', datadir) config_data.set_quoted('DATADIR', datadir)
config_data.set_quoted('SAMPLEHIVE_DATADIR', samplehive_datadir) config_data.set_quoted('SAMPLEHIVE_DATADIR', samplehive_datadir)
if build_type == 'debug' or build_type == 'debugoptimized'
config_data.set('SH_BUILD_DEBUG', 1)
elif build_type == 'release'
config_data.set('SH_BUILD_RELEASE', 1)
endif
# Import CMake # Import CMake
cmake = import('cmake') cmake = import('cmake')
@ -196,6 +202,13 @@ src = [
include_dirs = include_directories('src') include_dirs = include_directories('src')
# Static link C/C++ libs if platform is windows
link_args = []
if host_sys == 'windows'
link_args += ['-static-libgcc', '-static-libstdc++']
endif
# Dependencies # Dependencies
wx = dependency('wxwidgets', version: '>=3.1.5', required: false) wx = dependency('wxwidgets', version: '>=3.1.5', required: false)
@ -276,7 +289,7 @@ install_subdir('assets',
executable('SampleHive', executable('SampleHive',
sources: src, sources: src,
cpp_args: [wx_cxx_flags], cpp_args: [wx_cxx_flags],
link_args: [wx_libs], link_args: [wx_libs, link_args],
include_directories : include_dirs, include_directories : include_dirs,
dependencies: [wx, taglib, sqlite3, yaml, snd, spdlog], dependencies: [wx, taglib, sqlite3, yaml, snd, spdlog],
install: true, install: true,

View File

@ -28,6 +28,7 @@
#include "Utility/Signal.hpp" #include "Utility/Signal.hpp"
#include "Utility/Tags.hpp" #include "Utility/Tags.hpp"
#include <cstddef>
#include <exception> #include <exception>
#include <vector> #include <vector>
@ -220,7 +221,7 @@ void cWaveformViewer::UpdateWaveformBitmap()
} }
// Actually normalize // Actually normalize
for (int i = 0; i < waveform.size(); i++) for (size_t i = 0; i < waveform.size(); i++)
waveform[i] /= normalize; waveform[i] /= normalize;
// Draw code // Draw code
@ -235,7 +236,7 @@ void cWaveformViewer::UpdateWaveformBitmap()
SH_LOG_DEBUG("Drawing bitmap.."); SH_LOG_DEBUG("Drawing bitmap..");
for (int i = 0; i < waveform.size() - 1; i++) for (size_t i = 0; i < waveform.size() - 1; i++)
{ {
float half_display_height = static_cast<float>(display_height) / 2.0f; float half_display_height = static_cast<float>(display_height) / 2.0f;

View File

@ -22,7 +22,13 @@
#include <memory> #include <memory>
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE #include <SampleHiveConfig.hpp>
#ifndef SH_BUILD_DEBUG
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
#else
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_OFF
#endif
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>