forked from DanBloomberg/leptonica
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsw.cpp
72 lines (61 loc) · 2.38 KB
/
sw.cpp
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 *");
}