diff --git a/Source/Engine/TestsMain/TestsMain.Build.cs b/Source/Engine/TestsMain/TestsMain.Build.cs
index 1bb84cefd..cd0bfd6fb 100644
--- a/Source/Engine/TestsMain/TestsMain.Build.cs
+++ b/Source/Engine/TestsMain/TestsMain.Build.cs
@@ -10,45 +10,6 @@ using Flax.Build.NativeCpp;
///
public class TestsMain : EngineModule
{
- ///
- public override void Setup(BuildOptions options)
- {
- base.Setup(options);
-
- // Use source folder per platform group
- switch (options.Platform.Target)
- {
- case TargetPlatform.Windows:
- options.SourcePaths.Add(Path.Combine(FolderPath, "Windows"));
-
- // Visual Leak Detector (https://kinddragon.github.io/vld/)
- /*{
- var vldPath = @"C:\Program Files (x86)\Visual Leak Detector";
- var vldBinaries = options.Toolchain.Architecture == TargetArchitecture.x64 ? "Win64" : "Win32";
- var vldBinariesPostfix = options.Toolchain.Architecture == TargetArchitecture.x64 ? "x64" : "x86";
- options.PrivateDefinitions.Add("USE_VLD_MEM_LEAKS_CHECK");
- options.PrivateDefinitions.Add("VLD_FORCE_ENABLE");
- options.PrivateIncludePaths.Add(Path.Combine(vldPath, "include"));
- options.OutputFiles.Add(Path.Combine(vldPath, "lib", vldBinaries, "vld.lib"));
- options.DependencyFiles.Add(Path.Combine(vldPath, "bin", vldBinaries, "vld_" + vldBinariesPostfix + ".dll"));
- options.DependencyFiles.Add(Path.Combine(vldPath, "bin", vldBinaries, "vld_" + vldBinariesPostfix + ".pdb"));
- options.DependencyFiles.Add(Path.Combine(vldPath, "bin", vldBinaries, "dbghelp.dll"));
- options.DependencyFiles.Add(Path.Combine(vldPath, "bin", vldBinaries, "Microsoft.DTfW.DHL.manifest"));
- }*/
-
- // Visual Studio memory leaks detection
- /*{
- options.PrivateDefinitions.Add("USE_VS_MEM_LEAKS_CHECK");
- }*/
-
- break;
- case TargetPlatform.Linux:
- options.SourcePaths.Add(Path.Combine(FolderPath, "Linux"));
- break;
- default: throw new InvalidPlatformException(options.Platform.Target);
- }
- }
-
///
public override void GetFilesToDeploy(List files)
{
diff --git a/Source/Engine/TestsMain/Linux/main.cpp b/Source/Engine/TestsMain/TestsMain.cpp
similarity index 86%
rename from Source/Engine/TestsMain/Linux/main.cpp
rename to Source/Engine/TestsMain/TestsMain.cpp
index a3cb4cc41..29ad947d7 100644
--- a/Source/Engine/TestsMain/Linux/main.cpp
+++ b/Source/Engine/TestsMain/TestsMain.cpp
@@ -1,6 +1,6 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
-#if PLATFORM_LINUX
+#if PLATFORM_WINDOWS || PLATFORM_LINUX
#define CATCH_CONFIG_RUNNER
#include
diff --git a/Source/Engine/TestsMain/Windows/main.cpp b/Source/Engine/TestsMain/Windows/main.cpp
deleted file mode 100644
index 21a40090a..000000000
--- a/Source/Engine/TestsMain/Windows/main.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
-
-#if PLATFORM_WINDOWS
-
-#ifdef USE_VLD_MEM_LEAKS_CHECK
-#include
-#endif
-#ifdef USE_VS_MEM_LEAKS_CHECK
-#define _CRTDBG_MAP_ALLOC
-#include
-#include
-#else
-#include
-#endif
-
-#define CATCH_CONFIG_RUNNER
-#include
-
-
-int main(int argc, char* argv[])
-{
-#ifdef USE_VS_MEM_LEAKS_CHECK
- // Memory leaks detect inside VS
- int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
- flag |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF;
- _CrtSetDbgFlag(flag);
-#endif
-
-#ifdef USE_VLD_MEM_LEAKS_CHECK
- VLDGlobalEnable();
-#endif
-
- int result = Catch::Session().run(argc, argv);
- return result;
-}
-
-#endif
diff --git a/Source/FlaxNativeTests.Build.cs b/Source/FlaxNativeTests.Build.cs
index 4fb9ef0f9..b4c1ee027 100644
--- a/Source/FlaxNativeTests.Build.cs
+++ b/Source/FlaxNativeTests.Build.cs
@@ -19,6 +19,8 @@ public class FlaxNativeTestsTarget : EngineTarget
// Initialize
OutputName = "FlaxNativeTests";
ConfigurationName = "Tests";
+
+ // TODO: All platforms would benefit from the tests.
Platforms = new[]
{
TargetPlatform.Windows,
@@ -51,10 +53,11 @@ public class FlaxNativeTestsTarget : EngineTarget
///
public override Target SelectReferencedTarget(ProjectInfo project, Target[] projectTargets)
{
- var testTargetName = "FlaxNativeTests";
+ var testTargetName = "FlaxNativeTests"; // Should this be added to .flaxproj, similarly as "GameTarget" and "EditorTarget"?
var result = projectTargets.FirstOrDefault(x => x.Name == testTargetName);
if (result == null)
- throw new Exception("Invalid or missing test target {testTargetName} specified in project {project.Name} (referenced by project {Project.Name}).");
+ // Apparently .NET compiler that is used for building .Build.cs files is different that one used for building Flax.Build itself. String interpolation ($) does't work here.
+ throw new Exception(string.Format("Invalid or missing test target {0} specified in project {1} (referenced by project {2}).", testTargetName, project.Name, Project.Name));
return result;
}
}