feat/greedy-meshing: added meson + build options

This commit is contained in:
JuiceyDev 2026-04-06 20:41:19 +02:00
parent 521bd57b3a
commit f706ae5a22
2 changed files with 45 additions and 34 deletions

View file

@ -1,16 +1,16 @@
project( project(
'4jcraft', '4jcraft',
['cpp', 'c'], ['cpp', 'c'],
version: '0.1.0', version: '0.1.0',
meson_version: '>= 1.3', meson_version: '>= 1.3',
default_options: [ default_options: [
'cpp_std=c++23', 'cpp_std=c++23',
'warning_level=0', 'warning_level=0',
'buildtype=debugoptimized', # for now 'buildtype=debugoptimized', # for now
'unity=on', # merge source files per target 'unity=on', # merge source files per target
'unity_size=8', # TODO: mess around with this 'unity_size=8', # TODO: mess around with this
'b_pch=true', # precompiled headers 'b_pch=true', # precompiled headers
], ],
) )
pymod = import('python') pymod = import('python')
@ -19,30 +19,30 @@ python = pymod.find_installation('python3', required: true)
cc = meson.get_compiler('cpp') cc = meson.get_compiler('cpp')
global_cpp_defs = [ global_cpp_defs = [
'-DSPLIT_SAVES', '-DSPLIT_SAVES',
'-D_LARGE_WORLDS', '-D_LARGE_WORLDS',
'-D_EXTENDED_ACHIEVEMENTS', '-D_EXTENDED_ACHIEVEMENTS',
'-D_DEBUG_MENUS_ENABLED', '-D_DEBUG_MENUS_ENABLED',
'-D_DEBUG', '-D_DEBUG',
'-D_FORTIFY_SOURCE=2', '-D_FORTIFY_SOURCE=2',
'-DDEBUG', '-DDEBUG',
] ]
if host_machine.system() == 'linux' if host_machine.system() == 'linux'
global_cpp_defs += ['-Dlinux', '-D__linux', '-D__linux__'] global_cpp_defs += ['-Dlinux', '-D__linux', '-D__linux__']
endif endif
if get_option('renderer') == 'gles' if get_option('renderer') == 'gles'
global_cpp_defs += ['-DGLES'] global_cpp_defs += ['-DGLES']
gl_dep = dependency('glesv2', required: true) gl_dep = dependency('glesv2', required: true)
glu_dep = dependency('', required: false) glu_dep = dependency('', required: false)
else else
gl_dep = dependency('gl', required: true) gl_dep = dependency('gl', required: true)
glu_dep = dependency('glu', required: true) glu_dep = dependency('glu', required: true)
endif endif
if get_option('enable_vsync') if get_option('enable_vsync')
global_cpp_defs += ['-DENABLE_VSYNC'] global_cpp_defs += ['-DENABLE_VSYNC']
endif endif
if get_option('classic_panorama') if get_option('classic_panorama')
@ -50,22 +50,26 @@ if get_option('classic_panorama')
endif endif
if get_option('enable_frame_profiler') if get_option('enable_frame_profiler')
global_cpp_defs += ['-DENABLE_FRAME_PROFILER'] global_cpp_defs += ['-DENABLE_FRAME_PROFILER']
endif
if get_option('enable_greedy_meshing')
global_cpp_defs += ['-DENABLE_GREEDY_MESHING']
endif endif
if get_option('ui_backend') == 'shiggy' if get_option('ui_backend') == 'shiggy'
global_cpp_defs += ['-D_ENABLEIGGY'] global_cpp_defs += ['-D_ENABLEIGGY']
endif endif
if get_option('ui_backend') == 'java' if get_option('ui_backend') == 'java'
global_cpp_defs += '-DENABLE_JAVA_GUIS' global_cpp_defs += '-DENABLE_JAVA_GUIS'
endif endif
add_project_arguments(global_cpp_defs, language: ['cpp', 'c']) add_project_arguments(global_cpp_defs, language: ['cpp', 'c'])
global_cpp_args = [ global_cpp_args = [
'-Wshift-count-overflow', '-Wshift-count-overflow',
'-pipe', '-pipe',
] ]
add_project_arguments(global_cpp_args, language: 'cpp') add_project_arguments(global_cpp_args, language: 'cpp')
@ -86,4 +90,4 @@ subdir('targets/platform')
subdir('targets/resources') subdir('targets/resources')
subdir('targets/minecraft') subdir('targets/minecraft')
subdir('targets/app') subdir('targets/app')

View file

@ -7,8 +7,8 @@ option(
) )
option('classic_panorama', option('classic_panorama',
type : 'boolean', type : 'boolean',
value : false, value : false,
description : 'Enable classic java edition panorama (ui_backend=java ONLY).') description : 'Enable classic java edition panorama (ui_backend=java ONLY).')
option( option(
@ -40,3 +40,10 @@ option(
value: 'frustum', value: 'frustum',
description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.', description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.',
) )
option(
'enable_greedy_meshing',
type: 'boolean',
value: true,
description: 'Enable greedy meshing for chunks and liquid tops.',
)