-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8476c37
commit bd6de9b
Showing
10 changed files
with
121 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/OneWare.OssCadSuiteIntegration/OneWare.OssCadSuiteIntegration.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="..\..\build\props\Base.props" /> | ||
<Import Project="..\..\build\props\OneWare.Module.props" /> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\OneWare.Shared\OneWare.Shared.csproj" /> | ||
</ItemGroup> | ||
</Project> |
54 changes: 54 additions & 0 deletions
54
src/OneWare.OssCadSuiteIntegration/OssCadSuiteIntegrationModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using OneWare.Shared.Helpers; | ||
using OneWare.Shared.Services; | ||
using Prism.Ioc; | ||
using Prism.Modularity; | ||
// ReSharper disable StringLiteralTypo | ||
|
||
namespace OneWare.OssCadSuiteIntegration; | ||
|
||
public class OssCadSuiteIntegrationModule : IModule | ||
{ | ||
public void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
|
||
} | ||
|
||
public void OnInitialized(IContainerProvider containerProvider) | ||
{ | ||
var settingsService = containerProvider.Resolve<ISettingsService>(); | ||
|
||
settingsService.RegisterTitledPath("Tools", "OSS Cad Suite", "OssCadSuite_Path", "OSS CAD Suite Path", | ||
"Sets the path for the Yosys OSS CAD Suite", "", null, null, IsOssPathValid); | ||
|
||
string? environmentPathSetting; | ||
|
||
settingsService.GetSettingObservable<string>("OssCadSuite_Path").Subscribe(x => | ||
{ | ||
if (!IsOssPathValid(x)) | ||
{ | ||
containerProvider.Resolve<ILogger>().Warning("OSS CAD Suite path invalid", null, false); | ||
return; | ||
} | ||
|
||
var binPath = Path.Combine(x, "bin"); | ||
var pythonBin = Path.Combine(x, "py3bin"); | ||
var lib = Path.Combine(x, "lib"); | ||
|
||
environmentPathSetting = $";{binPath};{pythonBin};{lib};"; | ||
var currentPath = Environment.GetEnvironmentVariable("PATH"); | ||
|
||
//TODO Add all | ||
Environment.SetEnvironmentVariable("PATH", $"{currentPath}{environmentPathSetting}"); | ||
Environment.SetEnvironmentVariable("OPENFPGALOADER_SOJ_DIR", Path.Combine(x, "share", "openFPGALoader")); | ||
Environment.SetEnvironmentVariable("PYTHON_EXECUTABLE", Path.Combine(x, "py3bin", $"python3{PlatformHelper.ExecutableExtension}")); | ||
}); | ||
} | ||
|
||
private static bool IsOssPathValid(string path) | ||
{ | ||
if (!Directory.Exists(path)) return false; | ||
if (!File.Exists(Path.Combine(path, "bin", $"yosys{PlatformHelper.ExecutableExtension}"))) return false; | ||
if (!File.Exists(Path.Combine(path, "bin", $"openFPGALoader{PlatformHelper.ExecutableExtension}"))) return false; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters