Skip to content

Commit

Permalink
[zstd] Fix clang-cl flags (#29992)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neumann-A authored Apr 13, 2023
1 parent c2f29e5 commit 2c84b1e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
14 changes: 0 additions & 14 deletions ports/zstd/emscripten.patch

This file was deleted.

31 changes: 31 additions & 0 deletions ports/zstd/fix-emscripten-and-clang-cl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
index 0265349..4a50a67 100644
--- a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
+++ b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
@@ -54,10 +54,22 @@ macro(ADD_ZSTD_COMPILATION_FLAGS)
endif ()
# Add noexecstack flags
# LDFLAGS
- EnableCompilerFlag("-z noexecstack" false false true)
- # CFLAGS & CXXFLAGS
- EnableCompilerFlag("-Qunused-arguments" true true false)
- EnableCompilerFlag("-Wa,--noexecstack" true true false)
+ if(MSVC)
+ # UNICODE SUPPORT
+ EnableCompilerFlag("/D_UNICODE" true true false)
+ EnableCompilerFlag("/DUNICODE" true true false)
+ # Enable asserts in Debug mode
+ if (CMAKE_BUILD_TYPE MATCHES "Debug")
+ EnableCompilerFlag("/DDEBUGLEVEL=1" true true false)
+ endif ()
+ else()
+ if(NOT EMSCRIPTEN)
+ EnableCompilerFlag("-z noexecstack" false false true)
+ endif()
+ # CFLAGS & CXXFLAGS
+ EnableCompilerFlag("-Qunused-arguments" true true false)
+ EnableCompilerFlag("-Wa,--noexecstack" true true false)
+ endif()
elseif (MSVC) # Add specific compilation flags for Windows Visual

set(ACTIVATE_MULTITHREADED_COMPILATION "ON" CACHE BOOL "activate multi-threaded compilation (/MP flag)")
2 changes: 1 addition & 1 deletion ports/zstd/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ vcpkg_from_github(
HEAD_REF dev
PATCHES
no-static-suffix.patch
emscripten.patch
fix-emscripten-and-clang-cl.patch
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ZSTD_BUILD_STATIC)
Expand Down
2 changes: 1 addition & 1 deletion ports/zstd/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zstd",
"version": "1.5.4",
"port-version": 1,
"port-version": 2,
"description": "Zstandard - Fast real-time compression algorithm",
"homepage": "https://facebook.github.io/zstd/",
"license": "BSD-3-Clause OR GPL-2.0-only",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8750,7 +8750,7 @@
},
"zstd": {
"baseline": "1.5.4",
"port-version": 1
"port-version": 2
},
"zstr": {
"baseline": "1.0.7",
Expand Down
5 changes: 5 additions & 0 deletions versions/z-/zstd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "fcc4fe2738d903bc347d20d2d4c836699e273509",
"version": "1.5.4",
"port-version": 2
},
{
"git-tree": "4b61cbe1e314aa678d7cbf37a24b59e37694f4a6",
"version": "1.5.4",
Expand Down

0 comments on commit 2c84b1e

Please sign in to comment.