2023-06-04 03:27:14 -07:00
|
|
|
project('neko-player', ['c', 'cpp'],
|
2023-04-24 13:45:06 -07:00
|
|
|
version : '0.1',
|
|
|
|
default_options : ['warning_level=3',
|
|
|
|
'cpp_std=c++20'])
|
2023-07-10 12:45:24 -07:00
|
|
|
cmake = import('cmake')
|
2023-07-20 14:45:35 -07:00
|
|
|
#if get_option('debug')
|
|
|
|
# add_global_arguments('-DDEBUG', language: 'cpp')
|
|
|
|
#endif
|
2023-07-17 16:49:31 -07:00
|
|
|
if get_option('gles') or target_machine.cpu_family() == 'aarch64' or target_machine.cpu_family() == 'arm'
|
2023-07-16 19:59:23 -07:00
|
|
|
add_global_arguments('-DIMGUI_IMPL_OPENGL_ES2', language: 'cpp')
|
|
|
|
endif
|
2023-07-20 14:45:35 -07:00
|
|
|
cfg_data = configuration_data()
|
|
|
|
cfg_data.set('DEBUG', get_option('debug'))
|
2023-07-24 23:13:47 -07:00
|
|
|
cfg_data.set('LOCALE_DIR', get_option('localedir'))
|
2023-07-17 12:21:38 -07:00
|
|
|
# SDL Mixer X
|
2023-07-10 12:45:24 -07:00
|
|
|
smx_opts = cmake.subproject_options()
|
2023-07-16 19:59:23 -07:00
|
|
|
smx_opts.add_cmake_defines({'SDL_MIXER_X_STATIC': true, 'SDL_MIXER_X_SHARED': false, 'USE_MIDI_NATIVE_ALT': false, 'USE_MIDI_NATIVE': false})
|
2023-07-10 12:45:24 -07:00
|
|
|
smx_opts.set_override_option('c_std', 'c99')
|
|
|
|
smx_subproj = cmake.subproject('SDL-Mixer-X', options: smx_opts)
|
2023-07-17 12:21:38 -07:00
|
|
|
|
|
|
|
opts = []
|
|
|
|
|
2023-04-24 13:45:06 -07:00
|
|
|
deps = [
|
|
|
|
dependency('sdl2'),
|
2023-07-16 14:37:10 -07:00
|
|
|
dependency('SDL2_image'),
|
2023-04-24 13:45:06 -07:00
|
|
|
dependency('gl'),
|
2023-07-16 16:04:07 -07:00
|
|
|
subproject('jsoncpp').get_variable('jsoncpp_dep'),
|
2023-07-15 14:52:49 -07:00
|
|
|
dependency('soundtouch'),
|
2023-07-24 23:13:47 -07:00
|
|
|
dependency('intl'),
|
2023-07-17 12:21:38 -07:00
|
|
|
smx_subproj.dependency('SDL2_mixer_ext_Static')
|
2023-07-20 14:45:35 -07:00
|
|
|
|
2023-04-24 13:45:06 -07:00
|
|
|
]
|
2023-07-20 14:45:35 -07:00
|
|
|
git = find_program('git', required: false)
|
|
|
|
tag = 'unknown'
|
|
|
|
if git.found()
|
|
|
|
r = run_command(git, 'describe', '--tags', check: false)
|
|
|
|
if r.returncode() == 0
|
|
|
|
tag = r.stdout().strip()
|
|
|
|
else
|
|
|
|
warning('Git failed to detect the version of the software. The reported version will be "unknown".')
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
warning('Git not found. The reported version will be "unknown".')
|
|
|
|
endif
|
|
|
|
cfg_data.set('TAG', tag)
|
|
|
|
configure_file(input: 'config.h.in', output: 'config.h', configuration: cfg_data)
|
|
|
|
|
2023-04-24 13:45:06 -07:00
|
|
|
|
2023-07-17 16:49:31 -07:00
|
|
|
if get_option('portals') and target_machine.system() == 'linux'
|
2023-07-17 12:21:38 -07:00
|
|
|
# Dbus CXX
|
|
|
|
deps += dependency('libportal')
|
|
|
|
opts += '-DPORTALS'
|
|
|
|
endif
|
|
|
|
|
2023-04-24 13:45:06 -07:00
|
|
|
srcs = [
|
|
|
|
'main.cpp',
|
|
|
|
'playback.cpp',
|
2023-07-09 18:56:12 -07:00
|
|
|
'theme.cpp',
|
2023-07-17 12:21:38 -07:00
|
|
|
'file_browser.cpp',
|
2023-07-24 23:13:47 -07:00
|
|
|
'base85.cpp',
|
2023-04-24 13:45:06 -07:00
|
|
|
'imgui/imgui.cpp',
|
|
|
|
'imgui/imgui_widgets.cpp',
|
|
|
|
'imgui/imgui_tables.cpp',
|
|
|
|
'imgui/imgui_draw.cpp',
|
|
|
|
'imgui/imgui_demo.cpp',
|
|
|
|
'imgui/backends/imgui_impl_sdl2.cpp',
|
|
|
|
'imgui/backends/imgui_impl_opengl3.cpp',
|
|
|
|
]
|
|
|
|
|
|
|
|
include_dirs = [
|
|
|
|
'imgui',
|
|
|
|
'imgui/backends',
|
|
|
|
'imgui-filebrowser',
|
|
|
|
'IconFontCppHeaders',
|
|
|
|
'assets',
|
|
|
|
]
|
|
|
|
|
2023-04-24 15:28:39 -07:00
|
|
|
res = run_command('./assets/update-assets.sh', check: true)
|
2023-07-16 17:34:11 -07:00
|
|
|
# Validate MetaInfo file
|
|
|
|
metainfo_file = '/path/to/com.experimentalcraft.NekoPlayer.metainfo.xml'
|
|
|
|
ascli_exe = find_program('appstreamcli', required: false)
|
|
|
|
if ascli_exe.found()
|
|
|
|
test('validate metainfo file',
|
|
|
|
ascli_exe,
|
|
|
|
args: ['validate',
|
|
|
|
'--no-net',
|
|
|
|
'--pedantic',
|
|
|
|
metainfo_file]
|
|
|
|
)
|
|
|
|
endif
|
2023-07-16 16:04:07 -07:00
|
|
|
install_data('assets/icon.svg', rename: 'neko-player.svg', install_dir: 'share/icons/hicolor/scalable/apps/')
|
|
|
|
install_data('assets/neko-player.desktop', install_dir: 'share/applications')
|
2023-07-16 17:34:11 -07:00
|
|
|
install_data('assets/com.experimentalcraft.NekoPlayer.metainfo.xml', install_dir: 'share/metainfo')
|
2023-07-16 16:04:07 -07:00
|
|
|
exe = executable('neko-player', srcs,
|
2023-04-24 13:45:06 -07:00
|
|
|
dependencies: deps,
|
|
|
|
include_directories: include_dirs,
|
2023-07-17 12:21:38 -07:00
|
|
|
install : true,
|
2023-07-18 10:51:18 -07:00
|
|
|
win_subsystem: 'windows',
|
2023-07-17 12:21:38 -07:00
|
|
|
cpp_args: opts)
|