1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-02 20:22:31 +03:00
Commit Graph

407 Commits

Author SHA1 Message Date
de7c8b9842 cmake: Remove duplicated line 2025-01-28 00:22:35 +01:00
be1bf2469e fix: quote include directory for resource compiler 2025-01-27 15:18:55 -03:00
45c0e72c0a Instructions for Apple Framework builds 2025-01-22 22:54:03 +03:30
becef672bb Build: Revert min version to 3.10 2025-01-22 22:53:41 +03:30
897cec3876 Build: Add support for Apple frameworks
Signed-off-by: Treata11 <treata11@yahoo.com>
2025-01-21 20:58:27 +03:30
7d63a1c7c3 add prerelease option 2025-01-15 02:16:42 +08:00
757e29e170 Oops 2025-01-02 14:17:24 -08:00
54c3d998a0 Support for libc variants without fseeko/ftello
Some older Android libc implementations don't support `fseeko` or `ftello`.
This commit adds a new compile-time macro `LIBC_NO_FSEEKO` as well as a usage in CMake for old Android APIs.
2025-01-02 14:02:10 -08:00
788926fe48 Merge pull request #4217 from facebook/ZSTD_compressSequencesAndLiterals
ZSTD_compressSequencesAndLiterals
2024-12-26 11:41:44 -08:00
f0937b83d9 [cmake] Fix -z noexecstack portability
Summary:
Issue reported by @ryandesign and @MarcusCalhoun-Lopez.

CMake doesn't support spaces in flags. This caused older versions of gcc to
ignore the unknown flag "-z noexecstack" on MacOS since it was interpreted as a
single flag, not two separate flags. Then, during compilation it was treated as
"-z" "noexecstack", which was correctly forwarded to the linker. But the MacOS
linker does not support `-z noexecstack` so compilation failed.

The fix is to use `-Wl,-z,noexecstack`. This is never misinterpreted by a
compiler. However, not all compilers support this syntax to forward flags to the
linker. To fix this issue, we check if all the relevant `noexecstack` flags have
been successfully set, and if they haven't we disable assembly.

See also PR#4056 and PR#4061. I decided to go a different route because this is
simpler. It might not successfully set these flags on some compilers, but in that
case it also disables assembly, so they aren't required.

Test Plan:
```
mkdir build-cmake
cmake ../build/cmake/CMakeLists.txt
make -j
```

See that the linker flag is successfully detected & that assembly is enabled.

Run the same commands on MacOS which doesn't support `-Wl,-z,noexecstack` and see
that everything compiles and that `LD_FLAG_WL_Z_NOEXECSTACK` and
`ZSTD_HAS_NOEXECSTACK` are both false.
2024-12-20 15:06:23 -08:00
47edd0acf4 removed fullbench-dll project from visual solutions 2024-12-20 10:37:00 -08:00
6f8c1046d0 update Visual Studio solutions 2024-12-20 10:37:00 -08:00
2503b64345 fix minor artifact error in single_file_lib 2024-12-20 10:36:58 -08:00
b4a40a845f move Sequences definition to zstd_compress_internal.h
they should not be in common/zstd_internal.h,
since these definitions are not shared beyond lib/compress/.
2024-12-20 10:36:55 -08:00
1198a582d3 Update VERSION_LESS usage to VERSION_GREATER_THAN 2024-12-12 11:39:40 -08:00
e190e7944e Update cmake minimum requirement to 3.10
CMake warns on the current minimum requirement (3.5). Update to 3.10.
This means support is still available for the default on Ubuntu 18.04, which
exited LTS standard in April of 2023.
[draft]
2024-12-09 10:53:38 -08:00
adbb536d00 fixed single file library test
copy "zstd_errors.h" alongside "zstd.h" to pass compilation test.
2024-10-31 14:38:36 -07:00
76ad1d6903 fixed VS2010 solution 2024-10-23 11:50:56 -07:00
6939235f01 fixed meson build 2024-10-23 11:50:56 -07:00
dd38c677eb fixed single-library build 2024-10-23 11:50:56 -07:00
ccc02a9a77 meson: Fix contrib and tests build 2024-09-30 18:05:57 +03:00
d2d49a1161 meson: Do not export private headers in libzstd_dep to avoid name clash
This way libzstd_dep does not override, for instance, <xxhash.h>
2024-09-30 17:03:42 +03:00
44e83e9180 Fix typos not found by codespell 2024-06-20 20:16:25 +02:00
1232d4c45d Merge pull request #3931 from bgilbert/pthread
meson: don't add `-pthread` to static linking flags on Windows
2024-04-20 20:25:19 -07:00
5be2a8721d meson: don't add -pthread to static linking flags on Windows
Meson always returns -pthread in dependency('threads') on non-MSVC
compilers.  On Windows we use Windows threading primitives, so we don't
need this.  Avoid adding -pthread to libzstd's link flags, either as a
Meson subproject or via pkg-config Libs.private, so the application
doesn't inadvertently depend on winpthreads.

Add a Meson MinGW cross-compile CI test that checks for this.  It turns
out that pzstd fails to build in that environment, so have the test
skip building contrib for now.
2024-04-11 01:27:24 +09:00
fd5f8106a5 fix missing include folder for resource compiler 2024-04-06 00:05:58 +02:00
9c442d6fc2 Improve MSBuild search; add latest option 2024-03-23 18:34:07 -04:00
65ab6c267e Use vswhere to find MSBuild; add VS2022 support
See:
https://github.com/microsoft/vswhere/wiki/Find-MSBuild
2024-03-23 09:13:49 -04:00
42b02f5185 [cmake] Emit warnings for contradictory build settings
Document that the `ZSTD_BUILD_{SHARED,STATIC}` take precedence over `BUILD_SHARED_LIBS` when exactly one is ON.

Thanks to @teo-tsirpanis for pointing out the potentially confusing behavior.
2024-03-18 09:31:22 -07:00
a595e5812a [cmake] Fix up PR #3716
* Make a variable `PublicHeaders` for Zstd's public headers
* Add `PublicHeaders` to `Headers`, which was missing
* Only export `${LIBRARY_DIR}` publicly, not `common/`
* Switch the `target_include_directories()` to `INTERFACE` because zstd uses relative includes internally, so doesn't need any include directories to build
* Switch installation to use the `PublicHeaders` variable, and test that the right headers are installed
2024-03-18 09:18:51 -04:00
79cd0ff712 Makes it possible to use the lib through FetchContent or ExternalProject_Add 2024-03-18 09:18:51 -04:00
a0a9bc6c95 [cmake] Always create libzstd target
If both `ZSTD_BUILD_SHARED` and `ZSTD_BUILD_STATIC` are set, then cmake exports the libraries `libzstd_shared` and `libzstd_static` only.
It does not export `libzstd`, which is only exported when exactly one of `ZSTD_BUILD_SHARED` and `ZSTD_BUILD_STATIC` is set.
This PR exports `libzstd` in that case, based on the value of the standard CMake variable [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html).
This ensures that `libzstd` can always be used to refer to the exported zstd library, since the build errors if neither `ZSTD_BUILD_SHARED` nor `ZSTD_BUILD_STATIC` are set.

I tested all the possible combinations of `ZSTD_BUILD_SHARED`, `ZSTD_BUILD_STATIC`, and `BUILD_SHARED_LIBS` and they always worked as expected:
* If only exactly one of `ZSTD_BUILD_SHARED` and `ZSTD_BUILD_STATIC` is set, that is used as `libzstd`.
* Otherwise, libzstd is set based on `BUILD_SHARED_LIBS`.

Fixes #3859.
2024-03-14 15:04:46 -04:00
c1e995321e [CI] Run tests with CMake on Windows
Build and run tests on Windows with CMake
2024-03-13 09:45:40 -04:00
f6039f3d5f cmake refactor: move HP-UX specific logic into its own function
reduce visual clutter of corner case configuration.
2024-03-11 16:22:13 -07:00
a4db145900 Merge pull request #3862 from likema/fix-hpux-parisc
Fix building on HP-UX 11.11 PA-RISC
2024-03-11 15:55:58 -07:00
b27d1634a5 Merge branch 'dev' into unified-target 2024-02-28 01:25:15 +02:00
dcd713ce06 Define the unified target inside the CMake project, and export it.
This is less error-prone.
2024-02-27 23:39:59 +02:00
9e711c9360 fix Visual Studio datagen recipe 2024-02-20 22:59:58 -08:00
b34517a440 fix cmake build 2024-02-20 20:20:40 -08:00
c2d3570338 fix meson datagen build 2024-02-20 18:17:28 -08:00
fd03971252 blindfix meson recipe
note: absence of GLOB capability within meson makes its maintenance more painful.
2024-01-29 15:50:21 -08:00
befcec1788 fix cmake recipe 2024-01-29 15:45:16 -08:00
3ce4c6e046 fix Visual Studio solutions
note: we probably don't want to maintain VS2008 solution anymore.
Its successor VS2010 is > 10 years old,
which is more or less the limit after which we can stop supporting old compilers.
2024-01-29 15:24:42 -08:00
2fc7248412 fix cmakebuild test
write it in a way which is more compatible with older versions of cmake (<3.13)

Also:
fix pzstd compilation (notably on macos)
2024-01-27 17:30:06 -08:00
dcf784a04b Merge pull request #3760 from jcelerier/patch-1
[x-compile] Fix cross-compiling for AArch64 with lld
2024-01-13 11:41:30 -08:00
e49d1ab6aa Fix building on HP-UX 11.11 PA-RISC
By CMake 3.8.2 and GCC 4.7.1
2024-01-14 00:32:19 +08:00
475da4fb2e Make zstd::libzstd an imported interface target.
It cannot be an alias, because it would lock the package to use either static or shared libraries at its build time. We want to decide this at the time `find_package` is called.
2023-12-19 17:04:09 +02:00
c53d650d9a Export a zstd::libzstd target if only static or dynamic linkage is specified. 2023-11-07 15:54:19 +02:00
f013b1b504 [cmake] Remove code for compatibility with CMake < 3.0
The required version of CMake is now 3.5.
2023-11-01 20:46:47 +01:00
4502ca5f42 [cmake] Require CMake version 3.5 or newer
More recent versions of CMake emit the following warning:
CMake Deprecation Warning at cmake/CMakeLists.txt:10 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
2023-10-31 23:30:43 +01:00