Skip to content

Commit

Permalink
Build: Allow building with llvm-mingw headers
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Sep 12, 2022
1 parent 7391d18 commit 045214c
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 66 deletions.
44 changes: 42 additions & 2 deletions extras/Build/juceaide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,52 @@ if(JUCE_BUILD_HELPER_TOOLS)
else()
# If we're building using the NDK, the gradle wrapper will try to inject its own compiler using
# environment variables, which is unfortunate because we really don't want to cross-compile
# juceaide. If you really want to set the compilers for juceaide, pass the appropriate
# CMAKE_<lang>_COMPILER flags when configuring CMake.
# juceaide.
# Similarly, when cross-compiling from Linux->Windows (e.g. using
# Fedora's mingw64-cmake command), the environment might be configured
# for cross-compiling, and we'll need to attempt to put it back to the
# host settings in order to build an executable that can run on the host
# machine.
if(CMAKE_CROSSCOMPILING)
unset(ENV{ADDR2LINE})
unset(ENV{AR})
unset(ENV{ASM})
unset(ENV{AS})
unset(ENV{CC})
unset(ENV{CPP})
unset(ENV{CXXFILT})
unset(ENV{CXX})
unset(ENV{DLLTOOL})
unset(ENV{DLLWRAP})
unset(ENV{ELFEDIT})
unset(ENV{GCC})
unset(ENV{GCOV_DUMP})
unset(ENV{GCOV_TOOL})
unset(ENV{GCOV})
unset(ENV{GPROF})
unset(ENV{GXX})
unset(ENV{LDFLAGS})
unset(ENV{LD_BFD})
unset(ENV{LD})
unset(ENV{LTO_DUMP})
unset(ENV{NM})
unset(ENV{OBJCOPY})
unset(ENV{OBJDUMP})
unset(ENV{PKG_CONFIG_LIBDIR})
unset(ENV{PKG_CONFIG})
unset(ENV{RANLIB})
unset(ENV{RC})
unset(ENV{READELF})
unset(ENV{SIZE})
unset(ENV{STRINGS})
unset(ENV{STRIP})
unset(ENV{WIDL})
unset(ENV{WINDMC})
unset(ENV{WINDRES})

if(DEFINED ENV{PATH_ORIG})
set(ENV{PATH} "$ENV{PATH_ORIG}")
endif()
else()
# When building with clang-cl in Clion on Windows for an x64 target, the ABI detection phase
# of the inner build can fail unless we pass through these flags too
Expand Down
16 changes: 16 additions & 0 deletions modules/juce_audio_processors/format_types/juce_LV2SupportLibs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,29 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4100 4200 4244 4267 4389 4702 4706 4800 4996 63
extern "C"
{

#include <math.h>

#define is_windows_path serd_is_windows_path

#include "serd/src/base64.c"
#include "serd/src/byte_source.c"
#include "serd/src/env.c"
#include "serd/src/n3.c"
#undef TRY

// node.c will replace isnan and isinf with _isnan and _finite if the former symbols are undefined.
// MinGW declares these as normal functions rather than as preprocessor definitions, causing the build to fail.
#if defined (_WIN32) && defined (__GNUC__)

namespace Utils
{
inline int _isnan (double x) noexcept { return isnan (x); }
inline int _finite (double x) noexcept { return ! isinf (x); }
} // namespace Utils

using namespace Utils;
#endif

#include "serd/src/node.c"
#include "serd/src/reader.c"
#include "serd/src/string.c"
Expand Down
14 changes: 12 additions & 2 deletions modules/juce_gui_basics/juce_gui_basics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,19 @@
#include <vfw.h>
#include <commdlg.h>
#include <commctrl.h>
#include <UIAutomation.h>
#include <sapi.h>
#include <Dxgi.h>
#include <dxgi.h>

#if JUCE_MINGW
// Some MinGW headers use 'new' as a parameter name
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wkeyword-macro")
#define new new_
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif

#include <uiautomation.h>

#undef new

#if JUCE_WEB_BROWSER
#include <exdisp.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ void sendAccessibilityPropertyChangedEvent (const AccessibilityHandler& handler,

void notifyAccessibilityEventInternal (const AccessibilityHandler& handler, InternalAccessibilityEvent eventType)
{
using namespace ComTypes::Constants;

if (eventType == InternalAccessibilityEvent::elementCreated
|| eventType == InternalAccessibilityEvent::elementDestroyed)
{
if (auto* parent = handler.getParent())
sendAccessibilityAutomationEvent (*parent, ComTypes::UIA_LayoutInvalidatedEventId);
sendAccessibilityAutomationEvent (*parent, UIA_LayoutInvalidatedEventId);

return;
}
Expand All @@ -176,9 +178,9 @@ void notifyAccessibilityEventInternal (const AccessibilityHandler& handler, Inte
{
switch (eventType)
{
case InternalAccessibilityEvent::focusChanged: return ComTypes::UIA_AutomationFocusChangedEventId;
case InternalAccessibilityEvent::windowOpened: return ComTypes::UIA_Window_WindowOpenedEventId;
case InternalAccessibilityEvent::windowClosed: return ComTypes::UIA_Window_WindowClosedEventId;
case InternalAccessibilityEvent::focusChanged: return UIA_AutomationFocusChangedEventId;
case InternalAccessibilityEvent::windowOpened: return UIA_Window_WindowOpenedEventId;
case InternalAccessibilityEvent::windowClosed: return UIA_Window_WindowClosedEventId;
case InternalAccessibilityEvent::elementCreated:
case InternalAccessibilityEvent::elementDestroyed:
case InternalAccessibilityEvent::elementMovedOrResized: break;
Expand Down Expand Up @@ -221,12 +223,14 @@ void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent eventTyp

auto event = [eventType]() -> EVENTID
{
using namespace ComTypes::Constants;

switch (eventType)
{
case AccessibilityEvent::textSelectionChanged: return ComTypes::UIA_Text_TextSelectionChangedEventId;
case AccessibilityEvent::textChanged: return ComTypes::UIA_Text_TextChangedEventId;
case AccessibilityEvent::structureChanged: return ComTypes::UIA_StructureChangedEventId;
case AccessibilityEvent::rowSelectionChanged: return ComTypes::UIA_SelectionItem_ElementSelectedEventId;
case AccessibilityEvent::textSelectionChanged: return UIA_Text_TextSelectionChangedEventId;
case AccessibilityEvent::textChanged: return UIA_Text_TextChangedEventId;
case AccessibilityEvent::structureChanged: return UIA_StructureChangedEventId;
case AccessibilityEvent::rowSelectionChanged: return UIA_SelectionItem_ElementSelectedEventId;
case AccessibilityEvent::titleChanged:
case AccessibilityEvent::valueChanged: break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,46 +96,48 @@ static String getAutomationId (const AccessibilityHandler& handler)

static auto roleToControlTypeId (AccessibilityRole roleType)
{
using namespace ComTypes::Constants;

switch (roleType)
{
case AccessibilityRole::popupMenu:
case AccessibilityRole::dialogWindow:
case AccessibilityRole::splashScreen:
case AccessibilityRole::window: return ComTypes::UIA_WindowControlTypeId;
case AccessibilityRole::window: return UIA_WindowControlTypeId;

case AccessibilityRole::label:
case AccessibilityRole::staticText: return ComTypes::UIA_TextControlTypeId;
case AccessibilityRole::staticText: return UIA_TextControlTypeId;

case AccessibilityRole::column:
case AccessibilityRole::row: return ComTypes::UIA_ListItemControlTypeId;

case AccessibilityRole::button: return ComTypes::UIA_ButtonControlTypeId;
case AccessibilityRole::toggleButton: return ComTypes::UIA_CheckBoxControlTypeId;
case AccessibilityRole::radioButton: return ComTypes::UIA_RadioButtonControlTypeId;
case AccessibilityRole::comboBox: return ComTypes::UIA_ComboBoxControlTypeId;
case AccessibilityRole::image: return ComTypes::UIA_ImageControlTypeId;
case AccessibilityRole::slider: return ComTypes::UIA_SliderControlTypeId;
case AccessibilityRole::editableText: return ComTypes::UIA_EditControlTypeId;
case AccessibilityRole::menuItem: return ComTypes::UIA_MenuItemControlTypeId;
case AccessibilityRole::menuBar: return ComTypes::UIA_MenuBarControlTypeId;
case AccessibilityRole::table: return ComTypes::UIA_TableControlTypeId;
case AccessibilityRole::tableHeader: return ComTypes::UIA_HeaderControlTypeId;
case AccessibilityRole::cell: return ComTypes::UIA_DataItemControlTypeId;
case AccessibilityRole::hyperlink: return ComTypes::UIA_HyperlinkControlTypeId;
case AccessibilityRole::list: return ComTypes::UIA_ListControlTypeId;
case AccessibilityRole::listItem: return ComTypes::UIA_ListItemControlTypeId;
case AccessibilityRole::tree: return ComTypes::UIA_TreeControlTypeId;
case AccessibilityRole::treeItem: return ComTypes::UIA_TreeItemControlTypeId;
case AccessibilityRole::progressBar: return ComTypes::UIA_ProgressBarControlTypeId;
case AccessibilityRole::group: return ComTypes::UIA_GroupControlTypeId;
case AccessibilityRole::scrollBar: return ComTypes::UIA_ScrollBarControlTypeId;
case AccessibilityRole::tooltip: return ComTypes::UIA_ToolTipControlTypeId;
case AccessibilityRole::row: return UIA_ListItemControlTypeId;

case AccessibilityRole::button: return UIA_ButtonControlTypeId;
case AccessibilityRole::toggleButton: return UIA_CheckBoxControlTypeId;
case AccessibilityRole::radioButton: return UIA_RadioButtonControlTypeId;
case AccessibilityRole::comboBox: return UIA_ComboBoxControlTypeId;
case AccessibilityRole::image: return UIA_ImageControlTypeId;
case AccessibilityRole::slider: return UIA_SliderControlTypeId;
case AccessibilityRole::editableText: return UIA_EditControlTypeId;
case AccessibilityRole::menuItem: return UIA_MenuItemControlTypeId;
case AccessibilityRole::menuBar: return UIA_MenuBarControlTypeId;
case AccessibilityRole::table: return UIA_TableControlTypeId;
case AccessibilityRole::tableHeader: return UIA_HeaderControlTypeId;
case AccessibilityRole::cell: return UIA_DataItemControlTypeId;
case AccessibilityRole::hyperlink: return UIA_HyperlinkControlTypeId;
case AccessibilityRole::list: return UIA_ListControlTypeId;
case AccessibilityRole::listItem: return UIA_ListItemControlTypeId;
case AccessibilityRole::tree: return UIA_TreeControlTypeId;
case AccessibilityRole::treeItem: return UIA_TreeItemControlTypeId;
case AccessibilityRole::progressBar: return UIA_ProgressBarControlTypeId;
case AccessibilityRole::group: return UIA_GroupControlTypeId;
case AccessibilityRole::scrollBar: return UIA_ScrollBarControlTypeId;
case AccessibilityRole::tooltip: return UIA_ToolTipControlTypeId;

case AccessibilityRole::ignored:
case AccessibilityRole::unspecified: break;
};

return ComTypes::UIA_CustomControlTypeId;
return UIA_CustomControlTypeId;
}

//==============================================================================
Expand Down Expand Up @@ -206,38 +208,40 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
return false;
};

using namespace ComTypes::Constants;

switch (pId)
{
case ComTypes::UIA_WindowPatternId:
case UIA_WindowPatternId:
{
if (fragmentRoot)
return new UIAWindowProvider (this);

break;
}
case ComTypes::UIA_TransformPatternId:
case UIA_TransformPatternId:
{
if (fragmentRoot)
return new UIATransformProvider (this);

break;
}
case ComTypes::UIA_TextPatternId:
case ComTypes::UIA_TextPattern2Id:
case UIA_TextPatternId:
case UIA_TextPattern2Id:
{
if (accessibilityHandler.getTextInterface() != nullptr)
return new UIATextProvider (this);

break;
}
case ComTypes::UIA_ValuePatternId:
case UIA_ValuePatternId:
{
if (accessibilityHandler.getValueInterface() != nullptr)
return new UIAValueProvider (this);

break;
}
case ComTypes::UIA_RangeValuePatternId:
case UIA_RangeValuePatternId:
{
if (accessibilityHandler.getValueInterface() != nullptr
&& accessibilityHandler.getValueInterface()->getRange().isValid())
Expand All @@ -247,7 +251,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn

break;
}
case ComTypes::UIA_TogglePatternId:
case UIA_TogglePatternId:
{
if (accessibilityHandler.getCurrentState().isCheckable()
&& (accessibilityHandler.getActions().contains (AccessibilityActionType::toggle)
Expand All @@ -258,7 +262,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn

break;
}
case ComTypes::UIA_SelectionPatternId:
case UIA_SelectionPatternId:
{
if (role == AccessibilityRole::list
|| role == AccessibilityRole::popupMenu
Expand All @@ -269,7 +273,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn

break;
}
case ComTypes::UIA_SelectionItemPatternId:
case UIA_SelectionItemPatternId:
{
auto state = accessibilityHandler.getCurrentState();

Expand All @@ -280,46 +284,46 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn

break;
}
case ComTypes::UIA_TablePatternId:
case ComTypes::UIA_GridPatternId:
case UIA_TablePatternId:
case UIA_GridPatternId:
{
if (accessibilityHandler.getTableInterface() != nullptr
&& (pId == ComTypes::UIA_GridPatternId || accessibilityHandler.getRole() == AccessibilityRole::table))
&& (pId == UIA_GridPatternId || accessibilityHandler.getRole() == AccessibilityRole::table))
return static_cast<ComTypes::IGridProvider*> (new UIAGridProvider (this));

break;
}
case ComTypes::UIA_TableItemPatternId:
case ComTypes::UIA_GridItemPatternId:
case UIA_TableItemPatternId:
case UIA_GridItemPatternId:
{
if (isListOrTableCell (accessibilityHandler))
return static_cast<ComTypes::IGridItemProvider*> (new UIAGridItemProvider (this));

break;
}
case ComTypes::UIA_InvokePatternId:
case UIA_InvokePatternId:
{
if (accessibilityHandler.getActions().contains (AccessibilityActionType::press))
return new UIAInvokeProvider (this);

break;
}
case ComTypes::UIA_ExpandCollapsePatternId:
case UIA_ExpandCollapsePatternId:
{
if (accessibilityHandler.getActions().contains (AccessibilityActionType::showMenu)
&& accessibilityHandler.getCurrentState().isExpandable())
return new UIAExpandCollapseProvider (this);

break;
}
case ComTypes::UIA_ScrollPatternId:
case UIA_ScrollPatternId:
{
if (accessibilityHandler.getTableInterface() != nullptr)
return new UIAScrollProvider (this);

break;
}
case ComTypes::UIA_ScrollItemPatternId:
case UIA_ScrollItemPatternId:
{
if (isListOrTableCell (accessibilityHandler))
return new UIAScrollItemProvider (this);
Expand All @@ -345,6 +349,8 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPropertyValue (PROPERTYID propertyI
const auto state = accessibilityHandler.getCurrentState();
const auto ignored = accessibilityHandler.isIgnored();

using namespace ComTypes::Constants;

switch (propertyId)
{
case UIA_AutomationIdPropertyId:
Expand Down Expand Up @@ -389,7 +395,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPropertyValue (PROPERTYID propertyI
VariantHelpers::setBool (textInterface->isDisplayingProtectedText(), pRetVal);

break;
case ComTypes::UIA_IsPeripheralPropertyId:
case UIA_IsPeripheralPropertyId:
VariantHelpers::setBool (role == AccessibilityRole::tooltip
|| role == AccessibilityRole::popupMenu
|| role == AccessibilityRole::splashScreen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
namespace juce
{

#define UIA_FullDescriptionPropertyId 30159
#define UIA_IsDialogPropertyId 30174

class AccessibilityNativeHandle : public ComBaseClassHelper<IRawElementProviderSimple,
ComTypes::IRawElementProviderFragment,
ComTypes::IRawElementProviderFragmentRoot>
Expand Down
Loading

0 comments on commit 045214c

Please sign in to comment.