Author Topic: multiplatform GTK proyect  (Read 17888 times)

epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #15 on: April 09, 2009, 11:42:42 pm »
Thanks dmoore for your help.
I have managed to set the variables, once i have this working i will see to change the path depending on the OS, but it seems like variables inside backquotes are not parced.
I dont see variables inside backquotes on others wizards.


    project.SetVar(_T("pkg_config"), PkgConfig , false);
    project.AddCompilerOption(_T("`$(pkg_config) gtk+-2.0 --cflags --errors-to-stdout`"));
    project.AddLinkerOption(_T("`$(pkg_config) gtk+-2.0 --libs --errors-to-stdout`"));


This are the lines under "other option":

-mms-bitfields
`$(pkg_config) gtk+-2.0 --cflags --errors-to-stdout`

And this is the compilation line

mingw32-gcc.exe -Wall -mms-bitfields   -g     -c "C:\Documents and Settings\Diego_test\Escritorio\bbbbbb\main.c" -o obj\Debug\main.o


Is this what you say about that it is not outputing errors?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: multiplatform GTK proyect
« Reply #16 on: April 10, 2009, 08:17:27 pm »
yes, looks like backticks get substituted before variable expansions (I could be wrong, haven't looked at the code). not sure what the rationale for that would be...

The other not altogether unreasonable approach to take is to expect the user to put GTK\bin in their path. (Even if they can't change the path globally, the envvars plugins allows user to set up sets of environment variables that can be assigned per project.) This is not as newbie friendly, but less bug prone than relying on scripts. You could even have a pre-build script that tries to run pkg-config and spits out an error if it couldn't be found telling the user to put it in their path.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: multiplatform GTK proyect
« Reply #17 on: April 10, 2009, 08:18:32 pm »
Is this what you say about that it is not outputing errors?

you don't see anything if the backtick fails to execute - C::B simply substitutes an empty string... not so good.

epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #18 on: April 10, 2009, 08:45:03 pm »
Thanks.
I decided to make 4 targets, 2 for unixes (and possible mac too), and 2 for MSW.
Why?
Because, if you are testing and compiling your project on multipleplatforms, the compiled object code will need to be clean when you switch of desktop and thoose, making it slower to compile and test.

Too sad to hear that "backticks get substituted before variable expansions". That will make the project configuration cleaner by setting the gtk path and other stuff as variables.


Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: multiplatform GTK proyect
« Reply #19 on: April 10, 2009, 08:59:42 pm »
Too sad to hear that "backticks get substituted before variable expansions". That will make the project configuration cleaner by setting the gtk path and other stuff as variables.

probably a trivial fix, just have to figure out if there is a good reason it does what it does.

I decided to make 4 targets, 2 for unixes (and possible mac too), and 2 for MSW.

nice. I assume you will provide a dialog that lets the user choose which targets they want to create. (I think this is done on the other wizards)


epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #20 on: April 11, 2009, 04:09:30 am »

I have a problem adding files to a project. This should be done automatically by returnning a path in
functions GetFilesDir()

But it doesnt work when i configure new Targets.

    project.DuplicateBuildTarget(0,_T("Debug-Unix") )
    project.DuplicateBuildTarget(0,_T("Release-Unix") )
    project.DuplicateBuildTarget(0,_T("Debug-MSW") )
    project.DuplicateBuildTarget(0,_T("Release-MSW") )
    project.RemoveBuildTarget(_T("default") );

I have not used the default Debug and Release.

With this, main.c is added to the project but not to the targets, so it wont compile.
I have to "Add File" manually and add it to each target to be able to compile.



The other problem that i cant find solution, is to set the current target selection. I tryed with this:

        if (PLATFORM == PLATFORM_MSW)
            project.SetActiveBuildTarget( _T("Debug-MSW") );

But is not doing anything.

Can you help me with this?

epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #21 on: April 11, 2009, 08:25:46 pm »
Ok, the first is fixed, but, i still dont get the second fixed.

        if (PLATFORM == PLATFORM_MSW)
            project.SetActiveBuildTarget( _T("Debug-MSW") );


epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #22 on: April 12, 2009, 06:57:34 pm »
Here is my GTK Wizard.
Someone experienced with wizards should take a look at the code to see if there is something else to fix.

Now my question is: Will it be merged in mainstream? or should i keep my copy?

Differences with the original:
 - 4 targets created, 2 for unixes and 2 for windows, minimal differences.
 - The unixes targets could work with mac. I cant test that.
 - Added selection of starting code to a set of common examples of a minimal gtk, glade, systray icon, drawingarea, gdk and cairo, and custom widgets.
 - What is missing is a Clutter example.

Also it will be nice to create a GtkWidget/GObject generator plugin. ¿Is there any other similar plugin?

Cheers.



[attachment deleted by admin]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: multiplatform GTK proyect
« Reply #23 on: April 13, 2009, 10:19:14 pm »
Now my question is: Will it be merged in mainstream? or should i keep my copy?

I think you have made a useful contribution...

Quote
Differences with the original:
 - 4 targets created, 2 for unixes and 2 for windows, minimal differences.

The user should be able to check off which ones they want

Quote
- Added selection of starting code to a set of common examples of a minimal gtk, glade, systray icon, drawingarea, gdk and cairo, and custom widgets.
 - What is missing is a Clutter example.

interesting. it probably does no harm, but do you need so many samples?

Quote
Also it will be nice to create a GtkWidget/GObject generator plugin. ¿Is there any other similar plugin?

a class wizard or a gui? there's a very simple class wizard plugin that you can use as a template. wxSmith provides a more fully integrated wxWidgets gui building experience.

epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #24 on: April 14, 2009, 04:17:09 am »
The user should be able to check off which ones they want

The user can. From "Build Options" dialog. :)
I removed it for 2 reasongs. I couldnt find an easy way to separate windows configuration from linux configuration. And what if you launch the wizard from a Unix system?, then you wont be able to set a windows-gtk-path.
Also my opinion is that, making too much unnecesary pages in wizards, is like polution. I have never changed the Targets names, or paths. And i find the "Build Options" dialog simpler and smarter.
But if it is really needed, someone else could find the way to add the 4 targets. Its not my priority right now.


interesting. it probably does no harm, but do you need so many samples?
Thoose examples are zipped 64kb. This doesnt make harm, but it add a bonus and a starting point for each different project. Like a Glade based project with GtkBuilder or a plugin-based application with GModule starting with the same. A new custom widget which can be drawn with GDK or Cairo. Or using a DrawingArea which is very oft on gtk and can be done in many ways.
With this 64kb of examples, a new user can learn faster how to use a portable toolkit, and take a look before reading a complete tutorial.
It would be nice to have more starting points for wxWidgets and QT and be able to compile them on any platform.
In this way we help a bit more to show people that producing portable software is not hard.


Why would someone deliberately make a software non-portable when no extra code penalty is needed?
Or why shouldnt a portable IDE help to portability?

Cheers.

epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #25 on: June 01, 2009, 12:43:00 am »
Will this be added to main stream?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: multiplatform GTK proyect
« Reply #26 on: June 02, 2009, 08:17:39 am »
Will this be added to main stream?
Only if I find the time to include it into the build process. Notice that you did not provide the Makefiles (Makefile.am) and alike. There is nothing wrong with it, but adding it to trunk as it is would break compilation of C::B on Linux. So - in the current stage it needs some more work.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

epsilon_da

  • Guest
Re: multiplatform GTK proyect
« Reply #27 on: June 02, 2009, 04:50:07 pm »
ok, thanks.
I just need to know that i wouldnt need to overwrite the codeblocks gtk template each time it is updated in my distro.