From cd9c504f09a75099e43692d3af112aba685b5280 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 13 Jun 2023 20:02:19 +0300 Subject: [PATCH 44/44] Meson: Include just stub AI when server not built See osdn #48193 Signed-off-by: Marko Lindqvist --- gen_headers/meson_fc_config.h.in | 5 +++-- meson.build | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/gen_headers/meson_fc_config.h.in b/gen_headers/meson_fc_config.h.in index a1cb052efb..018ccde1d1 100644 --- a/gen_headers/meson_fc_config.h.in +++ b/gen_headers/meson_fc_config.h.in @@ -17,8 +17,9 @@ #define AI_MOD_DEFAULT "classic" -#define AI_MOD_STATIC_CLASSIC -#define AI_MOD_STATIC_TEX +#mesondefine AI_MOD_STATIC_CLASSIC +#mesondefine AI_MOD_STATIC_TEX +#mesondefine AI_MOD_STATIC_STUB #mesondefine DEFAULT_SOCK_PORT diff --git a/meson.build b/meson.build index f74b102607..1ca7858be4 100644 --- a/meson.build +++ b/meson.build @@ -64,7 +64,6 @@ elif testmatic != '' and testmatic != 'no' error('Unknown testmatic value ' + testmatic) endif -pub_conf_data.set('FREECIV_AI_MOD_LAST', 3) priv_conf_data.set('BINDIR', join_paths(get_option('prefix'), get_option('bindir'))) @@ -156,6 +155,17 @@ else server_binary_name = 'freeciv-server' endif +if server_type == 'disabled' + pub_conf_data.set('FREECIV_AI_MOD_LAST', 1) + + priv_conf_data.set('AI_MOD_STATIC_STUB', 1) +else + pub_conf_data.set('FREECIV_AI_MOD_LAST', 2) + + priv_conf_data.set('AI_MOD_STATIC_CLASSIC', 1) + priv_conf_data.set('AI_MOD_STATIC_TEX', 1) +endif + if meson.is_cross_build() cross_inc_str = meson.get_external_property('cross_inc_path', '') cross_inc_path = [cross_inc_str] @@ -1126,6 +1136,16 @@ common_lib = library('freeciv', install : true ) +if server_type == 'disabled' + +ais = static_library('fc_ai', + 'ai/stub/stubai.c', + sources: [verhdr], + include_directories: [server_inc, include_directories('ai/default')] + ) + +else + ais = static_library('fc_ai', 'ai/classic/classicai.c', 'ai/tex/texai.c', @@ -1157,6 +1177,8 @@ ais = static_library('fc_ai', include_directories: [server_inc, include_directories('ai/default')] ) +endif + server_lib = static_library('fc_server', 'ai/aitraits.c', 'ai/difficulty.c', -- 2.39.2