project('looper', ['c', 'cpp'], version : '0.1', default_options : ['warning_level=3', 'cpp_std=c++20']) cmake = import('cmake') #if get_option('debug') # add_global_arguments('-DDEBUG', language: 'cpp') #endif add_global_arguments('-DIMGUI_USER_CONFIG="imgui_config.h"', language: 'cpp') if get_option('gles') or target_machine.cpu_family() == 'aarch64' or target_machine.cpu_family() == 'arm' add_global_arguments('-DIMGUI_IMPL_OPENGL_ES2', language: 'cpp') endif cfg_data = configuration_data() cfg_data.set('DEBUG', get_option('debug')) cfg_data.set('LOCALE_DIR', get_option('prefix') / get_option('localedir')) # SDL Mixer X smx_opts = cmake.subproject_options() smx_opts.add_cmake_defines({'SDL_MIXER_X_STATIC': true, 'SDL_MIXER_X_SHARED': false, 'USE_MIDI_NATIVE_ALT': false, 'USE_MIDI_NATIVE': false}) smx_opts.set_override_option('c_std', 'c99') smx_subproj = cmake.subproject('SDL-Mixer-X', options: smx_opts) opts = [] deps = [ dependency('sdl2'), dependency('SDL2_image'), dependency('gl'), subproject('jsoncpp').get_variable('jsoncpp_dep'), dependency('soundtouch'), dependency('intl'), dependency('threads'), smx_subproj.dependency('SDL2_mixer_ext_Static') ] if get_option('vgmstream') vgm_opts = cmake.subproject_options() vgm_opts.add_cmake_defines({'BUILD_FB2K': false, 'BUILD_CLI': false, 'BUILD_WINAMP': false, 'BUILD_XMPLAY': false, 'BUILD_AUDACIOUS': false, 'BUILD_V123': false, 'BUILD_STATIC': false}) #vgm_opts.set_override_option('c_std', 'c99') vgm_subproj = cmake.subproject('vgmstream', options: vgm_opts) deps += vgm_subproj.dependency('libvgmstream') endif 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) if get_option('portals') and target_machine.system() == 'linux' # Dbus CXX deps += dependency('libportal') opts += '-DPORTALS' endif srcs = [ 'main.cpp', 'RendererBackend.cpp', 'playback.cpp', 'theme.cpp', 'file_browser.cpp', 'base85.cpp', 'imgui/imgui.cpp', 'imgui/imgui_widgets.cpp', 'imgui/imgui_tables.cpp', 'imgui/imgui_draw.cpp', 'imgui/imgui_demo.cpp', 'imgui/misc/cpp/imgui_stdlib.cpp', 'imgui/backends/imgui_impl_sdl2.cpp', 'imgui/backends/imgui_impl_opengl3.cpp', ] include_dirs = [ 'imgui', 'imgui/misc/cpp', 'imgui/backends', 'imgui-filebrowser', 'IconFontCppHeaders', 'assets', ] res = run_command('./assets/update-assets.sh', check: true) # Validate MetaInfo file metainfo_file = './assets/com.experimentalcraft.Looper.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 install_data('assets/icon.svg', rename: 'looper.svg', install_dir: 'share/icons/hicolor/scalable/apps/') install_data('assets/looper.desktop', install_dir: 'share/applications') install_data('assets/com.experimentalcraft.Looper.metainfo.xml', install_dir: 'share/metainfo') install_subdir('assets/translations/', exclude_files: 'looper.pot', strip_directory: true, install_dir: get_option('localedir')) exe = executable('looper', srcs, dependencies: deps, include_directories: include_dirs, install : true, win_subsystem: 'windows', cpp_args: opts)