Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: stahta01 on March 26, 2018, 09:08:39 pm

Title: Code::Blocks and Custom Makefile
Post by: stahta01 on March 26, 2018, 09:08:39 pm
I think that having an Compiler to be used only for Custom Makefiles is a good idea.

Settings->Compilers

Selected Compilers: NameOfCompilerToUseForCustomMakefile

Tim S.
Title: Re: Code::Blocks and Custom Makefile
Post by: stahta01 on March 26, 2018, 09:11:58 pm
Quote
Edit: All of the settings went away that I thought needed grayed out under Project Compiler settings; including some that I thought should not go away. So, I am confused on what to do.
i really don't want to clutter this topic, and we probably should open a new topic for discussion, but i was talking about the settings:
Project->Settings->project settings->Object names generation (is not grayed out, but should be)
Project->Settings->Build targets->Output filename (should be grayed out)
ecc...
Project->Build options->Compiler settings->Compiler flags (should be grayed out)
Project->Build options->Compiler settings->Other compiler options (should be grayed out)
ecc...

Quote
I just realized the problem is in the global compiler settings.

I think the solution should consider have a compiler used only for makefiles.
I don't understand what you are talking about? If a custom make file is used EVERY setting of compiler executable (linker and so) on SHOULD be ignored. Only the "make" program should work.... Can you elaborate more? Am i on the wrong path here?

Edit2: Add link to https://sourceforge.net/p/codeblocks/tickets/652/ (https://sourceforge.net/p/codeblocks/tickets/652/)
So, you want greyed out instead of being removed like it currently does?
Edit: Because most of the Compiler Settings are removed with Custom Makefile project is selected.

Tim S.

Title: Re: Code::Blocks and Custom Makefile
Post by: oBFusCATed on March 27, 2018, 12:38:17 am
Can you explain why? The compiler is used by the CC plugin to find global paths at the moment I think. Without a compiler the CC might work worse.

p.s. I don't understand why you've started a separate topic...
Title: Re: Code::Blocks and Custom Makefile
Post by: stahta01 on March 27, 2018, 12:59:42 am
Can you explain why? The compiler is used by the CC plugin to find global paths at the moment I think. Without a compiler the CC might work worse.
Did not think of that; so, will delay the idea of an separate compiler.

p.s. I don't understand why you've started a separate topic...

Because BlueHazard said to start a separate thread.

Tim S.

Title: Re: Code::Blocks and Custom Makefile
Post by: stahta01 on March 27, 2018, 02:24:50 am
Code
When using custom makefile
  Right Click on file
    Build File    **
    Clean File    **
    Options       Should be removed or grayed out
    Properties
      Build       Should be removed or grayed out
      Advanced    Should be removed or grayed out

** Build/Clean File needs to use the makefile or be grayed out

Tim S.
Title: Re: Code::Blocks and Custom Makefile
Post by: BlueHazzard on March 27, 2018, 11:32:47 am
Ok, i thought this was more badly. I never tried makefile projects, but it seems that there was a clean up already and all the reports where misleading
The one i still could find:
Project->Settings:

Code
When using custom makefile
  Right Click on file
    Build File    **
    Clean File    **
    Options       Should be removed or grayed out
    Properties
      Build       Should be removed or grayed out
      Advanced    Should be removed or grayed out

** Build/Clean File needs to use the makefile or be grayed out
I found out, that you can compile, clean a single file with make project: Project->build options->Make commands

The only thing missing is the "run" command....
I have to apologize, i did not tested before i started this discussion... The actual state is actually quite good....

Some other quirks i have found:
in the Project build options dialogue: "Make commands" at the bottom the descriptive text is "Known variables: $$make $$makefile ...."
shouldn't this be "$make" ecc.?
Title: Re: Code::Blocks and Custom Makefile
Post by: stahta01 on March 27, 2018, 03:38:04 pm
The double "$" is in many places in CB.

Tim S.
Title: Re: Code::Blocks and Custom Makefile
Post by: oBFusCATed on March 27, 2018, 06:52:00 pm
The double "$" is in many places in CB.
If you know such places report them in a ticket... It is related to xrc parsing I think.
Title: Re: Code::Blocks and Custom Makefile
Post by: stahta01 on March 27, 2018, 07:26:09 pm
The double "$" is in many places in CB.
If you know such places report them in a ticket... It is related to xrc parsing I think.

Using the current SVN, the only ones I see are custom makefile related.
I will create a ticket if I find any more.

Tim S.
Title: Re: Code::Blocks and Custom Makefile
Post by: stahta01 on March 28, 2018, 02:17:52 am
Possible patch file for some of the places; needs testing and checked by a better wxWidgets programmer than me.

Tim S.

Code
From b9dc8c854549650067c3aaacc0fc08c844c4d75b Mon Sep 17 00:00:00 2001
From: Tim S <stahta01@users.sourceforge.net>
Date: Tue, 27 Mar 2018 11:32:46 -0400
Subject: [PATCH] - UI: Disable options if makefile (Thanks stahta01)

---
 src/sdk/projectfileoptionsdlg.cpp |  2 +-
 src/src/projectoptionsdlg.cpp     | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/sdk/projectfileoptionsdlg.cpp b/src/sdk/projectfileoptionsdlg.cpp
index 7288b6d4a..a823df668 100644
--- a/src/sdk/projectfileoptionsdlg.cpp
+++ b/src/sdk/projectfileoptionsdlg.cpp
@@ -186,7 +186,7 @@ ProjectFileOptionsDlg::ProjectFileOptionsDlg(wxWindow* parent, ProjectFile* pf)
     XRCCTRL(*this, "staticIncludedFilesLabel", wxStaticText)->Hide();
     XRCCTRL(*this, "staticIncludedFiles",      wxStaticText)->Hide();
 
-    if (pf->AutoGeneratedBy())
+    if (pf->AutoGeneratedBy() || pf->GetParentProject()->IsMakefileCustom())
     {
         XRCCTRL(*this, "tabBuild",    wxPanel)->Enable(false);
         XRCCTRL(*this, "tabAdvanced", wxPanel)->Enable(false);
diff --git a/src/src/projectoptionsdlg.cpp b/src/src/projectoptionsdlg.cpp
index 5be29342d..9c817a9c8 100644
--- a/src/src/projectoptionsdlg.cpp
+++ b/src/src/projectoptionsdlg.cpp
@@ -126,7 +126,9 @@ ProjectOptionsDlg::ProjectOptionsDlg(wxWindow* parent, cbProject* project)
     bool hasPCH = compiler && compiler->GetSwitches().supportsPCH;
     XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->Enable(hasPCH);
 
-    XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox)->SetValue(m_Project->GetExtendedObjectNamesGeneration());
+    wxCheckBox* chkEON = XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox);
+    chkEON->SetValue(m_Project->GetExtendedObjectNamesGeneration());
+    chkEON->Enable(!(m_Project->IsMakefileCustom()));
 
     XRCCTRL(*this, "chkShowNotes", wxCheckBox)->SetValue(m_Project->GetShowNotesOnLoad());
     XRCCTRL(*this, "txtNotes", wxTextCtrl)->SetValue(m_Project->GetNotes());
@@ -271,8 +273,13 @@ void ProjectOptionsDlg::DoTargetChange(bool saveOld)
     TargetFilenameGenerationPolicy prefixPolicy;
     TargetFilenameGenerationPolicy extensionPolicy;
     target->GetTargetFilenameGenerationPolicy(prefixPolicy, extensionPolicy);
-    XRCCTRL(*this, "chkAutoGenPrefix", wxCheckBox)->SetValue(prefixPolicy == tgfpPlatformDefault);
-    XRCCTRL(*this, "chkAutoGenExt", wxCheckBox)->SetValue(extensionPolicy == tgfpPlatformDefault);
+    wxCheckBox* chkAGP = XRCCTRL(*this, "chkAutoGenPrefix", wxCheckBox);
+    bool customMake = m_Project->IsMakefileCustom();
+    chkAGP->SetValue(prefixPolicy == tgfpPlatformDefault);
+    chkAGP->Enable(!customMake);
+    wxCheckBox* chkAGE = XRCCTRL(*this, "chkAutoGenExt", wxCheckBox);
+    chkAGE->SetValue(extensionPolicy == tgfpPlatformDefault);
+    chkAGE->Enable(!customMake);
 
     chkCR->Enable(false);
     chkSL->Enable(target->GetTargetType() == ttDynamicLib);
@@ -1330,7 +1337,9 @@ void ProjectOptionsDlg::EndModal(int retCode)
         m_Project->SetMakefileExecutionDir(XRCCTRL(*this, "txtExecutionDir", wxTextCtrl)->GetValue());
         m_Project->SetTargetType(TargetType(XRCCTRL(*this, "cmbProjectType", wxComboBox)->GetSelection()));
         m_Project->SetModeForPCH((PCHMode)XRCCTRL(*this, "rbPCHStrategy", wxRadioBox)->GetSelection());
-        m_Project->SetExtendedObjectNamesGeneration(XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox)->GetValue());
+        wxCheckBox* chkEON = XRCCTRL(*this, "chkExtendedObjNames", wxCheckBox);
+        m_Project->SetExtendedObjectNamesGeneration(chkEON->GetValue());
+        chkEON->Enable(!(m_Project->IsMakefileCustom()));
         m_Project->SetShowNotesOnLoad(XRCCTRL(*this, "chkShowNotes", wxCheckBox)->GetValue());
         m_Project->SetCheckForExternallyModifiedFiles(XRCCTRL(*this, "chkCheckFiles", wxCheckBox)->GetValue());
         m_Project->SetNotes(XRCCTRL(*this, "txtNotes", wxTextCtrl)->GetValue());
--
2.16.2.windows.1