357 lines
9.1 KiB
Meson
357 lines
9.1 KiB
Meson
project('prosperon', ['c', 'cpp'],
|
|
version: '0.9.3',
|
|
meson_version: '>=1.4',
|
|
default_options : [ 'cpp_std=c++11'])
|
|
|
|
libtype = get_option('default_library')
|
|
|
|
link = []
|
|
src = []
|
|
|
|
add_project_arguments('-pedantic', language: ['c'])
|
|
|
|
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
|
|
|
|
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('-Wno-strict-prototypes', language:'c')
|
|
add_project_arguments('-Wno-unused-command-line-argument', language: 'c')
|
|
add_project_arguments('-Wno-unused-command-line-argument', language: 'cpp')
|
|
|
|
deps = []
|
|
|
|
if host_machine.system() == 'darwin'
|
|
add_project_arguments('-x', 'objective-c', language: 'c')
|
|
fworks = [
|
|
'foundation',
|
|
'metal',
|
|
'audiotoolbox',
|
|
'metalkit',
|
|
'avfoundation',
|
|
'quartzcore',
|
|
'cocoa',
|
|
'coreaudio',
|
|
'coremedia',
|
|
'gamecontroller',
|
|
'forcefeedback',
|
|
'iokit',
|
|
'corefoundation',
|
|
'corehaptics',
|
|
'carbon',
|
|
'uniformtypeidentifiers'
|
|
]
|
|
foreach fkit : fworks
|
|
deps += dependency('appleframeworks', modules: fkit)
|
|
endforeach
|
|
endif
|
|
|
|
cmake = import('cmake')
|
|
|
|
sdl3_opts = cmake.subproject_options()
|
|
sdl3_opts.add_cmake_defines({
|
|
'SDL_STATIC': 'ON',
|
|
'SDL_SHARED': 'OFF',
|
|
'SDL_TEST': 'OFF',
|
|
'CMAKE_BUILD_TYPE': 'Release',
|
|
'SDL_THREADS': 'ON',
|
|
'SDL_PIPEWIRE': 'ON',
|
|
'SDL_PULSEAUDIO': 'ON',
|
|
})
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
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')]
|
|
endif
|
|
|
|
if host_machine.system() == 'windows'
|
|
deps += cc.find_library('d3d11')
|
|
deps += cc.find_library('ws2_32', required:true)
|
|
deps += cc.find_library('dbghelp')
|
|
deps += cc.find_library('winmm')
|
|
deps += cc.find_library('setupapi')
|
|
deps += cc.find_library('imm32')
|
|
deps += cc.find_library('version')
|
|
deps += cc.find_library('cfgmgr32')
|
|
deps += cc.find_library('bcrypt')
|
|
sdl3_opts.add_cmake_defines({'HAVE_ISINF': '1'}) # Hack for MSYS2
|
|
sdl3_opts.add_cmake_defines({'HAVE_ISNAN': '1'})
|
|
link += '-static'
|
|
endif
|
|
|
|
if host_machine.system() == 'emscripten'
|
|
link += '-sUSE_WEBGPU'
|
|
# Use the pre-installed copy
|
|
deps += dependency('sdl3',
|
|
static : true,
|
|
method : 'pkg-config', # or 'cmake' if you prefer
|
|
required : true)
|
|
else
|
|
sdl3_proj = cmake.subproject('sdl3', options : sdl3_opts)
|
|
deps += sdl3_proj.dependency('SDL3-static')
|
|
endif
|
|
|
|
|
|
quickjs_opts = []
|
|
|
|
quickjs_opts += 'default_library=static'
|
|
deps += dependency('quickjs', static:true, default_options:quickjs_opts)
|
|
deps += dependency('qjs-layout', static:true)
|
|
deps += dependency('qjs-miniz', static:true)
|
|
deps += dependency('physfs', static:true)
|
|
deps += dependency('threads')
|
|
deps += dependency('chipmunk', static:true)
|
|
|
|
if host_machine.system() != 'emscripten'
|
|
deps += dependency('enet', static:true)
|
|
src += 'qjs_enet.c'
|
|
|
|
src += 'qjs_tracy.c'
|
|
tracy_opts = ['fibers=true', 'on_demand=true']
|
|
add_project_arguments('-DTRACY_ENABLE', language:['c','cpp'])
|
|
deps += dependency('tracy', static:true, default_options:tracy_opts)
|
|
|
|
src += 'qjs_dmon.c'
|
|
endif
|
|
|
|
deps += dependency('soloud', static:true)
|
|
deps += dependency('libqrencode', static:true)
|
|
|
|
link_args = link
|
|
sources = []
|
|
src += [
|
|
'anim.c', 'config.c', 'datastream.c','font.c','HandmadeMath.c','jsffi.c','model.c',
|
|
'render.c','simplex.c','spline.c', 'transform.c','prosperon.c', 'wildmatch.c',
|
|
'sprite.c', 'rtree.c', 'qjs_nota.c', 'qjs_soloud.c', 'qjs_sdl.c', 'qjs_math.c', 'qjs_geometry.c', 'qjs_transform.c', 'qjs_sprite.c', 'qjs_io.c', 'qjs_os.c',
|
|
'qjs_qr.c', 'qjs_wota.c', 'monocypher.c', 'qjs_blob.c', 'qjs_crypto.c', 'qjs_time.c', 'qjs_http.c', 'qjs_rtree.c', 'qjs_spline.c', 'qjs_js.c', 'qjs_debug.c'
|
|
]
|
|
# quirc src
|
|
src += [
|
|
'thirdparty/quirc/quirc.c', 'thirdparty/quirc/decode.c',
|
|
'thirdparty/quirc/identify.c', 'thirdparty/quirc/version_db.c'
|
|
]
|
|
|
|
curl_opts = [
|
|
'http=enabled',
|
|
'ssl=enabled',
|
|
'openssl=enabled',
|
|
'schannel=disabled',
|
|
'secure-transport=disabled',
|
|
'dict=disabled',
|
|
'file=disabled',
|
|
'ftp=disabled',
|
|
'gopher=disabled',
|
|
'imap=disabled',
|
|
'ldap=disabled',
|
|
'ldaps=disabled',
|
|
'mqtt=disabled',
|
|
'pop3=disabled',
|
|
'rtmp=disabled',
|
|
'rtsp=disabled',
|
|
'smb=disabled',
|
|
'smtp=disabled',
|
|
'telnet=disabled',
|
|
'tftp=disabled',
|
|
'alt-svc=disabled',
|
|
'asynchdns=disabled',
|
|
'aws=disabled',
|
|
'basic-auth=disabled',
|
|
'bearer-auth=disabled',
|
|
'bindlocal=disabled',
|
|
'brotli=disabled',
|
|
'cookies=disabled',
|
|
'digest-auth=disabled',
|
|
'doh=disabled',
|
|
'form-api=disabled',
|
|
'getoptions=disabled',
|
|
'gsasl=disabled',
|
|
'gss-api=disabled',
|
|
'headers-api=disabled',
|
|
'hsts=disabled',
|
|
'http2=disabled',
|
|
'idn=disabled',
|
|
'kerberos-auth=disabled',
|
|
'libcurl-option=disabled',
|
|
'libz=disabled',
|
|
'mime=disabled',
|
|
'negotiate-auth=disabled',
|
|
'netrc=disabled',
|
|
'ntlm=disabled',
|
|
'parsedate=disabled',
|
|
'progress-meter=disabled',
|
|
'proxy=disabled',
|
|
'psl=disabled',
|
|
'sha512_256=disabled',
|
|
'shuffle-dns=disabled',
|
|
'socketpair=disabled',
|
|
'tls-srp=disabled',
|
|
'unixsockets=disabled',
|
|
'verbose-strings=disabled',
|
|
'zstd=disabled',
|
|
'debug=disabled',
|
|
'curldebug=false',
|
|
'libuv=disabled',
|
|
'tests=disabled',
|
|
'unittests=disabled',
|
|
'default_library=static'
|
|
]
|
|
|
|
curl_proj = subproject('curl', default_options: curl_opts)
|
|
deps += dependency('libcurl')
|
|
deps += dependency('zlib', static: true)
|
|
deps += dependency('openssl', static:true)
|
|
|
|
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', tp / 'quirc'
|
|
]
|
|
|
|
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
|
|
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
|
|
|
|
# Produce core.zip
|
|
core = custom_target('core.zip',
|
|
output : 'core.zip',
|
|
command : ['sh', '-c',
|
|
'cd ' + meson.project_source_root() +
|
|
' && echo "Rebuilding core.zip" && rm -f ' + meson.current_build_dir() + '/core.zip && ' +
|
|
'zip -r ' + meson.current_build_dir() + '/core.zip scripts fonts icons shaders'
|
|
],
|
|
build_always_stale: true,
|
|
build_by_default: true
|
|
)
|
|
|
|
prosperon_raw = executable('prosperon_raw', sources,
|
|
dependencies: deps,
|
|
include_directories: includers,
|
|
link_args: link,
|
|
build_rpath: '$ORIGIN',
|
|
install:false
|
|
)
|
|
|
|
strip_enabled = ['release', 'minsize'].contains(get_option('buildtype'))
|
|
|
|
if strip_enabled
|
|
prosperon_raw_stripped = custom_target('prosperon_raw_stripped',
|
|
input: prosperon_raw,
|
|
output: 'prosperon_raw_stripped',
|
|
command: [
|
|
'sh', '-c',
|
|
'strip "$1" && cp "$1" "$2"',
|
|
'stripper',
|
|
'@INPUT@',
|
|
'@OUTPUT@'
|
|
],
|
|
build_by_default: true
|
|
)
|
|
exe_for_concat = prosperon_raw_stripped
|
|
else
|
|
exe_for_concat = prosperon_raw
|
|
endif
|
|
|
|
if host_machine.system() == 'windows'
|
|
exe_ext = '.exe'
|
|
else
|
|
exe_ext = ''
|
|
endif
|
|
|
|
prosperon = custom_target('prosperon',
|
|
output: 'prosperon' + exe_ext,
|
|
input: [exe_for_concat, core],
|
|
command: [
|
|
'sh', '-c',
|
|
'cat "$1" "$2" > "$3" && chmod +x "$3" >/dev/null 2>&1',
|
|
'concat',
|
|
'@INPUT0@',
|
|
'@INPUT1@',
|
|
'@OUTPUT@'
|
|
],
|
|
build_always_stale: true,
|
|
build_by_default: true
|
|
)
|
|
|
|
prosperon_dep = declare_dependency(
|
|
link_with: prosperon
|
|
)
|
|
|
|
copy_tests = custom_target(
|
|
'copy_tests',
|
|
output: 'tests',
|
|
command: [
|
|
'cp', '-rf',
|
|
join_paths(meson.project_source_root(), 'tests'),
|
|
meson.project_build_root()
|
|
],
|
|
build_always_stale: true,
|
|
build_by_default: true
|
|
)
|
|
|
|
tests = [
|
|
'spawn_actor',
|
|
'empty',
|
|
'nota',
|
|
'wota',
|
|
'portalspawner',
|
|
'overling',
|
|
'send',
|
|
'delay'
|
|
]
|
|
|
|
foreach file : tests
|
|
test(file, prosperon_raw, args:['tests/' + file + '.js'], depends:copy_tests)
|
|
endforeach
|