Skip to content

Commit

Permalink
Remove mingw-std-threads from 3rd party deps and use native libs/head…
Browse files Browse the repository at this point in the history
…ers instead (#7283)

* Remove mingw-std-threads from 3rd party deps

 and use native libs/headers instead

* switch MinGW to POSIX in CI
  • Loading branch information
FyiurAmron authored Jun 30, 2024
1 parent 13a05b9 commit edf6bf8
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 61 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions include/AudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
#ifndef LMMS_AUDIO_ENGINE_H
#define LMMS_AUDIO_ENGINE_H

#ifdef __MINGW32__
#include <mingw.mutex.h>
#else
#include <mutex>
#endif

#include <QThread>
#include <samplerate.h>
Expand Down
7 changes: 0 additions & 7 deletions include/ThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,10 @@
#include <type_traits>
#include <vector>

#ifdef __MINGW32__
#include <mingw.condition_variable.h>
#include <mingw.future.h>
#include <mingw.mutex.h>
#include <mingw.thread.h>
#else
#include <condition_variable>
#include <future>
#include <mutex>
#include <thread>
#endif

namespace lmms {
//! A thread pool that can be used for asynchronous processing.
Expand Down
6 changes: 1 addition & 5 deletions plugins/VstBase/RemoteVstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@
#undef Unsorted
#endif

#ifdef USE_MINGW_THREADS_REPLACEMENT
# include <mingw.mutex.h>
#else
# include <mutex>
#endif
#include <mutex>

#include <algorithm>
#include <vector>
Expand Down
15 changes: 0 additions & 15 deletions plugins/VstBase/RemoteVstPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,6 @@ endif()

if(IS_MINGW)
SET(CMAKE_REQUIRED_FLAGS "-std=c++17")

CHECK_CXX_SOURCE_COMPILES("
#include <mutex>
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)
Expand Down
6 changes: 0 additions & 6 deletions plugins/ZynAddSubFx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 0 additions & 6 deletions plugins/ZynAddSubFx/ThreadShims.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#include <condition_variable>
#include <mutex>
#include <thread>

#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS)
# include <mingw.condition_variable.h>
# include <mingw.mutex.h>
# include <mingw.thread.h>
#endif
6 changes: 0 additions & 6 deletions src/3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/3rdparty/mingw-std-threads
Submodule mingw-std-threads deleted from 6c2061
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 0 additions & 4 deletions src/core/FileSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
#include <chrono>
#include <lmmsconfig.h>

#ifdef __MINGW32__
#include <mingw.thread.h>
#else
#include <thread>
#endif

namespace lmms {
FileSearch::FileSearch(const QString& filter, const QStringList& paths, const QStringList& extensions,
Expand Down

0 comments on commit edf6bf8

Please sign in to comment.