Beispiel #1
0
    /// <inheritdoc />
    public override void Setup(BuildOptions options)
    {
        base.Setup(options);

        options.PublicDefinitions.Add("COMPILE_WITH_SHADER_COMPILER");

        options.SourcePaths.Clear();
        options.SourceFiles.AddRange(Directory.GetFiles(FolderPath, "*.*", SearchOption.TopDirectoryOnly));
        options.SourcePaths.Add(Path.Combine(FolderPath, "Parser"));

        switch (options.Platform.Target)
        {
        case TargetPlatform.Windows:
            options.PrivateDependencies.Add("ShaderCompilerD3D");
            if (WindowsPlatformBase.GetSDKs().Any(x => x.Key != WindowsPlatformSDK.v8_1))
            {
                options.PrivateDependencies.Add("ShaderCompilerDX");
            }
            options.PrivateDependencies.Add("ShaderCompilerVulkan");
            break;

        default: throw new InvalidPlatformException(options.Platform.Target);
        }

        if (Sdk.HasValid("PS4Sdk"))
        {
            options.PrivateDependencies.Add("ShaderCompilerPS4");
        }
    }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        /// <summary>
        /// Gets the installed Visual Studio instance.
        /// </summary>
        /// <returns>The install location.</returns>
        public static VisualStudioCodeInstance GetInstance()
        {
            if (_instance == null)
            {
                switch (Platform.BuildPlatform.Target)
                {
                case TargetPlatform.Windows:
                {
                    if (!WindowsPlatformBase.TryReadDirRegistryKey("HKEY_CURRENT_USER\\SOFTWARE\\Classes\\Applications\\Code.exe\\shell\\open\\command", string.Empty, out var cmd))
                    {
                        if (!WindowsPlatformBase.TryReadDirRegistryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Applications\\Code.exe\\shell\\open\\command", string.Empty, out cmd))
                        {
                            return(null);
                        }
                    }
                    var path = cmd.Substring(1, cmd.Length - "\" \"%1\"".Length - 1);
                    if (File.Exists(path))
                    {
                        _instance = new VisualStudioCodeInstance
                        {
                            Path = path,
                        };
                    }
                    break;
                }

                case TargetPlatform.Linux:
                {
                    var path = "/usr/bin/code";
                    if (File.Exists(path))
                    {
                        _instance = new VisualStudioCodeInstance
                        {
                            Path = path,
                        };
                    }
                    break;
                }
                }

                if (_instance != null)
                {
                    Log.Verbose($"Found VS Code at {_instance.Path}");
                }
            }

            return(_instance);
        }
Beispiel #4
0
 /// <summary>
 /// Prints info about all SDKs.
 /// </summary>
 public static void Print()
 {
     Get(string.Empty);
     foreach (var e in _sdks)
     {
         var sdk = e.Value;
         Log.Info(sdk.GetType().Name + ", " + sdk.Version + ", " + sdk.RootPath);
     }
     foreach (var e in WindowsPlatformBase.GetSDKs())
     {
         Log.Info("Windows SDK " + e.Key + ", " + WindowsPlatformBase.GetSDKVersion(e.Key) + ", " + e.Value);
     }
     foreach (var e in WindowsPlatformBase.GetToolsets())
     {
         Log.Info("Windows Toolset " + e.Key + ", " + e.Value);
     }
 }
        /// <summary>
        /// Gets the installed Visual Studio instance.
        /// </summary>
        /// <returns>The install location.</returns>
        public static VisualStudioCodeInstance GetInstance()
        {
            if (_instance == null)
            {
                switch (Platform.BuildPlatform.Target)
                {
                case TargetPlatform.Windows:
                {
                    if (!WindowsPlatformBase.TryReadDirRegistryKey("HKEY_CURRENT_USER\\SOFTWARE\\Classes\\Applications\\Code.exe\\shell\\open\\command", string.Empty, out var cmd))
                    {
                        if (!WindowsPlatformBase.TryReadDirRegistryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Applications\\Code.exe\\shell\\open\\command", string.Empty, out cmd))
                        {
                            return(null);
                        }
                    }
                    var path = cmd.Substring(1, cmd.Length - "\" \"%1\"".Length - 1);
                    if (File.Exists(path))
                    {
                        _instance = new VisualStudioCodeInstance
                        {
                            Path = path,
                        };
                    }
                    break;
                }

                case TargetPlatform.Linux:
                {
                    var path = "/usr/bin/code";
                    if (File.Exists(path))
                    {
                        _instance = new VisualStudioCodeInstance
                        {
                            Path = path,
                        };
                    }
                    break;
                }

                case TargetPlatform.Mac:
                {
                    var userFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    var paths      = new string[]
                    {
                        "/Applications/Visual Studio Code.app",
                        userFolder + "/Visual Studio Code.app",
                        userFolder + "/Downloads/Visual Studio Code.app",
                    };
                    foreach (var path in paths)
                    {
                        if (Directory.Exists(path))
                        {
                            _instance = new VisualStudioCodeInstance
                            {
                                Path = path,
                            };
                            break;
                        }
                    }
                    break;
                }
                }

                if (_instance != null)
                {
                    Log.Verbose($"Found VS Code at {_instance.Path}");
                }
            }

            return(_instance);
        }