]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Added premake4/GENie script to contrib folder
authorCodecat <spansjh@gmail.com>
Wed, 11 Jul 2018 16:02:18 +0000 (18:02 +0200)
committerCodecat <spansjh@gmail.com>
Wed, 11 Jul 2018 16:02:18 +0000 (18:02 +0200)
contrib/premake/premake4.lua [new file with mode: 0644]
contrib/premake/zstd.lua [new file with mode: 0644]

diff --git a/contrib/premake/premake4.lua b/contrib/premake/premake4.lua
new file mode 100644 (file)
index 0000000..6675e2e
--- /dev/null
@@ -0,0 +1,6 @@
+-- Include zstd.lua in your GENie or premake4 file, which exposes a project_zstd function
+dofile('zstd.lua')
+
+solution 'example'
+       configurations { 'Debug', 'Release' }
+       project_zstd('../../lib/')
diff --git a/contrib/premake/zstd.lua b/contrib/premake/zstd.lua
new file mode 100644 (file)
index 0000000..4759dff
--- /dev/null
@@ -0,0 +1,79 @@
+-- This GENie/premake file copies the behavior of the Makefile in the lib folder.
+-- Basic usage: project_zstd(ZSTD_DIR)
+
+function project_zstd(dir, compression, decompression, deprecated, dictbuilder, legacy)
+       if compression == nil then compression = true end
+       if decompression == nil then decompression = true end
+       if deprecated == nil then deprecated = false end
+       if dictbuilder == nil then dictbuilder = false end
+
+       if legacy == nil then legacy = 0 end
+
+       if compression then
+               dictbuilder = false
+               deprecated = false
+       end
+
+       if decompression then
+               legacy = 0
+               deprecated = false
+       end
+
+       project 'zstd'
+               kind 'StaticLib'
+               language 'C'
+
+               files {
+                       dir .. 'zstd.h',
+                       dir .. 'common/**.c',
+                       dir .. 'common/**.h'
+               }
+
+               if compression then
+                       files {
+                               dir .. 'compress/**.c',
+                               dir .. 'compress/**.h'
+                       }
+               end
+
+               if decompression then
+                       files {
+                               dir .. 'decompress/**.c',
+                               dir .. 'decompress/**.h'
+                       }
+               end
+
+               if dictbuilder then
+                       files {
+                               dir .. 'dictBuilder/**.c',
+                               dir .. 'dictBuilder/**.h'
+                       }
+               end
+
+               if deprecated then
+                       files {
+                               dir .. 'deprecated/**.c',
+                               dir .. 'deprecated/**.h'
+                       }
+               end
+
+               if legacy < 8 then
+                       files {
+                               dir .. 'legacy/zstd_v0' .. (legacy - 7) .. '.*'
+                       }
+               else
+                       includedirs {
+                               dir .. 'legacy'
+                       }
+               end
+
+               includedirs {
+                       dir,
+                       dir .. 'common'
+               }
+
+               defines {
+                       'XXH_NAMESPACE=ZSTD_',
+                       'ZSTD_LEGACY_SUPPORT=' .. legacy
+               }
+end