Merge remote-tracking branch 'origin/master' into 1.2

This commit is contained in:
Wojtek Figat
2021-03-30 17:58:29 +02:00
38 changed files with 303 additions and 109 deletions

View File

@@ -3,6 +3,24 @@ on: [push, pull_request]
jobs:
# Editor
editor-linux:
name: Editor (Linux, Development x64)
runs-on: "ubuntu-20.04"
steps:
- name: Install dependencies
run: |
sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext curl libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libcurl4-gnutls-dev
- name: Checkout repo
uses: actions/checkout@v2
- name: Checkout LFS
run: |
git lfs version
git lfs pull
- name: Build
run: |
./Development/Scripts/Linux/CallBuildTool.sh -build -log -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxEditor
# Game
game-linux:
name: Game (Linux, Release x64)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Editor/Particles/Smoke.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/Particles/Sparks.flax (Stored with Git LFS)

Binary file not shown.

View File

@@ -47,7 +47,7 @@ Flax Visual Studio extension provides better programming workflow, C# scripts de
* Install Visual Studio Code
* Install Mono ([https://www.mono-project.com/download/stable](https://www.mono-project.com/download/stable))
* Install Git with LFS
* Install requried packages: `sudo apt-get install nuget autoconf libtool libogg-dev automake build-essential gettext cmake python curl libtool-bin libx11-dev libpulse-dev libasound2-dev libjack-dev portaudio19-dev libcurl4-gnutls-dev`
* Install requried packages: `sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev nuget autoconf libogg-dev automake build-essential gettext cmake python curl libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libcurl4-gnutls-dev`
* Install compiler `sudo apt-get install clang lldb lld` (Clang 6 or newer)
* Clone repo (with LFS)
* Run `./GenerateProjectFiles.sh`

View File

@@ -282,7 +282,13 @@ namespace FlaxEditor.SceneGraph.Actors
{
// Remove unused points
while (srcCount > dstCount)
ActorChildNodes[srcCount-- - 1].Dispose();
{
var node = ActorChildNodes[srcCount-- - 1];
// TODO: support selection interface inside SceneGraph nodes (eg. on Root) so prefab editor can handle this too
if (Editor.Instance.SceneEditing.Selection.Contains(node))
Editor.Instance.SceneEditing.Deselect();
node.Dispose();
}
// Add new points
var id = ID;

View File

@@ -8,6 +8,9 @@
#include "Editor/Scripting/ScriptsBuilder.h"
#include "Engine/Engine/Globals.h"
#include "Engine/Platform/Win32/IncludeWindowsHeaders.h"
#if PLATFORM_LINUX
#include <stdio.h>
#endif
VisualStudioCodeEditor::VisualStudioCodeEditor(const String& execPath, const bool isInsiders)
: _execPath(execPath)

View File

@@ -341,7 +341,21 @@ void ScriptsBuilder::GetBinariesConfiguration(const Char*& target, const Char*&
target = platform = architecture = configuration = nullptr;
return;
}
target = Editor::Project->EditorTarget.GetText();
// Pick game target
if (Editor::Project->EditorTarget.HasChars())
{
target = Editor::Project->EditorTarget.Get();
}
else if (Editor::Project->GameTarget.HasChars())
{
target = Editor::Project->GameTarget.Get();
}
else
{
target = TEXT("");
LOG(Error, "Missing editor/game targets in project. Please specify EditorTarget and GameTarget properties in .flaxproj file.");
}
#if PLATFORM_WINDOWS
platform = TEXT("Windows");
@@ -551,19 +565,13 @@ bool ScriptsBuilderService::Init()
}
// Verify project
if (project->EditorTarget.IsEmpty() || project->GameTarget.IsEmpty())
if (project->EditorTarget.IsEmpty())
{
const String& name = project->Name;
String codeName;
for (int32 i = 0; i < name.Length(); i++)
{
Char c = name[i];
if (StringUtils::IsAlnum(c) && c != ' ' && c != '.')
codeName += c;
}
project->GameTarget = codeName + TEXT("Target");
project->EditorTarget = codeName + TEXT("EditorTarget");
LOG(Warning, "Missing EditorTarget property in opened project, using deducted target name {0}", Editor::Project->EditorTarget);
LOG(Warning, "Missing {0} property in opened project", TEXT("EditorTarget"));
}
if (project->GameTarget.IsEmpty())
{
LOG(Warning, "Missing {0} property in opened project", TEXT("GameTarget"));
}
// Remove any remaining files from previous Editor run hot-reloads

View File

@@ -1,7 +1,6 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using System;
using FlaxEditor.Gizmo;
using FlaxEditor.GUI.ContextMenu;
using FlaxEditor.GUI.Input;
using FlaxEditor.Options;

View File

@@ -70,7 +70,7 @@ namespace AnimationUtils
FORCE_INLINE void GetTangent<Quaternion>(const Quaternion& a, const Quaternion& b, float length, Quaternion& result)
{
const float oneThird = 1.0f / 3.0f;
Quaternion::Slerp(a, b, length * oneThird, result);
Quaternion::Slerp(a, b, oneThird, result);
}
template<>
@@ -79,7 +79,7 @@ namespace AnimationUtils
const float oneThird = 1.0f / 3.0f;
const float oneThirdLength = length * oneThird;
result.Translation = a.Translation + b.Translation * oneThirdLength;
Quaternion::Slerp(a.Orientation, b.Orientation, oneThirdLength, result.Orientation);
Quaternion::Slerp(a.Orientation, b.Orientation, oneThird, result.Orientation);
result.Scale = a.Scale + (b.Scale - a.Scale) * oneThirdLength;
}

View File

@@ -408,16 +408,20 @@ Asset* Content::LoadAsync(const StringView& path, MClass* type)
Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& type)
{
// Ensure path is in a valid format
String pathNorm(path);
FileSystem::NormalizePath(pathNorm);
#if USE_EDITOR
if (!FileSystem::FileExists(path))
if (!FileSystem::FileExists(pathNorm))
{
LOG(Error, "Missing file \'{0}\'", path);
LOG(Error, "Missing file \'{0}\'", pathNorm);
return nullptr;
}
#endif
AssetInfo assetInfo;
if (GetAssetInfo(path, assetInfo))
if (GetAssetInfo(pathNorm, assetInfo))
{
return LoadAsync(assetInfo.ID, type);
}

View File

@@ -194,13 +194,13 @@ void FlaxStorage::AddRef()
void FlaxStorage::RemoveRef()
{
ASSERT(_refCount > 0);
_refCount--;
if (_refCount == 0)
if (_refCount > 0)
{
_lastRefLostTime = DateTime::NowUTC();
_refCount--;
if (_refCount == 0)
{
_lastRefLostTime = DateTime::NowUTC();
}
}
}

View File

@@ -1566,7 +1566,7 @@ namespace FlaxEngine
}
/// <summary>
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and z-axis.
/// </summary>
/// <param name="scale">Scaling factor for all three axes.</param>
/// <returns>The created scaling Matrix3x3.</returns>
@@ -1577,7 +1577,7 @@ namespace FlaxEngine
}
/// <summary>
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and z-axis.
/// </summary>
/// <param name="x">Scaling factor that is applied along the x-axis.</param>
/// <param name="y">Scaling factor that is applied along the y-axis.</param>
@@ -1605,9 +1605,9 @@ namespace FlaxEngine
}
/// <summary>
/// Creates a Matrix3x3 that uniformly scales along all three axis.
/// Creates a Matrix3x3 that uniformly scales along all three axes.
/// </summary>
/// <param name="scale">The uniform scale that is applied along all axis.</param>
/// <param name="scale">The uniform scale that is applied along all axes.</param>
/// <param name="result">When the method completes, contains the created scaling Matrix3x3.</param>
public static void Scaling(float scale, out Matrix3x3 result)
{
@@ -1616,9 +1616,9 @@ namespace FlaxEngine
}
/// <summary>
/// Creates a Matrix3x3 that uniformly scales along all three axis.
/// Creates a Matrix3x3 that uniformly scales along all three axes.
/// </summary>
/// <param name="scale">The uniform scale that is applied along all axis.</param>
/// <param name="scale">The uniform scale that is applied along all axes.</param>
/// <returns>The created scaling Matrix3x3.</returns>
public static Matrix3x3 Scaling(float scale)
{

View File

@@ -189,10 +189,10 @@ public:
*height = bounds.Height;
}
void GetDpi(float* dpi) override
void GetDpi(int* dpi) override
{
auto currentDisplayInformation = Windows::Graphics::Display::DisplayInformation::GetForCurrentView();
*dpi = currentDisplayInformation->LogicalDpi;
*dpi = (int)currentDisplayInformation->LogicalDpi;
}
void GetTitle(wchar_t* buffer, int bufferLength) override

View File

@@ -370,18 +370,9 @@ void NavMeshRuntime::EnsureCapacity(int32 tilesToAddCount)
PROFILE_CPU_NAMED("NavMeshRuntime.EnsureCapacity");
// Navmesh tiles capacity growing rule
int32 newCapacity = 0;
if (capacity)
{
while (newCapacity < newTilesCount)
{
newCapacity = Math::RoundUpToPowerOf2(newCapacity);
}
}
else
{
newCapacity = 32;
}
int32 newCapacity = capacity ? capacity : 32;
while (newCapacity < newTilesCount)
newCapacity = Math::RoundUpToPowerOf2(newCapacity);
LOG(Info, "Resizing navmesh {2} from {0} to {1} tiles capacity", capacity, newCapacity, Properties.Name);

View File

@@ -121,7 +121,7 @@ public:
virtual void SetMousePosition(float x, float y) = 0;
virtual void GetMousePosition(float* x, float* y) = 0;
virtual void GetBounds(float* x, float* y, float* width, float* height) = 0;
virtual void GetDpi(float* dpi) = 0;
virtual void GetDpi(int* dpi) = 0;
virtual void GetTitle(wchar_t* buffer, int bufferLength) = 0;
virtual void SetTitle(const wchar_t* title) = 0;
virtual int GetGamepadsCount() = 0;

View File

@@ -320,7 +320,7 @@ void* Win32Platform::AllocatePages(uint64 numPages, uint64 pageSize)
const uint64 numBytes = numPages * pageSize;
// Use VirtualAlloc to allocate page-aligned memory
return VirtualAlloc(nullptr, numBytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
return VirtualAlloc(nullptr, (SIZE_T)numBytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
}
void Win32Platform::FreePages(void* ptr)

View File

@@ -87,8 +87,8 @@ bool ShadowsPass::Init()
if (!_supportsShadows)
{
LOG(Warning, "GPU doesn't support shadows rendering");
LOG(Warning, "Format: {0} features support: {1}", (int32)SHADOW_MAPS_FORMAT, (uint32)formatFeaturesDepth.Support);
LOG(Warning, "Format: {0} features support: {1}", (int32)formatTexture, (uint32)formatFeaturesTexture.Support);
LOG(Warning, "Format: {0}, features support: {1}", (int32)SHADOW_MAPS_FORMAT, (uint32)formatFeaturesDepth.Support);
LOG(Warning, "Format: {0}, features support: {1}", (int32)formatTexture, (uint32)formatFeaturesTexture.Support);
}
return false;

View File

@@ -298,6 +298,8 @@ void VolumetricFogPass::RenderRadialLight(RenderContext& renderContext, GPUConte
context->SetViewportAndScissors(_cache.Data.GridSize.X, _cache.Data.GridSize.Y);
// Setup data
perLight.SliceToDepth.X = _cache.Data.GridSize.Z;
perLight.SliceToDepth.Y = _cache.Data.VolumetricFogMaxDistance;
perLight.MinZ = volumeZBoundsMin;
perLight.LocalLightScatteringIntensity = light.VolumetricScatteringIntensity;
perLight.ViewSpaceBoundingSphere = Vector4(viewSpaceLightBoundsOrigin, bounds.Radius);
@@ -355,6 +357,8 @@ void VolumetricFogPass::RenderRadialLight(RenderContext& renderContext, GPUConte
bool withShadow = false;
// Setup data
perLight.SliceToDepth.X = cache.Data.GridSize.Z;
perLight.SliceToDepth.Y = cache.Data.VolumetricFogMaxDistance;
perLight.MinZ = volumeZBoundsMin;
perLight.LocalLightScatteringIntensity = light.VolumetricScatteringIntensity;
perLight.ViewSpaceBoundingSphere = Vector4(viewSpaceLightBoundsOrigin, bounds.Radius);

View File

@@ -812,6 +812,19 @@ namespace FlaxEngine.GUI
return spaceLoc;
}
private int FindPrevLineBegin()
{
int caretPos = CaretPosition;
if (caretPos - 2 < 0)
return 0;
int newLineLoc = _text.LastIndexOf('\n', caretPos - 2);
if (newLineLoc == -1)
newLineLoc = 0;
else
newLineLoc++;
return newLineLoc;
}
private int FindLineDownChar(int index)
{
if (!IsMultiline)
@@ -1181,7 +1194,6 @@ namespace FlaxEngine.GUI
return true;
}
case KeyboardKeys.Return:
{
if (IsMultiline)
{
// Insert new line
@@ -1192,15 +1204,22 @@ namespace FlaxEngine.GUI
// End editing
Defocus();
}
return true;
}
case KeyboardKeys.Home:
{
// Move caret to the first character
SetSelection(0);
if (shiftDown)
{
// Select text from the current cursor point back to the beginning of the line
if (_selectionStart != -1)
{
SetSelection(FindPrevLineBegin(), _selectionStart);
}
}
else
{
// Move caret to the first character
SetSelection(0);
}
return true;
}
case KeyboardKeys.End:
{
// Move caret after last character

View File

@@ -558,6 +558,7 @@ namespace FlaxEngine.GUI
}
SetBounds(ref bounds);
}
_parent?.PerformLayout();
return;
}
}

View File

@@ -35,28 +35,39 @@ namespace FlaxEngine.GUI
/// <inheritdoc />
protected override void PerformLayoutAfterChildren()
{
// Sort controls from left to right
float x = _margin.Left;
// Sort controls horizontally
float left = _margin.Left;
float right = _margin.Right;
float h = Height - _margin.Height;
bool hasAnyItem = false;
bool hasAnyLeft = false, hasAnyRight = false;
for (int i = 0; i < _children.Count; i++)
{
Control c = _children[i];
if (c.Visible && Mathf.IsZero(c.AnchorMax.X))
if (c.Visible)
{
var w = c.Width;
c.Bounds = new Rectangle(x + _offset.X, _margin.Top + _offset.Y, w, h);
x = c.Right + _spacing;
hasAnyItem = true;
if (Mathf.IsZero(c.AnchorMin.X) && Mathf.IsZero(c.AnchorMax.X))
{
c.Bounds = new Rectangle(left + _offset.X, _margin.Top + _offset.Y, w, h);
left = c.Right + _spacing;
hasAnyLeft = true;
}
else if (Mathf.IsOne(c.AnchorMin.X) && Mathf.IsOne(c.AnchorMax.X))
{
right += w + _spacing;
c.Bounds = new Rectangle(Width - right + _offset.X, _margin.Top + _offset.Y, w, h);
hasAnyRight = true;
}
}
}
if (hasAnyItem)
x -= _spacing;
x += _margin.Right;
if (hasAnyLeft)
left -= _spacing;
if (hasAnyRight)
right -= _spacing;
// Update size
if (_autoSize)
Width = x;
Width = left + right;
}
}
}

View File

@@ -35,28 +35,39 @@ namespace FlaxEngine.GUI
/// <inheritdoc />
protected override void PerformLayoutAfterChildren()
{
// Sort controls from top to bottom
float y = _margin.Top;
// Sort controls vertically
float top = _margin.Top;
float bottom = _margin.Bottom;
float w = Width - _margin.Width;
bool hasAnyItem = false;
bool hasAnyTop = false, hasAnyBottom = false;
for (int i = 0; i < _children.Count; i++)
{
Control c = _children[i];
if (c.Visible && Mathf.IsZero(c.AnchorMax.Y))
if (c.Visible)
{
var h = c.Height;
c.Bounds = new Rectangle(_margin.Left + _offset.X, y + _offset.Y, w, h);
y = c.Bottom + _spacing;
hasAnyItem = true;
if (Mathf.IsZero(c.AnchorMin.Y) && Mathf.IsZero(c.AnchorMax.Y))
{
c.Bounds = new Rectangle(_margin.Left + _offset.X, top + _offset.Y, w, h);
top = c.Bottom + _spacing;
hasAnyTop = true;
}
else if (Mathf.IsOne(c.AnchorMin.Y) && Mathf.IsOne(c.AnchorMax.Y))
{
bottom += h + _spacing;
c.Bounds = new Rectangle(_margin.Left + _offset.X, Height - bottom + _offset.Y, w, h);
hasAnyBottom = true;
}
}
}
if (hasAnyItem)
y -= _spacing;
y += _margin.Bottom;
if (hasAnyTop)
top -= _spacing;
if (hasAnyBottom)
bottom -= _spacing;
// Update size
if (_autoSize)
Height = y;
Height = top + bottom;
}
}
}

BIN
Source/Platforms/Linux/Binaries/ThirdParty/x64/libIrrXML.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
Source/Platforms/Linux/Binaries/ThirdParty/x64/libassimp.a (Stored with Git LFS) vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -35,8 +35,8 @@ public class assimp : DepsModule
options.DelayLoadLibraries.Add("assimp-vc140-md.dll");
break;
case TargetPlatform.Linux:
options.DependencyFiles.Add(Path.Combine(depsRoot, "libassimp.so"));
options.Libraries.Add(Path.Combine(depsRoot, "libassimp.so"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libassimp.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libIrrXML.a"));
break;
default: throw new InvalidPlatformException(options.Platform.Target);
}

View File

@@ -101,7 +101,7 @@ namespace Flax.Build
}
// Mono on Linux is using dynamic linking and needs additional link files
if (buildOptions.Platform.Target == TargetPlatform.Linux)
if (buildOptions.Platform.Target == TargetPlatform.Linux && Platform.BuildTargetPlatform == TargetPlatform.Linux && !IsPreBuilt)
{
var task = graph.Add<Task>();
task.PrerequisiteFiles.Add(Path.Combine(buildOptions.OutputFolder, "libmonosgen-2.0.so"));
@@ -120,6 +120,8 @@ namespace Flax.Build
private void BuildMainExecutable(TaskGraph graph, BuildOptions buildOptions)
{
if (IsPreBuilt)
return;
var outputPath = Path.Combine(buildOptions.OutputFolder, buildOptions.Platform.GetLinkOutputFileName(OutputName, LinkerOutput.Executable));
var exeBuildOptions = Builder.GetBuildOptions(this, buildOptions.Platform, buildOptions.Toolchain, buildOptions.Architecture, buildOptions.Configuration, buildOptions.WorkingDirectory);
exeBuildOptions.LinkEnv.Output = LinkerOutput.Executable;
@@ -139,7 +141,7 @@ namespace Flax.Build
// Build Main module
var mainModule = rules.GetModule("Main");
var mainModuleOutputPath = Path.Combine(exeBuildOptions.IntermediateFolder, mainModule.Name);
if (!IsPreBuilt && !Directory.Exists(mainModuleOutputPath))
if (!Directory.Exists(mainModuleOutputPath))
Directory.CreateDirectory(mainModuleOutputPath);
var mainModuleOptions = new BuildOptions
{

View File

@@ -45,7 +45,7 @@ namespace Flax.Build
throw new Exception($"Invalid or missing editor target {project.EditorTarget} specified in project {project.Name} (referenced by project {Project.Name}).");
return result;
}
if (!IsEditor && !string.IsNullOrEmpty(project.GameTarget))
if (!string.IsNullOrEmpty(project.GameTarget))
{
var result = projectTargets.FirstOrDefault(x => x.Name == project.GameTarget);
if (result == null)

View File

@@ -15,5 +15,17 @@ namespace Flax.Build
/// </summary>
[CommandLine("deployPlatforms", "Builds and packages the platforms data.")]
public static bool DeployPlatforms;
/// <summary>
/// Certificate file path for binaries signing.
/// </summary>
[CommandLine("deployCert", "Certificate file path for binaries signing.")]
public static string DeployCert;
/// <summary>
/// Certificate file password for binaries signing.
/// </summary>
[CommandLine("deployCertPass", "Certificate file password for binaries signing.")]
public static string DeployCertPass;
}
}

View File

@@ -12,6 +12,18 @@ namespace Flax.Deploy
{
partial class Deployment
{
private static void CodeSign(string file)
{
if (string.IsNullOrEmpty(Configuration.DeployCert))
return;
switch (Platform.BuildTargetPlatform)
{
case TargetPlatform.Windows:
VCEnvironment.CodeSign(file, Configuration.DeployCert, Configuration.DeployCertPass);
break;
}
}
public class Editor
{
private static string RootPath;
@@ -37,6 +49,7 @@ namespace Flax.Deploy
var dst = Path.Combine(OutputPath, binariesSubDir);
DeployFile(src, dst, "Flax.Build.exe");
CodeSign(Path.Combine(dst, "Flax.Build.exe"));
DeployFile(src, dst, "Flax.Build.xml");
DeployFile(src, dst, "Ionic.Zip.Reduced.dll");
DeployFile(src, dst, "Newtonsoft.Json.dll");
@@ -112,15 +125,26 @@ namespace Flax.Deploy
// Compress
Log.Info(string.Empty);
Log.Info("Compressing editor files...");
var editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, "Editor.zip");
using (ZipFile zip = new ZipFile())
string editorPackageZipPath;
if (Platform.BuildPlatform.Target == TargetPlatform.Linux)
{
zip.AddDirectory(OutputPath);
// Use system tool (preserves executable file attributes and link files)
editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, "FlaxEditorLinux.zip");
Utilities.Run("zip", "Editor.zip -r .", null, OutputPath, Utilities.RunOptions.None);
File.Move(Path.Combine(OutputPath, "Editor.zip"), editorPackageZipPath);
}
else
{
editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, "Editor.zip");
using (ZipFile zip = new ZipFile())
{
zip.AddDirectory(OutputPath);
zip.CompressionLevel = CompressionLevel.BestCompression;
zip.Comment = string.Format("Flax Editor {0}.{1}.{2}\nDate: {3}", Deployer.VersionMajor, Deployer.VersionMinor, Deployer.VersionBuild, DateTime.UtcNow);
zip.CompressionLevel = CompressionLevel.BestCompression;
zip.Comment = string.Format("Flax Editor {0}.{1}.{2}\nDate: {3}", Deployer.VersionMajor, Deployer.VersionMinor, Deployer.VersionBuild, DateTime.UtcNow);
zip.Save(editorPackageZipPath);
zip.Save(editorPackageZipPath);
}
}
Log.Info("Compressed editor package size: " + Utilities.GetFileSize(editorPackageZipPath));
@@ -166,12 +190,14 @@ namespace Flax.Deploy
// Deploy binaries
DeployFile(src, dst, editorExeName);
CodeSign(Path.Combine(dst, editorExeName));
DeployFile(src, dst, "FlaxEditor.Build.json");
DeployFile(src, dst, "FlaxEditor.lib");
DeployFile(src, dst, "FlaxEngine.CSharp.pdb");
DeployFile(src, dst, "FlaxEngine.CSharp.xml");
DeployFile(src, dst, "Newtonsoft.Json.pdb");
DeployFiles(src, dst, "*.dll");
CodeSign(Path.Combine(dst, "FlaxEngine.CSharp.dll"));
// Deploy debug symbols files
DeployFiles(src, dstDebug, "*.pdb");

View File

@@ -37,6 +37,22 @@ namespace Flax.Deploy
File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Release", "FlaxGame.a"));
}
// Sign binaries
if (platform == TargetPlatform.Windows && !string.IsNullOrEmpty(Configuration.DeployCert))
{
var binaries = Path.Combine(dst, "Binaries", "Game", "x64", "Debug");
CodeSign(Path.Combine(binaries, "FlaxGame.exe"));
CodeSign(Path.Combine(binaries, "FlaxEngine.CSharp.dll"));
binaries = Path.Combine(dst, "Binaries", "Game", "x64", "Development");
CodeSign(Path.Combine(binaries, "FlaxGame.exe"));
CodeSign(Path.Combine(binaries, "FlaxEngine.CSharp.dll"));
binaries = Path.Combine(dst, "Binaries", "Game", "x64", "Release");
CodeSign(Path.Combine(binaries, "FlaxGame.exe"));
CodeSign(Path.Combine(binaries, "FlaxEngine.CSharp.dll"));
}
// Don't distribute engine deps
Utilities.DirectoryDelete(Path.Combine(dst, "Binaries", "ThirdParty"));

View File

@@ -21,6 +21,8 @@ namespace Flax.Deploy
format = format.Replace("-", "--");
}
var cmdLine = string.Format(format, target, platform, architecture, configuration);
if (!string.IsNullOrEmpty(Configuration.Compiler))
cmdLine += " -compiler=" + Configuration.Compiler;
int result;
if (buildPlatform == TargetPlatform.Windows)

View File

@@ -2,6 +2,7 @@
using System;
using System.IO;
using System.Linq;
using Flax.Build;
using Flax.Build.Platforms;
using Flax.Build.Projects.VisualStudio;
@@ -255,5 +256,22 @@ namespace Flax.Deploy
string cmdLine = string.Format("\"{0}\" /t:Clean /verbosity:minimal /nologo", solutionFile);
Utilities.Run(msBuild, cmdLine);
}
internal static void CodeSign(string file, string certificatePath, string certificatePass)
{
if (!File.Exists(file))
throw new FileNotFoundException("Missing file to sign.", file);
if (!File.Exists(certificatePath))
throw new FileNotFoundException("Missing certificate to sign with.", certificatePath);
var sdks = WindowsPlatformBase.GetSDKs();
if (sdks.Count == 0)
throw new Exception("No Windows SDK found. Cannot sign file.");
var sdkKeys = sdks.Keys.ToList();
sdkKeys.Sort();
var sdk = sdks[sdkKeys.Last()];
var signtool = Path.Combine(sdk, "bin", "x64", "signtool.exe");
var cmdLine = string.Format("sign /debug /f \"{0}\" /p \"{1}\" /tr http://timestamp.comodoca.com /td sha256 /fd sha256 \"{2}\"", certificatePath, certificatePass, file);
Utilities.Run(signtool, cmdLine);
}
}
}

View File

@@ -39,6 +39,46 @@ namespace Flax.Deps.Dependencies
{
var root = options.IntermediateFolder;
var moduleFilename = "assimp.Build.cs";
var configs = new string[]
{
"-DASSIMP_NO_EXPORT=ON",
"-DASSIMP_BUILD_ASSIMP_TOOLS=OFF",
"-DASSIMP_BUILD_TESTS=OFF",
"-DASSIMP_BUILD_AMF_IMPORTER=FALSE",
"-DASSIMP_BUILD_AC_IMPORTER=FALSE",
"-DASSIMP_BUILD_ASE_IMPORTER=FALSE",
"-DASSIMP_BUILD_ASSBIN_IMPORTER=FALSE",
"-DASSIMP_BUILD_ASSXML_IMPORTER=FALSE",
"-DASSIMP_BUILD_DXF_IMPORTER=FALSE",
"-DASSIMP_BUILD_CSM_IMPORTER=FALSE",
"-DASSIMP_BUILD_HMP_IMPORTER=FALSE",
"-DASSIMP_BUILD_NFF_IMPORTER=FALSE",
"-DASSIMP_BUILD_NDO_IMPORTER=FALSE",
"-DASSIMP_BUILD_IFC_IMPORTER=FALSE",
"-DASSIMP_BUILD_FBX_IMPORTER=FALSE",
"-DASSIMP_BUILD_RAW_IMPORTER=FALSE",
"-DASSIMP_BUILD_TERRAGEN_IMPORTER=FALSE",
"-DASSIMP_BUILD_3MF_IMPORTER=FALSE",
"-DASSIMP_BUILD_STEP_IMPORTER=FALSE",
"-DASSIMP_BUILD_3DS_IMPORTER=FALSE",
"-DASSIMP_BUILD_BVH_IMPORTER=FALSE",
"-DASSIMP_BUILD_IRRMESH_IMPORTER=FALSE",
"-DASSIMP_BUILD_IRR_IMPORTER=FALSE",
"-DASSIMP_BUILD_MD2_IMPORTER=FALSE",
"-DASSIMP_BUILD_MD3_IMPORTER=FALSE",
"-DASSIMP_BUILD_MD5_IMPORTER=FALSE",
"-DASSIMP_BUILD_MDC_IMPORTER=FALSE",
"-DASSIMP_BUILD_MDL_IMPORTER=FALSE",
"-DASSIMP_BUILD_OFF_IMPORTER=FALSE",
"-DASSIMP_BUILD_COB_IMPORTER=FALSE",
"-DASSIMP_BUILD_Q3D_IMPORTER=FALSE",
"-DASSIMP_BUILD_Q3BSP_IMPORTER=FALSE",
"-DASSIMP_BUILD_SIB_IMPORTER=FALSE",
"-DASSIMP_BUILD_SMD_IMPORTER=FALSE",
"-DASSIMP_BUILD_X3D_IMPORTER=FALSE",
"-DASSIMP_BUILD_MMD_IMPORTER=FALSE",
};
var globalConfig = string.Join(" ", configs);
// Get the source
CloneGitRepo(root, "https://github.com/FlaxEngine/assimp.git");
@@ -73,13 +113,11 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Linux:
{
// Build for Linux
RunCmake(root, TargetPlatform.Linux, TargetArchitecture.x64, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DASSIMP_NO_EXPORT=ON -DASSIMP_BUILD_ASSIMP_TOOLS=OFF -DASSIMP_BUILD_TESTS=OFF");
RunCmake(root, TargetPlatform.Linux, TargetArchitecture.x64, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig);
Utilities.Run("make", null, null, root, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Linux, TargetArchitecture.x64);
var srcName = "libassimp.so.4.1.0";
var dstName = "libassimp.so";
Utilities.FileCopy(Path.Combine(root, "lib", srcName), Path.Combine(depsFolder, dstName));
Utilities.Run("strip", dstName, null, depsFolder, Utilities.RunOptions.None);
Utilities.FileCopy(Path.Combine(root, "lib", "libassimp.a"), Path.Combine(depsFolder, "libassimp.a"));
Utilities.FileCopy(Path.Combine(root, "lib", "libIrrXML.a"), Path.Combine(depsFolder, "libIrrXML.a"));
break;
}
}

View File

@@ -119,6 +119,8 @@ namespace Flax.Build
private bool IsTargetCSharpOnly(string name)
{
if (string.IsNullOrWhiteSpace(name))
return true;
var rules = Builder.GenerateRulesAssembly();
var target = rules.GetTarget(name);
return target == null || target.Modules.TrueForAll(x => !rules.GetModule(x).BuildNativeCode);