Move font renderer in a separate folder as a library

This commit is contained in:
Francesco Abbate 2020-06-04 18:52:01 +02:00
parent 2171ea17fb
commit c5575de058
11 changed files with 27 additions and 14 deletions

View File

@ -0,0 +1,18 @@
libagg_dep = dependency('libagg')
freetype_dep = dependency('freetype2')
font_renderer_sources = [
'agg_font_freetype.cpp',
'font_renderer.cpp',
]
font_renderer_cdefs = ['-DFONT_RENDERER_HEIGHT_HACK']
font_renderer_include = include_directories('.')
libfontrenderer = static_library('fontrenderer',
font_renderer_sources,
dependencies: [libagg_dep, freetype_dep],
cpp_args: font_renderer_cdefs,
)

View File

@ -6,14 +6,11 @@ libdl = cc.find_library('dl', required : false)
lua_dep = dependency('lua') lua_dep = dependency('lua')
sdl_dep = dependency('sdl2', method: 'config-tool') sdl_dep = dependency('sdl2', method: 'config-tool')
libagg_dep = dependency('libagg')
freetype_dep = dependency('freetype2')
stb_truetype_dep = dependency('stb_truetype') stb_truetype_dep = dependency('stb_truetype')
lite_include = include_directories('src') lite_include = include_directories('src')
install_subdir('data', install_dir : 'bin') install_subdir('data', install_dir : 'bin')
lite_cdefs = []
lite_link_args = [] lite_link_args = []
if get_option('buildtype') == 'release' if get_option('buildtype') == 'release'
lite_link_args += ['-static-libgcc', '-static-libstdc++'] lite_link_args += ['-static-libgcc', '-static-libstdc++']
@ -25,5 +22,6 @@ if host_machine.system() == 'windows'
lite_rc += windows.compile_resources('res.rc') lite_rc += windows.compile_resources('res.rc')
endif endif
subdir('lib/font_renderer')
subdir('src') subdir('src')
subdir('tests') subdir('tests')

View File

@ -4,20 +4,17 @@ lite_sources = [
'api/renderer_font.c', 'api/renderer_font.c',
'api/system.c', 'api/system.c',
'renderer.c', 'renderer.c',
'agg_font_freetype.cpp',
'font_renderer.cpp',
'rencache.c', 'rencache.c',
'main.c', 'main.c',
] ]
lite_cdefs += ['-DFONT_RENDERER_HEIGHT_HACK']
executable('lite', executable('lite',
lite_sources + lite_rc, lite_sources + lite_rc,
include_directories: lite_include, include_directories: [lite_include, font_renderer_include],
dependencies: [lua_dep, sdl_dep, libagg_dep, freetype_dep, libm, libdl], dependencies: [lua_dep, sdl_dep, libm, libdl],
link_with: libfontrenderer,
link_args: lite_link_args, link_args: lite_link_args,
cpp_args: lite_cdefs,
install: true, install: true,
gui_app: true, gui_app: true,
) )

View File

@ -6,9 +6,9 @@ executable('stb-font-render-test',
) )
executable('agg-font-render-test', executable('agg-font-render-test',
['../src/agg_font_freetype.cpp', '../src/font_renderer.cpp', 'agg_font_render_test.c'], 'agg_font_render_test.c',
include_directories: lite_include, include_directories: [lite_include, font_renderer_include],
cpp_args: lite_cdefs, dependencies: [sdl_dep, libm, libdl],
dependencies: [sdl_dep, libagg_dep, freetype_dep, libm, libdl], link_with: libfontrenderer,
install: false, install: false,
) )