Support compiling demos in wasm build

This commit is contained in:
mmcomando 2021-03-01 21:29:40 +01:00
parent d1c48e4c5f
commit 3eb4a40c39
11 changed files with 139 additions and 43 deletions

View file

@ -1,6 +1,7 @@
[wrap-git]
url = https://github.com/BindBC/bindbc-loader.git
revision = 9a51af991acce3c67e51695c07bf3fa6419ef938
url = https://github.com/mmcomando/bindbc-loader.git
push-url = https://github.com/BindBC/bindbc-loader.git
revision = wasm
patch_directory = bindbc-loader
[provide]

View file

@ -1,6 +1,7 @@
[wrap-git]
url = https://github.com/BindBC/bindbc-sdl.git
revision = 5c936064b7226630f5080f4b12b77ee39c8ac64b
url = https://github.com/mmcomando/bindbc-sdl.git
push-url = https://github.com/BindBC/bindbc-sdl.git
revision = wasm
patch_directory = bindbc-sdl
[provide]

View file

@ -3,12 +3,17 @@ project('bindbc-loader', 'd', version : '0.3.2', default_options: ['default_libr
# Files
src = files(
'source/bindbc/loader/package.d',
'source/bindbc/loader/sharedlib.d',
# 'source/bindbc/loader/sharedlib.d', # Not implemented for wasm
'source/bindbc/loader/system.d',
)
inc = include_directories('source')
if host_machine.cpu_family() != 'wasm32'
src = files(
'source/bindbc/loader/sharedlib.d',
)
endif
# Dependencies
lib = library('bindbc-loader', src,
include_directories : [inc],

View file

@ -1,24 +1,33 @@
project('cimgui', 'cpp', version : '1.73.0', default_options: ['default_library=shared', 'warning_level=1'])
project('cimgui', 'cpp', version : '1.73.0', default_options: ['default_library=static', 'warning_level=1'])
# Files
src = [
src = files(
'cimgui.cpp',
'imgui/imgui.cpp',
'imgui/imgui_draw.cpp',
'imgui/imgui_demo.cpp',
'imgui/imgui_widgets.cpp',
]
)
inc = [ '.' ]
inc +='imgui/examples/'
pub_inc = [ 'imgui' ]
# Dependencies
# bindbc_loader_dep = dependency('bindbc-loader')
if host_machine.cpu_family() == 'wasm32'
# For wasm we use C++ events/image handling implementation
src += files(
'imgui/examples/imgui_impl_opengl3.cpp',
'imgui/examples/imgui_impl_sdl.cpp',
)
endif
lib = shared_library('cimgui', src,
# dependencies : bindbc_loader_dep,
add_project_arguments('-DIMGUI_IMPL_API=extern "C" ', language : 'cpp')
# Dependencies
lib = library('cimgui', src,
include_directories : [inc, pub_inc],
# pic : true,
pic : true,
)
cimgui_dep = declare_dependency(