有关如何部署C ++ code工作的每一个地方的提示 [英] Tips on how to deploy C++ code to work every where

查看:205
本文介绍了有关如何部署C ++ code工作的每一个地方的提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是在谈论使便携式code。这更是一个分布的问题。我有一个中型项目。它具有对公共库有若干依赖关系(如OpenSSL的,zlib的,等等)。它编译我的机器上很好,现在是时候把它给世界。

I'm not talking about making portable code. This is more a question of distribution. I have a medium-sized project. It has several dependencies on common libraries (eg openssl, zlib, etc). It compiles fine on my machine and now it's time to give it to the world.

在其最好的本质建设工程。我想使安装程序在Windows,Linux,MacOSX的,等我想打一个可下载的焦油球,这将使code工作以 ./配置和一个制作(很可能是通过autoconf的)。这将是锦上添花有将建立installers..maybe甚至交叉编译所以Windows安装可以建立在Linux中make选项。

Essentially build engineering at its finest. I want to make installers for Windows, Linux, MacOSX, etc. I want to make a downloadable tar ball that will make the code work with a ./configure and a make (probably via autoconf). It would be icing on the cake to have a make option that would build the installers..maybe even cross-compile so a Windows installer could be built in Linux.

什么是最好的策略是什么?我在哪里可以预计要花的时间最多?如果首要重点是autoconf的还是有其他的工具,可以帮助?

What is the best strategy? Where can I expect to spend the most time? Should the prime focus be autoconf or are there other tools that can help?

推荐答案

我会建议 CMake的。优点:


  • 这是非常容易使用为构建简单和复杂的项目,静态库,动态库,可执行文件和它们的依赖。

  • 这是独立于平台,并产生makefile和/或IDE项目文件大多数编译器和IDE。

  • 它通过抽象Windows和UNIX之间的差异,如libShared.so和Shared.dll被称为共享(cmake的处理对每个平台的名称不同),如果共享是项目的一部分,梳理了相关性,如果不是假定它是在链接路径。

  • 它调查的所需,你就可以有选择地删除组件时,第三方库不可用或显示错误消息(用宏这船找到最常见的第三方库)的编译器和第三方库的用户系统。

  • 它可以在命令行或用一个简单的图形用户界面,使用户能够改变任何以上(例如编译器或第三方库的版本)中发现的参数来运行。

  • 支持宏自动化常见步骤。

  • 有一个名为CPack组件,它使您能够创建一个安装程序,我认为这只是一个制作安装命令行的事(我没有用它)。

  • 的CTEST组件与其他单元测试库,例如升压试验或谷歌测试集成。

  • It is very easy to use for building simple and complex projects with static libraries, dynamic libraries, executables and their dependencies.
  • It is platform independent and generates makefiles and/or ide project files for most compilers and IDEs.
  • It abstracts the differences between windows and unix, eg "libShared.so" and "Shared.dll" are referred to as "Shared" (cmake handles the name differences for each platform), if Shared is part of your project it sorts out the dependency if not it assumes that it is in the linker path.
  • It investigates the users system for compiler and 3rd party libraries that are required, you can then optionally remove components when 3rd party libraries are not available or display an error message (It ships with macros to find most common 3rd party libraries).
  • It can be run from the command line or with a simple gui that enables the user to change any of the parameters that were discovered above (eg compiler or version of 3rd party library).
  • It supports macros for automating common steps.
  • There is a component called CPack that enables you to create an installer, I think this is just a make install command line thing (I have not used it).
  • The CTest component integrates with other unit testing libraries like boost test or google test.

我用CMake的一切,现在,即使是简单的测试项目与Visual Studio。

I use CMake for everything now, even simple test projects with visual studio.

我从来没有使用自动工具,但很多其他用户的评论说,cmake的更容易使用。 KDE项目从自动工具转移到CMake的这个原因。

I have never used autotools but a lot of other users have commented that cmake is easier to use. The KDE project moved to cmake from autotools for this reason.

这篇关于有关如何部署C ++ code工作的每一个地方的提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆