Add check for which toolkit to use based on platform and general cleanup.
This commit is contained in:
parent
490012b5eb
commit
a14705f31f
67
meson.build
67
meson.build
|
|
@ -80,6 +80,15 @@ config_data.set_quoted('SAMPLEHIVE_DATADIR', samplehive_datadir)
|
||||||
# Import CMake
|
# Import CMake
|
||||||
cmake = import('cmake')
|
cmake = import('cmake')
|
||||||
|
|
||||||
|
# Check which platform the build is for and set the appropriate GUI toolkit
|
||||||
|
wx_toolkit = ''
|
||||||
|
|
||||||
|
if host_sys == 'linux'
|
||||||
|
wx_toolkit = 'gtk3'
|
||||||
|
elif host_sys == 'windows'
|
||||||
|
wx_toolkit = 'msw'
|
||||||
|
endif
|
||||||
|
|
||||||
wx_opts = cmake.subproject_options()
|
wx_opts = cmake.subproject_options()
|
||||||
wx_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
|
wx_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
|
||||||
'CMAKE_INSTALL_PREFIX': prefix,
|
'CMAKE_INSTALL_PREFIX': prefix,
|
||||||
|
|
@ -93,7 +102,7 @@ wx_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
|
||||||
'wxBUILD_SAMPLES': 'OFF',
|
'wxBUILD_SAMPLES': 'OFF',
|
||||||
'wxBUILD_DEMOS': 'OFF',
|
'wxBUILD_DEMOS': 'OFF',
|
||||||
'wxBUILD_COMPATIBILITY': '3.0',
|
'wxBUILD_COMPATIBILITY': '3.0',
|
||||||
'wxBUILD_TOOLKIT': 'gtk3',
|
'wxBUILD_TOOLKIT': wx_toolkit,
|
||||||
'wxUSE_UNICODE': 'ON',
|
'wxUSE_UNICODE': 'ON',
|
||||||
'wxUSE_AUI': 'OFF',
|
'wxUSE_AUI': 'OFF',
|
||||||
'wxUSE_XML': 'OFF',
|
'wxUSE_XML': 'OFF',
|
||||||
|
|
@ -175,23 +184,18 @@ include_dirs = include_directories('src')
|
||||||
# Dependencies
|
# Dependencies
|
||||||
wx = dependency('wxwidgets', version: '>=3.1.5', required: false)
|
wx = dependency('wxwidgets', version: '>=3.1.5', required: false)
|
||||||
|
|
||||||
wx_found = false
|
wx_cxx_flags = []
|
||||||
|
wx_libs = []
|
||||||
|
|
||||||
if not wx.found()
|
if not wx.found()
|
||||||
wx_found = false
|
|
||||||
|
|
||||||
wx_subproject = cmake.subproject('wxwidgets', options: wx_opts)
|
wx_subproject = cmake.subproject('wxwidgets', options: wx_opts)
|
||||||
wx_base = wx_subproject.dependency('wxbase')
|
wx_base = wx_subproject.dependency('wxbase')
|
||||||
wx_core = wx_subproject.dependency('wxcore')
|
wx_core = wx_subproject.dependency('wxcore')
|
||||||
wx_media = wx_subproject.dependency('wxmedia')
|
wx_media = wx_subproject.dependency('wxmedia')
|
||||||
wx = [wx_core, wx_base, wx_media]
|
wx = [wx_core, wx_base, wx_media]
|
||||||
else
|
else
|
||||||
wx_found = true
|
wxconfig = find_program(['wx-config', 'wx-config-gtk3'])
|
||||||
|
|
||||||
wxconfig = find_program(['wx-config-gtk3', 'wx-config'])
|
|
||||||
wx_modules = ['media', 'std']
|
wx_modules = ['media', 'std']
|
||||||
wx_cxx_flags = []
|
|
||||||
wx_libs = []
|
|
||||||
|
|
||||||
foreach module : wx_modules
|
foreach module : wx_modules
|
||||||
wx_cxx_flags += run_command(wxconfig, '--cxxflags', module).stdout().strip().split()
|
wx_cxx_flags += run_command(wxconfig, '--cxxflags', module).stdout().strip().split()
|
||||||
|
|
@ -223,50 +227,37 @@ if not yaml.found()
|
||||||
yaml = yaml_subproject.dependency('yaml-cpp')
|
yaml = yaml_subproject.dependency('yaml-cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
snd = dependency('sndfile', version: '>=1.0.28', required: false)
|
snd_subproject = cmake.subproject('libsndfile', options: snd_opts)
|
||||||
|
snd = snd_subproject.dependency('sndfile')
|
||||||
if not snd.found()
|
|
||||||
snd_subproject = cmake.subproject('libsndfile', options: snd_opts)
|
|
||||||
snd = snd_subproject.dependency('sndfile')
|
|
||||||
endif
|
|
||||||
|
|
||||||
spdlog = dependency('spdlog', version: '>=1.8.5', required: false)
|
spdlog = dependency('spdlog', version: '>=1.8.5', required: false)
|
||||||
|
|
||||||
if not spdlog.found()
|
if not spdlog.found()
|
||||||
spdlog_subproject = subproject('spdlog',
|
spdlog_subproject = subproject('spdlog',
|
||||||
default_options: [
|
default_options: [
|
||||||
'default_library=static',
|
'default_library=static',
|
||||||
'compile_library=true',])
|
'compile_library=true',])
|
||||||
|
|
||||||
spdlog = spdlog_subproject.get_variable('spdlog_dep')
|
spdlog = spdlog_subproject.get_variable('spdlog_dep')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Create samplehive-config.h based on configuration
|
# Create SampleHiveConfig.hpp based on configuration
|
||||||
config_h = configure_file(output: 'SampleHiveConfig.hpp',
|
config = configure_file(output: 'SampleHiveConfig.hpp',
|
||||||
configuration: config_data,)
|
configuration: config_data,)
|
||||||
|
|
||||||
install_subdir('assets',
|
install_subdir('assets',
|
||||||
install_dir: samplehive_datadir,
|
install_dir: samplehive_datadir,
|
||||||
exclude_directories: 'screenshots',
|
exclude_directories: 'screenshots',
|
||||||
strip_directory: true)
|
strip_directory: true)
|
||||||
|
|
||||||
if wx_found
|
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],
|
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,
|
install_rpath: prefix / 'lib')
|
||||||
install_rpath: prefix / 'lib')
|
|
||||||
else
|
|
||||||
executable('SampleHive',
|
|
||||||
sources: src,
|
|
||||||
include_directories : include_dirs,
|
|
||||||
dependencies: [wx, taglib, sqlite3, yaml, snd, spdlog],
|
|
||||||
install: true,
|
|
||||||
install_rpath: prefix / 'lib')
|
|
||||||
endif
|
|
||||||
|
|
||||||
summary(
|
summary(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue