[TEST] MSVC Build Tools for UXP

Discussions about the development and maturation of the platform code (UXP).
Warning: may contain highly-technical topics.

Moderators: trava90, athenian200

User avatar
FranklinDM
Add-ons Team
Add-ons Team
Posts: 570
Joined: 2017-01-14, 02:40
Location: Philippines
Contact:

[TEST] MSVC Build Tools for UXP

Unread post by FranklinDM » 2023-02-25, 18:39

Since MozillaBuild 3.x no longer has any msvc*-specific batch files, I've written a few batch files that target Visual Studio 2017 and higher (primarily tested with VS 2022). Aside from launching the appropriate VS environment, this also populates some essential variables, such as the location of the Windows SDK. They're available in this repository. Let me know if you encounter any issues.

Installation
Simply copy the files inside the /src directory into where you've installed MozillaBuild 3.x, and launch the batch file for your environment:
  • start-shell-msvc2022-x64.bat (64-bit build)
  • start-shell-msvc2022-x86.bat (32-bit build)
Configuration
The following can now be used for specifying the location of the Visual C++ redist in your .mozconfig. With this, you no longer have to hardcode certain directories.
  • $VCINSTALLDIR
  • $VCTOOLSREDISTDIR (MSVC++ Redistributable directory)
  • $SDKDIR (Windows SDK directory)
  • $SDKVER (Windows SDK latest installed version)
Example:

Code: Select all

WIN32_REDIST_DIR="$VCTOOLSREDISTDIR/$_BUILD_ARCH/Microsoft.VC143.CRT"
WIN_UCRT_REDIST_DIR="$SDKDIR/Redist/$SDKVER/ucrt/DLLs/$_BUILD_ARCH"

User avatar
EchedeyLR
Hobby Astronomer
Hobby Astronomer
Posts: 27
Joined: 2022-09-11, 17:54

Re: [TEST] MSVC Build Tools for UXP

Unread post by EchedeyLR » 2023-03-12, 17:35

I have a little question regarding to this.

Is not MSYS2 or directly MinGW a better environment for building applications for Windows which could provide some more centralized building style making it more near how is built to the rest of (POSIX) systems?

User avatar
FranklinDM
Add-ons Team
Add-ons Team
Posts: 570
Joined: 2017-01-14, 02:40
Location: Philippines
Contact:

Re: [TEST] MSVC Build Tools for UXP

Unread post by FranklinDM » 2023-03-14, 10:28

AFAIK we're already using the MSYS environment on Windows. What these batch files aim to do is initialize the MSVC-related variables and avoid having to update the mozconfig or hardcode the directories every time there's an update to the build tools or MSVC runtime itself.

Locked