Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: screetch on August 15, 2007, 12:10:22 pm

Title: Code::Blocks with Flex/Bison
Post by: screetch on August 15, 2007, 12:10:22 pm
Hell all,

I have a project that uses SCons for building. However, for developpement, I have made a SCons target that builds Visual C++ 2005 solutions/projects. This is a custom (very badly written but very helpful) tool that generates _native_ solutions, not makefile projects that call SCons, so that I can build an individual file and benefit from the fastness of Visual incremental build (while SCons is very accurate, incremental builds are quite slow).

I wanted to add another target to create Code::Blocks workspace and cbp files. Just as the Visual solution, I'd rather have a native build than a makefile project. I ran into a little problem though : I have bison/flex files as well as files that need to be copied to the target directory (much like a "make install" except it doesn't install system wide, just locally).
I haven't found a way to have the bison/flex commands integrated to Code::Blocks at the moment.

Is there a way to add "custom build files" easily in code blocks ? when a file changes t might regenerate new files that need to be rebuilt... etc, and I'm not sure it works fine :(
Title: Re: Code::Blocks with Flex/Bison
Post by: kisoft on August 15, 2007, 01:03:46 pm
I haven't found a way to have the bison/flex commands integrated to Code::Blocks at the moment.
My project being used bison and flex.
See pictures for explains.
OS: Windows.


[attachment deleted by admin]
Title: Re: Code::Blocks with Flex/Bison
Post by: screetch on August 15, 2007, 05:53:10 pm
I agree with you, but when I build a sample project, although it works it is always rebuilding the bison & flex files (which I don't want). Here is what happens :

- i do a full build. Everything is built so at the end everything is up to date.
- i do an incremental build. It rebuilds the parser.y and lexer.lex files, and relinks (without compiling any C file).
- i do an incremental build (yeah, again). It builds the parser.y and lexer.lex (I have set up these to have a smaller weight so they are built first) and THEN it builds again the two C files that have been generated.

then for each incremental build, it always rebuilds the y and lex files, but sometimes it rebuilds the C files as well and sometimes it doesn't.

So :
- the time stamps are checked when launching the build and you can't generate a file during the build for building in the same build
- it never checks the time stamp of the lex/yacc source file (it couldn't compare it to something else)

What it needs :
- it needs to know what are the outputs of the build step
- then it can compare the time stamps and see if one of the outputs is out of date
- then the outputs can be matched to files in the project so that they will be compiled again if the previous step has done the compilation

hope I'm clear.
Title: Re: Code::Blocks with Flex/Bison
Post by: kisoft on August 16, 2007, 09:17:26 am
I agree with you, but when I build a sample project, although it works it is always rebuilding the bison & flex files (which I don't want). Here is what happens :

You right. I confirm it. I set priority too :)

So :
- the time stamps are checked when launching the build and you can't generate a file during the build for building in the same build
- it never checks the time stamp of the lex/yacc source file (it couldn't compare it to something else)

You can look dependencies in the <projectname>.depend file. I have no time now.

What it needs :
- it needs to know what are the outputs of the build step
- then it can compare the time stamps and see if one of the outputs is out of date
- then the outputs can be matched to files in the project so that they will be compiled again if the previous step has done the compilation

hope I'm clear.

I think this problem is bug, or non correct making <projectname>.depend file, or feature for files with external compile command.
May be I look this problem later.

So, I does generate a makefile for my project and see some behaviour.
Dependencies constructed no right. I think we must check dependencies for our projects.