Skip to content

Commit

Permalink
Okay. Big changes. Reset to bin and obj output. Break down paths a bi…
Browse files Browse the repository at this point in the history
…t differently.

Static/Shared distinction on outputtype for libraries.
Static libraries emit no bin output. But do emit Library output.
LibraryOutput and ExecutableOutput represent whether a particular thing exists, but may in fact be the same thing. Windows, for instance, outputs a dll and a lib for shared. While linux outputs a .so and no lib for shared. But static on both outputs only a lib.
  • Loading branch information
wasabii committed Apr 7, 2024
1 parent 2158e73 commit d1ad77d
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
<ProjectGuid>f511e617-3e18-4dc6-9936-8746f3060663</ProjectGuid>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<OutputType>Shared</OutputType>
<TargetIdentifiers>x86_64-pc-windows-msvc;i686-pc-windows-msvc;thumbv7-pc-windows-msvc;aarch64-pc-windows-msvc</TargetIdentifiers>
<Verbose>true</Verbose>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SharedLibrary2\SharedLibrary2.clangproj">
<BuildReference>true</BuildReference>
</ProjectReference>
<ProjectReference Include="..\StaticLibrary1\StaticLibrary1.clangproj">
<BuildReference>true</BuildReference>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="hello1.c" />
Expand Down
2 changes: 2 additions & 0 deletions src/IKVM.Clang.Sdk.Tests/Project/SharedLibrary1/hello1.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <hello2.h>
#include <statichello1.h>
#include <stdio.h>

#include "hello1.h"

EXPORT void hello1() {
hello2();
statichello1();
printf(STRING);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ProjectGuid>f511e617-3e18-4dc6-9936-8746f3060663</ProjectGuid>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<OutputType>Shared</OutputType>
<TargetIdentifiers>x86_64-pc-windows-msvc;i686-pc-windows-msvc;thumbv7-pc-windows-msvc;aarch64-pc-windows-msvc</TargetIdentifiers>
<Verbose>true</Verbose>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<Import Sdk="IKVM.Clang.Sdk" Version="$(PackageVersion)" Project="Sdk.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>f511e617-3e18-4dc6-9936-8746f3060663</ProjectGuid>
</PropertyGroup>
<PropertyGroup>
<OutputType>Static</OutputType>
<TargetIdentifiers>x86_64-pc-windows-msvc;i686-pc-windows-msvc;thumbv7-pc-windows-msvc;aarch64-pc-windows-msvc</TargetIdentifiers>
<Verbose>true</Verbose>
</PropertyGroup>
<ItemGroup>
<Compile Include="statichello1.c" />
<Header Include="statichello1.h" />
</ItemGroup>
<Import Sdk="IKVM.Clang.Sdk" Version="$(PackageVersion)" Project="Sdk.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "statichello1.h"

void statichello1() {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void statichello1();
11 changes: 6 additions & 5 deletions src/IKVM.Clang.Sdk.Tests/ProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public static void ClassInitialize(TestContext context)
options.TargetsToBuild.Clear();
options.TargetsToBuild.Add("Clean");
options.TargetsToBuild.Add("Restore");
options.Arguments.Add("/v:d");
options.Arguments.Add("/v:diag");

var result = analyzer.Build(options);
context.AddResultFile(Path.Combine(WorkRoot, "msbuild.binlog"));
result.OverallSuccess.Should().Be(true);
Expand Down Expand Up @@ -167,21 +168,21 @@ public void CanBuildTestProject(EnvironmentPreference env, string tid, string li
options.TargetsToBuild.Clear();
options.TargetsToBuild.Add("Clean");
options.TargetsToBuild.Add("Build");
options.Arguments.Add("/v:d");
options.Arguments.Add("/v:diag");

var result = analyzer.Build(options);
TestContext.AddResultFile(Path.Combine(WorkRoot, $"{tid}-msbuild.binlog"));
result.OverallSuccess.Should().BeTrue();

var binDir = Path.Combine(TestRoot, "Executable", "dist", "Debug", tid, "bin");
var binDir = Path.Combine(TestRoot, "Executable", "bin", "Debug", tid);
File.Exists(Path.Combine(binDir, string.Format(exeName, "Executable"))).Should().BeTrue();
File.Exists(Path.Combine(binDir, string.Format(symName, "Executable"))).Should().BeTrue();

var libDir1 = Path.Combine(TestRoot, "SharedLibrary1", "dist", "Debug", tid, "lib");
var libDir1 = Path.Combine(TestRoot, "SharedLibrary1", "bin", "Debug", tid);
File.Exists(Path.Combine(libDir1, string.Format(libName, "SharedLibrary1"))).Should().BeTrue();
File.Exists(Path.Combine(libDir1, string.Format(symName, "SharedLibrary1"))).Should().BeTrue();

var libDir2 = Path.Combine(TestRoot, "SharedLibrary2", "dist", "Debug", tid, "lib");
var libDir2 = Path.Combine(TestRoot, "SharedLibrary2", "bin", "Debug", tid);
File.Exists(Path.Combine(libDir2, string.Format(libName, "SharedLibrary2"))).Should().BeTrue();
File.Exists(Path.Combine(libDir2, string.Format(symName, "SharedLibrary2"))).Should().BeTrue();
}
Expand Down
Loading

0 comments on commit d1ad77d

Please sign in to comment.