-
Notifications
You must be signed in to change notification settings - Fork 8
Add SRAL_DISABLE_UIA CMake option to optionally exclude UIA support #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add SRAL_DISABLE_UIA option (default OFF) to conditionally compile UIA
There was a problem hiding this 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_UIACMake 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) { |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
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.
| # Allow runtime library to be set externally; default to dynamic if not set | ||
| if(NOT CMAKE_MSVC_RUNTIME_LIBRARY) |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
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.
| # 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) |
Add SRAL_DISABLE_UIA option (default OFF) to conditionally compile UIA
Sometimes uia conflicts with static linking sral in some projects.