使用IDE的跨平台构建系统?

时间:2022-05-31 02:38:12

I've been searching since around a year for a combination of C++ build system and IDE which brings the following features:

大约一年以来,我一直在寻找C ++构建系统和IDE的组合,它带来了以下功能:

  1. Cross plattform build system that builds atleast on Windows, Linux and Mac OS.
  2. 跨平台构建系统,至少可以在Windows,Linux和Mac OS上构建。

  3. Some sort of inteligent code completion (IntelliSense of Visual Studio, that thing fromEclipse).
  4. 某种智能代码完成(Visual Studio的IntelliSense,来自Eclipse的那个东西)。

  5. Debugger integrated inside the IDE (starting debugging, setting breakpoints in the code, ...).
  6. 调试器集成在IDE内部(开始调试,在代码中设置断点,......)。

  7. No need to restart programms all over to build, or edit code.
  8. 无需重新启动程序来构建或编辑代码。

It doesn't matter for me on which operating system the IDE runs, only important aspect is that there is a way to build on other plattforms (possibly without requiring that IDE). The closest I got to these was a combination of CMake + VisualStudio. Problem with that is, that every time you want to adjust your build process (add or delete a file) you have to restart VisualStudio and reconfigure all settings, CMake won't set for you.

对于我来说,运行IDE的操作系统并不重要,唯一重要的方面是有一种方法可以在其他平台上构建(可能不需要IDE)。我最接近这些是CMake + VisualStudio的组合。问题是,每次你想调整你的构建过程(添加或删除文件)时你必须重新启动VisualStudio并重新配置所有设置,CMake将不会为你设置。

4 个解决方案

#1


2  

The Qt framework uses Qmake - it has a cross platform ide QtCreator that uses the qmake .pro files.

Qt框架使用Qmake - 它有一个使用qmake .pro文件的跨平台ide QtCreator。

There is also a plugin for visual studio that will convert .pro to and from visual studio projects

还有一个视觉工作室插件,可以将.pro与视觉工作室项目进行转换

#2


1  

Codeblocks also has a cross-platform build system.

Codeblocks还有一个跨平台的构建系统。

Codeblocks builds itself through its Codeblocks project file.

代码块通过其Codeblocks项目文件构建自己。

#3


1  

I have investigated a solution like the one you are looking for and haven't found anything satisfactory. I'm currently maintaining separate project files for each of my platforms (Visual Studio, XCode for OSX and iOS, makefiles for Linux, Android and webOS). I have found that it isn't a lot of work to keep them in sync, so I don't mind.

我已经调查了一个像您正在寻找的解决方案,但没有找到任何令人满意的解决方案。我目前正为每个平台维护单独的项目文件(Visual Studio,OSX和iOS的XCode,Linux,Android和webOS的makefile)。我发现让它们保持同步不是很多工作,所以我不介意。

But in any case, here are a couple of ideas that I think are the most promising to achieve what you want:

但无论如何,这里有一些我认为最有希望达到你想要的想法:

  1. I think the CMake solution that you are using is the best, but it is true that each time you regenerate your project custom settings are lost. You may want to generate a patch file with all your settings, so that you can reapply those changes after running CMake to update your projects. This should work for settings stored in text files, so it works for .sln, .vcxproj, vcxproj.filters and vcxproj.user files.

    我认为您使用的CMake解决方案是最好的,但确实每次重新生成项目时,自定义设置都会丢失。您可能希望生成包含所有设置的修补程序文件,以便在运行CMake以更新项目后重新应用这些更改。这适用于存储在文本文件中的设置,因此适用于.sln,.vcxproj,vcxproj.filters和vcxproj.user文件。

  2. You may have some luck with Eclipse or Netbeans. Both are cross-platform IDEs that will allow you to work with a single project file on multiple platforms. If you have your project under source control, then you can commit the project files from your main platform, and then on other platforms you just check out the projects and make the necessary changes to the settings (directories, etc.). You just need to remember to always commit changes to the projects from the main platform, and on the other ones the local changes will stay only in your local source tree.

    您可能对Eclipse或Netbeans有一些运气。两者都是跨平台的IDE,允许您在多个平台上使用单个项目文件。如果您的项目处于源代码管理之下,那么您可以从主平台提交项目文件,然后在其他平台上检查项目并对设置(目录等)进行必要的更改。您只需要记住始终从主平台提交对项目的更改,而在其他方面,本地更改将仅保留在本地源树中。

Option #2 above is decent, but not an option for me, as I have developed an addiction to the VS debugger, it is so much better than anything else that I would not consider any setup that does not include it.

上面的选项#2是不错的,但对我来说不是一个选项,因为我已经开发了对VS调试器的成瘾,它比其他任何我不会考虑任何不包括它的设置好多了。

Good luck!

#4


0  

Here is what I ended up doing:

这是我最终做的事情:

  • I stuck to CMake over qmake, since it simply seems more powerful, and is easy to install seperatly. Also both only generate Makefiles so they pretty much do the same for me.
  • 我坚持使用CMake而不是qmake,因为它看起来更强大,并且易于单独安装。两者都只生成Makefile,所以他们对我来说也是如此。

  • Since the Eclipse/VisualStudio project files created by CMake are only there for building I couldn't use them (running/debugging inside of IDE is not possible). Now I'm creating standard Makefiles and then build these with a hand mantainend Eclipse Project.
  • 由于CMake创建的Eclipse / VisualStudio项目文件仅用于构建,因此无法使用它们(无法在IDE内部运行/调试)。现在我正在创建标准的Makefile,然后使用Eclipse mantainend Eclipse Project构建它们。

  • I added a filesystem link to my source directory and code completion and debugging are working.
  • 我添加了一个文件系统链接到我的源目录,代码完成和调试正在运行。

#1


2  

The Qt framework uses Qmake - it has a cross platform ide QtCreator that uses the qmake .pro files.

Qt框架使用Qmake - 它有一个使用qmake .pro文件的跨平台ide QtCreator。

There is also a plugin for visual studio that will convert .pro to and from visual studio projects

还有一个视觉工作室插件,可以将.pro与视觉工作室项目进行转换

#2


1  

Codeblocks also has a cross-platform build system.

Codeblocks还有一个跨平台的构建系统。

Codeblocks builds itself through its Codeblocks project file.

代码块通过其Codeblocks项目文件构建自己。

#3


1  

I have investigated a solution like the one you are looking for and haven't found anything satisfactory. I'm currently maintaining separate project files for each of my platforms (Visual Studio, XCode for OSX and iOS, makefiles for Linux, Android and webOS). I have found that it isn't a lot of work to keep them in sync, so I don't mind.

我已经调查了一个像您正在寻找的解决方案,但没有找到任何令人满意的解决方案。我目前正为每个平台维护单独的项目文件(Visual Studio,OSX和iOS的XCode,Linux,Android和webOS的makefile)。我发现让它们保持同步不是很多工作,所以我不介意。

But in any case, here are a couple of ideas that I think are the most promising to achieve what you want:

但无论如何,这里有一些我认为最有希望达到你想要的想法:

  1. I think the CMake solution that you are using is the best, but it is true that each time you regenerate your project custom settings are lost. You may want to generate a patch file with all your settings, so that you can reapply those changes after running CMake to update your projects. This should work for settings stored in text files, so it works for .sln, .vcxproj, vcxproj.filters and vcxproj.user files.

    我认为您使用的CMake解决方案是最好的,但确实每次重新生成项目时,自定义设置都会丢失。您可能希望生成包含所有设置的修补程序文件,以便在运行CMake以更新项目后重新应用这些更改。这适用于存储在文本文件中的设置,因此适用于.sln,.vcxproj,vcxproj.filters和vcxproj.user文件。

  2. You may have some luck with Eclipse or Netbeans. Both are cross-platform IDEs that will allow you to work with a single project file on multiple platforms. If you have your project under source control, then you can commit the project files from your main platform, and then on other platforms you just check out the projects and make the necessary changes to the settings (directories, etc.). You just need to remember to always commit changes to the projects from the main platform, and on the other ones the local changes will stay only in your local source tree.

    您可能对Eclipse或Netbeans有一些运气。两者都是跨平台的IDE,允许您在多个平台上使用单个项目文件。如果您的项目处于源代码管理之下,那么您可以从主平台提交项目文件,然后在其他平台上检查项目并对设置(目录等)进行必要的更改。您只需要记住始终从主平台提交对项目的更改,而在其他方面,本地更改将仅保留在本地源树中。

Option #2 above is decent, but not an option for me, as I have developed an addiction to the VS debugger, it is so much better than anything else that I would not consider any setup that does not include it.

上面的选项#2是不错的,但对我来说不是一个选项,因为我已经开发了对VS调试器的成瘾,它比其他任何我不会考虑任何不包括它的设置好多了。

Good luck!

#4


0  

Here is what I ended up doing:

这是我最终做的事情:

  • I stuck to CMake over qmake, since it simply seems more powerful, and is easy to install seperatly. Also both only generate Makefiles so they pretty much do the same for me.
  • 我坚持使用CMake而不是qmake,因为它看起来更强大,并且易于单独安装。两者都只生成Makefile,所以他们对我来说也是如此。

  • Since the Eclipse/VisualStudio project files created by CMake are only there for building I couldn't use them (running/debugging inside of IDE is not possible). Now I'm creating standard Makefiles and then build these with a hand mantainend Eclipse Project.
  • 由于CMake创建的Eclipse / VisualStudio项目文件仅用于构建,因此无法使用它们(无法在IDE内部运行/调试)。现在我正在创建标准的Makefile,然后使用Eclipse mantainend Eclipse Project构建它们。

  • I added a filesystem link to my source directory and code completion and debugging are working.
  • 我添加了一个文件系统链接到我的源目录,代码完成和调试正在运行。