Updates for dev with dotnet on linux

This commit is contained in:
Wojtek Figat
2023-01-08 20:27:28 +01:00
parent bf60955e5e
commit 4e4f4e700b
9 changed files with 28 additions and 15 deletions

View File

@@ -10,8 +10,7 @@ if [ $testfilesize -le 1000 ]; then
fi
# Compile the build tool.
dotnet msbuild /nologo /verbosity:quiet "Source/Tools/Flax.Build/Flax.Build.csproj" /property:Configuration=Release /target:Restore,Clean /property:RestorePackagesConfig=True /p:RuntimeIdentifiers=linux-x64
dotnet msbuild /nologo /verbosity:quiet "Source/Tools/Flax.Build/Flax.Build.csproj" /property:Configuration=Release /target:Build /property:SelfContained=False /property:RuntimeIdentifiers=linux-x64
dotnet msbuild /nologo /verbosity:quiet "Source/Tools/Flax.Build/Flax.Build.csproj" /property:Configuration=Release /target:Restore,Build /property:RestorePackagesConfig=True /p:RuntimeIdentifiers=linux-x64
# Run the build tool using the provided arguments.
Binaries/Tools/Flax.Build "$@"

View File

@@ -63,7 +63,7 @@ bool CoreCLR::LoadHostfxr(const String& library_path_)
hostfxr_set_error_writer = (hostfxr_set_error_writer_fn)Platform::GetProcAddress(hostfxr, "hostfxr_set_error_writer");
hostfxr_get_dotnet_environment_info_result = (hostfxr_get_dotnet_environment_info_result_fn)Platform::GetProcAddress(hostfxr, "hostfxr_get_dotnet_environment_info_result");
hostfxr_run_app = (hostfxr_run_app_fn)Platform::GetProcAddress(hostfxr, "hostfxr_run_app");
return true;
}
@@ -111,7 +111,7 @@ void* CoreCLR::GetStaticMethodPointer(const String& methodName)
if (rc != 0)
LOG(Fatal, "Failed to get unmanaged function pointer for method {0}: 0x{1:x}", methodName.Get(), (unsigned int)rc);
cachedFunctions.Add(String(methodName), fun);
cachedFunctions.Add(methodName, fun);
return fun;
}

View File

@@ -22,9 +22,6 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<IntermediateOutputPath>..\..\..\Cache\Intermediate\Flax.Build.Tests\Debug</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<IntermediateOutputPath>..\..\..\Cache\Intermediate\Flax.Build.Tests\Release</IntermediateOutputPath>
</PropertyGroup>
<Import Project="..\..\Platforms\DotNet\NUnit\build\NUnit.props" />
<ItemGroup>

View File

@@ -25,7 +25,13 @@ namespace Flax.Build
task.Cost = 100;
task.DisableCache = true;
task.CommandPath = VCEnvironment.MSBuildPath;
task.CommandArguments = string.Format("\"{0}\" /m /t:Build /p:Configuration=\"{1}\" /p:Platform=\"{2}\" {3} /nologo", target.CustomExternalProjectFilePath, configuration.ToString(), "AnyCPU", VCEnvironment.Verbosity);
task.CommandArguments = $"\"{target.CustomExternalProjectFilePath}\" /m /p:BuildProjectReferences=false /t:Restore,Build /p:Configuration=\"{configuration}\" /p:RestorePackagesConfig=True /p:Platform=AnyCPU /nologo {VCEnvironment.Verbosity}";
if (task.CommandPath.EndsWith(" msbuild"))
{
// Special case when using dotnet CLI as msbuild
task.CommandPath = task.CommandPath.Substring(0, task.CommandPath.Length - 8);
task.CommandArguments = "msbuild " + task.CommandArguments;
}
return;
}

View File

@@ -55,6 +55,13 @@ namespace Flax.Deploy
case TargetPlatform.Linux:
case TargetPlatform.Mac:
{
// Use msbuild for .NET
toolPath = UnixPlatform.Which("dotnet");
if (toolPath != null)
{
return toolPath + " msbuild";
}
// Use msbuild from Mono
toolPath = UnixPlatform.Which("msbuild");
if (toolPath != null)

View File

@@ -40,7 +40,7 @@ namespace Flax.Build.Platforms
if (Platform.BuildTargetPlatform == TargetPlatform.Linux)
{
// Pick the newest compiler (overriden by specified in command line)
if (Which(Compiler) != null)
if (Which(Configuration.Compiler) != null)
Compiler = Configuration.Compiler;
else if (Which("clang++-10") != null)
Compiler = "clang++-10";

View File

@@ -546,7 +546,7 @@ namespace Flax.Build.Projects.VisualStudioCode
json.EndObject();
// Extension settings
json.AddField("omnisharp.useModernNet", false);
json.AddField("omnisharp.useModernNet", true);
json.EndRootObject();
@@ -566,7 +566,7 @@ namespace Flax.Build.Projects.VisualStudioCode
json.AddField("jake.autoDetect", "off");
json.AddField("grunt.autoDetect", "off");
json.AddField("omnisharp.defaultLaunchSolution", solution.Name + ".sln");
json.AddField("omnisharp.useModernNet", false);
json.AddField("omnisharp.useModernNet", true);
json.EndObject();
// Folders

View File

@@ -29,7 +29,6 @@ public class FlaxEngineTestsTarget : Target
Configurations = new[]
{
TargetConfiguration.Debug,
TargetConfiguration.Release,
};
CustomExternalProjectFilePath = System.IO.Path.Combine(FolderPath, "FlaxEngine.Tests.csproj");
}

View File

@@ -2,12 +2,13 @@
<PropertyGroup>
<Configurations>Editor.Windows.Debug;Editor.Linux.Debug</Configurations>
<Platforms>x64</Platforms>
<Configuration Condition=" '$(Configuration)' == '' ">Editor.Windows.Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Editor.Linux.Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{4AAED6A2-38B1-4A31-AB04-9264A94A8ECA}</ProjectGuid>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TestProjectType>UnitTest</TestProjectType>
<TargetFramework>net7.0</TargetFramework>
<OutputType>Library</OutputType>
<LangVersion>11.0</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>annotations</Nullable>
@@ -17,7 +18,11 @@
<OutputPath>..\..\..\Binaries\Tools\</OutputPath>
<IntermediateOutputPath>..\..\..\Cache\Intermediate\FlaxEngine.Tests\Debug</IntermediateOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<EnableBaseIntermediateOutputPathMismatchWarning>false</EnableBaseIntermediateOutputPathMismatchWarning>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<DefineConstants>USE_NETCORE;FLAX_ASSERTIONS</DefineConstants>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
@@ -26,14 +31,14 @@
</PropertyGroup>
<Import Project="..\..\Platforms\DotNet\NUnit\build\NUnit.props" />
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\Platforms\DotNet\NUnit\build\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\FlaxEngine.CSharp.csproj" />
<ProjectReference Include="..\..\FlaxEngine.csproj" />
</ItemGroup>
<ItemGroup>