Skip to content

Commit 732b1fe

Browse files
committed
add appveyor file for CD
1 parent 463a13b commit 732b1fe

File tree

6 files changed

+62
-28
lines changed

6 files changed

+62
-28
lines changed

MSBuild.Sdk.CMake.slngenproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<Project Sdk="MSBuild.SolutionSdk.SlnGen/0.1.0">
1+
<Project Sdk="MSBuild.SolutionSdk.SlnGen/0.1.1">
22
</Project>

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ This is the [MSBuild SDK](https://docs.microsoft.com/en-us/visualstudio/msbuild/
77
## Requirements
88

99
* [cmake](https://cmake.org)
10+
* you should add path to `cmake` to "PATH" environment variable
1011
* [dotnet core sdk 2.1.300 or later](https://dotnet.microsoft.com/download)
12+
* build tools for C/C++
1113

1214
## Steps from scratch
1315

@@ -21,9 +23,21 @@ This is the [MSBuild SDK](https://docs.microsoft.com/en-us/visualstudio/msbuild/
2123
```
2224
3. execute `dotnet build [project file]`
2325
* if you want to get release build, `dotnet build -c Release [project file]`
26+
* if you do not want to add cmake to PATH, `CMakeExe` property can be used
27+
* property can be spcified by `dotnet build -p:CMakeExe=/path/to/cmake`
2428

2529
Then you will get built binary in `/dir/to/project/builddir/[Configuration]/[Platform(default is 'any')]/[Configuration]`
2630

31+
## from template
32+
33+
if you want to create project from `dotnet new`, you can do it by installing templates for cmake project.
34+
35+
1. do `dotnet new -i MSBuild.Sdk.CMake.Template.Library` to install library template
36+
2. do `dotnet new -i MSBuild.Sdk.CMake.Template.Console` to install console template
37+
3. do `dotnet new cmlib --name [project name]`, then cmake library project will be created
38+
4. do `dotnet new cmconsole --name [project name]`, then cmake console project will be created
39+
5. after project creation, you can build project by `dotnet build`
40+
2741
## configure only
2842

2943
By default, `build` task execute `Configure` task before main build.

appveyor.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: 1.0.{build}
2+
init:
3+
- git config --global core.autocrlf input
4+
configuration: Release
5+
image:
6+
- Visual Studio 2017
7+
- Ubuntu 18.04 LTS
8+
install:
9+
pwsh: dotnet tool install -g Cake.Tool
10+
build_script:
11+
pwsh: dotnet-cake .\build.cake --configuration=Release
12+
artifacts:
13+
- path: "nupkg/*.nupkg"
14+
name: NuGetPackages
15+
nuget:
16+
project_feed: true
17+
deploy:
18+
- provider: NuGet
19+
api_key:
20+
secure: +X6X8wXYoeSk6FdqmxnFHfcq9XI0rjvX+LHDoW6pd+Xf7X7GqpEovk6lTLt5fRFZ
21+
on:
22+
APPVEYOR_REPO_TAG: true
23+
branch: master
24+
artifact: NuGetPackages
25+
- provider: GitHub
26+
auth_token:
27+
secure: MFZg3Ryx8cZ9XWIf8qvSE+48pmQc2LPAcPiRQ7bUtPRKj4mXvn+mtZVzPV7tQyX1
28+
on:
29+
APPVEYOR_REPO_TAG: true
30+
branch: master
31+
artifact: NuGetPackages
32+
prerelease: false
33+
draft: true

build.cake

+12-25
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,37 @@ var target = Argument("Target", "Default");
33

44
Task("Default")
55
.IsDependentOn("Build")
6+
.IsDependentOn("Test")
7+
.IsDependentOn("Pack")
68
;
79
Task("Restore")
810
.Does(() =>
911
{
10-
MSBuild("MSBuild.Sdk.CMake.slnproj", setting =>
11-
{
12-
setting.SetConfiguration(configuration)
13-
.SetVerbosity(Verbosity.Normal)
14-
.WithTarget("Restore")
15-
;
16-
});
12+
DotNetCoreRestore("MSBuild.Sdk.CMake.slnproj");
1713
});
1814
Task("Build")
1915
.IsDependentOn("Restore")
2016
.Does(() =>
2117
{
22-
MSBuild("MSBuild.Sdk.CMake.slnproj", setting =>
23-
{
24-
setting.SetConfiguration(configuration)
25-
.SetVerbosity(Verbosity.Normal)
26-
.WithTarget("Build")
27-
;
28-
});
18+
DotNetCoreBuild("MSBuild.Sdk.CMake.slnproj");
2919
});
3020
Task("Test")
3121
.IsDependentOn("Build")
3222
.Does(() =>
3323
{
34-
var regularProjectDir = DirectoryPath.FromString("tests").Combine("Regular");
35-
var projectFilePath = regularProjectDir.CombineWithFilePath("Regular.cmproj");
36-
DotNetCoreClean(projectFilePath.ToString());
37-
DotNetCoreBuild(projectFilePath.ToString());
24+
foreach(var projectName in new []{ "Install", "Regular" })
25+
{
26+
var regularProjectDir = DirectoryPath.FromString("tests").Combine(projectName);
27+
var projectFilePath = regularProjectDir.CombineWithFilePath($"{projectName}.cmproj");
28+
DotNetCoreClean(projectFilePath.ToString());
29+
DotNetCoreBuild(projectFilePath.ToString());
30+
}
3831
});
3932
Task("Pack")
4033
.IsDependentOn("Build")
4134
.Does(() =>
4235
{
43-
MSBuild("MSBuild.Sdk.CMake.slnproj", setting =>
44-
{
45-
setting.SetConfiguration(configuration)
46-
.SetVerbosity(Verbosity.Normal)
47-
.WithTarget("Pack")
48-
;
49-
});
36+
DotNetCorePack("MSBuild.Sdk.CMake.slnproj");
5037
foreach(var pkgname in new []{ "MSBuild.Sdk.CMake.Template.Console", "MSBuild.Sdk.CMake.Template.Library" })
5138
{
5239
string processName;

src/MSBuild.Sdk.CMake/Sdk/Sdk.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</Target>
4343
<Target Name="BuildClean">
4444
<Exec Command="&quot;$(CMakeExe)&quot; --build &quot;$(CMakeBuildDirectory)&quot; --target clean"
45-
Condition="Exists($([System.IO.Path]::Combine($(CMakeBuildDirectory),'CMakeCache.txt')))"/>
45+
Condition="Exists($([System.IO.Path]::Combine($(CMakeBuildDirectory),'cmake_install.cmake')))"/>
4646
</Target>
4747
<Target Name="Clean" DependsOnTargets="BuildClean;ConfigClean">
4848
</Target>

tests/Install/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(2.8)
1+
cmake_minimum_required(VERSION 2.8)
22

33
add_executable(installtest main.cpp)
44

0 commit comments

Comments
 (0)