forked from Unity-Technologies/Unity.Mathematics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (45 loc) · 2.16 KB
/
Program.cs
File metadata and controls
54 lines (45 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Globalization;
using System.IO;
using System.Threading;
namespace Unity.Mathematics.Mathematics.CodeGen
{
class MainClass
{
public static void Main (string[] args)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
var thisExeDir = Path.GetDirectoryName(typeof(MainClass).Assembly.Location);
if (thisExeDir == null)
{
throw new InvalidOperationException($"Unable to get path of current assembly from `{typeof(MainClass).Assembly.Location}`");
}
var directory = new DirectoryInfo(thisExeDir);
// go from `src/Unity.Mathematics.CodeGen/bin/Debug`
// to `src/`, so 3 directories
var parent = directory.Parent?.Parent?.Parent;
if (parent == null)
{
throw new InvalidOperationException($"Unable to get path of current assembly from `{typeof(MainClass).Assembly.Location}`");
}
var implementationDirectory = new DirectoryInfo(Path.Combine(parent.FullName, "Unity.Mathematics"));
if (!implementationDirectory.Exists)
{
throw new InvalidOperationException($"The directory `{implementationDirectory.FullName}` must exist");
}
var testDirectory = new DirectoryInfo(Path.Combine(parent.FullName, "Tests/Tests/Shared"));
if (!testDirectory.Exists)
{
throw new InvalidOperationException($"The directory `{testDirectory.FullName}` must exist");
}
var performanceTestDirectory = new DirectoryInfo(Path.Combine(parent.FullName, "Unity.Mathematics.PerformanceTests"));
if (!performanceTestDirectory.Exists)
{
throw new InvalidOperationException($"The directory `{performanceTestDirectory.FullName}` must exist");
}
Console.WriteLine("Generating swizzle and operators: " + directory);
VectorGenerator.Write(implementationDirectory.FullName, testDirectory.FullName, performanceTestDirectory.FullName);
Console.WriteLine("Done");
}
}
}