From cc62d8055d5c4437a43b6ed9ead0d7951d494822 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 20 Jan 2022 02:03:54 +0200 Subject: [PATCH 13/32] Meson: Build tolua for native builds Make native builds to work without prior tolua by building it as part of freeciv build, before it's needed. See osdn #43015 Signed-off-by: Marko Lindqvist --- meson.build | 56 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/meson.build b/meson.build index a1ab26135e..67b8e47fe2 100644 --- a/meson.build +++ b/meson.build @@ -481,7 +481,39 @@ gitrev = custom_target('gitrev', output: 'fc_gitrev_gen.h', command: [sh_exe, files('bootstrap/generate_gitrev.sh'), meson.source_root(), '@OUTPUT@'], build_by_default: get_option('gitrev')) -tolua_cmd = find_program('tolua') +if host_system == 'windows' + tinycthr_files = files('dependencies/tinycthread/fc_tinycthread.c') +else + tinycthr_files = files() +endif + +fc_deps = static_library('fc_dependencies', + 'dependencies/cvercmp/cvercmp.c', + lua_sources, + 'dependencies/tolua-5.2/src/lib/tolua_event.c', + 'dependencies/tolua-5.2/src/lib/tolua_is.c', + 'dependencies/tolua-5.2/src/lib/tolua_map.c', + 'dependencies/tolua-5.2/src/lib/tolua_push.c', + 'dependencies/tolua-5.2/src/lib/tolua_to.c', + 'dependencies/luasql/src/luasql.c', + 'dependencies/luasql/src/ls_sqlite3.c', + tinycthr_files, + sources: verhdr, + include_directories : common_inc, + dependencies: lua_dep + ) + +if meson.is_cross_build() + tolua_cmd = find_program('tolua') +else + tolua_cmd = executable('tolua', + 'dependencies/tolua-5.2/src/bin/tolua.c', + 'dependencies/tolua-5.2/src/bin/toluabind.c', + include_directories : ['dependencies/lua-5.4/src', + 'dependencies/tolua-5.2/include'], + link_with: fc_deps + ) +endif tolua = generator(tolua_cmd, arguments: ['-n', '@BASENAME@', @@ -522,28 +554,6 @@ tolua_signal = custom_target('tolua_signal', '-H', '@OUTPUT1@', files('common/scriptcore/tolua_signal.pkg')]) -if host_system == 'windows' - tinycthr_files = files('dependencies/tinycthread/fc_tinycthread.c') -else - tinycthr_files = files() -endif - -fc_deps = static_library('fc_dependencies', - 'dependencies/cvercmp/cvercmp.c', - lua_sources, - 'dependencies/tolua-5.2/src/lib/tolua_event.c', - 'dependencies/tolua-5.2/src/lib/tolua_is.c', - 'dependencies/tolua-5.2/src/lib/tolua_map.c', - 'dependencies/tolua-5.2/src/lib/tolua_push.c', - 'dependencies/tolua-5.2/src/lib/tolua_to.c', - 'dependencies/luasql/src/luasql.c', - 'dependencies/luasql/src/ls_sqlite3.c', - tinycthr_files, - sources: verhdr, - include_directories : common_inc, - dependencies: lua_dep - ) - common_lib = library('freeciv', 'utility/astring.c', 'utility/bitvector.c', -- 2.34.1