Skip to content

Commit

Permalink
ide: fix specifying all file extensions (output file extension for em…
Browse files Browse the repository at this point in the history
…scripten) inside <compiler>.cf instead of the ide specifying O=bc when calling make. add don't strip target and document output to compiler config. open compiler document (html files by emscripten) output in shell.

 - add static and shared library file extensions to compiler config
 - add executable file extension to compiler config
 - fix ar and ld fields are not being disabled for default compiler in global settings dialog, compilers tab, toolchain tab.
  • Loading branch information
redj authored and jerstlouis committed Jul 28, 2016
1 parent dd35656 commit 48e1508
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 36 deletions.
19 changes: 17 additions & 2 deletions default.cf
Expand Up @@ -7,8 +7,23 @@ ifdef WINDOWS_HOST
endif
endif

# EXTENSIONS
OUT := $(if $(STATIC_LIBRARY_TARGET),$(A),$(if $(SHARED_LIBRARY_TARGET),$(SO)$(VER),$(if $(EXECUTABLE_TARGET),$(E),.x)))
# PREFIXES AND EXTENSIONS
EC := .ec
S := .sym
I := .imp
B := .bowl
C := .c
ifndef O
O := .o
endif
A := .a
E := $(if $(WINDOWS_TARGET),.exe,)
SO := $(if $(WINDOWS_TARGET),.dll,$(if $(OSX_TARGET),.dylib,.so))
LP := $(if $(WINDOWS_TARGET),$(if $(STATIC_LIBRARY_TARGET),lib,),lib)
HOST_E := $(if $(WINDOWS_HOST),.exe,)
HOST_SO := $(if $(WINDOWS_HOST),.dll,$(if $(OSX_HOST),.dylib,.so))
HOST_LP := $(if $(WINDOWS_HOST),$(if $(STATIC_LIBRARY_TARGET),lib,),lib)
.SUFFIXES: .c .ec .sym .imp .bowl $(O) $(A)

# TOOLCHAIN
export CC = $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)gcc$(_SYSROOT)$(if $(GCC_CC_FLAGS),$(space)$(GCC_CC_FLAGS),)
Expand Down
61 changes: 51 additions & 10 deletions ide/src/IDESettings.ec
Expand Up @@ -1244,11 +1244,23 @@ public:
get { return objectFileExt && objectFileExt[0] ? objectFileExt : objectDefaultFileExt ; }
isset { return objectFileExt && objectFileExt[0] && strcmp(objectFileExt, objectDefaultFileExt); }
}
property const char * outputFileExt
property const char * staticLibFileExt
{
set { delete staticLibFileExt; if(value && value[0]) staticLibFileExt = CopyString(value); }
get { return staticLibFileExt; }
isset { return staticLibFileExt && staticLibFileExt[0]; }
}
property const char * sharedLibFileExt
{
set { delete outputFileExt; if(value && value[0]) outputFileExt = CopyString(value); }
get { return outputFileExt; }
isset { return outputFileExt && outputFileExt[0]; }
set { delete sharedLibFileExt; if(value && value[0]) sharedLibFileExt = CopyString(value); }
get { return sharedLibFileExt; }
isset { return sharedLibFileExt && sharedLibFileExt[0]; }
}
property const char * executableFileExt
{
set { delete executableFileExt; if(value && value[0]) executableFileExt = CopyString(value); }
get { return executableFileExt; }
isset { return executableFileExt && executableFileExt[0]; }
}
property const char * executableLauncher
{
Expand Down Expand Up @@ -1281,6 +1293,7 @@ public:
isset { return sysroot && sysroot[0]; }
}
bool resourcesDotEar;
bool noStripTarget;
property Array<String> includeDirs
{
set
Expand Down Expand Up @@ -1434,6 +1447,23 @@ public:
get { return executableLauncher; }
isset { return false; }
}
property const char * outputFileExt
{
set { delete executableFileExt; if(value && value[0]) executableFileExt = CopyString(value); }
get { return executableFileExt; }
isset { return false; }
}
// utility
property bool hasDocumentOutput
{
get
{
bool result = executableFileExt && executableFileExt[0] &&
(!strcmpi(executableFileExt, "htm") || !strcmpi(executableFileExt, "html"));
return result;
}
isset { return false; }
}
private:
Array<String> includeDirs { };
Array<String> libraryDirs { };
Expand All @@ -1459,7 +1489,9 @@ private:
char * ldCommand;
char * arCommand;
char * objectFileExt;
char * outputFileExt;
char * staticLibFileExt;
char * sharedLibFileExt;
char * executableFileExt;
char * executableLauncher;
char * distccHosts;
char * gnuToolchainPrefix;
Expand All @@ -1483,7 +1515,9 @@ private:
delete ldCommand;
delete arCommand;
delete objectFileExt;
delete outputFileExt;
delete staticLibFileExt;
delete sharedLibFileExt;
delete executableFileExt;
delete makeCommand;
delete executableLauncher;
delete distccHosts;
Expand Down Expand Up @@ -1560,15 +1594,18 @@ public:
arCommand,
ldCommand,
objectFileExt,
outputFileExt,
staticLibFileExt,
sharedLibFileExt,
executableFileExt,
executableLauncher,
ccacheEnabled,
distccEnabled,
false,
distccHosts,
gnuToolchainPrefix,
sysroot,
resourcesDotEar
resourcesDotEar,
noStripTarget
};
for(s : includeDirs) copy.includeDirs.Add(CopyString(s));
for(s : libraryDirs) copy.libraryDirs.Add(CopyString(s));
Expand Down Expand Up @@ -1648,8 +1685,12 @@ class CompilerConfigs : List<CompilerConfig>
ccfg.arCommand = arDefaultCommand;
if(!ccfg.objectFileExt || !ccfg.objectFileExt[0])
ccfg.objectFileExt = objectDefaultFileExt;
/*if(!ccfg.outputFileExt || !ccfg.outputFileExt[0])
ccfg.outputFileExt = outputDefaultFileExt;*/
/*if(!ccfg.staticLibFileExt || !ccfg.staticLibFileExt[0])
ccfg.staticLibFileExt = staticLibDefaultFileExt;*/
/*if(!ccfg.sharedLibFileExt || !ccfg.sharedLibFileExt[0])
ccfg.sharedLibFileExt = sharedLibDefaultFileExt;*/
/*if(!ccfg.executableFileExt || !ccfg.executableFileExt[0])
ccfg.executableFileExt = outputDefaultFileExt;*/
if(!ccfg._refCount) incref ccfg;
}
}
Expand Down
70 changes: 63 additions & 7 deletions ide/src/dialogs/GlobalSettingsDialog.ec
Expand Up @@ -864,7 +864,8 @@ class CompilerToolchainTab : CompilersSubTab
cppLabel.disabled = cpp.disabled = isVC || disabled;
cxxLabel.disabled = cxx.disabled = isVC || disabled;
ccLabel.disabled = cc.disabled = isVC || disabled;
ldLabel.disabled = cxx.disabled = isVC || disabled;
ldLabel.disabled = ld.disabled = isVC || disabled;
arLabel.disabled = ar.disabled = isVC || disabled;
makeLabel.disabled = make.disabled = disabled;
executableLauncherLabel.disabled = executableLauncher.disabled = disabled;
gnuToolchainPrefixLabel.disabled = gnuToolchainPrefix.disabled = disabled;
Expand Down Expand Up @@ -1167,18 +1168,70 @@ class CompilerOptionsTab : CompilersSubTab
}
};

Label outputFileExtLabel { this, position = { 8, 306 }, labeledWindow = outputFileExt };
EditBox outputFileExt
Label staticLibFileExtLabel { this, position = { 8, 306 }, labeledWindow = staticLibFileExt };
EditBox staticLibFileExt
{
this, text = $"Output file extension";//, hotKey = altH;
this, text = $"Output (a, so, exe) file extension";//, hotKey = altH;
position = { 168, 304 }, size = { 80, 22 };

bool NotifyModified(EditBox editBox)
{
CompilerConfig compiler = loadedCompiler;
if(compiler)
{
compiler.outputFileExt = editBox.contents;
compiler.staticLibFileExt = editBox.contents;
modifiedDocument = true;
compilersTab.modifiedDocument = true;
}
return true;
}
};
EditBox sharedLibFileExt
{
this;
position = { 256, 304 }, size = { 80, 22 };

bool NotifyModified(EditBox editBox)
{
CompilerConfig compiler = loadedCompiler;
if(compiler)
{
compiler.sharedLibFileExt = editBox.contents;
modifiedDocument = true;
compilersTab.modifiedDocument = true;
}
return true;
}
};
EditBox executableFileExt
{
this;
position = { 344, 304 }, size = { 80, 22 };

bool NotifyModified(EditBox editBox)
{
CompilerConfig compiler = loadedCompiler;
if(compiler)
{
compiler.executableFileExt = editBox.contents;
modifiedDocument = true;
compilersTab.modifiedDocument = true;
}
return true;
}
};

Button stripTarget
{
this, text = $"Strip target", hotKey = altC, position = { 168, 332 };
isCheckbox = true;

bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
CompilerConfig compiler = loadedCompiler;
if(compiler)
{
compiler.noStripTarget = !button.checked;
modifiedDocument = true;
compilersTab.modifiedDocument = true;
}
Expand All @@ -1188,7 +1241,7 @@ class CompilerOptionsTab : CompilersSubTab

Button resourcesDotEar
{
this, text = $"Use resources.ear", position = { 300, 308 };
this, text = $"Use resources.ear", position = { 308, 332 };
isCheckbox = true;

bool NotifyClicked(Button button, int x, int y, Modifiers mods)
Expand Down Expand Up @@ -1236,7 +1289,10 @@ class CompilerOptionsTab : CompilersSubTab
cxxFlags.strings = compiler.cxxFlags;
linkerFlags.strings = compiler.linkerFlags;
objectFileExt.contents = compiler.objectFileExt;
outputFileExt.contents = compiler.outputFileExt;
staticLibFileExt.contents = compiler.staticLibFileExt;
sharedLibFileExt.contents = compiler.sharedLibFileExt;
executableFileExt.contents = compiler.executableFileExt;
stripTarget.checked = !compiler.noStripTarget;
resourcesDotEar.checked = compiler.resourcesDotEar;

labelTargetPlatform.disabled = disabled;
Expand Down

0 comments on commit 48e1508

Please sign in to comment.