]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/zstd/contrib/premake/zstd.lua
Update to Zstandard 1.4.0
[FreeBSD/FreeBSD.git] / sys / contrib / zstd / contrib / premake / zstd.lua
1 -- This GENie/premake file copies the behavior of the Makefile in the lib folder.
2 -- Basic usage: project_zstd(ZSTD_DIR)
3
4 function project_zstd(dir, compression, decompression, deprecated, dictbuilder, legacy)
5         if compression == nil then compression = true end
6         if decompression == nil then decompression = true end
7         if deprecated == nil then deprecated = false end
8         if dictbuilder == nil then dictbuilder = false end
9
10         if legacy == nil then legacy = 0 end
11
12         if not compression then
13                 dictbuilder = false
14                 deprecated = false
15         end
16
17         if not decompression then
18                 legacy = 0
19                 deprecated = false
20         end
21
22         project 'zstd'
23                 kind 'StaticLib'
24                 language 'C'
25
26                 files {
27                         dir .. 'zstd.h',
28                         dir .. 'common/**.c',
29                         dir .. 'common/**.h'
30                 }
31
32                 if compression then
33                         files {
34                                 dir .. 'compress/**.c',
35                                 dir .. 'compress/**.h'
36                         }
37                 end
38
39                 if decompression then
40                         files {
41                                 dir .. 'decompress/**.c',
42                                 dir .. 'decompress/**.h'
43                         }
44                 end
45
46                 if dictbuilder then
47                         files {
48                                 dir .. 'dictBuilder/**.c',
49                                 dir .. 'dictBuilder/**.h'
50                         }
51                 end
52
53                 if deprecated then
54                         files {
55                                 dir .. 'deprecated/**.c',
56                                 dir .. 'deprecated/**.h'
57                         }
58                 end
59
60                 if legacy ~= 0 then
61                         if legacy >= 8 then
62                                 files {
63                                         dir .. 'legacy/zstd_v0' .. (legacy - 7) .. '.*'
64                                 }
65                         end
66                         includedirs {
67                                 dir .. 'legacy'
68                         }
69                 end
70
71                 includedirs {
72                         dir,
73                         dir .. 'common'
74                 }
75
76                 defines {
77                         'XXH_NAMESPACE=ZSTD_',
78                         'ZSTD_LEGACY_SUPPORT=' .. legacy
79                 }
80 end