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

takeshimiya

  • Guest
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.

takeshimiya

  • Guest
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: 4315
    • 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.

takeshimiya

  • Guest
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: 4315
    • 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.

ABX

  • Guest
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: 4315
    • 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
<?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...

ABX

  • Guest
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.

ABX

  • Guest
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: 4315
    • 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
                        <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
<?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...