Skip to content

Commit

Permalink
next try
Browse files Browse the repository at this point in the history
  • Loading branch information
oltolm committed Apr 18, 2023
1 parent 0c6af50 commit 7d98d90
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 23 deletions.
15 changes: 6 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ cmake_policy (SET CMP0091 NEW)
project (drmingw VERSION 0.9.10 LANGUAGES C CXX)


include(CPack)

option (ENABLE_COVERAGE "Enable code coverage." OFF)


Expand All @@ -27,8 +25,6 @@ add_link_options(
-static-libstdc++
)

link_libraries(ssp)

find_package (WinDbg)

include_directories (
Expand Down Expand Up @@ -61,13 +57,12 @@ include (StaticCRT)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0" OR
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "8.3")
add_compile_options (-fstack-protector-all)
add_link_options(-lssp)
link_libraries(ssp)
endif ()

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
add_compile_definitions (HAVE_WIN64=1)
else ()
add_link_options (-Wl,--enable-stdcall-fixup)
add_compile_definitions (HAVE_WIN64=0)
endif ()

Expand All @@ -91,9 +86,9 @@ add_compile_definitions (
PSAPI_VERSION=2

# version
PACKAGE_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR}
PACKAGE_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR}
PACKAGE_VERSION_PATCH=${CPACK_PACKAGE_VERSION_PATCH}
PACKAGE_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
PACKAGE_VERSION_MINOR=${PROJECT_VERSION_MINOR}
PACKAGE_VERSION_PATCH=${PROJECT_VERSION_PATCH}
)

# Macro to force using debug flags, regardless of the current build type
Expand Down Expand Up @@ -168,3 +163,5 @@ endif ()
set (CPACK_GENERATOR "7Z")

set (CPACK_STRIP_FILES ON)

include(CPack)
4 changes: 0 additions & 4 deletions ci/toolchain/aarch64-w64-mingw32-clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# Statically link CRT
set (CMAKE_C_FLAGS "--start-no-unused-arguments -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments")
set (CMAKE_CXX_FLAGS "--start-no-unused-arguments -static-libstdc++ -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments")
4 changes: 0 additions & 4 deletions ci/toolchain/i686-w64-mingw32-clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# Statically link CRT
set (CMAKE_C_FLAGS "--start-no-unused-arguments -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments")
set (CMAKE_CXX_FLAGS "--start-no-unused-arguments -static-libstdc++ -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments")
4 changes: 0 additions & 4 deletions ci/toolchain/x86_64-w64-mingw32-clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# Statically link CRT
set (CMAKE_C_FLAGS "--start-no-unused-arguments -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments")
set (CMAKE_CXX_FLAGS "--start-no-unused-arguments -static-libstdc++ -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments")
1 change: 0 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ list(APPEND test_targets test_mgwhelp_stripped)
# test_mgwhelp_zdebug
#

option (ENABLE_ZDEBUG_TEST "Enable compressed debug sections test." OFF)
add_custom_command (
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_zdebug.debug
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug --compress-debug-sections $<TARGET_FILE:test_mgwhelp> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_zdebug.debug
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ add_test_executable (ud2 ud2.c)
if (MINGW)
target_compile_options (stack_buffer_overflow PRIVATE -fstack-protector-all)
target_link_options (stack_buffer_overflow PRIVATE -fstack-protector-all)
target_link_libraries (stack_buffer_overflow PRIVATE -Wl,-Bstatic -lssp -Wl,-Bdynamic)
target_link_libraries (stack_buffer_overflow PRIVATE ssp)
endif ()
if (MSVC)
target_compile_options (stack_buffer_overflow PRIVATE /GS)
Expand Down

0 comments on commit 7d98d90

Please sign in to comment.