summaryrefslogtreecommitdiff
path: root/tests/projects/package/depconfigs/xmake.lua
blob: 11623755c12f21ccef9ecdf1fb254b16094a6377 (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
add_requires("libpng", {system = false, configs = {runtimes = "MD"}})
add_requires("libtiff", {system = false, configs = {runtimes = "MD", zlib = true}})

add_requireconfs("libpng.zlib",        {system = false, override = true, configs = {cxflags = "-DTEST1"}, version = "1.2.10"})
add_requireconfs("libtiff.*|cmake",    {system = false, configs = {cxflags = "-DTEST2"}})

target("test")
    set_kind("binary")
    add_files("src/*.c")
    add_packages("libpng")
    before_build(function (target)
        if target:pkg("libpng") then
            local found
            for _, linkdir in ipairs(target:pkg("libpng"):get("linkdirs")) do
                if linkdir:find("zlib[/\\]v1%.2%.10") then
                    found = true
                end
            end
            assert(found, "package(zlib 1.2.10) not found!")
        end
    end)

target("test2")
    set_kind("binary")
    add_files("src/*.c")
    add_packages("libtiff")
    before_build(function (target)
        if target:pkg("libtiff") then
            local found
            for _, linkdir in ipairs(target:pkg("libtiff"):get("linkdirs")) do
                if linkdir:find("zlib", 1, true) then
                    found = true
                end
            end
            assert(found, "package(zlib) not found!")
        end
    end)