From 23d77c531e44fd4a4af2c3de2ba13dd6263f9767 Mon Sep 17 00:00:00 2001 From: Codecat Date: Wed, 11 Jul 2018 18:02:18 +0200 Subject: [PATCH 1/3] Added premake4/GENie script to contrib folder --- contrib/premake/premake4.lua | 6 +++ contrib/premake/zstd.lua | 79 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 contrib/premake/premake4.lua create mode 100644 contrib/premake/zstd.lua diff --git a/contrib/premake/premake4.lua b/contrib/premake/premake4.lua new file mode 100644 index 000000000..6675e2e48 --- /dev/null +++ b/contrib/premake/premake4.lua @@ -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 index 000000000..4759dff76 --- /dev/null +++ b/contrib/premake/zstd.lua @@ -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 From 1a61bdb9c08c9b4edc1891c78514510d67906789 Mon Sep 17 00:00:00 2001 From: Codecat Date: Sat, 14 Jul 2018 12:27:42 +0200 Subject: [PATCH 2/3] Update zstd.lua --- contrib/premake/zstd.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/contrib/premake/zstd.lua b/contrib/premake/zstd.lua index 4759dff76..0f7fc558b 100644 --- a/contrib/premake/zstd.lua +++ b/contrib/premake/zstd.lua @@ -57,11 +57,12 @@ function project_zstd(dir, compression, decompression, deprecated, dictbuilder, } end - if legacy < 8 then - files { - dir .. 'legacy/zstd_v0' .. (legacy - 7) .. '.*' - } - else + if legacy ~= 0 then + if legacy >= 8 then + files { + dir .. 'legacy/zstd_v0' .. (legacy - 7) .. '.*' + } + end includedirs { dir .. 'legacy' } From 044cd81ce6cf4ef6c15bec933166a66a4528bc29 Mon Sep 17 00:00:00 2001 From: Codecat Date: Sat, 14 Jul 2018 12:34:03 +0200 Subject: [PATCH 3/3] Fix wrong conditions --- contrib/premake/zstd.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/premake/zstd.lua b/contrib/premake/zstd.lua index 0f7fc558b..df1ace3ee 100644 --- a/contrib/premake/zstd.lua +++ b/contrib/premake/zstd.lua @@ -9,12 +9,12 @@ function project_zstd(dir, compression, decompression, deprecated, dictbuilder, if legacy == nil then legacy = 0 end - if compression then + if not compression then dictbuilder = false deprecated = false end - if decompression then + if not decompression then legacy = 0 deprecated = false end