1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Build: Allow building with llvm-mingw headers

This commit is contained in:
reuk 2022-09-05 21:22:45 +01:00
parent 7391d18b8e
commit 045214c986
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
11 changed files with 212 additions and 65 deletions

View file

@ -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

View file

@ -50,6 +50,8 @@ 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"
@ -57,6 +59,20 @@ extern "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"

View file

@ -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>

View file

@ -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;
}
@ -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;
@ -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;
}

View file

@ -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::row: return 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::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;
}
//==============================================================================
@ -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())
@ -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)
@ -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
@ -269,7 +273,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
break;
}
case ComTypes::UIA_SelectionItemPatternId:
case UIA_SelectionItemPatternId:
{
auto state = accessibilityHandler.getCurrentState();
@ -280,31 +284,31 @@ 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())
@ -312,14 +316,14 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
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);
@ -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:
@ -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,

View file

@ -26,9 +26,6 @@
namespace juce
{
#define UIA_FullDescriptionPropertyId 30159
#define UIA_IsDialogPropertyId 30174
class AccessibilityNativeHandle : public ComBaseClassHelper<IRawElementProviderSimple,
ComTypes::IRawElementProviderFragment,
ComTypes::IRawElementProviderFragmentRoot>

View file

@ -136,6 +136,68 @@ enum ScrollAmount
ScrollAmount_SmallIncrement = 4
};
namespace Constants
{
#undef UIA_InvokePatternId
#undef UIA_SelectionPatternId
#undef UIA_ValuePatternId
#undef UIA_RangeValuePatternId
#undef UIA_ScrollPatternId
#undef UIA_ExpandCollapsePatternId
#undef UIA_GridPatternId
#undef UIA_GridItemPatternId
#undef UIA_WindowPatternId
#undef UIA_SelectionItemPatternId
#undef UIA_TablePatternId
#undef UIA_TableItemPatternId
#undef UIA_TextPatternId
#undef UIA_TogglePatternId
#undef UIA_TransformPatternId
#undef UIA_ScrollItemPatternId
#undef UIA_TextPattern2Id
#undef UIA_StructureChangedEventId
#undef UIA_MenuOpenedEventId
#undef UIA_AutomationFocusChangedEventId
#undef UIA_MenuClosedEventId
#undef UIA_LayoutInvalidatedEventId
#undef UIA_Invoke_InvokedEventId
#undef UIA_SelectionItem_ElementSelectedEventId
#undef UIA_Text_TextSelectionChangedEventId
#undef UIA_Text_TextChangedEventId
#undef UIA_Window_WindowOpenedEventId
#undef UIA_Window_WindowClosedEventId
#undef UIA_IsPeripheralPropertyId
#undef UIA_FullDescriptionPropertyId
#undef UIA_IsDialogPropertyId
#undef UIA_IsReadOnlyAttributeId
#undef UIA_CaretPositionAttributeId
#undef UIA_ButtonControlTypeId
#undef UIA_CheckBoxControlTypeId
#undef UIA_ComboBoxControlTypeId
#undef UIA_EditControlTypeId
#undef UIA_HyperlinkControlTypeId
#undef UIA_ImageControlTypeId
#undef UIA_ListItemControlTypeId
#undef UIA_ListControlTypeId
#undef UIA_MenuBarControlTypeId
#undef UIA_MenuItemControlTypeId
#undef UIA_ProgressBarControlTypeId
#undef UIA_RadioButtonControlTypeId
#undef UIA_ScrollBarControlTypeId
#undef UIA_SliderControlTypeId
#undef UIA_TextControlTypeId
#undef UIA_ToolTipControlTypeId
#undef UIA_TreeControlTypeId
#undef UIA_TreeItemControlTypeId
#undef UIA_CustomControlTypeId
#undef UIA_GroupControlTypeId
#undef UIA_DataItemControlTypeId
#undef UIA_WindowControlTypeId
#undef UIA_HeaderControlTypeId
#undef UIA_HeaderItemControlTypeId
#undef UIA_TableControlTypeId
const long UIA_InvokePatternId = 10000;
const long UIA_SelectionPatternId = 10001;
const long UIA_ValuePatternId = 10002;
@ -165,6 +227,8 @@ const long UIA_Text_TextChangedEventId = 20015;
const long UIA_Window_WindowOpenedEventId = 20016;
const long UIA_Window_WindowClosedEventId = 20017;
const long UIA_IsPeripheralPropertyId = 30150;
const long UIA_FullDescriptionPropertyId = 30159;
const long UIA_IsDialogPropertyId = 30174;
const long UIA_IsReadOnlyAttributeId = 40015;
const long UIA_CaretPositionAttributeId = 40038;
const long UIA_ButtonControlTypeId = 50000;
@ -193,6 +257,8 @@ const long UIA_HeaderControlTypeId = 50034;
const long UIA_HeaderItemControlTypeId = 50035;
const long UIA_TableControlTypeId = 50036;
} // namespace Constants
interface IRawElementProviderFragmentRoot;
interface IRawElementProviderFragment;

View file

@ -66,9 +66,11 @@ private:
if (handler.getActions().invoke (AccessibilityActionType::showMenu))
{
using namespace ComTypes::Constants;
sendAccessibilityAutomationEvent (handler, handler.getCurrentState().isExpanded()
? ComTypes::UIA_MenuOpenedEventId
: ComTypes::UIA_MenuClosedEventId);
? UIA_MenuOpenedEventId
: UIA_MenuClosedEventId);
return S_OK;
}

View file

@ -43,8 +43,10 @@ public:
if (handler.getActions().invoke (AccessibilityActionType::press))
{
using namespace ComTypes::Constants;
if (isElementValid())
sendAccessibilityAutomationEvent (handler, ComTypes::UIA_Invoke_InvokedEventId);
sendAccessibilityAutomationEvent (handler, UIA_Invoke_InvokedEventId);
return S_OK;
}

View file

@ -49,8 +49,10 @@ public:
if (isRadioButton)
{
using namespace ComTypes::Constants;
handler.getActions().invoke (AccessibilityActionType::press);
sendAccessibilityAutomationEvent (handler, ComTypes::UIA_SelectionItem_ElementSelectedEventId);
sendAccessibilityAutomationEvent (handler, UIA_SelectionItem_ElementSelectedEventId);
return S_OK;
}

View file

@ -303,15 +303,17 @@ private:
{
VariantHelpers::clear (pRetVal);
using namespace ComTypes::Constants;
switch (attributeId)
{
case ComTypes::UIA_IsReadOnlyAttributeId:
case UIA_IsReadOnlyAttributeId:
{
VariantHelpers::setBool (textInterface.isReadOnly(), pRetVal);
break;
}
case ComTypes::UIA_CaretPositionAttributeId:
case UIA_CaretPositionAttributeId:
{
auto cursorPos = textInterface.getTextInsertionOffset();