diff --git a/Package.swift b/Package.swift index 97f2c6a5251..44127612b60 100644 --- a/Package.swift +++ b/Package.swift @@ -12,6 +12,7 @@ let package = Package( // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "libzstd", + type: .static, targets: [ "libzstd" ]) ], dependencies: [ @@ -25,7 +26,7 @@ let package = Package( name: "libzstd", path: "lib", sources: [ "common", "compress", "decompress", "dictBuilder" ], - publicHeadersPath: ".", + publicHeadersPath: "spm", cSettings: [ .headerSearchPath(".") ]) diff --git a/lib/spm/module.modulemap b/lib/spm/module.modulemap new file mode 100644 index 00000000000..0f1051efbfc --- /dev/null +++ b/lib/spm/module.modulemap @@ -0,0 +1,14 @@ +module libzstd [extern_c] { + header "zstd_shim.h" + export * + + module dictbuilder [extern_c] { + header "zdict_shim.h" + export * + } + + module errors [extern_c] { + header "../zstd_errors.h" + export * + } +} diff --git a/lib/spm/zdict_shim.h b/lib/spm/zdict_shim.h new file mode 100644 index 00000000000..48d6cbd950a --- /dev/null +++ b/lib/spm/zdict_shim.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_ZDICT_SHIM_H +#define ZSTD_ZDICT_SHIM_H + +#define ZSTD_STATIC_LINKING_ONLY +#include "../zdict.h" + +#endif /* ZSTD_ZDICT_SHIM_H */ diff --git a/lib/spm/zstd_shim.h b/lib/spm/zstd_shim.h new file mode 100644 index 00000000000..ede95c51f72 --- /dev/null +++ b/lib/spm/zstd_shim.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_SHIM_H +#define ZSTD_SHIM_H + +#define ZSTD_STATIC_LINKING_ONLY +#include "../zstd.h" + +#endif /* ZSTD_SHIM_H */