Author Topic: Good (auto/quick/easy?) way to create a multi-project workspace?  (Read 5294 times)

Offline lphilpot

  • Multiple posting newcomer
  • *
  • Posts: 11
Good (auto/quick/easy?) way to create a multi-project workspace?
« on: September 28, 2006, 10:40:16 pm »
I'm working through a book and have the source for all the programs/exercises/etc. in each chapter. Right now, I have them all added to a project in my text editor and just compile each file as needed from inside the editor. However, I'd really like to have them all in C::B for the debugger, etc.

The project tree looks like :

chapter001
    file1.cpp
    file2.cpp
    ...
chapter002
    file1.cpp
    file2.cpp
    ....

etc. The total is 19 directories and more than 200 files, so you can see why I'd like to avoid having to manually add each one.  8)

Does anyone know of a way to, 1) Get them all into C::B without having to manually add each one, and 2) Is there a reasonable way to configure such workspace/projects so that it would be easy to compile and run each source file independently of the others? In other words, when I build I don't want to build everything, just the (single) file I'm currently working on.

Thanks.
« Last Edit: September 28, 2006, 10:52:40 pm by lphilpot »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Good (auto/quick/easy?) way to create a multi-project workspace?
« Reply #1 on: September 29, 2006, 08:07:42 am »
etc. The total is 19 directories and more than 200 files, so you can see why I'd like to avoid having to manually add each one.  8)
If you right-click on a project you get a menu with "Add files...". If you call this within the file-open dialog that appears you can select multiple files and put them all together in your project. But: You have to do this project-wise, thus there is no way C::B creates 1..n projects for you.  (How should C::B by the way - it cannot figure out what sources belong to a project).

I build I don't want to build everything, just the (single) file I'm currently working on.
Just open it inside C::B (without creating a project) and hit "Build". C::B supports single-file compilation just fine.

With regards, Morten.

Edit: Of course you could also add all files to a single project recursively (using "add files") and then create 1..n targets and activate within these targets only the files that shall be compiled. Have a look at how it's done in CodeBlocks.cbp (the project file of Code::Blocks). Thus a "target" it a "chapter" in your case. And the whole book with all exercises would be a single project then. This would enable an easy setup for includes, libs and stuff project-wise which applies to all targets then - if you like and set it up like that.
« Last Edit: September 29, 2006, 08:11:26 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline lphilpot

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Good (auto/quick/easy?) way to create a multi-project workspace?
« Reply #2 on: September 29, 2006, 05:54:41 pm »
If you right-click on a project you get a menu with "Add files...". If you call this within the file-open dialog that appears you can select multiple files and put them all together in your project. But: You have to do this project-wise, thus there is no way C::B creates 1..n projects for you.  (How should C::B by the way - it cannot figure out what sources belong to a project).

That's kind of what I figured. I guess I could work with the project file (Perl?), but that's probably overkill.


Quote
Of course you could also add all files to a single project recursively (using "add files") and then create 1..n targets and activate within these targets only the files that shall be compiled. Have a look at how it's done in CodeBlocks.cbp (the project file of Code::Blocks). Thus a "target" it a "chapter" in your case.

Actually, just about each source file would have to be a target of its own, since most of the programs are one file only (with a few exceptions). That would be ~200 targets, plus new ones would have to be added for each exercise that's completed (at the end of each chapter).

I've already got a project setup in my text editor that works pretty well, but having to debug with an old Turbo Debugger is a bit less than optimal. However, it works. Please note, I don't consider this a deficiency in Code::Blocks - It works great. I was just hoping there was a convenient way to consolidate all of it in one IDE for a nice tidy package.  :)

Thanks for the tips.

Alturin

  • Guest
Re: Good (auto/quick/easy?) way to create a multi-project workspace?
« Reply #3 on: September 30, 2006, 11:39:26 am »
Maybe you could use something like xargs and a sed script to kick up the XML config file for the project?
Then in the future all you'd have to do was add a new file+target when you do a new assignment.

Offline lphilpot

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Good (auto/quick/easy?) way to create a multi-project workspace?
« Reply #4 on: September 30, 2006, 02:29:31 pm »
That might be possible, but I'm on Windows (at the moment). I have a number of the standard *nix utilities installed, but I've not found xargs for Windows.