From bd271a968e0337330b118f5f4d63d93a149f4093 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 13 Jun 2023 20:05:24 +0300 Subject: [PATCH 26/26] 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 e365065f94..0ecd015617 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 #define DEFAULT_SOCK_PORT 5556 diff --git a/meson.build b/meson.build index b963ca583c..9944c1c671 100644 --- a/meson.build +++ b/meson.build @@ -21,7 +21,6 @@ priv_conf_data = configuration_data() pub_conf_data = configuration_data() liblua_conf_data = configuration_data() -pub_conf_data.set('FREECIV_AI_MOD_LAST', 3) priv_conf_data.set('BINDIR', join_paths(get_option('prefix'), get_option('bindir'))) @@ -109,6 +108,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] @@ -944,6 +954,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', @@ -975,6 +995,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