if(projectView && projectView.popupMenu && projectView.popupMenu.menu && projectView.popupMenu.created)
{
MenuItem menu;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectLink, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRebuild, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectClean, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRealClean, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRegenerate, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRemove, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::FileClean, 0); if(menu) menu.disabled = unavailable;
- menu = projectView.popupMenu.menu.FindItem(ProjectView::FileCompile, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectBuild, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectLink, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRebuild, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectClean, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRealClean, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRegenerate, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::ProjectRemove, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::FileClean, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::FileCompile, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugPrecompile, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugCompile, 0); if(menu) menu.disabled = unavailable;
+ menu = projectView.popupMenu.menu.FindItem(ProjectView::FileDebugGenerateSymbols, 0); if(menu) menu.disabled = unavailable;
projectView.popupMenu.Update(null);
}
}
{
List<ProjectNode> nodes { };
nodes.Add(node);
- projectView.Compile(node.project, nodes, mods.ctrl && mods.shift);
+ projectView.Compile(node.project, nodes, mods.ctrl && mods.shift, normal);
delete nodes;
result = true;
bool OnPostCreate()
{
int c;
+ bool passThrough = false;
+ bool debugStart = false;
+ DynamicString passArgs { };
for(c = 1; c<app.argc; c++)
{
- char fullPath[MAX_LOCATION];
- char parentPath[MAX_LOCATION];
- char ext[MAX_EXTENSION];
- bool isProject;
- FileAttribs dirAttribs;
- GetWorkingDir(fullPath, MAX_LOCATION);
- PathCat(fullPath, app.argv[c]);
- StripLastDirectory(fullPath, parentPath);
- GetExtension(app.argv[c], ext);
- isProject = !strcmpi(ext, "epj");
-
- if(isProject && c > 1) continue;
-
- // Create directory for projects (only)
- if(((dirAttribs = FileExists(parentPath)) && dirAttribs.isDirectory) || isProject)
+ if(!strcmp(app.argv[c], "-debug-start"))
+ debugStart = true;
+ else if(!passThrough && !strcmp(app.argv[c], "-@"))
+ passThrough = true;
+ else if(passThrough)
{
- if(isProject && !FileExists(fullPath))
+ passArgs.concat(" ");
+ passArgs.concat(app.argv[c]);
+ }
+ else
+ {
+ char fullPath[MAX_LOCATION];
+ char parentPath[MAX_LOCATION];
+ char ext[MAX_EXTENSION];
+ bool isProject;
+ FileAttribs dirAttribs;
+ GetWorkingDir(fullPath, MAX_LOCATION);
+ PathCat(fullPath, app.argv[c]);
+ StripLastDirectory(fullPath, parentPath);
+ GetExtension(app.argv[c], ext);
+ isProject = !strcmpi(ext, "epj");
+
+ if(isProject && c > (debugStart ? 2 : 1)) continue;
+
+ // Create directory for projects (only)
+ if(((dirAttribs = FileExists(parentPath)) && dirAttribs.isDirectory) || isProject)
{
- // The NewProject will handle directory creation
- /*if(!dirAttribs.isDirectory)
- {
- MakeDir(parentPath);
- dirAttribs = FileExists(parentPath);
- }
- if(dirAttribs.isDirectory)*/
+ if(isProject && !FileExists(fullPath))
{
- char name[MAX_LOCATION];
- NewProjectDialog newProjectDialog;
-
- if(projectView)
+ // The NewProject will handle directory creation
+ /*if(!dirAttribs.isDirectory)
{
- projectView.visible = false;
- if(!projectView.Destroy(0))
- return true;
+ MakeDir(parentPath);
+ dirAttribs = FileExists(parentPath);
}
+ if(dirAttribs.isDirectory)*/
+ {
+ char name[MAX_LOCATION];
+ NewProjectDialog newProjectDialog;
- newProjectDialog = { master = this };
+ if(projectView)
+ {
+ projectView.visible = false;
+ if(!projectView.Destroy(0))
+ return true;
+ }
- strcpy(name, app.argv[c]);
- StripExtension(name);
- GetLastDirectory(name, name);
- newProjectDialog.projectName.contents = name;
- newProjectDialog.projectName.NotifyModified(newProjectDialog, newProjectDialog.projectName);
- newProjectDialog.locationEditBox.path = parentPath;
- newProjectDialog.NotifyModifiedLocation(newProjectDialog.locationEditBox);
+ newProjectDialog = { master = this };
- newProjectDialog.Modal();
- if(projectView)
- {
- ideSettings.AddRecentProject(projectView.fileName);
- ide.UpdateRecentMenus();
- settingsContainer.Save();
+ strcpy(name, app.argv[c]);
+ StripExtension(name);
+ GetLastDirectory(name, name);
+ newProjectDialog.projectName.contents = name;
+ newProjectDialog.projectName.NotifyModified(newProjectDialog, newProjectDialog.projectName);
+ newProjectDialog.locationEditBox.path = parentPath;
+ newProjectDialog.NotifyModifiedLocation(newProjectDialog.locationEditBox);
+
+ newProjectDialog.Modal();
+ if(projectView)
+ {
+ ideSettings.AddRecentProject(projectView.fileName);
+ ide.UpdateRecentMenus();
+ settingsContainer.Save();
+ }
}
+ // Open only one project
+ break;
}
- // Open only one project
- break;
+ else
+ ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal);
}
- else
- ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal);
}
}
+ if(passThrough && projectView && projectView.project && workspace)
+ workspace.commandLineArgs = passArgs;
+ delete passArgs;
+ if(debugStart)
+ ;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock
return true;
}
return config ? config.name : "Common";
}
+public enum SingleFileCompileMode { normal, debugPrecompile, debugCompile, debugGenerateSymbols };
+
class Project : struct
{
class_no_expansion; // To use Find on the Container<Project> in Workspace::projects
}
}
- bool Build(bool isARun, List<ProjectNode> onlyNodes, CompilerConfig compiler, ProjectConfig config, bool justPrint)
+ bool Build(bool isARun, List<ProjectNode> onlyNodes, CompilerConfig compiler, ProjectConfig config, bool justPrint, SingleFileCompileMode mode)
{
bool result = false;
DualPipe f;
{
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
- sprintf(command, "%s CF_DIR=\"%s\"%s%s COMPILER=%s -j%d %s%s%s -C \"%s\"%s -f \"%s\"",
- compiler.makeCommand, cfDir,
+ sprintf(command, "%s %sCF_DIR=\"%s\"%s%s COMPILER=%s -j%d %s%s%s -C \"%s\"%s -f \"%s\"",
+ compiler.makeCommand,
+ mode == normal ? "" : (mode == debugPrecompile ? "ECP_DEBUG=y " : mode == debugCompile ? "ECC_DEBUG=y " : mode == debugGenerateSymbols ? "ECS_DEBUG=y " : ""),
+ cfDir,
crossCompiling ? " TARGET_PLATFORM=" : "", targetPlatform,
compilerName, numJobs,
compiler.ccacheEnabled ? "CCACHE=y " : "",
compiler.distccEnabled ? "DISTCC=y " : "",
- (String)makeTargets, topNode.path, justPrint ? " -n" : "", makeFilePath);
+ (String)makeTargets, topNode.path, (justPrint || mode != normal) ? " -n" : "", makeFilePath);
if(justPrint)
ide.outputView.buildBox.Logf("%s\n", command);
if((f = DualPipeOpen(PipeOpenMode { output = true, error = true, input = true }, command)))
{
+ bool found = false;
if(justPrint)
{
ProcessPipeOutputRaw(f);
result = true;
}
+ else if(mode != normal)
+ {
+ char line[65536];
+ while(!f.Eof())
+ {
+ bool result = true;
+ while(result)
+ {
+ if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)))
+ {
+ if(!found && strstr(line, "ide ") == line)
+ {
+ strcpy(command, line);
+ found = true;
+ }
+ }
+ }
+ }
+ }
else
result = ProcessBuildPipeOutput(f, objDirExp, isARun, onlyNodes, compiler, config);
delete f;
+ if(found)
+ Execute(command);
}
else
ide.outputView.buildBox.Logf($"Error executing make (%s) command\n", compiler.makeCommand);
delete target;
}
- void Compile(List<ProjectNode> nodes, CompilerConfig compiler, ProjectConfig config, bool justPrint)
+ void Compile(List<ProjectNode> nodes, CompilerConfig compiler, ProjectConfig config, bool justPrint, SingleFileCompileMode mode)
{
- Build(false, nodes, compiler, config, justPrint);
+ Build(false, nodes, compiler, config, justPrint, mode);
}
#endif
File f = FileOpen(path, write);
if(f)
{
+ if(compiler.environmentVars && compiler.environmentVars.count)
+ {
+ f.Puts("# ENVIRONMENT VARIABLES\n");
+ f.Puts("\n");
+ for(e : compiler.environmentVars)
+ {
+ f.Printf("export %s := %s\n", e.name, e.string);
+ }
+ }
+
f.Puts("# TOOLCHAIN\n");
f.Puts("\n");
f.Printf("CPP := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.cppCommand);
f.Printf("CC := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.ccCommand);
f.Printf("CXX := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.cxxCommand);
- f.Printf("ECP := %s\n", compiler.ecpCommand);
- f.Printf("ECC := %s$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.eccCommand);
- f.Printf("ECS := %s$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.ecsCommand);
+ f.Printf("ECP := $(if $(ECP_DEBUG),ide -debug-start $(ECERE_SDK_SRC)/compiler/ecp/ecp.epj -@,%s)\n", compiler.ecpCommand);
+ f.Printf("ECC := $(if $(ECC_DEBUG),ide -debug-start $(ECERE_SDK_SRC)/compiler/ecc/ecc.epj -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.eccCommand);
+ f.Printf("ECS := $(if $(ECS_DEBUG),ide -debug-start $(ECERE_SDK_SRC)/compiler/ecs/ecs.epj -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.ecsCommand);
f.Printf("EAR := %s\n", compiler.earCommand);
f.Puts("AS := $(GCC_PREFIX)as\n");
f.Puts("UPX := upx\n");
f.Puts("\n");
- if(compiler.environmentVars && compiler.environmentVars.count)
- {
- f.Puts("# ENVIRONMENT VARIABLES\n");
- f.Puts("\n");
- for(e : compiler.environmentVars)
- {
- f.Printf("export %s := %s\n", e.name, e.string);
- }
- }
-
f.Puts("UPXFLAGS = -9\n"); // TOFEAT: Compression Level Option? Other UPX Options?
f.Puts("\n");
MenuItem { popupContent, $"Regenerate Makefile", m, NotifySelect = ProjectRegenerate }.disabled = buildMenuUnavailable;
MenuDivider { popupContent };
}
+ MenuItem { popupContent, $"Debug Generate Symbols", l, NotifySelect = FileDebugGenerateSymbols }.disabled = buildMenuUnavailable;
+ MenuDivider { popupContent };
MenuItem { popupContent, $"New File...", l, Key { l, ctrl = true }, NotifySelect = ProjectNewFile };
MenuItem { popupContent, $"New Folder...", n, Key { f, ctrl = true }, NotifySelect = ProjectNewFolder };
MenuItem { popupContent, $"Import Folder...", i, NotifySelect = ProjectImportFolder };
MenuItem { popupContent, $"Clean", l, NotifySelect = FileClean }.disabled = buildMenuUnavailable;
MenuItem { popupContent, $"Compile", c, Key { f7, ctrl = true}, NotifySelect = FileCompile }.disabled = buildMenuUnavailable;
MenuDivider { popupContent };
+ MenuItem { popupContent, $"Debug Precompile", l, NotifySelect = FileDebugPrecompile }.disabled = buildMenuUnavailable;
+ MenuItem { popupContent, $"Debug Compile", l, NotifySelect = FileDebugCompile }.disabled = buildMenuUnavailable;
+ MenuDivider { popupContent };
MenuItem { popupContent, $"Remove", r, NotifySelect = FileRemoveFile };
MenuDivider { popupContent };
MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
ide.AdjustBuildMenus();
ide.AdjustDebugMenus();
- result = prj.Build(buildType == run, null, compiler, config, justPrint);
+ result = prj.Build(buildType == run, null, compiler, config, justPrint, normal);
if(config)
{
return true;
}
- bool Compile(Project project, List<ProjectNode> nodes, bool justPrint)
+ bool Compile(Project project, List<ProjectNode> nodes, bool justPrint, SingleFileCompileMode mode)
{
bool result = true;
char fileName[MAX_LOCATION];
if(ProjectPrepareForToolchain(project, normal, true, true, compiler, config))
{
if(config)
- ide.outputView.buildBox.Logf($"Compiling specific file(s) in project %s using the %s configuration...\n",
- project.name, config.name);
+ ide.outputView.buildBox.Logf($"%s specific file(s) in project %s using the %s configuration...\n",
+ mode == normal ? $"Compiling" : $"Debug compiling", project.name, config.name);
else
- ide.outputView.buildBox.Logf($"Compiling specific file(s) in project %s...\n",
- project.name);
+ ide.outputView.buildBox.Logf($"%s specific file(s) in project %s...\n",
+ mode == normal ? $"Compiling" : $"Debug compiling", project.name);
buildInProgress = compilingFile;
ide.AdjustBuildMenus();
- project.Compile(nodes, compiler, config, justPrint);
+ project.Compile(nodes, compiler, config, justPrint, mode);
buildInProgress = none;
ide.AdjustBuildMenus();
}
selectedRows.Free(null);
if(project)
- Compile(project, nodes, mods.ctrl && mods.shift);
+ Compile(project, nodes, mods.ctrl && mods.shift, normal);
else
ide.outputView.buildBox.Logf($"Please select files from a single project.\n");
delete nodes;
return true;
}
+ bool FileDebugPrecompile(MenuItem selection, Modifiers mods)
+ {
+ DataRow row = fileList.currentRow;
+ ProjectNode node = row ? (ProjectNode)row.tag : null;
+ if(node)
+ {
+ List<ProjectNode> nodes { };
+ nodes.Add(node);
+ Compile(node.project, nodes, mods.ctrl && mods.shift, debugPrecompile);
+ delete nodes;
+ }
+ }
+
+ bool FileDebugCompile(MenuItem selection, Modifiers mods)
+ {
+ DataRow row = fileList.currentRow;
+ ProjectNode node = row ? (ProjectNode)row.tag : null;
+ if(node)
+ {
+ List<ProjectNode> nodes { };
+ nodes.Add(node);
+ Compile(node.project, nodes, mods.ctrl && mods.shift, debugCompile);
+ delete nodes;
+ }
+ }
+
+ bool FileDebugGenerateSymbols(MenuItem selection, Modifiers mods)
+ {
+ DataRow row = fileList.currentRow;
+ ProjectNode node = row ? (ProjectNode)row.tag : null;
+ if(node)
+ {
+ List<ProjectNode> nodes { };
+ nodes.Add(node);
+ Compile(node.project, nodes, mods.ctrl && mods.shift, debugGenerateSymbols);
+ delete nodes;
+ }
+ }
+
Project GetSelectedProject(bool useSelection)
{
Project prj = project;