Author Topic: .cbp to CMake?  (Read 10932 times)

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
.cbp to CMake?
« on: September 21, 2014, 07:39:13 pm »
Hi,
I am looking into the possibility of writing an INDI device driver for my slightly non-standard telescope. I know Code::Blocks quite well, and prefer it for all my work, but I see that INDI is using the CMake build system, of which I am not so familiar.

Does anything like a .cbp  =>  CMake export plugin (or separate utility) exist?  I have seen the opposite mentioned, but I'd like it the other way around, if possible  ;D

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: .cbp to CMake?
« Reply #1 on: September 21, 2014, 09:01:46 pm »
Probably it will be possible, but I'm sure that you'll learn cmake faster than making a plugin for codeblocks.
(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

  • Lives here!
  • ****
  • Posts: 536
Re: .cbp to CMake?
« Reply #2 on: September 21, 2014, 10:09:59 pm »
Probably it will be possible, but I'm sure that you'll learn cmake faster than making a plugin for codeblocks.

If those are the alternatives, yes probably. But I was hoping that this wasn't a brand new idea  ;)  I find it awkward not to be able to edit/build/run/debug from an IDE during development (and you want code completion, for example). For final distribution something like cmake makes a lot more sense, obviously.  To edit/build/debug a project within C::B and then at any time export it as a cmake project for separate build/distribution sounds to me like an attractive idea if anyone wants to try.

I noticed cbp2make exists. A similar idea.



Offline pirx67

  • Multiple posting newcomer
  • *
  • Posts: 40
Re: .cbp to CMake?
« Reply #3 on: September 21, 2014, 11:32:45 pm »
Hi,

as far as I know CMake is a so called "MakeMake" tool. Itself doesn't guide the build process but only provides a means to describe how to build a certain software independent from
the target OS and the target build system. So you have then the choice to use the "make" / build control tools that you have on your build platform.

For instance you could tell CMake to create GNU Makefiles to build the software. You only need CMake to create the Makefiles. The build of the software will be guided by the GNU Makefiles then.
So you could for instance configure a Code::Blocks project to use these external Makefiles.

But even better you could advise CMake to create Code::Blocks project files (*.cbp) (see http://www.cmake.org/Wiki/CMake_Generator_Specific_Information). How good that works?
I don't know. But as you can see building a plugin as you proposed would counterfeit the idea of CMake.

My 2 cents here,
    pirx67

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: .cbp to CMake?
« Reply #4 on: September 22, 2014, 12:36:23 am »
You might find Project Exporter Plugin to be useful.  I have not touched it for a while, so it may require some tweaks to build with current versions of C::B.  However, it does (did) implement most common functionality, so it should work for simple and medium complicated build setups.

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: .cbp to CMake?
« Reply #5 on: September 22, 2014, 01:04:42 am »
as far as I know CMake is a so called "MakeMake" tool. Itself doesn't guide the build process but only provides a means to describe how to build a certain software independent from
the target OS and the target build system. So you have then the choice to use the "make" / build control tools that you have on your build platform.

For instance you could tell CMake to create GNU Makefiles to build the software. You only need CMake to create the Makefiles. The build of the software will be guided by the GNU Makefiles then.
So you could for instance configure a Code::Blocks project to use these external Makefiles.

But even better you could advise CMake to create Code::Blocks project files (*.cbp) (see http://www.cmake.org/Wiki/CMake_Generator_Specific_Information). How good that works?
I don't know. But as you can see building a plugin as you proposed would counterfeit the idea of CMake.

My 2 cents here,
    pirx67

Different things to different people, I guess. My point is that I want to start with Code::Blocks because it is natural to me. You forget the reasons I gave about the development process.

Apparently, CMake was created because someone had the idea that GNU make files were too inconvenient to create manually. The fact that GNU makefiles are used in the build process is a non-issue as long as you don't have to edit them manually. I am saying the same thing about CMake (recognising that others may see it differently). If I had the choice, I would prefer not to have to learn it, because I already know how to describe my software dependencies in another rather general system: Code::Blocks. I just want to translate that description so I can more easily add to the library that happens to use CMake. 

As mentioned above, I already heard about translating from CMake to Code::Blocks, but such translation is of no interest to me, for the reasons I gave. For sure the plugin I proposed would not work against the idea of CMake, absolutely not. Those who want to use CMake can use CMake. The point is more that those who want to use Code::Blocks have to use CMake in situations like this. It isn't ideal even if it isn't the end of the world. The ideal would be to give people more choice, and translating .cbp to CMake would make perfect sense and hurt nobody if it existed.

But as it doesn't exist, this is all theory. I'll have to figure out how to handle it manually.