Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MsBuildResolver and CMakeResolver examples #340

Merged
merged 1 commit into from May 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -14,6 +14,9 @@
/examples/Python/Out/
/examples/Python/script_out/
/examples/HybridBuild/Out/
/examples/CMakeHelloWorld/Out/
/examples/MsBuildHelloWorld/Out/
/examples/MsBuildHelloWorld/Debug/
bin/
obj/
contentcache/
Expand Down
3 changes: 3 additions & 0 deletions Examples/CMakeHelloWorld/CMakeLists.txt
@@ -0,0 +1,3 @@
cmake_minimum_required (VERSION 2.6)
project (Example)
add_executable(Example main.cc)
7 changes: 7 additions & 0 deletions Examples/CMakeHelloWorld/README.md
@@ -0,0 +1,7 @@
# Instructions

1. Setup BuildXL as explained in the documentation
2. Point the environment variable BUILDXL_BIN to the BuildXL binary folder path. For example, if you set up BuildXL in D:\BuildXL, then D:\BuildXL\Out\Bin\debug\net472 should be the value.
3. Run .\run.ps1 from PowerShell, or equivalently run.bat from the command line prompt

The build outputs will be located in Out/Example. For further configuration options, see: https://github.com/microsoft/BuildXL/blob/master/Public/Sdk/Public/Prelude/Prelude.Configuration.Resolvers.dsc#L285
1 change: 1 addition & 0 deletions Examples/CMakeHelloWorld/build.bat
@@ -0,0 +1 @@
%BUILDXL_BIN%/bxl /c:config.bc /disableProcessRetryOnResourceExhaustion+
1 change: 1 addition & 0 deletions Examples/CMakeHelloWorld/build.ps1
@@ -0,0 +1 @@
& $Env:BUILDXL_BIN/bxl /c:config.bc /disableProcessRetryOnResourceExhaustion+
10 changes: 10 additions & 0 deletions Examples/CMakeHelloWorld/config.bc
@@ -0,0 +1,10 @@
config({
resolvers: [
{
kind: "CMake",
projectRoot: d`.`,
moduleName: "Project",
buildDirectory: r`Example`,
}
]
});
5 changes: 5 additions & 0 deletions Examples/CMakeHelloWorld/main.cc
@@ -0,0 +1,5 @@
#include <iostream>

int main(int argc, char *argv[]) {
std::cout << "Hello World!" << std::endl;
}
22 changes: 22 additions & 0 deletions Examples/MsBuildHelloWorld/Example.vcxproj
@@ -0,0 +1,22 @@
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.default.props" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ItemGroup>
<ClCompile Include="main.cc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Targets" />
</Project>
7 changes: 7 additions & 0 deletions Examples/MsBuildHelloWorld/README.md
@@ -0,0 +1,7 @@
# Instructions

1. Setup BuildXL as explained in the documentation
2. Point the environment variable BUILDXL_BIN to the BuildXL binary folder path. For example, if you set up BuildXL in D:\BuildXL, then D:\BuildXL\Out\Bin\debug\net472 should be the value.
3. Run .\run.ps1 from PowerShell, or equivalently run.bat from the command line prompt

The build outputs will be located in the Debug folder. For further configuration options, see: https://github.com/microsoft/BuildXL/blob/master/Public/Sdk/Public/Prelude/Prelude.Configuration.Resolvers.dsc#L98
1 change: 1 addition & 0 deletions Examples/MsBuildHelloWorld/build.bat
@@ -0,0 +1 @@
%BUILDXL_BIN%/bxl /c:config.bc /disableProcessRetryOnResourceExhaustion+
1 change: 1 addition & 0 deletions Examples/MsBuildHelloWorld/build.ps1
@@ -0,0 +1 @@
& $Env:BUILDXL_BIN/bxl /c:config.bc /disableProcessRetryOnResourceExhaustion+
9 changes: 9 additions & 0 deletions Examples/MsBuildHelloWorld/config.bc
@@ -0,0 +1,9 @@
config({
resolvers: [
{
kind: "MsBuild",
root: d`.`,
Copy link
Member

Choose a reason for hiding this comment

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

side-note: Should we rename this to projectRoot like cmake?

Copy link
Member

Choose a reason for hiding this comment

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

We could... don't have a strong opinion about this :)


In reply to: 285703454 [](ancestors = 285703454)

Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistency raises the WTF/minute metric :)


In reply to: 285705018 [](ancestors = 285705018,285703454)

moduleName: "Project",
}
]
});
5 changes: 5 additions & 0 deletions Examples/MsBuildHelloWorld/main.cc
@@ -0,0 +1,5 @@
#include <iostream>

int main(int argc, char *argv[]) {
std::cout << "Hello World!" << std::endl;
}