-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d064632
commit 45dee63
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Building | ||
|
||
This project is configured to build with both CMake and the Swift Package Manager (SPM), with caveats: | ||
|
||
- Due to XCTest's dependency on SPM-generated code, the CMake build does not build tests. | ||
- Due to SPM limitations, the SPM build requires support from Powershell scripts. | ||
|
||
Pull requests are validated with a GitHub Actions workflow which builds using both build systems and runs tests from the SPM build. | ||
|
||
## CMake | ||
|
||
To build with CMake, open a `VS Developer Command Prompt` at the root of this repo and type: | ||
|
||
```cmd | ||
cmake --preset debug | ||
cmake --build --preset debug | ||
``` | ||
|
||
When building from the root of the repo, the Generator project will be built during the configure phase, so that the resulting executable can be used to generate test projections later in the build. | ||
|
||
The repo is configured such that many subdirectories can be built the same way, to scope down the build. | ||
|
||
You can also use [Visual Studio Code](https://code.visualstudio.com/) with the [CMake Tools extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) to configure and build, as long as you start it from within a `VS Developer Command Prompt`. | ||
|
||
## SPM | ||
|
||
The root of the repo is an SPM package that builds the support module and can run its tests. This allows SPM references to the git repo to resolve to the support module. | ||
|
||
```cmd | ||
swift build --build-tests | ||
swift test --skip-build | ||
``` | ||
|
||
The `/Generator` subdirectory is an independent SPM package that builds the code generator and can run its tests: | ||
|
||
```cmd | ||
Generator> swift build --build-tests | ||
Generator> swift test --skip-build | ||
``` | ||
|
||
The `/InteropTests` subdirectory requires building `WinRTComponent.winmd` and `WinRTComponent.dll`, which SPM cannot do. A helper script, `Build-WinRTComponentProjection.ps1`, will do that using CMake, after which the package can be built and tested normally. |