mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-27 23:13:38 +00:00
build: break platform_sdl2 up into per-subsystem libraries
This commit is contained in:
parent
7b28bcbcb6
commit
9834a95f0e
|
|
@ -15,6 +15,7 @@ client_dependencies = [
|
|||
input_dep,
|
||||
profile_dep,
|
||||
storage_dep,
|
||||
fs_dep,
|
||||
assets_localisation_dep,
|
||||
platform_dep,
|
||||
minecraft_dep,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ lib_minecraft = static_library('minecraft',
|
|||
input_dep,
|
||||
profile_dep,
|
||||
storage_dep,
|
||||
fs_dep,
|
||||
glm_dep,
|
||||
nbt_dep,
|
||||
java_dep,
|
||||
|
|
|
|||
12
targets/platform/fs/meson.build
Normal file
12
targets/platform/fs/meson.build
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
lib_platform_fs_std = static_library(
|
||||
'platform_fs_std',
|
||||
files('std/StdFilesystem.cpp'),
|
||||
include_directories: [platform_inc, include_directories('../..')],
|
||||
dependencies: [_threads],
|
||||
cpp_args: global_cpp_args + global_cpp_defs,
|
||||
)
|
||||
|
||||
fs_dep = declare_dependency(
|
||||
link_with: lib_platform_fs_std,
|
||||
include_directories: [platform_inc],
|
||||
)
|
||||
13
targets/platform/input/meson.build
Normal file
13
targets/platform/input/meson.build
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
lib_platform_input_sdl2 = static_library(
|
||||
'platform_input_sdl2',
|
||||
files('sdl2/SDL2Input.cpp'),
|
||||
include_directories: [platform_inc, include_directories('../..')],
|
||||
dependencies: [_sdl2, _threads],
|
||||
cpp_args: global_cpp_args + global_cpp_defs,
|
||||
)
|
||||
|
||||
input_dep = declare_dependency(
|
||||
link_with: lib_platform_input_sdl2,
|
||||
include_directories: [platform_inc],
|
||||
dependencies: [_sdl2],
|
||||
)
|
||||
|
|
@ -1,6 +1,16 @@
|
|||
platform_inc = include_directories('.')
|
||||
_threads = dependency('threads')
|
||||
_sdl2 = dependency('sdl2')
|
||||
|
||||
if get_option('renderer') == 'gles'
|
||||
_gl = dependency('glesv2', required: true)
|
||||
_defs = ['-DGLES']
|
||||
else
|
||||
_gl = dependency('gl', required: true)
|
||||
_defs = []
|
||||
endif
|
||||
|
||||
# Core: thread + shutdown plumbing, no backend.
|
||||
lib_platform_core = static_library('platform_core',
|
||||
files('C4JThread.cpp', 'ShutdownManager.cpp'),
|
||||
include_directories: [platform_inc, include_directories('..')],
|
||||
|
|
@ -13,40 +23,11 @@ platform_dep = declare_dependency(
|
|||
include_directories: platform_inc,
|
||||
)
|
||||
|
||||
# SDL2-based platform implementations (formerly 4J.* modules)
|
||||
_sdl2 = dependency('sdl2')
|
||||
_defs = []
|
||||
|
||||
if get_option('renderer') == 'gles'
|
||||
_gl = dependency('glesv2', required: true)
|
||||
_defs += ['-DGLES']
|
||||
else
|
||||
_gl = dependency('gl', required: true)
|
||||
endif
|
||||
|
||||
sdl2_sources = files(
|
||||
'input/sdl2/SDL2Input.cpp',
|
||||
'profile/stub/StubProfile.cpp',
|
||||
'storage/stub/StubStorage.cpp',
|
||||
'renderer/gl/GLRenderer.cpp',
|
||||
'renderer/gl/render_stubs.cpp',
|
||||
'fs/std/StdFilesystem.cpp',
|
||||
)
|
||||
|
||||
lib_platform_sdl2 = static_library('platform_sdl2',
|
||||
sdl2_sources,
|
||||
include_directories: [platform_inc],
|
||||
dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep],
|
||||
cpp_args: _defs + global_cpp_args + global_cpp_defs,
|
||||
)
|
||||
|
||||
# Combined dependency: interfaces + SDL2 implementations
|
||||
# Replaces the old render_dep, input_dep, profile_dep, storage_dep
|
||||
render_dep = declare_dependency(
|
||||
link_with: lib_platform_sdl2,
|
||||
include_directories: [platform_inc],
|
||||
dependencies: [_sdl2, _gl, _threads, glm_dep],
|
||||
)
|
||||
input_dep = render_dep
|
||||
profile_dep = render_dep
|
||||
storage_dep = render_dep
|
||||
# Per-subsystem backends. Each lives in its own subdir and produces its
|
||||
# own library + dep so consumers can ask for the subsystem they need
|
||||
# without dragging the others in.
|
||||
subdir('input')
|
||||
subdir('profile')
|
||||
subdir('storage')
|
||||
subdir('fs')
|
||||
subdir('renderer')
|
||||
|
|
|
|||
12
targets/platform/profile/meson.build
Normal file
12
targets/platform/profile/meson.build
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
lib_platform_profile_stub = static_library(
|
||||
'platform_profile_stub',
|
||||
files('stub/StubProfile.cpp'),
|
||||
include_directories: [platform_inc, include_directories('../..')],
|
||||
dependencies: [_threads],
|
||||
cpp_args: global_cpp_args + global_cpp_defs,
|
||||
)
|
||||
|
||||
profile_dep = declare_dependency(
|
||||
link_with: lib_platform_profile_stub,
|
||||
include_directories: [platform_inc],
|
||||
)
|
||||
13
targets/platform/renderer/meson.build
Normal file
13
targets/platform/renderer/meson.build
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
lib_platform_renderer_gl = static_library(
|
||||
'platform_renderer_gl',
|
||||
files('gl/GLRenderer.cpp', 'gl/render_stubs.cpp'),
|
||||
include_directories: [platform_inc, include_directories('../..')],
|
||||
dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep],
|
||||
cpp_args: _defs + global_cpp_args + global_cpp_defs,
|
||||
)
|
||||
|
||||
render_dep = declare_dependency(
|
||||
link_with: lib_platform_renderer_gl,
|
||||
include_directories: [platform_inc],
|
||||
dependencies: [_sdl2, _gl, _threads, glm_dep],
|
||||
)
|
||||
12
targets/platform/storage/meson.build
Normal file
12
targets/platform/storage/meson.build
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
lib_platform_storage_stub = static_library(
|
||||
'platform_storage_stub',
|
||||
files('stub/StubStorage.cpp'),
|
||||
include_directories: [platform_inc, include_directories('../..')],
|
||||
dependencies: [_threads],
|
||||
cpp_args: global_cpp_args + global_cpp_defs,
|
||||
)
|
||||
|
||||
storage_dep = declare_dependency(
|
||||
link_with: lib_platform_storage_stub,
|
||||
include_directories: [platform_inc],
|
||||
)
|
||||
Loading…
Reference in a new issue