File: sw.cpp

package info (click to toggle)
leptonlib 1.76.0-1~bpo9+1
  • links: PTS
  • area: main
  • in suites: stretch-backports
  • size: 26,468 kB
  • sloc: ansic: 186,278; sh: 4,454; makefile: 204; cpp: 61
file content (72 lines) | stat: -rw-r--r-- 2,433 bytes parent folder | download | duplicates (2)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
void build(Solution &sln)
{
    auto &s = sln.addDirectory("demo");
    auto &leptonica = s.addTarget<LibraryTarget>("danbloomberg.leptonica", "1.74.4");
    leptonica.Source = Git("https://github.com/DanBloomberg/leptonica", "{v}");

    leptonica.setChecks("leptonica");

    leptonica +=
        "src/.*\\.c"_rr,
        "src/.*\\.h"_rr,
        "src/endianness.h.in";

    leptonica.Public +=
        "src"_id;

    leptonica.Private += "HAVE_LIBGIF"_d;
    leptonica.Private += "HAVE_LIBJP2K"_d;
    leptonica.Private += "HAVE_LIBJPEG"_d;
    leptonica.Private += "HAVE_LIBPNG"_d;
    leptonica.Private += "HAVE_LIBTIFF"_d;
    leptonica.Private += "HAVE_LIBWEBP"_d;
    leptonica.Private += "HAVE_LIBZ"_d;
    leptonica.Private += "LIBJP2K_HEADER=\"openjpeg.h\""_d;
    leptonica.Public += "HAVE_CONFIG_H"_d;
    leptonica.Private += sw::Shared, "LIBLEPT_EXPORTS"_d;

    leptonica += "pub.cppan2.demo.gif-5"_dep;
    leptonica += "pub.cppan2.demo.jpeg-9"_dep;
    leptonica += "pub.cppan2.demo.uclouvain.openjpeg.openjp2-2"_dep;
    leptonica += "pub.cppan2.demo.png-1"_dep;
    leptonica += "pub.cppan2.demo.tiff-4"_dep;
    leptonica += "pub.cppan2.demo.webp-0"_dep;

    if (leptonica.Variables["WORDS_BIGENDIAN"] == "1")
        leptonica.Variables["ENDIANNESS"] = "L_BIG_ENDIAN";
    else
        leptonica.Variables["ENDIANNESS"] = "L_LITTLE_ENDIAN";

    leptonica.Variables["APPLE_UNIVERSAL_BUILD"] = "defined (__APPLE_CC__)";

    leptonica.configureFile("src/endianness.h.in", "endianness.h");
    leptonica.writeFileOnce("config_auto.h");

    if (s.Settings.Native.CompilerType == CompilerType::MSVC)
    {
        for (auto *f : leptonica.gatherSourceFiles())
            f->BuildAs = NativeSourceFile::CPP;
    }

    if (s.Settings.TargetOS.Type == OSType::Windows)
        leptonica += "User32.lib"_l, "Gdi32.lib"_l;
}

void check(Checker &c)
{
    auto &s = c.addSet("leptonica");
    s.checkFunctionExists("fmemopen");
    s.checkFunctionExists("fstatat");
    s.checkIncludeExists("dlfcn.h");
    s.checkIncludeExists("inttypes.h");
    s.checkIncludeExists("memory.h");
    s.checkIncludeExists("stdint.h");
    s.checkIncludeExists("stdlib.h");
    s.checkIncludeExists("strings.h");
    s.checkIncludeExists("string.h");
    s.checkIncludeExists("sys/stat.h");
    s.checkIncludeExists("sys/types.h");
    s.checkIncludeExists("unistd.h");
    s.checkTypeSize("size_t");
    s.checkTypeSize("void *");
}