Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@78andyp
Copy link
Member

@78andyp 78andyp commented Nov 14, 2025

Description

To allow Kodi to compile for VS 2026 on windows.
Remove support for VS versions prior to 2022.
Needs CMAKE v4.2+

Motivation and context

VS 2026 support.

How has this been tested?

Locally.

What is the effect on users?

Screenshots (if appropriate):

Types of change

  • Improvement (non-breaking change which improves existing functionality)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • All new and existing tests passed

@github-actions
Copy link

Critical

Overly broad version detection pattern (tools/buildsteps/windows/vswhere.bat:36)
The pattern findstr "18" will match any path containing "18", including potential false positives like "2018" or other paths with "18" in them. This could incorrectly identify non-VS2026 installations as VS2026.

Suggested fix: Use a more specific pattern like findstr "\\18\\" or findstr "2026" to match the actual VS2026 version marker, similar to how 2019 and 2022 are detected by their year.

@fuzzard
Copy link
Contributor

fuzzard commented Nov 14, 2025

Shouldn't have to touch the minimum. It's a minimum after all, not what's being used

@78andyp
Copy link
Member Author

78andyp commented Nov 14, 2025

Shouldn't have to touch the minimum. It's a minimum after all, not what's being used

Does it not matter that the 'Visual Studio 2026 18' generator doesn't exist in versions before 4.2??

@CrystalP
Copy link
Contributor

Thanks for trying VS 2026.
docs\README.Windows.md needs some edits in the prerequisites and manual build,

I don't think BuildSetup.bat should be changed yet.

@78andyp
Copy link
Member Author

78andyp commented Nov 14, 2025

Thanks for trying VS 2026. docs\README.Windows.md needs some edits in the prerequisites and manual build,

I don't think BuildSetup.bat should be changed yet.

Agree. I've marked it as draft already.
I thought it would be helpful for people having a play (like me!) in the interim.
No hurry to merge.

@fuzzard
Copy link
Contributor

fuzzard commented Nov 14, 2025

Shouldn't have to touch the minimum. It's a minimum after all, not what's being used

Does it not matter that the 'Visual Studio 2026 18' generator doesn't exist in versions before 4.2??

No, because Kodi doesn't require 4.2

@thexai
Copy link
Member

thexai commented Nov 14, 2025

Adding support for VS 2026 is not the same as "forcing use VS 2026". As fuzzard says, the minimum requirements shouldn't change. Any changes should be optional and maintain backward compatibility (with VS 2022 at least).

Does it not matter that the 'Visual Studio 2026 18' generator doesn't exist in versions before 4.2??

not matter for use CMake 3.28 + VS 2022 (the minimum required)

If you want use use VS 2026 you need CMake 4.2 (not released yet)

@78andyp
Copy link
Member Author

78andyp commented Nov 14, 2025

Thanks for the clarification.

@78andyp 78andyp marked this pull request as ready for review November 15, 2025 11:19
@github-actions
Copy link

Critical

Overly broad version detection pattern remains unaddressed (tools/buildsteps/windows/vswhere.bat:36)
The pattern findstr "18" matches any path containing "18", causing false positives (e.g., "2018", "C:\Users\User18", directory names with "18"). This differs from the 2019/2022 detection which use full year strings.

Fix: Use findstr "2026" to match the pattern established by existing version checks (lines 32, 34).

@thexai thexai added Type: Improvement non-breaking change which improves existing functionality Platform: Windows Platform: WindowsStore labels Nov 17, 2025
@thexai
Copy link
Member

thexai commented Nov 17, 2025

Not necessary in this PR but as you are here maybe remove support of Visual Studio 2015 removing this block:

IF %vcvars%==no (
  FOR /f "usebackq tokens=1* delims=" %%i in (`%vswhere% -legacy -property installationPath`) do (
    ECHO %%i | findstr "14" >NUL 2>NUL
    IF NOT ERRORLEVEL 1 (
      IF EXIST "%%i\VC\vcvarsall.bat" (
        SET vcvars="%%i\VC\vcvarsall.bat"
        SET vsver=14 2015
      )
    )
  )
)

@78andyp
Copy link
Member Author

78andyp commented Nov 17, 2025

@thexai, thanks - done.

Shall I also simplify:

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  SET vcarch=x64
) else (
  rem arm host tools are only really working in VS 17 2022+
  rem fall back to x64 for older VS installations
  if "%vsvernumber%" GEQ "17" (
    rem PROCESSOR_ARCHITECTURE returns uppercase. Use powershell to
    rem lowercase for comparison and usage with vcvarsall.bat
    FOR /F "usebackq tokens=*" %%A IN (`powershell.exe -Command "('%PROCESSOR_ARCHITECTURE%').ToLower( )"`) DO SET vcarch=%%A
  ) else (
    SET vcarch=x64
  )
)

If VS 2022 is the minimum required.

@78andyp
Copy link
Member Author

78andyp commented Nov 21, 2025

@claude review.

@claude
Copy link

claude bot commented Nov 21, 2025

Claude finished @78andyp's task —— View job


Code Review for PR #27473

  • Read changed files and understand the changes
  • Analyze code for issues and improvements
  • Post review feedback

Summary

This PR adds Visual Studio 2026 support and removes VS 2015/2017 legacy support from vswhere.bat. The changes are straightforward and well-structured.

What's Good ✓

  1. VS 2015 removal - The legacy -legacy fallback block for VS 2015 was correctly removed as requested by @thexai
  2. ARM host tools simplification - The conditional logic for ARM host tools was appropriately simplified since VS 2022 is now the minimum supported version (lines 60-62)
  3. Clean diff - The changes result in a more maintainable file with less conditional complexity

Issue to Address

VS 2026 detection pattern (line 36-37)

The current detection pattern findstr "\\18\\" is correct and addresses the earlier concern about false positives. This pattern specifically looks for \18\ in the path, which correctly matches the VS 2026 installation path structure:

C:\Program Files\Microsoft Visual Studio\18\Community

The escaped backslashes (\\18\\) correctly match the literal backslashes in the Windows path. This is better than findstr "2026" for VS 2026 because:

  • VS 2019 uses 2019 in the path → findstr "2019" works
  • VS 2022 uses 2022 in the path → findstr "2022" works
  • VS 2026 uses 18 (toolset version) in the path, not 2026findstr "\\18\\" is the correct approach

One potential edge case to consider: If VS 2026's installation path actually contains 2026 instead of 18, then findstr "2026" would be needed instead. I'd recommend confirming the actual path structure in VS 2026 Preview. Based on @thexai's comment showing C:\Program Files\Microsoft Visual Studio\18\Community, the current implementation looks correct.

Minor Suggestion

Line 31 still defaults to SET vsver=15 2017 as a fallback. Since VS 2017 is no longer officially supported (VS 2022 is minimum), you might consider:

  • Changing the default to 17 2022, or
  • Adding a warning/error if neither 2019, 2022, nor 2026 is detected

This is a low-priority suggestion since the current behavior still works.

Verdict

The PR looks good and ready to merge once there's confirmation that the VS 2026 installation path structure uses 18 rather than 2026. The simplification of the ARM host tools logic is correct given VS 2022 as the minimum requirement.


@78andyp 78andyp changed the title Visual Studio 2026 support. Visual Studio 2026 support. Minumum version Visual Studio 2022. Nov 21, 2025
@78andyp 78andyp changed the title Visual Studio 2026 support. Minumum version Visual Studio 2022. Visual Studio 2026 support. Minimum version Visual Studio 2022. Nov 21, 2025
@78andyp
Copy link
Member Author

78andyp commented Nov 21, 2025

@claude review

@claude
Copy link

claude bot commented Nov 21, 2025

Claude finished @78andyp's task —— View job


Code Review for PR #27473

  • Read changed files and understand the changes
  • Analyze code for issues and improvements
  • Post review feedback

Summary

This PR adds Visual Studio 2026 support and removes VS 2015/2017/2019 legacy support from vswhere.bat. The changes simplify the codebase significantly now that VS 2022 is the minimum supported version.

What's Good ✓

  1. VS 2015 removal - The legacy -legacy fallback block for VS 2015 was correctly removed as requested by @thexai
  2. VS 2017/2019 detection removal - Since VS 2022 is now the minimum, removing the 2017 and 2019 detection logic is appropriate
  3. ARM host tools simplification - The conditional logic for ARM host tools was correctly simplified (lines 57-59) since VS 2022+ is now assumed
  4. Clean diff - The changes result in a more maintainable file with less conditional complexity (-26 lines, +6 lines)

Issues to Address

1. VS 2026 detection pattern (lines 32-34)

The pattern findstr "\\18\\" is implemented to address the earlier concern about false positives. However, I want to verify the pattern logic:

  • The pattern \\18\\ in a batch file's findstr will look for the literal string \18\ (the backslashes are escaped)
  • This correctly matches paths like C:\Program Files\Microsoft Visual Studio\18\Community

This appears correct assuming VS 2026 uses 18 in its installation path rather than 2026. Based on @thexai's earlier comment confirming the path structure, this should work.

2. Inconsistent indentation (line 32)

    SET vsver=17 2022
	rem Default path for VS2026 does not include text 2026

Line 32 uses a tab character for indentation while the surrounding lines use spaces. This should be corrected for consistency:

    SET vsver=17 2022
    rem Default path for VS2026 does not include text 2026

3. Missing VS 2019 detection (potential issue)

The current implementation defaults to VS 2022 (SET vsver=17 2022) and only checks for VS 2026. If someone has VS 2019 installed (which uses version 16), this script will incorrectly report it as VS 2022.

However, since VS 2022 is now the minimum supported version, users with only VS 2019 should not be using this build system. You may want to add an explicit check/warning if an older VS version is detected, or document that VS 2019 is no longer supported.

Minor Suggestions

  1. Comment clarity - The comment on line 32 could be more precise:
    rem VS2026 path uses version number (18) not year (2026)

Verdict

The PR is well-structured and achieves its goals. The main items to address are:

  1. Required: Fix the inconsistent tab/space indentation on line 32
  2. Optional: Consider if VS 2019 installations should produce a warning/error since it's no longer supported

Once the indentation is fixed, this should be ready to merge.


To build Kodi:
* **Windows** 64bit OS, Windows 10 or above (allows build of x64, win32, ARM64, UWP-64 and UWP-32)
* **[CMake](https://cmake.org/download/)** version 3.28 or greater
* **[CMake](https://cmake.org/download/)** version 3.28 or greater for Visual Studio 2022, version 4.2 or greater for Visual Studio 2026
Copy link
Contributor

Choose a reason for hiding this comment

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

The 4.2 or greater seems wrong

The below is output of cmake version installed with Visual Studio 2026 Community Edition

C:\Program Files\Microsoft Visual Studio\18\Community>cmake --version
cmake version 4.1.1-msvc1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Copy link
Member Author

Choose a reason for hiding this comment

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

Odd. From the changelog https://cmake.org/cmake/help/latest/release/4.2.html
image
I wonder if VS shipped with a custom version prior to 4.2 full release.
There was also a bug in 4.2RC that prevented building without intervention - I don't know it that was present in 4.1.1 - I will try and set up a VM and check.

Copy link
Member Author

@78andyp 78andyp Dec 22, 2025

Choose a reason for hiding this comment

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

@fuzzard - just done some tests
Win11 25H2 in VM with VS Comm 2026 - compiles fine (included CMake v4.1.1-msvc)
Then installed CMake 4.1.4 (latest from 4.1.x branch)
Compile fails:
image
Works again wtih CMake 4.2.1.

Updated readme to reflect this.

@jenkins4kodi jenkins4kodi added the Rebase needed PR that does not apply/merge cleanly to current base branch label Dec 21, 2025
@jenkins4kodi jenkins4kodi removed the Rebase needed PR that does not apply/merge cleanly to current base branch label Dec 22, 2025
The minimum version is Visual Studio 2022.
@78andyp
Copy link
Member Author

78andyp commented Dec 24, 2025

Jenkins build this please

Copy link
Contributor

@fuzzard fuzzard left a comment

Choose a reason for hiding this comment

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

Seems ok to me

@78andyp 78andyp merged commit b42937a into xbmc:master Dec 27, 2025
6 checks passed
Comment on lines -90 to -91
* Select the optional component: `Universal Windows Platform tools`
* Select the optional component: `C++ (v143) Universal Windows Platform tools`
Copy link
Contributor

@CrystalP CrystalP Dec 27, 2025

Choose a reason for hiding this comment

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

These lines went missing.

I don't remember if "Universal Windows Platform tools" is selected by default in VS 2022

However I know runtime 1.43 has to be selected explicitly in the installer (no runtime selected by default). Not sure if it would build without, but you would end up with local settings different from the official build (and most devs at this point)

Copy link
Member Author

Choose a reason for hiding this comment

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

Those options don't seem to exist any more.
Also did a test install of VS2026 Community in a VM with just the main components selected and built kodi fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe they don't exist for VS 2026 but VS 2022 is still the official tool and until deprecated (2019 was only recently removed!), the instructions need to support both versions.

Click in **Individual components** select
* Under **Compilers, build tools and runtimes** section select
* `MSVC v143 - VS 2022 C++ ARM64 build tools (Latest)` (if compiling for ARM64)
* `MSVC Build Tools for ARM64/ARM64EC (Latest)` (if compiling for ARM64)
Copy link
Contributor

Choose a reason for hiding this comment

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

That option does not exist in the VS 2022 installer, only explicitly spelled out version, like the previous version of the readme had. Should be 1.43 for consistency with official builds/other devs, not 1.41 or 1.42

Is the version-less option new in VS 2026?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants