meson: Build Dear ImGui more properly as a library

This commit is contained in:
Matt Borgerson 2022-04-22 00:47:19 -07:00 committed by mborgerson
parent ff4d682af6
commit fe57f7a2b2
2 changed files with 20 additions and 19 deletions

View File

@ -262,7 +262,6 @@ esac
# find absolute path (and resolve symlinks) to build out of tree
configure="${project_source_dir}/configure"
build_cflags="${build_cflags} -I${project_source_dir}/ui/imgui"
set -x # Print commands from now on

View File

@ -15,19 +15,32 @@ softmmu_ss.add(files(
'udmabuf.c',
))
xemu_ss = ss.source_set()
xemu_ss.add(files(
imgui_files = files(
'imgui/imgui.cpp',
'imgui/imgui_draw.cpp',
'imgui/imgui_tables.cpp',
'imgui/imgui_demo.cpp',
#'imgui/imgui_demo.cpp',
'imgui/imgui_widgets.cpp',
'imgui/backends/imgui_impl_opengl3.cpp',
'imgui/backends/imgui_impl_sdl.cpp',
'implot/implot.cpp',
'implot/implot_demo.cpp',
'implot/implot_items.cpp',
#'implot/implot_demo.cpp',
'implot/implot_items.cpp'
)
imgui_cppargs = ['-DIMGUI_IMPL_OPENGL_LOADER_CUSTOM="epoxy/gl.h"']
libimgui = static_library('imgui',
sources: imgui_files,
cpp_args: imgui_cppargs,
include_directories: 'imgui',
dependencies: [sdl, opengl])
imgui = declare_dependency(link_with: libimgui,
compile_args: imgui_cppargs,
include_directories: 'imgui')
xemu_ss = ss.source_set()
xemu_ss.add(files(
'xemu.c',
'xemu-custom-widgets.c',
'xemu-data.c',
@ -39,26 +52,15 @@ xemu_ss.add(files(
'xemu-hud.cc',
'xemu-reporting.cc',
))
xemu_ss.add(when: 'CONFIG_WIN32', if_true: files('xemu-update.cc'))
imgui_flags = ['-DIMGUI_IMPL_OPENGL_LOADER_CUSTOM="epoxy/gl.h"']
if 'CONFIG_WIN32' in config_host
imgui_flags += ['-DWIN32', '-DMINGW32']
endif
if 'CONFIG_LINUX' in config_host
imgui_flags += ['-DLINUX']
endif
if 'CONFIG_DARWIN' in config_host
imgui_flags += ['-DAPPLE']
xemu_cocoa = dependency('appleframeworks', modules: 'Cocoa')
xemu_ss.add(xemu_cocoa) # FIXME: Use existing cocoa name
endif
imgui = declare_dependency(compile_args: imgui_flags, include_directories: 'imgui')
xemu_ss.add(sdl, opengl, openssl, imgui)
xemu_ss.add(imgui, sdl, opengl, openssl)
xemu_ss.add(when: 'CONFIG_LINUX', if_true: [xemu_gtk, files('xemu-os-utils-linux.c', 'noc_file_dialog_gtk.c')])
xemu_ss.add(when: 'CONFIG_WIN32', if_true: files('xemu-os-utils-windows.c', 'noc_file_dialog_win32.c'))
xemu_ss.add(when: 'CONFIG_DARWIN', if_true: files('xemu-os-utils-macos.m', 'noc_file_dialog_macos.m'))