Merge pull request #6931 from def-/pr-mingw-stack-protector

Fix build which broke in 3 different ways
This commit is contained in:
heinrich5991 2023-07-28 15:09:39 +00:00 committed by GitHub
commit b57cd2e210
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 2 deletions

View file

@ -297,6 +297,9 @@ if(NOT MSVC AND NOT HAIKU)
if(SECURITY_COMPILER_FLAGS) if(SECURITY_COMPILER_FLAGS)
# Protect the stack pointer. # Protect the stack pointer.
add_cxx_compiler_flag_if_supported(OUR_FLAGS -fstack-protector-strong) add_cxx_compiler_flag_if_supported(OUR_FLAGS -fstack-protector-strong)
if(MINGW)
add_linker_flag_if_supported(OUR_FLAGS_LINK -lssp)
endif()
endif() endif()
# Disable exceptions as DDNet does not use them. # Disable exceptions as DDNet does not use them.
@ -573,6 +576,10 @@ if(EXCEPTION_HANDLING)
find_package(ExceptionHandling) find_package(ExceptionHandling)
endif() endif()
if(SECURITY_COMPILER_FLAGS)
find_package(SSP)
endif()
if(TARGET_OS AND TARGET_OS STREQUAL "mac") if(TARGET_OS AND TARGET_OS STREQUAL "mac")
find_program(CMAKE_OTOOL otool) find_program(CMAKE_OTOOL otool)
find_program(DMGBUILD dmgbuild) find_program(DMGBUILD dmgbuild)
@ -1755,6 +1762,7 @@ set(COPY_FILES
${DISCORDSDK_COPY_FILES} ${DISCORDSDK_COPY_FILES}
${VULKAN_COPY_FILES} ${VULKAN_COPY_FILES}
${EXCEPTION_HANDLING_COPY_FILES} ${EXCEPTION_HANDLING_COPY_FILES}
${SSP_COPY_FILES}
) )
file(COPY ${COPY_FILES} DESTINATION .) file(COPY ${COPY_FILES} DESTINATION .)
# Don't add integration test files to COPY_FILES since we don't want to add # Don't add integration test files to COPY_FILES since we don't want to add

View file

@ -1,4 +1,6 @@
find_program(GLSLANG_VALIDATOR_PROGRAM glslangValidator) find_program(GLSLANG_VALIDATOR_PROGRAM
NAMES glslang glslangValidator
)
find_program(SPIRV_OPTIMIZER_PROGRAM spirv-opt) find_program(SPIRV_OPTIMIZER_PROGRAM spirv-opt)
set(GLSLANG_VALIDATOR_PROGRAM_FOUND TRUE) set(GLSLANG_VALIDATOR_PROGRAM_FOUND TRUE)

17
cmake/FindSSP.cmake Normal file
View file

@ -0,0 +1,17 @@
if(TARGET_OS STREQUAL "windows")
set_extra_dirs_lib(SSP ssp)
find_file(SSP_LIBRARY
NAMES libssp-0.dll
HINTS ${HINTS_SSP_LIBDIR}
PATHS ${PATHS_SSP_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
is_bundled(SSP_BUNDLED "${SSP_LIBRARY}")
if(NOT SSP_BUNDLED)
message(FATAL_ERROR "could not find ssp paths")
endif()
set(SSP_COPY_FILES
"${EXTRA_SSP_LIBDIR}/libssp-0.dll"
)
endif()

@ -1 +1 @@
Subproject commit 328fd20b5d94b253d699130390bc23c72fae8dca Subproject commit 59d64dbb36ade02607ad20a7f3a45605ab1de80d