User forums > Using Code::Blocks

multiplatform GTK proyect

<< < (3/6) > >>

dmoore:

--- Quote from: epsilon_da on April 09, 2009, 06:42:56 pm ---I couldnt see the output, i just cant find an option to enable all outputs which works.

--- End quote ---

settings -> compiler and debugger -> global compiler settings -> other settings -> compiler logging

epsilon_da:
Thanks.

I have 2 questions about the scripting.

It seems like a will have to create different targets (i dont know how yet) for each OS unless CB supports the next stuff:

To be able to use the same pkg-config commands on any os, then it muss be on the path.
project.AddCompilerOption(_T("`pkg-config gtk+-2.0 --cflags --errors-to-stdout`"));
project.AddLinkerOption(_T("`pkg-config gtk+-2.0 --libs --errors-to-stdout`"));

I need that codeblocks adds   GtkPathDefaultBin   to the path only when the project is run in windows. For that i need an script to be executed before each compilation and be able to check this variables and save it to the PATH before running gcc or the backquoted code.
Can this be done in "PRE build steps"?
Where is a tutorial or documentation or code examples to know what kind of scripting is used on this place.

Also i have to add -mms-bitfields to gcc only on windows

if _os_ == Windows:
   PATH += GtkPathDefault + FILE_SEP_PATH + "bin"
   CC += CC + "-mms-bitfields"

(Assuming that PATH and CC is reseted on every run)

OR -mms-bitfields, could be added directly to "Compiler Flags".
Also   -mno-cygwin  is an useful flag too.
Both should only be when compiling on windows.



--- Quote ---If the API uses structs with certain kinds of bitfields, you must use the flag -mms-bitfields in gcc for the struct field packing to be identical to that MSVC uses. GTK+ uses such API, and the commonly used GTK+ binaries built by TorLillqvist are compiled using gcc with this flag. They are thus also usable from MSVC code, and when building GTK+-using software with gcc, the flag must also be used.

--- End quote ---

dmoore:
take a look at the wxWidgets wizard script as it uses the PLATFORM constant to determine which OS (see here for more on Scripting http://wiki.codeblocks.org/index.php?title=Scripting_commands).

I don't think there is support for setting the path via a script (yet). An alternative to setting the path is to define a custom variable for the project in project -> build options -> custom variables, say

gtk_bin_dir = C:\GTK\bin\

on win32 and leave it empty on linux. then your back tick would be:

`$(gtk_bin_dir)pkg-config gtk+-2.0 --cflags`

to do that in a script I think you would use the SetVar method of CompilerOptionsBase

epsilon_da:
But i am on the same problem here, or not?

IF i have gtk_bin_dir setted to some path on windows side and then try to compile con linux, the path will be wrong.
I need to update this variable every time the program is built and check for OS.

I am currently reading what you gave me. Thanks.

dmoore:

--- Quote from: epsilon_da on April 09, 2009, 11:04:51 pm ---IF i have gtk_bin_dir setted to some path on windows side and then try to compile con linux, the path will be wrong.
I need to update this variable every time the program is built and check for OS.

--- End quote ---

you could have the wizard add a build script to check platform and define variables accordingly every build.
Not sure how you will deal with cross-compiling...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version