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 known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
7 changed files with 56 additions and 26 deletions

View File

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

View File

@ -4,6 +4,12 @@
#mesondefine CURL_STATICLIB
#mesondefine ZLIB_WINAPI
#mesondefine LUACONSOLE
#mesondefine NOHTTP
#mesondefine GRAVFFT
#mesondefine RENDERER
#mesondefine FONTEDITOR
#mesondefine BETA
#mesondefine DEBUG
#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(
input: 'Config.template.h',
output: 'Config.h',
configuration: conf_data
)
config_template = files('Config.template.h')
subdir('config')
powder_files = files(
'SDLCompat.cpp',