[libpeas/meson.msvc: 1/7] meson.build: Improve lua search on Windows
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas/meson.msvc: 1/7] meson.build: Improve lua search on Windows
- Date: Mon, 8 Jun 2020 10:18:50 +0000 (UTC)
commit 811794108fdcac5db268144fed61f0926b79562f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Nov 19 18:00:16 2019 +0800
meson.build: Improve lua search on Windows
On Windows, especially Visual Studio builds, lua does not come with a
pkg-config file, so we may need to look for the dependencies manually.
We first reverse the order of the search in such situations, by looking
for whether we have lua.exe or luajit.exe in our path, and then we look
for the lua headers and the lua library[1]. If they could be found, we
proceed to look for lua-lgi and build as we did before.
[1]: lua51.lib for luajit or lua5[3|2|1].lib for lua 5.[3|2|1].
meson.build | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 240c5e4..984c791 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,7 @@ project(
'libpeas', 'c',
version: '1.26.0',
license: 'LGPLv2.1+',
- meson_version: '>= 0.49.0',
+ meson_version: '>= 0.50.0',
default_options: [
'buildtype=debugoptimized',
]
@@ -149,7 +149,51 @@ endif
luajit_prg = find_program('luajit', required: false)
xmllint_prg = find_program('xmllint', required: false)
+if cc.get_id() == 'msvc'
+ if luajit_prg.found()
+ # luajit has lua51.lib as its import library
+ lua_names = ['lua51']
+ else
+ lua_names = ['lua53', 'lua52', 'lua51']
+ endif
+
+ lua_headers = ['lua.h', 'lualib.h', 'lauxlib.h']
+ # On Windows, the lua program may be named as lua.exe
+ foreach lua: lua_names + ['lua']
+ if not lua51_prg.found() and not luajit_prg.found()
+ lua51_prg = find_program(lua, required: false)
+ endif
+ if lua51_prg.found()
+ if lua != 'lua'
+ lua51_dep = cc.find_library(lua, has_headers: lua_headers, required: false)
+ endif
+ endif
+ endforeach
+
+ if not lua51_dep.found() and not luajit_dep.found()
+ foreach lualib: lua_names
+ if luajit_prg.found()
+ if not luajit_dep.found()
+ luajit_dep = cc.find_library(lualib, has_headers: lua_headers, required: false)
+ endif
+ endif
+
+ if lua51_prg.found()
+ if not lua51_dep.found()
+ lua51_dep = cc.find_library(lualib, has_headers: lua_headers, required: false)
+ endif
+ endif
+ endforeach
+ endif
+endif
+
+lua_found = false
+
if (luajit_dep.found() and luajit_prg.found()) or (lua51_dep.found() and lua51_prg.found())
+ lua_found = true
+endif
+
+if lua_found
if luajit_prg.found()
lua_prg = luajit_prg
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]