Hello,
I work with Code::Blocks 17.12, under Windows 10.
I downloaded examples of C ++ programs.
These examples are in the form of a directory hierarchy.
Is there a script to generate automatically all the *.cbp project files?
Thank you,
Pierre8r
No, but probably you could write one using the integrated squirrel scripting language or try and tell us what is missing from the scripting engine.
Or you could just use "add files recursively..." to already existing project.
Thanks oBFusCATed.
Can we generate a cbp file with the --build parameter?
if yes, what do you think is the best idea, use the --build parameter recursively, or copy, modify and rename a cbp file template?
You cannot generate cbp files using the --build parameter of codeblocks. This parameter is used when you want to build existing cbp files on the command line without starting the ui.
Can you explain more what you would like to do?
Create a project for every c file in the folder?
Create a exe for every c file in the project, but only one project file?
Hello BlueHazzard,
It's about C++ files not C files.
I want to create a cbp file for each directory and sub directory.
(https://image.ibb.co/dLbS89/choisir_les_constructeurs.jpg)
(https://image.ibb.co/g01S89/Code_Blocks.jpg)
(https://image.ibb.co/hhm5vp/finale.jpg)
choisir_les_constructeurs.cbp
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="choisir_les_constructeurs" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/choisir_les_constructeurs" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/choisir_les_constructeurs" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>
finale.cbp
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="finale" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/finale" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/finale" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>
Here is my suggestion:
1, you can write a simple script(maybe using python) file which replace the source file paths in the cbp(you may first create a cbp template).
2, you can write a simple cmake, and let cmake generate all the cbp files.
I think method 1 is easier.
I have looked into the squirrel api and it is not possible with the current api in codeblocks to do this within codeblocks...
The API is missing some folder traversing and file searching... : http://wiki.codeblocks.org/index.php/Scripting_commands#IO_namespace
@obfuscated: Is it worth to extend the scripting api? I think file handling is something essential for a embedded scripting api...
Probably it is a good idea to extend it with these capabilities.