Skip to content

Conversation

@alex19EP
Copy link
Contributor

@alex19EP alex19EP commented Jan 5, 2026

Add SRAL_DISABLE_UIA option (default OFF) to conditionally compile UIA

Sometimes uia conflicts with static linking sral in some projects.

Add SRAL_DISABLE_UIA option (default OFF) to conditionally compile UIA
Copilot AI review requested due to automatic review settings January 5, 2026 00:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a CMake option SRAL_DISABLE_UIA to conditionally exclude UI Automation (UIA) support from the SRAL library, addressing static linking conflicts that can occur with UIA in some projects.

Key Changes:

  • Adds SRAL_DISABLE_UIA CMake option (default OFF) to control UIA compilation
  • Conditionally compiles UIA-related source files and links uiautomationcore.lib
  • Changes default MSVC runtime library from static to dynamic linking

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
CMakeLists.txt Adds SRAL_DISABLE_UIA option, conditionally includes UIA sources and libraries, and changes default runtime library to dynamic linking
SRC/SRAL.cpp Guards UIA header include, engine initialization, and Narrator process detection with SRAL_NO_UIA preprocessor checks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


#endif
static void speech_engine_update() {
if (!g_currentEngine || !g_currentEngine->GetActive() || g_currentEngine->GetNumber() == SRAL_ENGINE_SAPI || g_currentEngine->GetNumber() == SRAL_ENGINE_UIA || g_currentEngine->GetNumber() == SRAL_ENGINE_AV_SPEECH) {
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

When SRAL_NO_UIA is defined, the condition still checks for SRAL_ENGINE_UIA even though the UIA engine is never initialized. This comparison against SRAL_ENGINE_UIA will never be true when UIA is disabled, but the check itself can still execute. Consider wrapping the SRAL_ENGINE_UIA check in the condition with a preprocessor directive to avoid the unnecessary comparison when UIA is disabled.

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +8
# Allow runtime library to be set externally; default to dynamic if not set
if(NOT CMAKE_MSVC_RUNTIME_LIBRARY)
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

This change modifies the default runtime library from static (MultiThreaded) to dynamic (MultiThreadedDLL), which is unrelated to the UIA feature toggle. This is a breaking change that could affect existing users who depend on static linking and should be documented or split into a separate PR. If this change is intentional and related to UIA compatibility issues, it should be explained in the PR description.

Suggested change
# Allow runtime library to be set externally; default to dynamic if not set
if(NOT CMAKE_MSVC_RUNTIME_LIBRARY)
# Allow runtime library to be set externally; optionally enable dynamic CRT
option(SRAL_USE_DYNAMIC_MSVC_RUNTIME "Use dynamic MSVC runtime library (/MD, /MDd)" OFF)
if(SRAL_USE_DYNAMIC_MSVC_RUNTIME AND NOT CMAKE_MSVC_RUNTIME_LIBRARY)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant