Migrate hardcoded -D flags to per-target Config.h

This commit is contained in:
Tamás Bálint Misius 2021-01-18 12:20:36 +01:00
parent 36f661b87f
commit ea41fa4e81
No account linked to committer's email address
7 changed files with 56 additions and 26 deletions

View File

@ -247,16 +247,6 @@ subdir('data')
subdir('resources') subdir('resources')
if get_option('build_powder') if get_option('build_powder')
powder_args = []
if uopt_lua != 'none'
powder_args += '-DLUACONSOLE'
endif
if not uopt_http
powder_args += '-DNOHTTP'
endif
if uopt_fftw
powder_args += '-DGRAVFFT'
endif
powder_deps = [ powder_deps = [
threads_dep, threads_dep,
zlib_dep, zlib_dep,
@ -272,9 +262,9 @@ if get_option('build_powder')
executable( executable(
'powder', 'powder',
sources: powder_files, sources: powder_files,
include_directories: project_inc, include_directories: [ project_inc, powder_inc ],
c_args: project_c_args + powder_args, c_args: project_c_args,
cpp_args: project_cpp_args + powder_args, cpp_args: project_cpp_args,
cpp_pch: 'pch/pch_cpp.h', cpp_pch: 'pch/pch_cpp.h',
gui_app: true, gui_app: true,
link_args: project_link_args, link_args: project_link_args,
@ -283,7 +273,6 @@ if get_option('build_powder')
endif endif
if get_option('build_render') if get_option('build_render')
render_args = [ '-DRENDERER', '-DNOHTTP' ]
render_deps = [ render_deps = [
threads_dep, threads_dep,
zlib_dep, zlib_dep,
@ -291,9 +280,9 @@ if get_option('build_render')
executable( executable(
'render', 'render',
sources: render_files, sources: render_files,
include_directories: project_inc, include_directories: [ project_inc, render_inc ],
c_args: project_c_args + render_args, c_args: project_c_args,
cpp_args: project_cpp_args + render_args, cpp_args: project_cpp_args,
cpp_pch: 'pch/pch_cpp.h', cpp_pch: 'pch/pch_cpp.h',
link_args: project_link_args, link_args: project_link_args,
dependencies: render_deps, dependencies: render_deps,
@ -301,7 +290,6 @@ if get_option('build_render')
endif endif
if get_option('build_font') if get_option('build_font')
font_args = [ '-DFONTEDITOR', '-DNOHTTP' ]
font_deps = [ font_deps = [
threads_dep, threads_dep,
zlib_dep, zlib_dep,
@ -314,9 +302,9 @@ if get_option('build_font')
executable( executable(
'font', 'font',
sources: font_files, sources: font_files,
include_directories: project_inc, include_directories: [ project_inc, font_inc ],
c_args: project_c_args + font_args, c_args: project_c_args,
cpp_args: project_cpp_args + font_args, cpp_args: project_cpp_args,
cpp_pch: 'pch/pch_cpp.h', cpp_pch: 'pch/pch_cpp.h',
gui_app: true, gui_app: true,
link_args: project_link_args, link_args: project_link_args,

View File

@ -4,6 +4,12 @@
#mesondefine CURL_STATICLIB #mesondefine CURL_STATICLIB
#mesondefine ZLIB_WINAPI #mesondefine ZLIB_WINAPI
#mesondefine LUACONSOLE
#mesondefine NOHTTP
#mesondefine GRAVFFT
#mesondefine RENDERER
#mesondefine FONTEDITOR
#mesondefine BETA #mesondefine BETA
#mesondefine DEBUG #mesondefine DEBUG
#mesondefine IGNORE_UPDATES #mesondefine IGNORE_UPDATES

View File

@ -0,0 +1,12 @@
font_conf_data = conf_data
font_conf_data.set('FONTEDITOR', true)
font_conf_data.set('RENDERER', false)
font_conf_data.set('LUACONSOLE', false)
font_conf_data.set('NOHTTP', true)
font_conf_data.set('GRAVFFT', false)
configure_file(
input: config_template,
output: 'Config.h',
configuration: font_conf_data
)
font_inc = include_directories('.')

3
src/config/meson.build Normal file
View File

@ -0,0 +1,3 @@
subdir('powder')
subdir('render')
subdir('font')

View File

@ -0,0 +1,12 @@
powder_conf_data = conf_data
powder_conf_data.set('FONTEDITOR', false)
powder_conf_data.set('RENDERER', false)
powder_conf_data.set('LUACONSOLE', uopt_lua != 'none')
powder_conf_data.set('NOHTTP', not uopt_http)
powder_conf_data.set('GRAVFFT', uopt_fftw)
configure_file(
input: config_template,
output: 'Config.h',
configuration: powder_conf_data
)
powder_inc = include_directories('.')

View File

@ -0,0 +1,12 @@
render_conf_data = conf_data
render_conf_data.set('FONTEDITOR', false)
render_conf_data.set('RENDERER', true)
render_conf_data.set('LUACONSOLE', false)
render_conf_data.set('NOHTTP', true)
render_conf_data.set('GRAVFFT', false)
configure_file(
input: config_template,
output: 'Config.h',
configuration: render_conf_data
)
render_inc = include_directories('.')

View File

@ -1,8 +1,5 @@
configure_file( config_template = files('Config.template.h')
input: 'Config.template.h', subdir('config')
output: 'Config.h',
configuration: conf_data
)
powder_files = files( powder_files = files(
'SDLCompat.cpp', 'SDLCompat.cpp',