Author Topic: Project dependent upon another project?  (Read 7262 times)

Offline Sephiroth

  • Multiple posting newcomer
  • *
  • Posts: 17
Project dependent upon another project?
« on: June 25, 2024, 06:50:53 pm »
I did this regularly with MSVS 2005, but have not messed with it in ages. I am building a cross-platform utility that will allow users to backup saves/config/etc from any game whether they are on Windows or Linux. This will consist of two separate projects. Both must build for the complete solution.

One is a service that monitors for specified programs to be run and backs up their data when they start (you start game A, it sees this, and backs up whatever the user specified). This is literally a Windows service that has no UI and will be the same under Linux.

The other is a wxWidgets project that will provide a UI to specify games (executables) and what to backup for each game. This simply writes a configuration file that the service reads when it starts or when it restarts. This is crucial for making the project easy enough for non-techs to use.

The master project will build each of the child projects and (if possible) package the outputs of said projects into an installer or tgz for users to install. The master project will not have any actual code to build. It just builds the two child projects and then builds the installer.

How can I accomplish this? Also, would it be possible to somehow tie this entire thing to my Github so it lives there and I can allow others access to the code?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1640
Re: Project dependent upon another project?
« Reply #1 on: June 25, 2024, 06:56:28 pm »
You can create a project with two targets (Service and UI) and a virtual one including both.

Offline Sephiroth

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Project dependent upon another project?
« Reply #2 on: June 25, 2024, 06:59:43 pm »
Can you go into detail a bit? I can easily create individual projects but have NEVER tried anything involving multiple projects in CodeBlocks. Also, why do I need a virtual project if there is a real project targeting both?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1640
Re: Project dependent upon another project?
« Reply #3 on: June 25, 2024, 07:05:27 pm »
Read again my post, I am talking about two targets in one project.

Multiple projects can be joined in a workspace, but the target approach is better.

Offline cacb

  • Lives here!
  • ****
  • Posts: 539
Re: Project dependent upon another project?
« Reply #4 on: June 25, 2024, 07:09:32 pm »
Create a Code::Blocks workspace with multiple projects using same name build targets.

workspace-folder  (contains MyProjects.workspace)
       |
      +- projectA-folder   (contains projectA.cbp)
       |
      +- projectB-folder   (contains projectB.cbp)

Select "Properties" on ProjectB and go to "Project Dependencies..." at the bottom.
Declare ProjectB to depend on ProjectA. This info will be saved in the MyProjects.workspace file only.

When you build ProjectB , then projectA will be checked for necessary build first.

Offline Sephiroth

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Project dependent upon another project?
« Reply #5 on: June 25, 2024, 07:25:38 pm »
So in MSVS the master project would depend on project A and B in your example. It checks A and builds if needed, then it does the same for B. There's no way to do this in CodeBlocks? Making one project depend on another when it really does not WILL confuse me down the road. If I step away for a while and come back to it this strange chaining of dependencies will be a hold-up. Is there any way to make the master project check and build each sub-project one at a time?

Offline cacb

  • Lives here!
  • ****
  • Posts: 539
Re: Project dependent upon another project?
« Reply #6 on: June 25, 2024, 07:38:38 pm »
It is just a build order dependency. There is no automatic library linking or anything like that.

The workspace is not a project, it is a workspace containing projects and declaring possible project build dependencies. If you insist you could create a dummy project doing nothing but declaring dependency on projectA and ProjectB. But what I said does the same thing. 

Offline Sephiroth

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Project dependent upon another project?
« Reply #7 on: June 25, 2024, 07:52:51 pm »
Okay, I think I see what that does, I am just used to a way that seems more logical. You'd create a project in MSVS and add all sub-projects. You could go into the master project and specify the build order of the sub-projects, whether or not they depended on each other. I am assuming this is not possible in CodeBlocks and that is why you are telling me to do the dependencies the way that you did. I was expecting something like MSVS and Borland, or even a few others I used in the past.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7695
    • My Best Post
Re: Project dependent upon another project?
« Reply #8 on: June 26, 2024, 02:08:07 am »
Projects can depend on other projects with the info stored in a workspace.
Targets in a project can depend on external files with the info stored in the project file.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Trasatorn

  • Single posting newcomer
  • *
  • Posts: 1
Re: Project dependent upon another project?
« Reply #9 on: September 18, 2024, 11:03:05 am »
Projects can depend on other projects

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1640
Re: Project dependent upon another project?
« Reply #10 on: September 18, 2024, 11:08:21 am »
Future spam added to radar.