From edf6bf8dfe2a1354dc04b05f679754613e8f1a40 Mon Sep 17 00:00:00 2001 From: FyiurAmron Date: Sun, 30 Jun 2024 21:49:06 +0200 Subject: [PATCH] Remove mingw-std-threads from 3rd party deps and use native libs/headers instead (#7283) * Remove mingw-std-threads from 3rd party deps and use native libs/headers instead * switch MinGW to POSIX in CI --- .github/workflows/build.yml | 6 ++++++ .gitmodules | 3 --- include/AudioEngine.h | 4 ---- include/ThreadPool.h | 7 ------- plugins/VstBase/RemoteVstPlugin.cpp | 6 +----- plugins/VstBase/RemoteVstPlugin/CMakeLists.txt | 15 --------------- plugins/ZynAddSubFx/CMakeLists.txt | 6 ------ plugins/ZynAddSubFx/ThreadShims.h | 6 ------ src/3rdparty/CMakeLists.txt | 6 ------ src/3rdparty/mingw-std-threads | 1 - src/CMakeLists.txt | 4 ---- src/core/FileSearch.cpp | 4 ---- 12 files changed, 7 insertions(+), 61 deletions(-) delete mode 160000 src/3rdparty/mingw-std-threads diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db397d848..9a63375c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -183,6 +183,12 @@ jobs: CCACHE_NOCOMPRESS: 1 MAKEFLAGS: -j2 steps: + - name: Enable POSIX MinGW + run: | + update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix + update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix + update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix + update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix - name: Configure git run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Check out diff --git a/.gitmodules b/.gitmodules index 1c43fd1b3..58c4d8526 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,9 +25,6 @@ [submodule "src/3rdparty/weakjack/weakjack"] path = src/3rdparty/weakjack/weakjack url = https://github.com/x42/weakjack.git -[submodule "src/3rdparty/mingw-std-threads"] - path = src/3rdparty/mingw-std-threads - url = https://github.com/meganz/mingw-std-threads.git [submodule "doc/wiki"] path = doc/wiki url = https://github.com/lmms/lmms.wiki.git diff --git a/include/AudioEngine.h b/include/AudioEngine.h index 923bc0092..f80c860d8 100644 --- a/include/AudioEngine.h +++ b/include/AudioEngine.h @@ -25,11 +25,7 @@ #ifndef LMMS_AUDIO_ENGINE_H #define LMMS_AUDIO_ENGINE_H -#ifdef __MINGW32__ -#include -#else #include -#endif #include #include diff --git a/include/ThreadPool.h b/include/ThreadPool.h index b1d7900a6..ad4d79850 100644 --- a/include/ThreadPool.h +++ b/include/ThreadPool.h @@ -31,17 +31,10 @@ #include #include -#ifdef __MINGW32__ -#include -#include -#include -#include -#else #include #include #include #include -#endif namespace lmms { //! A thread pool that can be used for asynchronous processing. diff --git a/plugins/VstBase/RemoteVstPlugin.cpp b/plugins/VstBase/RemoteVstPlugin.cpp index ba40bcb68..ef31cfdb8 100644 --- a/plugins/VstBase/RemoteVstPlugin.cpp +++ b/plugins/VstBase/RemoteVstPlugin.cpp @@ -87,11 +87,7 @@ #undef Unsorted #endif -#ifdef USE_MINGW_THREADS_REPLACEMENT -# include -#else -# include -#endif +#include #include #include diff --git a/plugins/VstBase/RemoteVstPlugin/CMakeLists.txt b/plugins/VstBase/RemoteVstPlugin/CMakeLists.txt index a3cd517ff..dd15bb0bd 100644 --- a/plugins/VstBase/RemoteVstPlugin/CMakeLists.txt +++ b/plugins/VstBase/RemoteVstPlugin/CMakeLists.txt @@ -66,21 +66,6 @@ endif() if(IS_MINGW) SET(CMAKE_REQUIRED_FLAGS "-std=c++17") - - CHECK_CXX_SOURCE_COMPILES(" - #include - int main(int argc, const char* argv[]) { - std::mutex m; - return 0; - } - " HAS_STD_MUTEX) - - if(NOT HAS_STD_MUTEX) - target_include_directories(${EXE_NAME} SYSTEM PRIVATE - "${LMMS_SOURCE_DIR}/src/3rdparty/mingw-std-threads") - target_compile_definitions(${EXE_NAME} PRIVATE - -DUSE_MINGW_THREADS_REPLACEMENT) - endif() endif() if(LMMS_BUILD_WIN32) diff --git a/plugins/ZynAddSubFx/CMakeLists.txt b/plugins/ZynAddSubFx/CMakeLists.txt index a0eb6f36a..b3490a50f 100644 --- a/plugins/ZynAddSubFx/CMakeLists.txt +++ b/plugins/ZynAddSubFx/CMakeLists.txt @@ -111,12 +111,6 @@ set_target_properties(zynaddsubfx_nio PROPERTIES SYSTEM TRUE) set_target_properties(zynaddsubfx_gui PROPERTIES SYSTEM TRUE) set_target_properties(zynaddsubfx_synth PROPERTIES SYSTEM TRUE) -if(MINGW) - target_link_libraries(zynaddsubfx_nio PUBLIC mingw_stdthreads) - target_link_libraries(zynaddsubfx_gui PUBLIC mingw_stdthreads) - target_link_libraries(zynaddsubfx_synth PUBLIC mingw_stdthreads) -endif() - # Relative include paths don't work automatically for the GUI, because the # generated C++ files aren't in the source directory. Thus, add the expected # source directory as an additional include directory. diff --git a/plugins/ZynAddSubFx/ThreadShims.h b/plugins/ZynAddSubFx/ThreadShims.h index 843b50fb5..ff947b3d0 100644 --- a/plugins/ZynAddSubFx/ThreadShims.h +++ b/plugins/ZynAddSubFx/ThreadShims.h @@ -1,9 +1,3 @@ #include #include #include - -#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS) -# include -# include -# include -#endif diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt index 4467cd075..e5cb62527 100644 --- a/src/3rdparty/CMakeLists.txt +++ b/src/3rdparty/CMakeLists.txt @@ -11,12 +11,6 @@ target_include_directories(jack_headers INTERFACE jack2/common) ADD_SUBDIRECTORY(hiir) ADD_SUBDIRECTORY(weakjack) -if(MINGW) - option(MINGW_STDTHREADS_GENERATE_STDHEADERS "" ON) - add_subdirectory(mingw-std-threads) - set(LMMS_USE_MINGW_STD_THREADS ON PARENT_SCOPE) -endif() - # The lockless ring buffer library is linked as part of the core add_library(ringbuffer OBJECT ringbuffer/src/lib/ringbuffer.cpp diff --git a/src/3rdparty/mingw-std-threads b/src/3rdparty/mingw-std-threads deleted file mode 160000 index 6c2061b7d..000000000 --- a/src/3rdparty/mingw-std-threads +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6c2061b7da41d6aa1b2162ff4383ec3ece864bc6 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 940d485f9..5aefebf7a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -154,10 +154,6 @@ if(LMMS_HAVE_OGGVORBIS) list(APPEND EXTRA_LIBRARIES Vorbis::vorbisenc Vorbis::vorbisfile) endif() -if(LMMS_USE_MINGW_STD_THREADS) - list(APPEND EXTRA_LIBRARIES mingw_stdthreads) -endif() - SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} diff --git a/src/core/FileSearch.cpp b/src/core/FileSearch.cpp index fe1efd97e..8a668360e 100644 --- a/src/core/FileSearch.cpp +++ b/src/core/FileSearch.cpp @@ -28,11 +28,7 @@ #include #include -#ifdef __MINGW32__ -#include -#else #include -#endif namespace lmms { FileSearch::FileSearch(const QString& filter, const QStringList& paths, const QStringList& extensions,