Author Topic: Compiler Plugin: Plan to add compiler for MSys2  (Read 20471 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #15 on: October 24, 2016, 04:06:54 am »
Why do you want to introduce this complexity instead of just adding a field if the compiler is enabled? You'll have to add such field anyway. And then add the simple dialog where the user can select the needed compilers. And lastly add some logic to show this dialog if C::B detects if the user has old config.

Is the default GCC compiler user-defined using your logic? Will it be removed from everybody's list of compilers if this change is added to C::B?

user-defined is what the auto detect window calls it; me I would throw out the auto detect and just add a field like you suggest. But, that does NOT seem to match the autodetect windows that is displayed on startup when it detects new/missing compilers.

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #16 on: October 24, 2016, 05:22:46 am »
Why do you want to introduce this complexity instead of just adding a field if the compiler is enabled? You'll have to add such field anyway. And then add the simple dialog where the user can select the needed compilers. And lastly add some logic to show this dialog if C::B detects if the user has old config.

Is the default GCC compiler user-defined using your logic? Will it be removed from everybody's list of compilers if this change is added to C::B?

user-defined is what the auto detect window calls it; me I would throw out the auto detect and just add a field like you suggest. But, that does NOT seem to match the autodetect windows that is displayed on startup when it detects new/missing compilers.

Tim S.

Decided on a less GUI change method.
Add a checkbox called "Do not show missing compilers" which are the ones marked Not-Found by the auto detect window.

I can do most of the code changes in a single function called by DoRegisterCompilers, by verifying the compiler installation directory exists.
If it does NOT exist remove it from the list of compilers.

Edit: Decided to change
 void CompilerFactory::RegisterCompiler(Compiler* compiler)
to
 void CompilerFactory::RegisterCompiler(Compiler* compiler, bool found = false)

When found equals true it only Registers the Compiler if the master path of the compiler exists.

Tim S.
« Last Edit: October 24, 2016, 05:45:32 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #17 on: October 24, 2016, 07:48:11 am »
Link to the patch that still needs a lot of work https://github.com/stahta01/cb_misc/blob/master/Patches/svn/reduceList.patch

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #18 on: October 24, 2016, 09:55:08 am »
1. How do I enable not found compiler? I've installed one in non-default location and want to use it for example.
2. How do I disable found compiler I don't care for?
3. Why are you mixing addition of msys2-mingw and the autodetection changes in this patch?
4. Can you install this new compiler on linux? I doubt, but just want to ask.
5. Default parameter values is better to not be used.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #19 on: October 24, 2016, 02:19:58 pm »
1. How do I enable not found compiler? I've installed one in non-default location and want to use it for example.

I have yet to do the GUI changes; at current time I am using the "Enable non-platform compilers".

2. How do I disable found compiler I don't care for?

Set the master path to an invalid path will do it.

3. Why are you mixing addition of msys2-mingw and the autodetection changes in this patch?

Speed, the final patch will split those two xml files out.

4. Can you install this new compiler on linux? I doubt, but just want to ask.

Not likely.

5. Default parameter values is better to not be used.

Should I make a second function with the same name; but, two parameters or use a different name?
I think using the same name is better.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #20 on: October 24, 2016, 03:34:37 pm »
Decided to add a second checked box named something like "Do not show disabled Compilers" to add the feature you want.

Will use new name for the method I edited called something like "conditionalRegisterCompiler".
And, move the reading of the GUI setting inside it.

So, my patch will need to be changed a lot.

I will be working on the GUI changes and then do the code changes.

Edit: For some unknown reason the "GNU GCC Compiler for ARM" is still being displayed in the list.
I would guess it has a broken IsValid method.

Tim S.
« Last Edit: October 24, 2016, 06:01:55 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #21 on: October 24, 2016, 06:09:07 pm »
Attached patch that still needs work.

It is missing any GUI button to disable a Compiler. That is the next thing for me to add.
Button called "Disable"? I will look back at your posts to see where you wanted the button.

And, it has commented out code in it.

Please verify my changes to compiler.h file?
And, I edited compiler_options.xrc directly, is there an wxSmith file I should edit instead?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #22 on: October 24, 2016, 06:16:14 pm »
It should be in a new dialog hidden behind an Add button in just below the selected compiler combo box we have now.

Adding a Dialog is beyond what I feel up to doing at this time; but, it does make more sense than an "Disable" button like I was thinking of doing.

I am a C Programming who does almost no GUI programming.

I will see if any of the wx Dialogs I know about can be adapted to do what you want; but, I will NOT have time for a few weeks.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #23 on: October 24, 2016, 06:28:04 pm »
It should be in a new dialog hidden behind an Add button in just below the selected compiler combo box we have now.

Adding a Dialog is beyond what I feel up to doing at this time; but, it does make more sense than an "Disable" button like I was thinking of doing.

I am a C Programming who does almost no GUI programming.

I will see if any of the wx Dialogs I know about can be adapted to do what you want; but, I will NOT have time for a few weeks.

Tim S.

Would it look OK if I moved the "selected compiler combo box" a little to the right and have the button to the left of it?
I think the dialog will be used to "adjust the compilers listed" for the hint; no idea about the button name.

I will have to look at the code behind the  "selected compiler combo box" and do research on wx combo boxes.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #24 on: October 24, 2016, 09:08:45 pm »
I don't like the idea of the checkboxes at all as already mentioned.

About default parameters - just make it non-default and pass the correct value at every call site. There is no need for a separate function.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #25 on: October 25, 2016, 03:18:47 pm »
I will research some of the C++ and wx Classes that can be used to replace the class used under CompilerFactory.
I think it will be easier to add the feature you want by changing that class; and, I can then add the feature I want to the new class.

So, I will be planning on changing this line below; and doing other stuff needed to add your feature.

Code
WX_DEFINE_ARRAY(Compiler*, CompilersArray);

Looks like I will need to create an wxChoice box that only holds the compilers to be displayed in the compiler list.
And, I will create an wxList to display all the registered compilers; and use that list to select the compilers to be displayed.

I know almost nothing about how to use the wx classes wxChoice, wxList, and wxComboBox.

Files that I need to remember to edit or verify they still work right after my changes include:
src\plugins\compilergcc\compileroptionsdlg.cpp
src\plugins\scriptedwizard\compilerpanel.cpp     I have no idea where the compiler list in scripted wizard gets its data.


I have decided to add an new GUI entry in the "Compiler Settings" windows either above or below "Batch Builds" called "Compiler List" to do the GUI stuff for this feature. The "Global Compiler Settings"/"Project build Options" is just to busy to add anything to it.

I will likely move or remove the option "Enable non-platform Compiler" from the "Other settings Tab".

Tim S.


C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #26 on: October 25, 2016, 03:39:23 pm »
I am going to create an class called "CompilerList" or "cbCompilerList" and fill that with the registered compiler list and then give options to delete compilers from the list. This will be my next attempt at coding the feature you want.

Buttons likely to be on the Compiler List GUI include
Add  All              to add all the registered compilers to the list.
Auto Remove     to remove invalid compilers from the list using the compiler class isValid method
Remove             to delete the selected compilers from the list.
Save                 save the compiler in the list to external location on harddrive
Cancel/Load      to load list from external location on the harddrive

Will post a link to my Git repo in which I am going the work when I make progress; likely be a few days.
My Linux partition was broken by Windows 10; so, I need to either fix Linux or figure out a safe way to update Git repo on Windows.
Edit: Fixed Linux; was able to do apt upgrade and that fixed the no GUI on Linux (I had thought it was NOT booting at all).

Tim S.
« Last Edit: October 26, 2016, 11:56:17 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Compiler Plugin: Plan to add compiler for MSys2
« Reply #27 on: November 17, 2016, 10:59:54 pm »
I edited the CompilerFactory adding what I thought was good code; but, it does nothing.

I am going to try again in a few weeks; but, I think the issue is user error.

Looks like I need to learn more C++ and wxWidgets events.
And, how to use CB to debug CB plugins.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org