meson: set correct flags when compiling LuaJIT on Windows

This commit is contained in:
Myaamori 2020-10-27 17:07:14 +00:00 committed by Ryan Lucia
parent 1fc019447a
commit 130339a3d6
1 changed files with 26 additions and 18 deletions

View File

@ -11,25 +11,33 @@ endif
dynasm_dasc = files('../vm_@0@.dasc'.format(dynasm_arch))
dasm = [minilua, files('../../dynasm/dynasm.lua')]
# BUG: meson does not resolve paths correctly for subprojects
hpre = '#include "@0@/../lj_arch.h"'.format(meson.current_source_dir())
checkdefs = [
['LJ_ARCH_BITS', '64', ['-D', 'P64']],
['LJ_HASJIT', '1', ['-D', 'JIT']],
['LJ_HASFFI', '1', ['-D', 'FFI']],
['LJ_DUALNUM', '1', ['-D', 'DUALNUM']],
]
if host_machine.cpu_family() == 'x86'
checkdefs += ['__SSE2__', '1', ['-D', 'SSE']]
endif
foreach def: checkdefs
if cc.get_define(def[0], prefix: hpre) == def[1]
dasm += def[2]
if cc.get_id() == 'msvc'
# the cl.exe preprocessor seemingly removes/expands macros, so hardcode flags
dasm += ['-D', 'WIN', '-D', 'JIT', '-D', 'FFI']
if host_machine.cpu_family() == 'x86_64'
dasm += ['-D', 'P64']
endif
endforeach
else
# BUG: meson does not resolve paths correctly for subprojects
hpre = '#include "@0@/../lj_arch.h"'.format(meson.current_source_dir())
checkdefs = [
['LJ_ARCH_BITS', '64', ['-D', 'P64']],
['LJ_HASJIT', '1', ['-D', 'JIT']],
['LJ_HASFFI', '1', ['-D', 'FFI']],
['LJ_DUALNUM', '1', ['-D', 'DUALNUM']],
]
if host_machine.cpu_family() == 'x86'
checkdefs += ['__SSE2__', '1', ['-D', 'SSE']]
endif
foreach def: checkdefs
if cc.get_define(def[0], prefix: hpre) == def[1]
dasm += def[2]
endif
endforeach
endif
buildvm_src = files(
'buildvm.c',