summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules/test_pch.lua
blob: 98286c2299d2f39df75329471a36c36f9e613c3d (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
import("lib.detect.find_tool")
import("core.base.semver")
import("detect.sdks.find_vstudio")
import("utils.ci.is_running", {alias = "ci_is_running"})

function _build()
    if ci_is_running() then
        os.run("xmake -rvD")
    else
        os.run("xmake -r")
    end
    local outdata = os.iorun("xmake")
    if outdata then
        if outdata:find("compiling") or outdata:find("linking") or outdata:find("generating") then
            raise("Modules incremental compilation does not work\n%s", outdata)
        end
    end
end

function main(t)
    -- TODO c++ modules with pch does not work for gcc now.
    if is_host("linux") then
        local clang = find_tool("clang", {version = true})
        if clang then
            os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n,build.c++.clang.fallbackscanner")
            _build()
        end
    else
        _build()
    end
end