-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Dllimport generator build and test fixes #59658
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
Changes from all commits
ea54b1f
6f40531
dbc141d
2a65756
a24525e
7a3148f
fe101e4
ed44881
e05c631
e5652ae
986e9a5
102a95d
4644434
ac37572
027ad10
d5e66f1
f77cd70
cf6e22b
a3efde9
c8fcd84
e77b7f0
e320cbd
d4aff51
392ee65
d633dc8
6107024
ff049ab
50c189e
6646f12
4d55f3a
2c94662
00726aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Output the toolchain information required to create a command line that builds with the right rootfs as XML | ||
|
||
set (ADDED_COMPILE_OPTIONS) | ||
if (CMAKE_SCRIPT_MODE_FILE) | ||
# add_compile_options and add_definitions can't be used in scripts, | ||
# so override the implementations to append to a local property | ||
macro(add_compile_options) | ||
list(APPEND ADDED_COMPILE_OPTIONS ${ARGV}) | ||
endmacro() | ||
macro(add_definitions) | ||
list(APPEND ADDED_COMPILE_OPTIONS ${ARGV}) | ||
endmacro() | ||
endif() | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/../common/cross/toolchain.cmake) | ||
|
||
message("<toolchain-info>") | ||
message("<target-triple>${TOOLCHAIN}</target-triple>") | ||
message("<linker-args>${CMAKE_SHARED_LINKER_FLAGS_INIT}</linker-args>") | ||
message("<compiler-args>${ADDED_COMPILE_OPTIONS}</compiler-args>") | ||
message("</toolchain-info>") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Xunit; | ||
|
||
// We build the libraries tests in CI once per target OS+Arch+Configuration, but we share it between runtime test runs. | ||
// As a result, we need to exclude the Mono run here since we build the tests once for CoreCLR and Mono for desktop test runs. | ||
// We should switch this to another mechanism in the future so we don't submit a work item of this assembly that skips every test | ||
// for Mono-on-Desktop-Platforms test runs. | ||
[assembly:ActiveIssue("https://github.com/dotnet/runtime/issues/59815", TestRuntimes.Mono)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do this via a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doh. I completely forgot about that. +1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't do that because we don't build the libraries tests for each runtime flavor, we use one build for both CoreCLR and Mono on desktop platforms (like Linux and Mac). I tried that originally and it didn't work. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ | |
<EnableDynamicLoading>true</EnableDynamicLoading> | ||
<DnneAddGeneratedBinaryToProject>true</DnneAddGeneratedBinaryToProject> | ||
<DnneGenRollForward>Major</DnneGenRollForward> | ||
<!-- To integrate with DNNE's architecture calculation, we need to set the RID for this project. --> | ||
<RuntimeIdentifier>$(OutputRid)</RuntimeIdentifier> | ||
<AppHostRuntimeIdentifier>$(OutputRid)</AppHostRuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
@@ -17,4 +20,97 @@ | |
<ProjectReference Include="..\SharedTypes\SharedTypes.csproj" /> | ||
</ItemGroup> | ||
|
||
<Target Name="GetLinuxCrossBuildArgumentsForDNNE" | ||
Condition="'$(CrossBuild)' == 'true' and ( | ||
'$(TargetOS)' == 'Linux' or | ||
'$(TargetOS)' == 'NetBSD' or | ||
'$(TargetOS)' == 'FreeBSD' or | ||
'$(TargetOS)' == 'illumos' or | ||
'$(TargetOS)' == 'Solaris')"> | ||
<PropertyGroup> | ||
<NativeCompiler>$(Compiler)</NativeCompiler> | ||
<NativeCompiler Condition="'$(NativeCompiler)' == ''">clang</NativeCompiler> | ||
</PropertyGroup> | ||
|
||
<Exec Command="bash -c 'source "$(RepositoryEngineeringDir)/common/native/init-compiler.sh" "$(RepositoryEngineeringDir)/common/native" $(TargetArchitecture) $(NativeCompiler) && echo $CC '" | ||
EchoOff="true" | ||
ConsoleToMsBuild="true" | ||
StandardOutputImportance="Low"> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="DnneCompilerCommand" /> | ||
</Exec> | ||
<Exec Command="cmake -P "$(RepositoryEngineeringDir)/native/output-toolchain-info.cmake"" | ||
EchoOff="true" | ||
ConsoleToMsBuild="true" | ||
StandardOutputImportance="Low" | ||
EnvironmentVariables="TARGET_BUILD_ARCH=$(TargetArchitecture)"> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="CrossTargetXml" /> | ||
</Exec> | ||
|
||
<XmlPeek XmlContent="$(CrossTargetXml)" Query="toolchain-info/target-triple/text()"> | ||
<Output TaskParameter="Result" PropertyName="TargetTriple" /> | ||
</XmlPeek> | ||
<XmlPeek XmlContent="$(CrossTargetXml)" Query="toolchain-info/linker-args/text()"> | ||
<Output TaskParameter="Result" PropertyName="DnneLinkerUserFlags" /> | ||
</XmlPeek> | ||
<XmlPeek XmlContent="$(CrossTargetXml)" Query="toolchain-info/compiler-args/text()"> | ||
<Output TaskParameter="Result" PropertyName="DnneCompilerUserFlags" /> | ||
</XmlPeek> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Learned about a new task today - not sure I'm happy about it... |
||
|
||
<PropertyGroup> | ||
<CommonToolchainArgs>--target=$(TargetTriple) --gcc-toolchain=$(ROOTFS_DIR)/usr --sysroot=$(ROOTFS_DIR)</CommonToolchainArgs> | ||
<DnneLinkerUserFlags>$(CommonToolchainArgs) $(DnneLinkerUserFlags.Replace(';',' '))</DnneLinkerUserFlags> | ||
<DnneCompilerUserFlags>$(CommonToolchainArgs) $(DnneCompilerUserFlags.Replace(';',' '))</DnneCompilerUserFlags> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
<Target Name="GetAppleCrossBuildArgumentsForDNNE" | ||
Condition="'$(TargetOS)' == 'OSX' or | ||
'$(TargetOS)' == 'MacCatalyst' or | ||
'$(TargetOS)' == 'iOS' or | ||
'$(TargetOS)' == 'iOSSimulator' or | ||
'$(TargetOS)' == 'tvOS' or | ||
'$(TargetOS)' == 'tvOSSimulator'"> | ||
<PropertyGroup Condition=" '$(TargetOS)' == 'MacCatalyst'"> | ||
<TargetTriple Condition="'$(TargetArchitecture)' == 'arm64'">arm64-apple-ios14.2-macabi</TargetTriple> | ||
<TargetTriple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-apple-ios13.5-macabi</TargetTriple> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(TargetOS)' == 'OSX'"> | ||
<TargetTriple Condition="'$(TargetArchitecture)' == 'arm64'">arm64-apple-macos11</TargetTriple> | ||
<TargetTriple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-apple-macos10.13</TargetTriple> | ||
<XCodeSdkName>macosx</XCodeSdkName> | ||
</PropertyGroup> | ||
|
||
<Error Condition="'$(TargetTriple)' == ''" Text="A target triple was not specified for the native components build. Update the 'GetAppleCrossBuildArgumentsForDNNE' target to specify a triple." /> | ||
<Error Condition="'$(XCodeSdkName)' == ''" Text="The name of the XCode SDK for the target platform, as passed to xcrun to locate the sdk, must be specified." /> | ||
|
||
<!-- xcrun is used to locate the XCode SDKs and tools within them. See the xcrun manpage for usage information. --> | ||
<Exec Command="xcrun --sdk $(XCodeSdkName) --show-sdk-path" | ||
jkoritzinsky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EchoOff="true" | ||
ConsoleToMsBuild="true" | ||
StandardOutputImportance="Low"> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="SysRootIncludePath" /> | ||
</Exec> | ||
|
||
<Exec Command="xcrun --sdk $(XCodeSdkName) --find clang" | ||
EchoOff="true" | ||
ConsoleToMsBuild="true" | ||
StandardOutputImportance="Low"> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="DnneCompilerCommand" /> | ||
</Exec> | ||
|
||
<PropertyGroup> | ||
<DnneLinkerUserFlags>-target $(TargetTriple)</DnneLinkerUserFlags> | ||
<DnneCompilerUserFlags>-isysroot "$(SysRootIncludePath)" -target $(TargetTriple)</DnneCompilerUserFlags> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
<Target Name="GetBuildArgumentsForDNNE" | ||
DependsOnTargets="ResolveFrameworkReferences; | ||
GetLinuxCrossBuildArgumentsForDNNE; | ||
GetAppleCrossBuildArgumentsForDNNE" | ||
BeforeTargets="DnneBuildNativeExports"> | ||
<PropertyGroup> | ||
<DnneNetHostDir>$([System.IO.Path]::GetDirectoryName('$(AppHostSourcePath)'))</DnneNetHostDir> | ||
</PropertyGroup> | ||
</Target> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" /> | ||
|
||
<PropertyGroup> | ||
<EnableDefaultItems>true</EnableDefaultItems> | ||
<UseLocalTargetingRuntimePack>true</UseLocalTargetingRuntimePack> | ||
</PropertyGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" /> | ||
|
||
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets, $(MSBuildThisFileDirectory)..))" /> | ||
</Project> |
Uh oh!
There was an error while loading. Please reload this page.