From 39b335ccef6c545efa71649e009d9cce6633496d Mon Sep 17 00:00:00 2001 From: tpoole Date: Fri, 22 Nov 2024 11:14:10 +0000 Subject: [PATCH] Make building with MinGW a compiler error --- extras/Build/CMake/JUCEHelperTargets.cmake | 6 +++--- extras/Build/CMake/JUCEModuleSupport.cmake | 10 +--------- extras/Build/CMake/JUCEUtils.cmake | 9 --------- modules/juce_core/native/juce_Threads_windows.cpp | 2 +- modules/juce_core/system/juce_TargetPlatform.h | 8 +------- 5 files changed, 6 insertions(+), 29 deletions(-) diff --git a/extras/Build/CMake/JUCEHelperTargets.cmake b/extras/Build/CMake/JUCEHelperTargets.cmake index 244cccec7101..051296daea7c 100644 --- a/extras/Build/CMake/JUCEHelperTargets.cmake +++ b/extras/Build/CMake/JUCEHelperTargets.cmake @@ -140,9 +140,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIA $<$:$,-GL,-flto>>) target_link_libraries(juce_recommended_lto_flags INTERFACE $<$:$<$:-LTCG>>) -elseif((NOT MINGW) AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))) +elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) target_compile_options(juce_recommended_lto_flags INTERFACE $<$:-flto>) target_link_libraries(juce_recommended_lto_flags INTERFACE $<$:-flto>) # Xcode 15.0 requires this flag to avoid a compiler bug diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake index 0d93d36033a6..03378a2090bf 100644 --- a/extras/Build/CMake/JUCEModuleSupport.cmake +++ b/extras/Build/CMake/JUCEModuleSupport.cmake @@ -68,9 +68,7 @@ endfunction() if((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "Linux") - OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD") - OR MSYS - OR MINGW) + OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) # If you really need to override the detected arch for some reason, # you can configure the build with -DJUCE_TARGET_ARCHITECTURE= if(NOT DEFINED JUCE_TARGET_ARCHITECTURE) @@ -654,12 +652,6 @@ function(juce_add_module module_path) endif() _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" windowsLibs) - elseif(MSYS OR MINGW) - if(module_name STREQUAL "juce_gui_basics") - target_compile_options(${module_name} INTERFACE "-Wa,-mbig-obj") - endif() - - _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" mingwLibs) endif() endif() diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index 8a6b0d6e1528..8daccbaa5f16 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -1051,10 +1051,6 @@ function(_juce_add_vst3_manifest_helper_target) target_compile_options(juce_vst3_helper PRIVATE -fobjc-arc) endif() - if(MSYS OR MINGW) - target_link_options(juce_vst3_helper PRIVATE -municode) - endif() - set_target_properties(juce_vst3_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) @@ -1083,11 +1079,6 @@ function(juce_enable_vst3_manifest_step shared_code_target) "juce_enable_copy_plugin_step too.") endif() - if((MSYS OR MINGW) AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) - message(WARNING "VST3 manifest generation is disabled for ${shared_code_target} because the compiler is not supported.") - return() - endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN) message(WARNING "VST3 manifest generation is disabled for ${shared_code_target} because a " "${JUCE_TARGET_ARCHITECTURE} manifest helper cannot run on a host system processor detected to be " diff --git a/modules/juce_core/native/juce_Threads_windows.cpp b/modules/juce_core/native/juce_Threads_windows.cpp index be21a44c637a..a459a7800e21 100644 --- a/modules/juce_core/native/juce_Threads_windows.cpp +++ b/modules/juce_core/native/juce_Threads_windows.cpp @@ -325,7 +325,7 @@ void DynamicLibrary::close() void* DynamicLibrary::getFunction (const String& functionName) noexcept { - return handle != nullptr ? (void*) GetProcAddress ((HMODULE) handle, functionName.toUTF8()) // (void* cast is required for mingw) + return handle != nullptr ? (void*) GetProcAddress ((HMODULE) handle, functionName.toUTF8()) : nullptr; } diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h index 0c55ad7c586a..ee433d33873c 100644 --- a/modules/juce_core/system/juce_TargetPlatform.h +++ b/modules/juce_core/system/juce_TargetPlatform.h @@ -110,13 +110,7 @@ #endif #ifdef __MINGW32__ - #define JUCE_MINGW 1 - #warning Support for MinGW has been removed. Please use an alternative compiler. - #ifdef __MINGW64__ - #define JUCE_64BIT 1 - #else - #define JUCE_32BIT 1 - #endif + #error "MinGW is not supported. Please use an alternative compiler." #endif /** If defined, this indicates that the processor is little-endian. */