Files
cell/meson.build
2025-01-28 11:16:00 -06:00

166 lines
4.9 KiB
Meson

project('prosperon', ['c', 'cpp'], default_options : [ 'cpp_std=c++11'])
libtype = get_option('default_library')
link = []
src = []
if not get_option('editor')
add_project_arguments('-DNEDITOR', language:'c')
endif
# Grab the nearest tag (e.g., "0.6.1")
git_tag_cmd = run_command('git', 'describe', '--tags', '--abbrev=0', check: false)
prosperon_version = 'unknown'
if git_tag_cmd.returncode() == 0
prosperon_version = git_tag_cmd.stdout().strip()
endif
# Grab short commit hash (e.g., "de1c9a1")
git_commit_cmd = run_command('git', 'rev-parse', '--short', 'HEAD', check: false)
prosperon_commit = 'unknown'
if git_commit_cmd.returncode() == 0
prosperon_commit = git_commit_cmd.stdout().strip()
endif
# Important: pass the definitions without double-escaping quotes
add_project_arguments(
'-DPROSPERON_VERSION="' + prosperon_version + '"',
'-DPROSPERON_COMMIT="' + prosperon_commit + '"',
language : 'c'
)
add_project_arguments('-Wno-incompatible-pointer-types', language: 'c')
add_project_arguments('-Wno-narrowing', language: 'cpp')
add_project_arguments('-Wno-missing-braces', language:'c')
add_project_arguments('-Wl,--disable-new-dtags', language:'cpp')
add_project_arguments('-Wl,--disable-new-dtags', language:'c')
deps = []
if host_machine.system() == 'darwin'
add_project_arguments('-x', 'objective-c', language: 'c')
fworks = ['foundation', 'metal', 'audiotoolbox', 'metalkit', 'avfoundation', 'quartzcore', 'cocoa']
foreach fkit : fworks
deps += dependency('appleframeworks', modules: fkit)
endforeach
endif
cc = meson.get_compiler('c')
deps += dependency('sdl3', required:true)
if host_machine.system() == 'darwin'
deps += dependency('appleframeworks', modules: 'accelerate')
add_project_arguments('-DACCELERATE_NEW_LAPACK=1', language:'c')
add_project_arguments('-DACCELERATE_LAPACK_ILP64=1', language:'c')
endif
if host_machine.system() == 'linux'
deps += cc.find_library('asound', required:true)
deps += [dependency('x11'), dependency('xi'), dependency('xcursor'), dependency('egl'), dependency('gl')]
link += '-fuse-ld=mold' # use mold, which is very fast, for debug builds
endif
if host_machine.system() == 'windows'
deps += cc.find_library('d3d11')
# these are for tracy
deps += cc.find_library('ws2_32', required:true)
deps += cc.find_library('dbghelp')
#end
link += '-static' # Required to pack in mingw dlls on cross compilation
endif
if host_machine.system() == 'emscripten'
link += '-sUSE_WEBGPU'
endif
tracy_opts = ['fibers=true', 'on_demand=true']
quickjs_opts = []
src += 'qjs_tracy.c'
add_project_arguments('-DTRACY_ENABLE', language:['c','cpp'])
deps += dependency('tracy', static:true, default_options:tracy_opts)
quickjs_opts += 'default_library=static'
deps += dependency('quickjs', static:true, default_options:quickjs_opts)
storefront = get_option('storefront')
if storefront == 'steam'
deps += dependency('qjs-steam',static:false)
endif
deps += dependency('qjs-layout',static:true)
deps += dependency('qjs-nota',static:true)
deps += dependency('qjs-miniz')
deps += dependency('qjs-soloud',static:true)
deps += dependency('physfs', static:true)
#deps += dependency('opencv4')
#deps += cc.find_library('opencv')
deps += dependency('threads')
if get_option('chipmunk')
deps += dependency('qjs-chipmunk', static:false)
endif
if get_option('enet')
deps += dependency('qjs-enet', static:false)
endif
sources = []
src += ['anim.c', 'config.c', 'datastream.c','font.c','gameobject.c','HandmadeMath.c','jsffi.c','model.c','render.c','script.c','simplex.c','spline.c', 'timer.c', 'transform.c','yugine.c', 'wildmatch.c', 'sprite.c', 'quadtree.c', 'aabb.c', 'rtree.c']
imsrc = ['GraphEditor.cpp','ImCurveEdit.cpp','ImGradient.cpp','imgui_draw.cpp','imgui_tables.cpp','imgui_widgets.cpp','imgui.cpp','ImGuizmo.cpp','imnodes.cpp','implot_items.cpp','implot.cpp', 'imgui_impl_sdlrenderer3.cpp', 'imgui_impl_sdl3.cpp', 'imgui_impl_sdlgpu3.cpp']
srceng = 'source'
tp = srceng / 'thirdparty'
includes = [srceng,tp / 'cgltf',tp / 'imgui',tp / 'par',tp / 'stb',tp,tp / 'pl_mpeg/include']
foreach file : src
full_path = join_paths('source', file)
sources += files(full_path)
endforeach
if get_option('editor')
sources += 'source/qjs_imgui.cpp'
foreach imgui : imsrc
sources += tp / 'imgui' / imgui
endforeach
sub_dmon = subproject('qjs-dmon')
dmon_dep = sub_dmon.get_variable('qjs_dmon_dep')
endif
includers = []
foreach inc : includes
includers += include_directories(inc)
endforeach
zip_folders = ['scripts', 'fonts', 'icons', 'shaders']
zip_paths = []
foreach folder: zip_folders
zip_paths += meson.project_source_root() / folder
endforeach
core = custom_target('core.zip',
output:'core.zip',
command: ['zip', '-r', '-j', '@OUTPUT@'] + zip_paths,
)
prosperon = executable('prosperon', sources,
dependencies: deps,
include_directories: includers,
link_args: link,
build_rpath: '$ORIGIN',
install:true,
install_dir:'bin'
)
prosperon_dep = declare_dependency(
link_with:prosperon
)
test('sanity', prosperon)