diff --git a/doc/building.md b/doc/building.md index b7cebc72eca..71af6261134 100644 --- a/doc/building.md +++ b/doc/building.md @@ -1,13 +1,38 @@ -# How to build Openconsole +# How to build OpenConsole -Openconsole can be built with Visual Studio or from the command line. There are build scripts for both cmd and PowerShell in /tools. +This repository uses [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) for some of its dependencies. To make sure submodules are restored or updated, be sure to run the following prior to building: + +```shell +git submodule update --init --recursive +``` + +OpenConsole.sln may be built from within Visual Studio or from the command-line using a set of convenience scripts & tools in the **/tools** directory: When using Visual Studio, be sure to set up the path for code formatting. This can be done in Visual Studio by going to Tools > Options > Text Editor > C++ > Formatting and checking "Use custom clang-format.exe file" and choosing the clang-format.exe in the repository at /dep/llvm/clang-format.exe by clicking "browse" right under the check box. -## Building with cmd +### Building in PowerShell + +```powershell +Import-Module .\tools\OpenConsole.psm1 +Set-MsBuildDevEnvironment +Invoke-OpenConsoleBuild +``` + +There are a few additional exported functions (look at their documentation for further details): -The cmd scripts are set up to emulate a portion of the OS razzle build environment. razzle.cmd is the first script that should be run. bcz.cmd will build clean and bz.cmd should build incrementally. +- `Invoke-OpenConsoleBuild` - builds the solution. Can be passed msbuild arguments. +- `Invoke-OpenConsoleTests` - runs the various tests. Will run the unit tests by default. +- `Start-OpenConsole` - starts Openconsole.exe from the output directory. x64 is run by default. +- `Debug-OpenConsole` - starts Openconsole.exe and attaches it to the default debugger. x64 is run by default. +- `Invoke-CodeFormat` - uses clang-format to format all c++ files to match our coding style. + +### Building in Cmd + +```shell +.\tools\razzle.cmd +bcz +``` There are also scripts for running the tests: - `runut.cmd` - run the unit tests @@ -15,15 +40,13 @@ There are also scripts for running the tests: - `runuia.cmd` - run the UIA tests - `runformat` - uses clang-format to format all c++ files to match our coding style. -## Build with Powershell +## Running & Debugging -Openconsole.psm1 should be loaded with `Import-Module`. From there `Set-MsbuildDevEnvironment` will set up environment variables required to build. There are a few exported functions (look at their documentation for further details): +To debug the Windows Terminal in VS, right click on `CascadiaPackage` (in the Solution Explorer) and go to properties. In the Debug menu, change "Application process" and "Background task process" to "Native Only". -- `Invoke-OpenConsolebuild` - builds the solution. Can be passed msbuild arguments. -- `Invoke-OpenConsoleTests` - runs the various tests. Will run the unit tests by default. -- `Start-OpenConsole` - starts Openconsole.exe from the output directory. x64 is run by default. -- `Debug-OpenConsole` - starts Openconsole.exe and attaches it to the default debugger. x64 is run by default. -- `Invoke-CodeFormat` - uses clang-format to format all c++ files to match our coding style. +You should then be able to build & debug the Terminal project by hitting F5. + +> 👉 You will _not_ be able to launch the Terminal directly by running the WindowsTerminal.exe. For more details on why, see [#926](https://github.com/microsoft/terminal/issues/926), [#4043](https://github.com/microsoft/terminal/issues/4043) ## Configuration Types