Skip to content

Commit

Permalink
Module Symbol Support
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperHackio committed May 2, 2024
1 parent c1828da commit 7e0fc8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
23 changes: 14 additions & 9 deletions SyatiModuleBuildTool/ModuleUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static string[] CollectModuleFlags(List<ModuleInfo> Modules)
return [.. flags];
}


public static void PerformAllModuleCodeGen(List<ModuleInfo> Modules)
{
for (int i = 0; i < Modules.Count; i++)
Expand Down Expand Up @@ -166,8 +167,6 @@ public static void VerifyDependancies(List<ModuleInfo> Modules)
}
}



public static string[] GetModuleDependancies(ModuleInfo MI, List<ModuleInfo> OtherModules)
{
if (MI.ModuleDependancies is null)
Expand Down Expand Up @@ -220,6 +219,7 @@ public static string[] CreateModuleDependancyIncludes(ModuleInfo MI, List<Module
return Includes;
}


public static string[] GetModuleExtensionIncludes(ModuleInfo MI)
{
if (MI.ModuleExtensionDefinition is null)
Expand Down Expand Up @@ -303,15 +303,20 @@ public static void CompileModule(ModuleInfo MI, string[] Flags, string[] Include





public static string[] CollectModuleSymbols(List<ModuleInfo> Modules)
{
List<string> Paths = [];
foreach (ModuleInfo module in Modules)
{
string path = CreateModuleSymbolPath(module);
if (Directory.Exists(path))
Paths.Add(path);
}
return [.. Paths];
}

public static string CreateModuleCodeGenBuildPath(ModuleInfo MI) => "\"" + Path.Combine(MI.FolderPath, "codebuild").Replace("\\", "/") + "\"";
public static string CreateModuleIncludePath(ModuleInfo MI) => "\"" + Path.Combine(MI.FolderPath, "include").Replace("\\", "/") + "\"";
public static string CreateModuleSourcePath(ModuleInfo MI) => "\"" + Path.Combine(MI.FolderPath, "source").Replace("\\", "/") + "\"";





public static string CreateModuleSymbolPath(ModuleInfo MI) => "\"" + Path.Combine(MI.FolderPath, "symbols").Replace("\\", "/") + "\"";
}
8 changes: 6 additions & 2 deletions SyatiModuleBuildTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,19 @@ void TryLoadModule(string ModulePath)
// If we made it here, we have a successful compile. Hooray!
// I hope linking works...

//TODO: Module Symbol Support
Console.WriteLine();
Console.WriteLine("Linking...");
string Kamek = $"{Path.Combine(SyatiFolderPath, "deps/Kamek/Kamek.exe")}";
List<string> SymbolPaths =
[
Path.Combine(SyatiFolderPath, "symbols"),
];
string Symbols = $"-externals=\"{SymbolPaths[0]}/{args[0]}.txt\" ";
SymbolPaths.AddRange(ModuleUtility.CollectModuleSymbols(Modules));
string Symbols = "";
for (int y = 0; y < SymbolPaths.Count; y++)
{
Symbols += $"-externals=\"{SymbolPaths[y]}/{args[0]}.txt\" ";
}
string MapFile = $"-output-map=\"{Path.Combine(args[3], $"CustomCode_{args[0]}.map")}\"";
string Output = $"-output-kamek=\"{Path.Combine(args[3], $"CustomCode_{args[0]}.bin")}\"";
int result = CompileUtility.LaunchProcess(Kamek, $"{string.Join(" ", AllObjectOutputs)} {Symbols} {Output} {MapFile}");
Expand Down

0 comments on commit 7e0fc8d

Please sign in to comment.