Skip to content

Commit

Permalink
Restore VS2022 support (#13524)
Browse files Browse the repository at this point in the history
Fix-up of #13387
Fixes #13033

Summary of the issue:
Pr #13387 introduced support for custom UIA extensions, there by using the Microsoft UIA Automation remote operations library. This pr disabled building support for Visual Studio 2022. This has now been solved.

Description of how this pull request fixes the issue:
Fixes build on Visual Studio 2022 by ensuring that the windir environment variable is available. This should eventually be fixed in scons itself, though there's a note in their source code stating that adding environment variables to the basic set that's imported from os.environ should be considered very carefully.
  • Loading branch information
LeonarddeR authored Mar 24, 2022
1 parent 14a9499 commit 7f53efd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions nvdaHelper/archBuild_sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def COMProxyDllBuilder(env,target,source,proxyClsid):
return proxyDll
env.AddMethod(COMProxyDllBuilder,'COMProxyDll')

# We only support compiling with MSVC 14.2 (2019) or newer
if not env.get('MSVC_VERSION') or tuple(map(int, env.get('MSVC_VERSION').split("."))) < (14, 2):
raise RuntimeError("Visual C++ 14.2 (Visual Studio 2019) or newer not found")

TARGET_ARCH=env['TARGET_ARCH']
debug=env['nvdaHelperDebugFlags']
release=env['release']
Expand Down
5 changes: 5 additions & 0 deletions nvdaHelper/microsoft-ui-uiautomation/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Import(
'sourceLibDir',
)

env = env.Clone()
# Building with msbuild requires windir to be set as environment variable,
# otherwise the build fails with Visual Studio 2022
env['ENV']['windir'] = os.environ['windir']

MSUIA_sourceDir = Dir('#include/microsoft-ui-uiautomation/src/uiAutomation')
MSUIA_lib_outDir = Dir('lib')
MSUIA_include_outDir = Dir('include')
Expand Down
13 changes: 7 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ The following dependencies need to be installed on your system:

* [Python](https://www.python.org/), version 3.7, 32 bit
* Use latest minor version if possible.
* Microsoft Visual Studio 2019:
* When you do not use the Visual Studio IDE itself, you can download the [build tools](https://aka.ms/vs/16/release/vs_BuildTools.exe)
* When you are intending to use the Visual Studio IDE (not required for NVDA development), you can download [the community version](https://aka.ms/vs/16/release/vs_Community.exe), which is also used by appveyor
* The Professional and Enterprise versions are also supported
* Preview versions are *not* supported
* Building with Visual Studio 2022 is not officially supported at this stage.
* Microsoft Visual Studio 2019 or 2022:
* To replicate the production build environment, use the [version of Visual Studio 2019 that AppVeyor is using](https://www.appveyor.com/docs/windows-images-software/#visual-studio-2019).
* When you do not use the Visual Studio IDE itself, you can download the [build tools](https://aka.ms/vs/16/release/vs_BuildTools.exe)
* When you are intending to use the Visual Studio IDE (not required for NVDA development), you can download [the community version](https://aka.ms/vs/16/release/vs_Community.exe), which is also used by appveyor
* The Professional and Enterprise versions are also supported
* Preview versions are *not* supported
* Building with Visual Studio 2022 explicitly requires the MSVC v142 - VS 2019 C++ build tools to be installed (see below)
* When installing Visual Studio, you need to enable the following:
* In the list on the Workloads tab
* in the Windows grouping:
Expand Down
5 changes: 0 additions & 5 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ env = Environment(variables=vars,HOST_ARCH='x86',tools=[
"recursiveInstall"
])

# Specifically request to use Visual Studio 2019 (MSVC 14.2).
# This will ensure that this specific version is selected if there are multiple versions installed,
# And fail the build if this version is not installed at all.
env.SetDefault(MSVC_VERSION='14.2')

# speed up subsequent runs by checking timestamps of targets and dependencies, and only using md5 if timestamps differ.
env.Decider('MD5-timestamp')

Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ What's New in NVDA


== Changes for Developers ==
- Compiling NVDA dependencies with Visual Studio 2022 (17.0) is now supported. For development and release builds, Visual Studio 2019 is still used. (#13033)
- When retrieving the count of selected children via accSelection, the case where a negative child ID or an IDispatch is returned by IAccessible::get_accSelection is now handled properly. (#13276)
- ``gui.quit`` has been deprecated for removal in 2023.1. (#13498)
- Use `wx.CallAfter(mainFrame.onExitCommand, None)` directly instead.
Expand Down

0 comments on commit 7f53efd

Please sign in to comment.