Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Jan 18, 2025
1 parent 0e40f0d commit fe31582
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 39 deletions.
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/binskim/arm64-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong")
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS --compile-no-warning-as-error -DBENCHMARK_ENABLE_WERROR=OFF)
Expand Down
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/binskim/arm64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "arm64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/binskim/universal2-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-triplets/binskim/x64-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection")
set(VCPKG_C_FLAGS "-fstack-clash-protection -fcf-protection")
set(VCPKG_CXX_FLAGS "-fstack-clash-protection -fcf-protection")
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS --compile-no-warning-as-error -DBENCHMARK_ENABLE_WERROR=OFF)
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-triplets/binskim/x64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection")
set(VCPKG_C_FLAGS "-fstack-clash-protection -fcf-protection")
set(VCPKG_CXX_FLAGS "-fstack-clash-protection -fcf-protection")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "x86_64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-triplets/binskim_nortti/arm64-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_C_FLAGS "-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS --compile-no-warning-as-error -DBENCHMARK_ENABLE_WERROR=OFF)
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-triplets/binskim_nortti/arm64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_C_FLAGS "-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "arm64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-triplets/binskim_nortti/universal2-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_C_FLAGS "-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-triplets/binskim_nortti/x64-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_C_FLAGS "-fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS --compile-no-warning-as-error -DBENCHMARK_ENABLE_WERROR=OFF)
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-triplets/binskim_nortti/x64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_C_FLAGS "-fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0")
set(VCPKG_CXX_FLAGS "-fstack-clash-protection -fcf-protection -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "x86_64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/default/arm64-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "")
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS --compile-no-warning-as-error -DBENCHMARK_ENABLE_WERROR=OFF)
Expand Down
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/default/arm64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "arm64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/default/universal2-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/default/x64-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "")
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS --compile-no-warning-as-error -DBENCHMARK_ENABLE_WERROR=OFF)
Expand Down
2 changes: 0 additions & 2 deletions cmake/vcpkg-triplets/default/x64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "")
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "x86_64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
23 changes: 14 additions & 9 deletions cmake/vcpkg-triplets/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ def add_copyright_header(f):
# Disable RTTI and turn usage of dynamic_cast and typeid into errors
cxxflags += ["/GR-", "/we4541"]
# TODO: should it be a cmake list separated by semicolons?
f.write('set(VCPKG_C_FLAGS "{}")\n'.format(" ".join(cflags)))
f.write('set(VCPKG_CXX_FLAGS "{}")\n'.format(" ".join(cxxflags)))
if len(cflags) >= 1:
f.write('set(VCPKG_C_FLAGS "{}")\n'.format(" ".join(cflags)))
if len(cxxflags) >= 1:
f.write('set(VCPKG_CXX_FLAGS "{}")\n'.format(" ".join(cxxflags)))
f.write("list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS --compile-no-warning-as-error -DVCPKG_CMAKE_CONFIGURE_OPTIONS=17)\n")
if ldflags:
f.write('set(VCPKG_LINKER_FLAGS "{}")\n'.format(" ".join(ldflags)))
Expand Down Expand Up @@ -146,11 +148,12 @@ def add_copyright_header(f):
ldflags = []
cflags = []
if enable_binskim:
cflags += [
"-Wp,-D_FORTIFY_SOURCE=2",
"-Wp,-D_GLIBCXX_ASSERTIONS",
"-fstack-protector-strong",
]
# TODO: enable the following flags for optimized build
#cflags += [
# "-Wp,-D_FORTIFY_SOURCE=2",
# "-Wp,-D_GLIBCXX_ASSERTIONS",
# "-fstack-protector-strong",
#]
if target_abi == "x64":
cflags += ["-fstack-clash-protection", "-fcf-protection"]
elif enable_asan:
Expand All @@ -163,8 +166,10 @@ def add_copyright_header(f):
cxxflags = cflags.copy()
if not enable_rtti:
cxxflags.append("-fno-rtti")
f.write('set(VCPKG_C_FLAGS "{}")\n'.format(" ".join(cflags)))
f.write('set(VCPKG_CXX_FLAGS "{}")\n'.format(" ".join(cxxflags)))
if len(cflags) >= 1:
f.write('set(VCPKG_C_FLAGS "{}")\n'.format(" ".join(cflags)))
if len(cxxflags) >= 1:
f.write('set(VCPKG_CXX_FLAGS "{}")\n'.format(" ".join(cxxflags)))
if os_name == "linux":
f.write("set(VCPKG_CMAKE_SYSTEM_NAME Linux)\n")
else:
Expand Down

0 comments on commit fe31582

Please sign in to comment.