diff --git a/uppsrc/Core/Vcont.h b/uppsrc/Core/Vcont.h index 1f2e241ce..8e704165b 100644 --- a/uppsrc/Core/Vcont.h +++ b/uppsrc/Core/Vcont.h @@ -110,10 +110,6 @@ public: Vector() { vector = NULL; items = alloc = 0; } ~Vector() { -// if(items >= 0 && (alloc - items) * sizeof(T) > 16) -// RLOG("~Vector, waste: " << (alloc - items) * sizeof(T) -// << ", items: " << items << ", alloc: " << alloc << ", sizeof(T): " << sizeof(T) -// << ", " << typeid(T).name()); //TODO remove Free(); return; // Constraints: #ifdef CPP_11 diff --git a/uppsrc/ide/Builders/Build.cpp b/uppsrc/ide/Builders/Build.cpp index bf88b1e1e..e6b38adad 100644 --- a/uppsrc/ide/Builders/Build.cpp +++ b/uppsrc/ide/Builders/Build.cpp @@ -193,8 +193,10 @@ One MakeBuild::CreateBuilder(Host *host) b->debug_options = Join(bm.Get("COMMON_OPTIONS", ""), bm.Get("DEBUG_OPTIONS", "")); b->release_options = Join(bm.Get("COMMON_OPTIONS", ""), bm.Get("RELEASE_OPTIONS", "")); b->release_size_options = Join(bm.Get("COMMON_OPTIONS", ""), bm.Get("RELEASE_SIZE_OPTIONS", "")); + b->common_link = bm.Get("COMMON_LINK", ""); b->debug_link = bm.Get("DEBUG_LINK", ""); b->release_link = bm.Get("RELEASE_LINK", ""); + b->main_conf = !!main_conf.GetCount(); b->allow_pch = bm.Get("ALLOW_PRECOMPILED_HEADERS", "") == "1"; b->start_time = start_time; @@ -511,7 +513,8 @@ bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, b String mainpackage = wspc[0]; Vector linkfile, immfile; - String linkopt = GetMethodVars(method).Get(targetmode ? "RELEASE_LINK" : "DEBUG_LINK", Null); + String linkopt = Merge(" ", GetMethodVars(method).Get("COMMON_LINK", Null), + GetMethodVars(method).Get(targetmode ? "RELEASE_LINK" : "DEBUG_LINK", Null)); if(linkopt.GetCount()) linkopt << ' '; ok = true; diff --git a/uppsrc/ide/Builders/MakeFile.cpp b/uppsrc/ide/Builders/MakeFile.cpp index fe8fcadd8..3f3a3448e 100644 --- a/uppsrc/ide/Builders/MakeFile.cpp +++ b/uppsrc/ide/Builders/MakeFile.cpp @@ -88,7 +88,8 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package, flags << ' ' << Gather(pkg.option, config.GetKeys()); makefile.config << "CFLAGS =" << flags << "\n" "CXXFLAGS =" << flags << "\n" - "LDFLAGS = " << (HasFlag("DEBUG") ? debug_link : release_link) << " $(LINKOPTIONS)\n" + "LDFLAGS = " << Merge(" ", common_link, HasFlag("DEBUG") ? debug_link : release_link) + << " $(LINKOPTIONS)\n" "LIBPATH ="; for(int i = 0; i < libpath.GetCount(); i++) makefile.config << " -L" << GetMakePath(AdjustMakePath(GetHostPathQ(libpath[i]))); diff --git a/uppsrc/ide/Core/Core.h b/uppsrc/ide/Core/Core.h index faefe1397..d1e34d4ee 100644 --- a/uppsrc/ide/Core/Core.h +++ b/uppsrc/ide/Core/Core.h @@ -415,6 +415,7 @@ struct Builder { String debug_options; String release_options; String release_size_options; + String common_link; String debug_link; String release_link; String version; diff --git a/uppsrc/ide/Debuggers/GdbData.cpp b/uppsrc/ide/Debuggers/GdbData.cpp index 9bfc5722e..5a70c7a8b 100644 --- a/uppsrc/ide/Debuggers/GdbData.cpp +++ b/uppsrc/ide/Debuggers/GdbData.cpp @@ -245,7 +245,8 @@ void Gdb::Cpu() while(!ss.IsEof()) { String ln = ss.GetLine(); cpu.Add(AttrText(ln).SetFont(Courier(Ctrl::HorzLayoutZoom(12))) - .Paper(even ? Blend(SColorMark, SColorPaper, 220) : SColorPaper)); + .Paper(even ? Blend(SColorMark, SColorPaper, 220) : SColorPaper) + .Ink(SColorText)); even = !even; } } diff --git a/uppsrc/ide/InstantSetup.cpp b/uppsrc/ide/InstantSetup.cpp index 03a29921c..35753ef61 100644 --- a/uppsrc/ide/InstantSetup.cpp +++ b/uppsrc/ide/InstantSetup.cpp @@ -150,6 +150,8 @@ void InstantSetup() df.Dir(GetProgramsFolder()); String default_method; + + bool dirty = false; for(int x64 = 0; x64 < 2; x64++) { String method = x64 ? "MSC15x64" : "MSC15"; @@ -223,71 +225,73 @@ void InstantSetup() bm.GetAdd("LIB") = Join(libs, ";"); SaveVarFile(ConfigFile(method + ".bm"), bm); + dirty = true; if(!x64) default_method = "MSC15"; } } - for(int x64 = 0; x64 < 2; x64++) { - String m = x64 ? "64" : "32"; - String method = "MINGW" + m; - #ifdef _DEBUG - method << "Test"; - #endif - VectorMap bm = GetMethodVars(method); - - Vector bins = Split(bm.Get("PATH", ""), ';'); - Vector incs = Split(bm.Get("INCLUDE", ""), ';'); - Vector libs = Split(bm.Get("LIB", ""), ';'); - if(CheckDirs(bins, 2) && CheckDirs(incs, 2) && CheckDirs(libs, 2)) { + String bin = GetExeDirFile("bin"); + if(DirectoryExists(bin + "/TDM64")) + for(int x64 = 0; x64 < 2; x64++) { + String method = x64 ? "MINGWx64" : "MINGW"; + #ifdef _DEBUG + method << "Test"; + #endif + VectorMap bm = GetMethodVars(method); + + Vector bins = Split(bm.Get("PATH", ""), ';'); + Vector incs = Split(bm.Get("INCLUDE", ""), ';'); + Vector libs = Split(bm.Get("LIB", ""), ';'); + if(CheckDirs(bins, 3) && CheckDirs(incs, 2) && CheckDirs(libs, 2)) { + if(!x64) + default_method = Nvl(default_method, method); + continue; + } + + bmSet(bm, "BUILDER", "GCC"); + bmSet(bm, "COMPILER", ""); + bmSet(bm, "COMMON_OPTIONS", x64 ? "-msse2" : "-msse2 -m32"); + bmSet(bm, "COMMON_CPP_OPTIONS", "-std=c++11"); + bmSet(bm, "COMMON_C_OPTIONS", ""); + bmSet(bm, "COMMON_LINK", x64 ? "" : "-m32"); + bmSet(bm, "COMMON_FLAGS", ""); + bmSet(bm, "DEBUG_INFO", "2"); + bmSet(bm, "DEBUG_BLITZ", "1"); + bmSet(bm, "DEBUG_LINKMODE", "0"); + bmSet(bm, "DEBUG_OPTIONS", "-O0 -ggdb"); + bmSet(bm, "DEBUG_FLAGS", ""); + bmSet(bm, "DEBUG_LINK", ""); + bmSet(bm, "RELEASE_BLITZ", ""); + bmSet(bm, "RELEASE_LINKMODE", "0"); + bmSet(bm, "RELEASE_OPTIONS", "-O3 -ffunction-sections"); + bmSet(bm, "RELEASE_SIZE_OPTIONS", "-Os -finline-limit=20 -ffunction-sections"); + bmSet(bm, "RELEASE_FLAGS", ""); + bmSet(bm, "RELEASE_LINK", ""); + bmSet(bm, "DEBUGGER", "gdb"); + bmSet(bm, "ALLOW_PRECOMPILED_HEADERS", "1"); + // bmSet(bm, "LINKMODE_LOCK", "0"); + + String m = x64 ? "" : "32"; + bins.At(0) = bin + "/TDM64/bin"; + bins.At(1) = bin + "/TDM64/opt/bin" + m; + bins.At(2) = bin + "/TDM64/gdb" + m + "/bin"; + incs.At(0) = bin + "/TDM64/i686-w64-mingw32/include"; + incs.At(1) = bin + "/TDM64/opt/include"; + libs.At(0) = bin + "/TDM64/i686-w64-mingw32/lib" + m; + libs.At(1) = bin + "/TDM64/opt/lib" + m; + + bm.GetAdd("PATH") = Join(bins, ";"); + bm.GetAdd("INCLUDE") = Join(incs, ";"); + bm.GetAdd("LIB") = Join(libs, ";"); + + SaveVarFile(ConfigFile(method + ".bm"), bm); + dirty = true; + if(!x64) default_method = Nvl(default_method, method); - continue; } - - String bin = GetExeDirFile("bin"); - if(!DirectoryExists(bin + "/mingw" + m)) - break; - - bmSet(bm, "BUILDER", "GCC"); - bmSet(bm, "COMPILER", ""); - bmSet(bm, "COMMON_OPTIONS", "-msse2"); - bmSet(bm, "COMMON_CPP_OPTIONS", "-std=c++11"); - bmSet(bm, "COMMON_C_OPTIONS", ""); - bmSet(bm, "COMMON_FLAGS", ""); - bmSet(bm, "DEBUG_INFO", "2"); - bmSet(bm, "DEBUG_BLITZ", "1"); - bmSet(bm, "DEBUG_LINKMODE", "0"); - bmSet(bm, "DEBUG_OPTIONS", "-O0 -ggdb"); - bmSet(bm, "DEBUG_FLAGS", ""); - bmSet(bm, "DEBUG_LINK", ""); - bmSet(bm, "RELEASE_BLITZ", ""); - bmSet(bm, "RELEASE_LINKMODE", "0"); - bmSet(bm, "RELEASE_OPTIONS", "-O3 -ffunction-sections"); - bmSet(bm, "RELEASE_SIZE_OPTIONS", "-Os -finline-limit=20 -ffunction-sections"); - bmSet(bm, "RELEASE_FLAGS", ""); - bmSet(bm, "RELEASE_LINK", ""); - bmSet(bm, "DEBUGGER", "gdb"); - bmSet(bm, "ALLOW_PRECOMPILED_HEADERS", "1"); -// bmSet(bm, "LINKMODE_LOCK", "0"); - - bins.At(0) = bin + "/mingw" + m + "/bin"; - bins.At(1) = bin + "/mingw" + m + "/opt/bin"; - incs.At(0) = bin + "/mingw" + m + "/i686-w64-mingw32/include"; - incs.At(1) = bin + "/mingw" + m + "/opt/include"; - libs.At(0) = bin + "/mingw" + m + "/i686-w64-mingw32/lib"; - libs.At(1) = bin + "/mingw" + m + "/opt/lib"; - - bm.GetAdd("PATH") = Join(bins, ";"); - bm.GetAdd("INCLUDE") = Join(incs, ";"); - bm.GetAdd("LIB") = Join(libs, ";"); - - SaveVarFile(ConfigFile(method + ".bm"), bm); - - if(!x64) - default_method = Nvl(default_method, method); - } if(default_method.GetCount()) SaveFile(GetExeDirFile("default_method"), default_method); @@ -330,8 +334,16 @@ void InstantSetup() "UPP = " + AsCString(b) + ";\r\n" "OUTPUT = " + AsCString(out) + ";\r\n" ); + dirty = true; } } + + Ide *ide = dynamic_cast(TheIde()); + if(dirty && ide) { + ide->SyncBuildMode(); + SyncCodeBase(); + ide->SetBar(); + } } bool CheckLicense() diff --git a/uppsrc/ide/Methods.cpp b/uppsrc/ide/Methods.cpp index d0d6e6f8d..0e386e963 100644 --- a/uppsrc/ide/Methods.cpp +++ b/uppsrc/ide/Methods.cpp @@ -391,6 +391,7 @@ void DefaultBuilderSetup::InitSetupCtrlsMap(VectorMap& map) map.Add("COMMON_OPTIONS", &common_options); map.Add("COMMON_CPP_OPTIONS", &common_cpp_options); map.Add("COMMON_C_OPTIONS", &common_c_options); + map.Add("COMMON_LINK", &common_link_options); map.Add("COMMON_FLAGS", &common_flags); map.Add("DEBUG_INFO", &debug_info); map.Add("DEBUG_BLITZ", &debug_blitz); diff --git a/uppsrc/ide/ide.lay b/uppsrc/ide/ide.lay index 53a83fe07..5fcb3e19c 100644 --- a/uppsrc/ide/ide.lay +++ b/uppsrc/ide/ide.lay @@ -228,43 +228,45 @@ LAYOUT(BuildMethodsAndroidBuilderSetupLayout, 648, 500) END_LAYOUT LAYOUT(BuildMethodsDefaultBuilderSetupLayout, 648, 500) - ITEM(Label, dv___0, SetLabel(t_("&Compiler name:")).LeftPosZ(8, 104).TopPosZ(16, 19)) - ITEM(EditString, compiler, LeftPosZ(132, 100).TopPosZ(16, 19)) - ITEM(Label, dv___2, SetLabel(t_("&External debugger:")).LeftPosZ(240, 100).TopPosZ(16, 19)) - ITEM(EditString, debugger, LeftPosZ(344, 120).TopPosZ(16, 20)) - ITEM(Label, dv___4, SetLabel(t_("Common options")).LeftPosZ(0, 112).TopPosZ(48, 19)) - ITEM(EditString, common_options, HSizePosZ(132, 0).TopPosZ(48, 19)) - ITEM(Label, dv___6, SetLabel(t_("Common C++ options")).LeftPosZ(0, 128).TopPosZ(68, 19)) - ITEM(EditString, common_cpp_options, HSizePosZ(132, 0).TopPosZ(68, 19)) - ITEM(Label, dv___8, SetLabel(t_("Common C options")).LeftPosZ(0, 112).TopPosZ(88, 19)) - ITEM(EditString, common_c_options, HSizePosZ(132, 0).TopPosZ(88, 19)) - ITEM(Label, dv___10, SetLabel(t_("Common fixed flags")).LeftPosZ(0, 112).TopPosZ(108, 19)) - ITEM(EditString, common_flags, HSizePosZ(132, 0).TopPosZ(108, 19)) - ITEM(LabelBox, dv___12, SetLabel(t_("Tools")).HSizePosZ(0, 0).TopPosZ(0, 44)) - ITEM(Label, dv___13, SetLabel(t_("Default debug info level:")).LeftPosZ(4, 132).TopPosZ(152, 19)) - ITEM(DropList, debug_info, LeftPosZ(140, 116).TopPosZ(152, 19)) - ITEM(TextOption, debug_blitz, SetLabel(t_("Use BLITZ")).HSizePosZ(264, 276).TopPosZ(152, 15)) - ITEM(TextOption, debug_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(376, 12).TopPosZ(152, 15)) - ITEM(Label, dv___17, SetLabel(t_("Debug options")).LeftPosZ(0, 112).TopPosZ(184, 19)) + ITEM(Label, dv___0, SetLabel(t_("&Compiler name:")).LeftPosZ(8, 104).TopPosZ(12, 19)) + ITEM(EditString, compiler, LeftPosZ(132, 100).TopPosZ(12, 19)) + ITEM(Label, dv___2, SetLabel(t_("&External debugger:")).LeftPosZ(240, 100).TopPosZ(12, 19)) + ITEM(EditString, debugger, LeftPosZ(344, 120).TopPosZ(12, 20)) + ITEM(Label, dv___4, SetLabel(t_("Common options")).LeftPosZ(0, 112).TopPosZ(40, 19)) + ITEM(EditString, common_options, HSizePosZ(132, 0).TopPosZ(40, 19)) + ITEM(Label, dv___6, SetLabel(t_("Common C++ options")).LeftPosZ(0, 128).TopPosZ(60, 19)) + ITEM(EditString, common_cpp_options, HSizePosZ(132, 0).TopPosZ(60, 19)) + ITEM(Label, dv___8, SetLabel(t_("Common C options")).LeftPosZ(0, 112).TopPosZ(80, 19)) + ITEM(EditString, common_c_options, HSizePosZ(132, 0).TopPosZ(80, 19)) + ITEM(Label, dv___10, SetLabel(t_("Common link options")).LeftPosZ(0, 124).TopPosZ(100, 19)) + ITEM(EditString, common_link_options, HSizePosZ(132, 0).TopPosZ(100, 19)) + ITEM(Label, dv___12, SetLabel(t_("Common fixed flags")).LeftPosZ(0, 112).TopPosZ(120, 19)) + ITEM(EditString, common_flags, HSizePosZ(132, 0).TopPosZ(120, 19)) + ITEM(LabelBox, dv___14, SetLabel(t_("Tools")).HSizePosZ(0, 0).TopPosZ(0, 36)) + ITEM(Label, dv___15, SetLabel(t_("Default debug info level:")).LeftPosZ(4, 132).TopPosZ(156, 19)) + ITEM(DropList, debug_info, LeftPosZ(140, 116).TopPosZ(156, 19)) + ITEM(TextOption, debug_blitz, SetLabel(t_("Use BLITZ")).HSizePosZ(264, 276).TopPosZ(156, 19)) + ITEM(TextOption, debug_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(376, 12).TopPosZ(156, 19)) + ITEM(Label, dv___19, SetLabel(t_("Debug options")).LeftPosZ(0, 112).TopPosZ(184, 19)) ITEM(EditString, debug_options, HSizePosZ(132, 0).TopPosZ(184, 19)) - ITEM(Label, dv___19, SetLabel(t_("Debug fixed flags")).LeftPosZ(0, 112).TopPosZ(204, 19)) + ITEM(Label, dv___21, SetLabel(t_("Debug fixed flags")).LeftPosZ(0, 112).TopPosZ(204, 19)) ITEM(EditString, debug_flags, HSizePosZ(132, 0).TopPosZ(204, 19)) - ITEM(Label, dv___21, SetLabel(t_("Debug link options")).LeftPosZ(0, 112).TopPosZ(224, 19)) + ITEM(Label, dv___23, SetLabel(t_("Debug link options")).LeftPosZ(0, 112).TopPosZ(224, 19)) ITEM(EditString, debug_link, HSizePosZ(132, 0).TopPosZ(224, 19)) - ITEM(TextSwitch, release_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(376, 20).TopPosZ(268, 16)) - ITEM(LabelBox, dv___24, SetLabel(t_("Release mode defaults")).HSizePosZ(0, 0).TopPosZ(252, 40)) - ITEM(TextOption, release_blitz, SetLabel(t_("Use BLITZ")).LeftPosZ(8, 256).TopPosZ(268, 15)) - ITEM(Label, dv___26, SetLabel(t_("Optimize for speed")).LeftPosZ(0, 112).TopPosZ(296, 19)) - ITEM(EditString, speed_options, HSizePosZ(132, 0).TopPosZ(296, 19)) - ITEM(Label, dv___28, SetLabel(t_("Optimize for size")).LeftPosZ(0, 112).TopPosZ(316, 19)) - ITEM(EditString, size_options, HSizePosZ(132, 0).TopPosZ(316, 19)) - ITEM(Label, dv___30, SetLabel(t_("Release fixed flags")).LeftPosZ(0, 112).TopPosZ(336, 19)) - ITEM(EditString, release_flags, HSizePosZ(132, 0).TopPosZ(336, 19)) - ITEM(Label, dv___32, SetLabel(t_("Release link options")).LeftPosZ(0, 112).TopPosZ(356, 19)) - ITEM(EditString, release_link, HSizePosZ(132, 0).TopPosZ(356, 19)) - ITEM(TabCtrl, paths, HSizePosZ(0, 0).VSizePosZ(400, 0)) - ITEM(TextOption, allow_pch, SetLabel(t_("Allow precompiled headers")).LeftPosZ(0, 212).TopPosZ(380, 16)) - ITEM(LabelBox, dv___36, SetLabel(t_("Debug mode defaults")).HSizePosZ(0, 0).TopPosZ(136, 44)) + ITEM(TextSwitch, release_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(376, 20).TopPosZ(264, 16)) + ITEM(LabelBox, dv___26, SetLabel(t_("Release mode defaults")).HSizePosZ(0, 0).TopPosZ(248, 36)) + ITEM(TextOption, release_blitz, SetLabel(t_("Use BLITZ")).LeftPosZ(8, 256).TopPosZ(264, 15)) + ITEM(Label, dv___28, SetLabel(t_("Optimize for speed")).LeftPosZ(0, 112).TopPosZ(288, 19)) + ITEM(EditString, speed_options, HSizePosZ(132, 0).TopPosZ(288, 19)) + ITEM(Label, dv___30, SetLabel(t_("Optimize for size")).LeftPosZ(0, 112).TopPosZ(308, 19)) + ITEM(EditString, size_options, HSizePosZ(132, 0).TopPosZ(308, 19)) + ITEM(Label, dv___32, SetLabel(t_("Release fixed flags")).LeftPosZ(0, 112).TopPosZ(328, 19)) + ITEM(EditString, release_flags, HSizePosZ(132, 0).TopPosZ(328, 19)) + ITEM(Label, dv___34, SetLabel(t_("Release link options")).LeftPosZ(0, 112).TopPosZ(348, 19)) + ITEM(EditString, release_link, HSizePosZ(132, 0).TopPosZ(348, 19)) + ITEM(TabCtrl, paths, HSizePosZ(0, 0).VSizePosZ(392, 0)) + ITEM(TextOption, allow_pch, SetLabel(t_("Allow precompiled headers")).LeftPosZ(0, 212).TopPosZ(372, 16)) + ITEM(LabelBox, dv___38, SetLabel(t_("Debug mode defaults")).HSizePosZ(0, 0).TopPosZ(144, 36)) END_LAYOUT LAYOUT(ModePaneLayout, 320, 460)