Skip to content

Commit

Permalink
Make building with MinGW a compiler error
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoole committed Nov 22, 2024
1 parent f0928eb commit 39b335c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 29 deletions.
6 changes: 3 additions & 3 deletions extras/Build/CMake/JUCEHelperTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIA
$<$<CONFIG:Release>:$<IF:$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">,-GL,-flto>>)
target_link_libraries(juce_recommended_lto_flags INTERFACE
$<$<CONFIG:Release>:$<$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">:-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 $<$<CONFIG:Release>:-flto>)
target_link_libraries(juce_recommended_lto_flags INTERFACE $<$<CONFIG:Release>:-flto>)
# Xcode 15.0 requires this flag to avoid a compiler bug
Expand Down
10 changes: 1 addition & 9 deletions extras/Build/CMake/JUCEModuleSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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=<custom arch>
if(NOT DEFINED JUCE_TARGET_ARCHITECTURE)
Expand Down Expand Up @@ -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()

Expand Down
9 changes: 0 additions & 9 deletions extras/Build/CMake/JUCEUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion modules/juce_core/native/juce_Threads_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 1 addition & 7 deletions modules/juce_core/system/juce_TargetPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

1 comment on commit 39b335c

@dromer
Copy link

@dromer dromer commented on 39b335c Nov 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

Please sign in to comment.