Author Topic: C::B Workspace/project to cmake or premake?  (Read 443 times)

Offline cacb

  • Regular
  • ***
  • Posts: 429
C::B Workspace/project to cmake or premake?
« on: November 14, 2020, 10:20:05 am »
Hi, this may be a naive question, but anyway....

I have lots of Code::Blocks workspaces with several projects dependent on each other. I find this way of working quite excellent so that is fine and I want to keep it that way. My projects use C::B global variables a lot.

Now someone approached me and said they want to build my stuff using CMake . But I don't find it tempting to use CMake as a build system during development (even within C::B), but I can see it would be nice to offer as a "deployment build system". 

Therefore: Have anyone considered automatic generation of CMake files (CMakeLists.txt) or similar for premake from Code::Blocks workspace and project files? I know cbp2make exists for plain make files, so what I am asking for would be kind of similar, but targeting CMake /Premake.

A C::B plugin that allowed export of a C::B workspace to CMake or Premake would bee nice...

Thoughts?


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12897
    • Travis build status
Re: C::B Workspace/project to cmake or premake?
« Reply #1 on: November 14, 2020, 12:12:04 pm »
I doubt it would be possible or it would work well.
Fitting the C::B model of projects to CMakes might not match 1:1 and then there would be problems.
Also CMake requires the build system to be out-of-tree and most CB projects are in-tree.

CMake is meant to be used the other way - you write the cmake files by hand and it generates the ide projects/build system.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cacb

  • Regular
  • ***
  • Posts: 429
Re: C::B Workspace/project to cmake or premake?
« Reply #2 on: November 14, 2020, 12:43:45 pm »
I doubt it would be possible or it would work well.
I guess that is a "no" to my question if anyone have given it a thought for C::B, but I have seen discussions elsewhere of the same idea. But of course, the fact that I have not found such a tool could mean you are right. But I am not convinced.

CMake is meant to be used the other way - you write the cmake files by hand and it generates the ide projects/build system.
Of course I know that, but I disagree with this way of thinking, as maintaining the CMakeLists.txt (or premake equivalent) file would be a nightmare + several other arguments that I will not go into here. C::B projects are well defined in .cbp files, so I can't see why they can not be transformed into CMake or Premake input. If there is an argument about "out-of-tree", well then put the generated CMakeLists.txt (or premake equivalent)  file elsewhere.

In any case, it looks like my main question is answered: No such plugin or external tool exists. So if it becomes a real need, I probably have to create it myself.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12897
    • Travis build status
Re: C::B Workspace/project to cmake or premake?
« Reply #3 on: November 14, 2020, 12:54:57 pm »
If you cannot find it with a simple search in your favourite search engine or github, then probably it doesn't exists.

BTW: CMake is a lot more powerful than our own build system would ever be and it is slow and stupid, but that is how life work not-perfect solutions win at the end.
BTW2: The current integration of cmake is not ideal, it should be the other way round CB should parse cmakefiles and generate the projects somehow. Someday if I get to do the other build system (meson) I'll see if there is a better way. :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]