summaryrefslogtreecommitdiff
path: root/core/src/luajit/xmake.lua
blob: a26b11e67ab82fe4c246b8e98f8c8b58420ed3e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- disable jit compiler for redhat and centos
local jit = true
local autogendir = "autogen/$(plat)/jit/$(arch)"
if os.isfile("/etc/redhat-release") then
    jit = false
    autogendir = "autogen/$(plat)/nojit/$(arch)"
end

-- add target
target("luajit")

    -- make as a static library
    set_kind("static")

    -- set warning all and disable error
    set_warnings("all")

    -- disable c99(/TP) for windows
    if is_plat("windows") then
        set_languages("c89")
    end

    -- add header files
    add_headerfiles("luajit/src/(*.h)")

    -- add include directories
    add_includedirs(autogendir)
    add_includedirs("luajit/src", {public = true})

    -- add the common source files
    add_files("luajit/src/*.c|ljamalg.c|luajit.c")
    if is_plat("windows", "msys", "cygwin") then
        add_files(autogendir .. "/lj_vm.obj")
    else
        add_files(autogendir .. "/*.S")
    end

    -- disable jit compiler?
    if not jit then
        add_defines("LUAJIT_DISABLE_JIT")
    end

    -- enable lua5.2 compat, @see http://luajit.org/extensions.html
    --[[
    add_defines("LUAJIT_ENABLE_LUA52COMPAT")
    if not is_plat("windows") then
        add_cflags("-Wno-error=unused-function")
    end]]