Author Topic: BOUNTY: bakefile - Output: C::B Project Files  (Read 29871 times)

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
BOUNTY: bakefile - Output: C::B Project Files
« on: September 17, 2005, 02:18:20 am »
Hi! I think that it's very important to add support for C::B project files in the bakefile project.

Currently with a bakefile you can generate:
-MS Visual C++ projects
-MS eMbedded Visual C++ projects
-Borland C++ Builder X projects
-Xcode 2 projects
-MS Visual C++ makefiles
-MinGW makefiles
-GNU GCC makefiles
-Borland makefiles
-Digital Mars makefiles
-Open Watcom makefiles
-Autoconf support

As wxWidgets uses bakefiles (well, bakefiles are developed by Vaclav, one of the leaders of wx), you can for example, compile the wx lib and samples with only 1 or 2 clicks when using the projects of MSVC or others.

So, if bakefiles supports as an output the .cbp Code::Blocks project files, it will be very easy to compile for example the wx lib.
And when the support for .cbp files in the bakefile project, the .cbp files will come by default in the next releases of wxWidgets.
That would make:
a) Compiling wxWidgets from inside C::B.
b) Make C::B a lot more popular because it'll come with project files bundled.
c) For your own projects, you can use bakefiles also, so you wouldn't be forcing the users of your project to have a specific IDE to compile it.
d) As compiling wxWidgets from inside C::B would be a lot more easy than compiling from command line (and mostly for new users), we'll be stopping a lot the endless posts in the forum "I can't compile wxWidgets, what I have to type in the command line..."


I don't think it would be very hard to do, as the format of C::B files is XML, and the bakefiles itself are XML too.

I would make it, but the bakefile code is in Python (I don't know Python).

If you know Python, please take a look at http://bakefile.sourceforge.net/

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #1 on: September 17, 2005, 04:30:43 am »
Yes, but there is a problem. Codeblocks CBP files are _NOT_ XML compliant.

for starters.... <Code::Blocks_project_file> isn't a valid XML element. See the :: in there? They're forbidden.

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #2 on: September 17, 2005, 09:21:10 am »
Well, that's not the point.
The MSVC project files aren't XML for example.

Anyways, there is any good reason to not be XML compliant?
« Last Edit: September 17, 2005, 09:23:34 am by takeshimiya »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #3 on: September 17, 2005, 11:56:27 am »
Yes, but there is a problem. Codeblocks CBP files are _NOT_ XML compliant.

for starters.... <Code::Blocks_project_file> isn't a valid XML element. See the :: in there? They're forbidden.

Is this the only problem with the file, or is there more?
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #4 on: September 17, 2005, 04:59:00 pm »
No, i think that's the only problem so far... just use valid tag names, and ta-da.

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #5 on: September 17, 2005, 10:07:07 pm »
<CodeBlocks-project-file> sounds better :)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #6 on: September 18, 2005, 05:44:18 am »
<CodeBlocks-project-file> sounds better :)

Um... is the dash allowed as a tag name?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #7 on: September 18, 2005, 01:33:36 pm »
OK, I changed all codeblocks XML files to use <CodeBlocks_*> instead of <Code::Blocks_*>.
For obvious reasons, the old tag is still recognized.
Be patient!
This bug will be fixed soon...

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #8 on: September 18, 2005, 02:59:24 pm »
How do you think that bakefile support will be integraded with c::b? I am curently in the process of making c::b work with qmake as a makefile generator (I 'll open a thread explaining and asking some questions) and the best solution seems to be integrated as a compiler option under "invoke compiler directly" etc. If anyone has any other thoughts I'm more than interested...
P.S. Seems codeblocks in the near future will not only be able to use any compiler out there but also any makefile generator :wink:
Life would be so much easier if we could just look at the source code.

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #9 on: September 21, 2005, 02:50:25 pm »
Hi! I think that it's very important to add support for C::B project files in the bakefile project.

Currently with a bakefile you can generate:
-MS Visual C++ projects
-MS eMbedded Visual C++ projects
-Borland C++ Builder X projects
-Xcode 2 projects
-MS Visual C++ makefiles
-MinGW makefiles
-GNU GCC makefiles
-Borland makefiles
-Digital Mars makefiles
-Open Watcom makefiles
-Autoconf support

Note that you missed symbian format and you missed that some of listed formats are experimental (or unfinished). There is also on-going new format(s).

As wxWidgets uses bakefiles (well, bakefiles are developed by Vaclav, one of the leaders of wx), you can for example, compile the wx lib and samples with only 1 or 2 clicks when using the projects of MSVC or others.

Vaclav is bakefile coordinator and main designer but there is more developers (including me).

So, if bakefiles supports as an output the .cbp Code::Blocks project files, it will be very easy to compile for example the wx lib.

I can prepare Code::Blocks format as long as you could give me specification of your project file format.

ABX

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #10 on: September 21, 2005, 03:16:17 pm »
Quote from: ABX
I can prepare Code::Blocks format as long as you could give me specification of your project file format.

This sounds nice :)
It's simple XML. What info exactly do you want?

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Some App"/>
<Option compiler="0"/> <!-- 0-based compiler index: compiler 0 is always gcc -->
<Build>
<Target title="Debug_Linux"> <!-- build target; roughly analogous to MSVC configurations -->
<Option output="glfwapp"/> <!-- the binary output result -->
<Option working_dir="."/>
<Option object_output=".objs\debug"/>
<Option deps_output=".deps"/>
<Option type="1"/> <--! 0=GUI, 1=console, 2=staticlib, 3=dll, 4="commands only" -->
<Option compiler="0"/> <!-- compiler index -->
<Option includeInTargetAll="0"/> <!-- if all targets have this zero, no "all" target is created; a specific target must be selected for building (like MSVC's configurations) -->
<Compiler> <!-- compiler options for target -->
<Add option="-g"/>
<Add option="-DDEBUG_MEMORY"/>
<Add option="-DDEBUG"/>
<Add directory="test\subdir"/>
</Compiler>
<Linker> <!-- linker options for target -->
<Add library="GL"/>
<Add library="Xxf86vm"/>
<Add library="pthread"/>
<Add directory="\usr\X11R6\lib"/>
</Linker>
<Environment> <!-- environment variables for target -->
<Variable name="GM" value="/home/mandrav/Devel/GameMonkey/gm"/>
</Environment>
</Target>
<!-- more targets follow (as needed) -->
<Target>
</Target>
</Build>
<Compiler> <!-- compiler options for project (added to each target's compiler options) -->
<Add option="-Wall"/>
<Add directory="core\gm"/>
<Add directory="core\gm\platform\win32gcc"/>
<Add directory="core\gm\binds"/>
</Compiler>
<Linker> <!-- linker options for project (added to each target's linker options) -->
<Add library="glfw"/>
<Add directory="core\gm"/>
</Linker>
<!-- project files follow -->
<Unit filename="core\bst.cpp">
<Option compilerVar="CPP"/>
<Option compile="1"/>
<Option link="1"/>
<!-- the following repeats for all targets this file is part of... -->
<Option target="Debug_Linux"/>
<Option target="Release_Linux"/>
<Option target="Release_Win32"/>
<Option target="Debug_Win32"/>
</Unit>
<!-- more units follow (as needed) -->
<Unit>
</Unit>
</Project>
</CodeBlocks_project_file>
Be patient!
This bug will be fixed soon...

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #11 on: September 21, 2005, 05:08:16 pm »
Quote from: ABX
I can prepare Code::Blocks format as long as you could give me specification of your project file format.

This sounds nice :)
It's simple XML. What info exactly do you want?

Thanks for the sample code, quick questions:

1. Is this case sensitive format? In tags? In tag parameters? In values?
2. Is this format finished? Once it will be in bakefiles you will be limited to supported syntax. Are you sure it will never ever extend it? I ask because I don't see version number in syntax.
3. Can <Project> occur more than once?
4. Compilers can be from indexed list. How can I provide settings for all of them at once? I see single block for compiler 0 only.
5. Different compilers have different linkers. How to supply settings to other linkers?
6. How <Option type="5"/> (commands only) codes commands?
7. Are names in <Option target="Debug_Linux"/> preset and can be only selected from predefined list or not?
8. Is there concept of workspace which collects some project files as in VC IDE?

I will probably have more questions in the future so is there direct url to the online source responsible for parsing that structure?

ABX

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #12 on: September 21, 2005, 05:42:57 pm »
1. Yes, it's case sensitive. All XML is.
2. No, we plan to extend it in future versions.
3. No, a project file only has one project.
4. This is an issue we'll tackle in future versions, current format is kinda... ugly.
5. Same as above.
6. and  7. I don't know :P Yiannis knows that.
8. Yes, there are workspace files.

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #13 on: September 21, 2005, 06:14:48 pm »
1. Yes, it's case sensitive. All XML is.

Well, the only source of my knowledge about it is this thread and as corrections mentioned in this thread pointed out it wasn't "real" XML when this thread started, I wanted to have it confirmed. :)

2. No, we plan to extend it in future versions.
3. No, a project file only has one project.
4. This is an issue we'll tackle in future versions, current format is kinda... ugly.
5. Same as above.

Then I would suggest to introduce concept of version number before I will code things for bakefile. That would allow easier cooperation between us (as well as bug reporting for C::B users probably).

8. Yes, there are workspace files.

... and its syntax is?

ABX

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #14 on: September 21, 2005, 06:47:48 pm »
Quote from: ABX
I can prepare Code::Blocks format as long as you could give me specification of your project file format.

This sounds nice :)
It's simple XML. What info exactly do you want?

Thanks for the sample code, quick questions:

1. Is this case sensitive format? In tags? In tag parameters? In values?
2. Is this format finished? Once it will be in bakefiles you will be limited to supported syntax. Are you sure it will never ever extend it? I ask because I don't see version number in syntax.
3. Can <Project> occur more than once?
4. Compilers can be from indexed list. How can I provide settings for all of them at once? I see single block for compiler 0 only.
5. Different compilers have different linkers. How to supply settings to other linkers?
6. How <Option type="5"/> (commands only) codes commands?
7. Are names in <Option target="Debug_Linux"/> preset and can be only selected from predefined list or not?
8. Is there concept of workspace which collects some project files as in VC IDE?

I will probably have more questions in the future so is there direct url to the online source responsible for parsing that structure?

ABX

1) Yes
2) I guess you probably missed this tag? (<FileVersion major="1" minor="1"/>)
3) No, a project file contains a single project
4 and 5) Currently, you 'd have to duplicate targets to give different options for different compilers. After v1.0 is released this will change though, since a major overhaul is planned for the compiler framework
6) See example below
7) Target names are free text, whatever describes them better. In MSVC terms, an example target could be named "Win32 | Release"
8 ) Yes and it's a separate file (*.workspace). You asked for projects ;)

Example for "commands-only" target:
Code: [Select]
                        <Target title="update">
                                <Option type="4"/>
                                <Option includeInTargetAll="0"/>
                                <ExtraCommands>
                                        <Mode before="always"/> <!-- always run pre-build steps -->
                                        <Add before="update1.bat"/> <!-- pre-build step -->
                                        <Add before="update2.bat"/> <!-- pre-build step -->
                                        <Add after="cmd /c copy my.lib ../../lib/m.lib"/> <!-- post-build step -->
                                </ExtraCommands>
                        </Target>

If you want to have a more in-depth look at the project's file format, look at the source.

Workspace file:

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_workspace_file>
<CodeBlocks_workspace_file>
        <Workspace title="Default workspace">
                <Project filename="../projects/someproject.cbp"/>
                <Project filename="../projects/otherproject.cbp" active="1"/> <!-- this project is active when the workspace loads -->
        </Workspace>
</CodeBlocks_workspace_file>

Note that project dependencies are not implemented yet.
If you want to have a more in-depth look at the workspace's file format, look at the source.
Be patient!
This bug will be fixed soon...

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #15 on: September 21, 2005, 07:11:06 pm »
2) I guess you probably missed this tag? (<FileVersion major="1" minor="1"/>)

Yes. I missed that. Thanks!

7) Target names are free text, whatever describes them better. In MSVC terms, an example target could be named "Win32 | Release"

That raises the question about handling of different platforms withing one development. Would you prefer to have separate projects for wxWidgets collected as targets of single project of separated projects within common workspace or just separated workspaces. I mean would you prefer:

Workspace: wxWidgets
+ project: wxWidgets
++ target: wxMSW Debug
++ target: wxMSW Release
++ target: wxGTK Debug
++ target: wxGTK Release

or

Workspace: wxWidgets
+ project: wxMSW
++ target: Debug
++ target: Release
+ project: wxGTK
++ target: Debug
++ target: Release

or

Workspace: wxWidgets-wxMSW
+ project: wxMSW
++ target: Debug
++ target: Release
Workspace: wxWidgets-wxGTK
+ project: wxGTK
++ target: Debug
++ target: Release

Note that there is another level of complexity between port name and build type which is multilib/monolithic idea of wxWidgets.

To understand the syntax and concepts better I will start from wxMSW which is my own native platform but I need to think about the future extension according to your needs.

If you want to have a more in-depth look at the ...

Thanks!

ABX

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #16 on: September 30, 2005, 03:32:34 pm »
Code: [Select]
<Add directory="\usr\X11R6\lib"/>
</Linker>
<Environment> <!-- environment variables for target -->
<Variable name="GM" value="/home/mandrav/Devel/GameMonkey/gm"/>

Looking at quoted part I'm not sure what is directory separator? \ or / ? BTW: I have 'codeblocks' format quite advanced already.

ABX

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #17 on: September 30, 2005, 04:02:11 pm »
Code: [Select]
<Add directory="\usr\X11R6\lib"/>
</Linker>
<Environment> <!-- environment variables for target -->
<Variable name="GM" value="/home/mandrav/Devel/GameMonkey/gm"/>

Looking at quoted part I'm not sure what is directory separator? \ or / ?

Whichever. Code::Blocks converts it to the system default, on load ;)
[*EDIT*]
It doesn't convert the env. vars contents though because it doesn't know if it's a path or not...
[/*EDIT*]

BTW: I have 'codeblocks' format quite advanced already.

That's nice to hear :D
« Last Edit: September 30, 2005, 04:04:08 pm by mandrav »
Be patient!
This bug will be fixed soon...

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #18 on: September 30, 2005, 08:42:12 pm »
Great! :D

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #19 on: October 04, 2005, 12:21:20 am »
BTW: I have 'codeblocks' format quite advanced already.

That's nice to hear :D

Question about flags:

bakefile has concept of 4 groups of flags: C flags, CPP flags, C++ flags, linker flags and these flags are specified per project (no possibility now for flags per source). From the example given in this thread I don't see how in <Compiler> I can split C vs. CPP vs. C++. Currently I decided that <Compile><Add option="..."> will serve for CPP flags, while C and C++ will be added into every unit depending on 'compilerVar' value. Also don't see how to add linker flags (no example syntax). Any hint would be appreciated. Thanks in advance.

ABX

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #20 on: October 04, 2005, 01:23:36 am »
I think that solution is ok for now, using <Option compilerVar="CC"/> or <Option compilerVar="CPP"/> at Project/Unit/Target level when corresponding.

And for separating Compiler/Linker flags, it is currently implemented at Project/Unit/Target level (take a look at the CodeBlocks-wx2.6.0.cbp itself), for example at Target level:

<Target title="sdk">
    <Option output="devel\codeblocks.dll"/>
    <Option working_dir="devel"/>
    <Option object_output=".objs\2.6"/>
    <Option deps_output=".deps"/>
    <Option external_deps="sdk\tinyxml\libtxml.a;"/>
    <Option type="3"/>
    <Option compiler="0"/>
    <Option parameters="--debug-log --no-check-associations"/>
    <Option createStaticLib="1"/>
    <Option projectLinkerOptionsRelation="2"/>
    <Compiler>
        <Add option="-DEXPORT_LIB"/>
        <Add option="-DEXPORT_EVENTS"/>
        <Add option="-D_USRDLL"/>

    </Compiler>
    <Linker>
        <Add option="-Wl,--enable-auto-image-base"/>
        <Add option="-Wl,--export-all-symbols"/>
        <Add option="-Wl,--add-stdcall-alias"/>

        <Add library="libtxml.a"/>
        <Add library="libwxscintilla.a"/>
        <Add directory="devel"/>
    </Linker>
</Target>

for compiler and linker flags.

Hope that helps :)

PD: What's the difference between CPP and C++ flags?
« Last Edit: October 04, 2005, 01:47:12 am by takeshimiya »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #21 on: October 04, 2005, 08:41:43 am »
Quote
PD: What's the difference between CPP and C++ flags?

C PreProcessor flags
vs
C++ compiler flags
although it is seldom followed (people usually put CPP flags in C++ (CXX) flags)...
Be patient!
This bug will be fixed soon...

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #22 on: October 04, 2005, 10:04:04 am »
PD: What's the difference between CPP and C++ flags?

In short CPP is common to C and C++. See comments in any wxW/build/msw/config.*

Thanks for the answer!

ABX

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #23 on: October 04, 2005, 09:18:44 pm »
Is using the name "CPP" for preprocessor a good idea? Last time I checked, CPP used to mean "C Plus Plus" (confused)

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #24 on: October 04, 2005, 09:39:14 pm »
Is using the name "CPP" for preprocessor a good idea? Last time I checked, CPP used to mean "C Plus Plus" (confused)

I'm not sure I understand your questions. Do you mean/think we (bakefile) invented it? AFAIK this is widely used split, see how many sites refer to them in http://www.google.com/search?q=cppflags+cxxflags

ABX

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #25 on: October 04, 2005, 11:47:32 pm »
Oh, OK. Thanks.

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #26 on: October 05, 2005, 02:02:30 am »
Yeah, I supposed that the PP mean for PreProcessor.

Probably most people use them in C/C++ flags because most compilers include a preprocessor in the same executable I think.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #27 on: October 05, 2005, 08:51:22 am »
Right. But the reason it's provided as a separate variable, is what ABX said for: to allow for common options for C and C++ files (assuming you 're mixing them).
Be patient!
This bug will be fixed soon...

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #28 on: January 09, 2006, 10:38:35 am »
Is this little project still in progres? I can't find any source in the cvs...
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline ABX

  • Single posting newcomer
  • *
  • Posts: 9
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #29 on: January 09, 2006, 10:43:42 am »
Is this little project still in progres?

Yes. Had to delay it due to private issues but have plan to complete it. Thanks for interest!

ABX

Offline grv575

  • Official tester
  • Regular
  • ***
  • Posts: 381
Re: BOUNTY: bakefile - Output: C::B Project Files
« Reply #30 on: January 09, 2006, 03:46:40 pm »
Is using the name "CPP" for preprocessor a good idea? Last time I checked, CPP used to mean "C Plus Plus" (confused)

The other thing is they're somewhat standard for unix Makefiles.  If there are environment variables defined

CFLAGS - for C flags
LDFLAGS - for LoaDer (linker) flags
CPPFLAGS - for C PreProcessor flags

then a lot of makefile will use those variables to pass to gcc et al.  Guess the short cryptic names dates back to early unix lazyness.