Skip to content

Commit

Permalink
Removed support for mingw-std-threads
Browse files Browse the repository at this point in the history
The support for MinGW >= 11 is broken (meganz/mingw-std-threads#79),
which prevents building on Debian Bookworm.

This commit fixes it by explicitely building with the POSIX variant of MinGW, which has built-in
support for std threads.
  • Loading branch information
socram8888 committed Feb 15, 2023
1 parent 3382ecc commit 96c61bc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 37 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# 3P dependencies.
include(BuildFmt)
include(BuildSpdlog)

if (BUILD_LINUX_MIDDLEWARE)
include(BuildMingwStdThreads)
endif()

include(BuildGoogleTest)

if (BUILD_TESTS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sudo apt install windows-fido-bridge
You can also build this repository from source:

```
sudo apt install build-essential cmake g++-mingw-w64-x86-64 git
sudo apt install build-essential cmake g++-mingw-w64-x86-64-posix git
git clone https://github.com/mgbowen/windows-fido-bridge.git
cd windows-fido-bridge
Expand Down
6 changes: 2 additions & 4 deletions cmake/BuildGoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
if (MINGW)
# When cross-compiling with MinGW, make the Google Test-generated
# executables statically-linked to allow them to run with no extra DLLs.
include(BuildMingwStdThreads)

target_link_libraries(gtest PUBLIC -static mingw_stdthreads)
target_link_libraries(gtest_main PUBLIC -static mingw_stdthreads)
target_link_libraries(gtest PUBLIC -static)
target_link_libraries(gtest_main PUBLIC -static)
endif()
23 changes: 0 additions & 23 deletions cmake/BuildMingwStdThreads.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions cmake/BuildSpdlog.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include(BuildFmt)
include(BuildMingwStdThreads)

include(FetchContent)

Expand All @@ -22,5 +21,5 @@ option(SPDLOG_FMT_EXTERNAL "" ON)
add_subdirectory(${spdlog_SOURCE_DIR} ${spdlog_BINARY_DIR})

if (MINGW)
target_link_libraries(spdlog PUBLIC mingw_stdthreads fmt)
target_link_libraries(spdlog PUBLIC fmt)
endif()
4 changes: 2 additions & 2 deletions cmake/toolchain-mingw64.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(prefix x86_64-w64-mingw32-)
set(CMAKE_C_COMPILER ${prefix}gcc)
set(CMAKE_CXX_COMPILER ${prefix}g++)
set(CMAKE_C_COMPILER ${prefix}gcc-posix)
set(CMAKE_CXX_COMPILER ${prefix}g++-posix)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
Expand Down

0 comments on commit 96c61bc

Please sign in to comment.