Enable building against system zstd.
This commit is contained in:
parent
30a25b7d03
commit
a408388623
6 changed files with 33 additions and 20 deletions
|
@ -171,6 +171,7 @@ opts.Add('builtin_pcre2', "Use the builtin pcre2 library (yes/no)", 'yes')
|
||||||
opts.Add('builtin_recast', "Use the builtin recast library (yes/no)", 'yes')
|
opts.Add('builtin_recast', "Use the builtin recast library (yes/no)", 'yes')
|
||||||
opts.Add('builtin_squish', "Use the builtin squish library (yes/no)", 'yes')
|
opts.Add('builtin_squish', "Use the builtin squish library (yes/no)", 'yes')
|
||||||
opts.Add('builtin_zlib', "Use the builtin zlib library (yes/no)", 'yes')
|
opts.Add('builtin_zlib', "Use the builtin zlib library (yes/no)", 'yes')
|
||||||
|
opts.Add('builtin_zstd', "Use the builtin zstd library (yes/no)", 'yes')
|
||||||
|
|
||||||
# Environment setup
|
# Environment setup
|
||||||
opts.Add("CXX", "C++ compiler")
|
opts.Add("CXX", "C++ compiler")
|
||||||
|
|
21
core/SCsub
21
core/SCsub
|
@ -83,24 +83,8 @@ thirdparty_minizip_sources = [
|
||||||
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
|
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
|
||||||
env.add_source_files(env.core_sources, thirdparty_minizip_sources)
|
env.add_source_files(env.core_sources, thirdparty_minizip_sources)
|
||||||
|
|
||||||
thirdparty_zstd_dir = "#thirdparty/zstd/"
|
if "builtin_zstd" in env and env["builtin_zstd"] == "yes":
|
||||||
thirdparty_zstd_sources = [
|
SConscript("#thirdparty/zstd/SCsub")
|
||||||
"common/entropy_common.c",
|
|
||||||
"common/error_private.c",
|
|
||||||
"common/fse_decompress.c",
|
|
||||||
"common/pool.c",
|
|
||||||
"common/threading.c",
|
|
||||||
"common/xxhash.c",
|
|
||||||
"common/zstd_common.c",
|
|
||||||
"compress/fse_compress.c",
|
|
||||||
"compress/huf_compress.c",
|
|
||||||
"compress/zstd_compress.c",
|
|
||||||
"compress/zstdmt_compress.c",
|
|
||||||
"decompress/huf_decompress.c",
|
|
||||||
"decompress/zstd_decompress.c",
|
|
||||||
]
|
|
||||||
thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
|
|
||||||
env.add_source_files(env.core_sources, thirdparty_zstd_sources)
|
|
||||||
|
|
||||||
|
|
||||||
# Godot's own sources
|
# Godot's own sources
|
||||||
|
@ -123,5 +107,4 @@ SConscript('helper/SCsub')
|
||||||
# Build it all as a library
|
# Build it all as a library
|
||||||
lib = env.Library("core", env.core_sources)
|
lib = env.Library("core", env.core_sources)
|
||||||
env.Prepend(LIBS=[lib])
|
env.Prepend(LIBS=[lib])
|
||||||
env.Append(CPPPATH=["#thirdparty/zstd", "#thirdparty/zstd/common"])
|
|
||||||
Export('env')
|
Export('env')
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
#include "zip_io.h"
|
#include "zip_io.h"
|
||||||
|
|
||||||
#include "thirdparty/misc/fastlz.h"
|
#include "thirdparty/misc/fastlz.h"
|
||||||
#include "thirdparty/zstd/zstd.h"
|
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
#include <zstd.h>
|
||||||
|
|
||||||
int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) {
|
int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) {
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,9 @@ def configure(env):
|
||||||
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
|
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
|
||||||
env.ParseConfig('pkg-config libsquish --cflags --libs')
|
env.ParseConfig('pkg-config libsquish --cflags --libs')
|
||||||
|
|
||||||
|
if env['builtin_zstd'] == 'no':
|
||||||
|
env.ParseConfig('pkg-config libzstd --cflags --libs')
|
||||||
|
|
||||||
# Sound and video libraries
|
# Sound and video libraries
|
||||||
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
|
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,9 @@ def configure(env):
|
||||||
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
|
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
|
||||||
env.ParseConfig('pkg-config libsquish --cflags --libs')
|
env.ParseConfig('pkg-config libsquish --cflags --libs')
|
||||||
|
|
||||||
|
if env['builtin_zstd'] == 'no':
|
||||||
|
env.ParseConfig('pkg-config libzstd --cflags --libs')
|
||||||
|
|
||||||
# Sound and video libraries
|
# Sound and video libraries
|
||||||
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
|
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
|
||||||
|
|
||||||
|
|
23
thirdparty/zstd/SCsub
vendored
Normal file
23
thirdparty/zstd/SCsub
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
Import('env')
|
||||||
|
|
||||||
|
thirdparty_zstd_dir = "#thirdparty/zstd/"
|
||||||
|
thirdparty_zstd_sources = [
|
||||||
|
"common/entropy_common.c",
|
||||||
|
"common/error_private.c",
|
||||||
|
"common/fse_decompress.c",
|
||||||
|
"common/pool.c",
|
||||||
|
"common/threading.c",
|
||||||
|
"common/xxhash.c",
|
||||||
|
"common/zstd_common.c",
|
||||||
|
"compress/fse_compress.c",
|
||||||
|
"compress/huf_compress.c",
|
||||||
|
"compress/zstd_compress.c",
|
||||||
|
"compress/zstdmt_compress.c",
|
||||||
|
"decompress/huf_decompress.c",
|
||||||
|
"decompress/zstd_decompress.c",
|
||||||
|
]
|
||||||
|
thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
|
||||||
|
env.add_source_files(env.core_sources, thirdparty_zstd_sources)
|
||||||
|
env.Append(CPPPATH=["#thirdparty/zstd", "#thirdparty/zstd/common"])
|
Loading…
Reference in a new issue