meson: Apply Lua 5.2 compat flags to both native and non-native builds (#69)

Otherwise -DLUAJIT_ENABLE_LUA52COMPAT isn't included when building
buildvm, which will then fail to pick up Lua 5.2-only functions
defined using the LJLIB_CF macro (e.g. table.pack).
This commit is contained in:
Myaamori 2020-05-20 05:48:51 +01:00 committed by odrling
parent 5e9cc572f2
commit 10acc00445
1 changed files with 7 additions and 5 deletions

View File

@ -7,21 +7,23 @@ system_deps = [
cc.find_library('m', required: false)
]
add_project_arguments('-DLUAJIT_ENABLE_LUA52COMPAT', language: 'c')
# compat flag is needed for both the buildvm code generator (compiled natively) and luajit itself
add_project_arguments('-DLUAJIT_ENABLE_LUA52COMPAT', language: 'c', native: true)
add_project_arguments('-DLUAJIT_ENABLE_LUA52COMPAT', language: 'c', native: false)
if host_machine.system() == 'linux'
add_project_arguments('-DLUAJIT_OS=LUAJIT_OS_LINUX', language: 'c')
add_project_arguments('-DLUAJIT_OS=LUAJIT_OS_LINUX', language: 'c', native: true)
readline_dep = cc.find_library('readline')
ljvm_mode = 'elfasm'
ljvm_bout = 'lj_vm.s'
elif host_machine.system() == 'darwin'
add_project_arguments(['-DLUAJIT_OS=LUAJIT_OS_OSX'], language: 'c')
add_project_arguments(['-DLUAJIT_OS=LUAJIT_OS_OSX'], language: 'c', native: true)
readline_dep = cc.find_library('readline')
ljvm_mode = 'machasm'
ljvm_bout = 'lj_vm.s'
elif host_machine.system() == 'windows'
add_project_arguments('-DLUAJIT_OS=LUAJIT_OS_WINDOWS', language: 'c')
add_project_arguments('-DLUAJIT_OS=LUAJIT_OS_WINDOWS', language: 'c', native: true)
if cc.get_id() != 'msvc'
add_project_arguments('-malign-double', language: 'c')
add_project_arguments('-malign-double', language: 'c', native: true)
endif
readline_dep = []
ljvm_mode = 'peobj'