简体   繁体   English

如何在Visual Studio中构建具有不同依赖性版本的多个产品?

[英]How can I build multiple products with different dependency versions in Visual Studio?

I'm building a Ruby C Extensions and I have to build for both Ruby 1.8 and Ruby 2.0. 我正在构建Ruby C扩展,并且必须同时为Ruby 1.8和Ruby 2.0进行构建。 The source code is the same, but I have to link to different Ruby libs and set different build paths. 源代码是相同的,但是我必须链接到不同的Ruby库并设置不同的构建路径。

In Xcode I was able to set up a project where the project contained the common configuration. 在Xcode中,我能够建立一个包含通用配置的项目。 Then I set up two targets that configured different include paths and libs as well as different output (Debug/Release) paths. 然后,我设置了两个目标,这些目标配置了不同的包含路径和库以及不同的输出(调试/发布)路径。

When I build I will get two products built, one for each targeted Ruby version. 在构建时,我将构建两种产品,每种目标Ruby版本一个。 When I build Release I get: 构建发行版时,我得到:

  • build/Release/1.8/Example.bundle 构建/发布/1.8/Example.bundle
  • build/Release/2.0/Example.bundle 构建/发布/2.0/Example.bundle

Now I am trying to do the same thing for Visual Studio 2010. I've been looking at the Configuration Manager and Property Sheets, but I'm struggling to fond out how I can make the same type of inheritance for the targets as I can in Xcode. 现在,我试图为Visual Studio 2010做同样的事情。我一直在研究配置管理器和属性表,但我一直在努力寻找如何为目标进行相同类型的继承的方法。在Xcode中。

  1. Is it possible to have multiple targets in VS, as you can in Xcode, that produce two products from the same project when you build? 像在Xcode中一样,在VS中是否可以有多个目标,这些目标在构建时会从同一项目中产生两个产品?

  2. Do I have to create a Debug and Release configuration for each Ruby core I want to target? 是否必须为我要定位的每个Ruby核心创建一个Debug和Release配置?

I think I know what you are looking for (but I can't be sure, as I have no experience with Xcode.) 我想我知道您在寻找什么(但是我不确定,因为我没有使用Xcode的经验。)

If you are using Visual Studio, one way you can do something like this is to set up you project properties for a build configuration (eg for Release) and then copy that config into a new build type (eg call it "Release20") and go in and change the properties that you want for the new build. 如果您使用的是Visual Studio,则可以执行以下操作的一种方法是为构建配置(例如,对于Release)设置项目属性,然后将该配置复制到新的构建类型(例如,将其称为“ Release20”),然后进入并更改新构建所需的属性。 You can do this in "Configuration Manager". 您可以在“配置管理器”中执行此操作。 (When you select to add a new configuration, it lets you copy all properties from an existing one.) (当您选择添加新配置时,它使您可以从现有配置中复制所有属性。)

However, it seems that you are already familiar with this, so I'm not sure what the problem is. 但是,您似乎已经对此很熟悉,所以我不确定是什么问题。

Another thing you should know is that the two build configs don't stay linked together (this is not a proper inheritance and overriding of properties, like using property sheets.) If you change something in one, it doesn't affect the other. 您应该知道的另一件事是,两个构建配置不会保持链接在一起(这不是对属性的正确继承和覆盖,就像使用属性表一样。)如果您在一个中进行更改,则不会影响另一个。

Precisely for these reasons (in addition to some others) I myself have foregone trying to wrangle the VS build system. 正是由于这些原因(除了一些其他原因),我本人已经尝试破坏VS构建系统。 I now use Premake and CMake for all my projects. 现在,我将Premake和CMake用于所有项目。 But of course it's quite a chore building a build system for someone else's large code base. 但是,当然要为别人的大型代码库构建构建系统是一件很麻烦的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我安装了多个Visual Studio版本时,如何使用Visual Studio 2008构建增强功能? - How do I build boost with Visual Studio 2008 when I have multiple Visual Studio versions installed? 从一个Visual Studio项目构建多个版本的静态库 - Build multiple versions of static library from one Visual Studio project 如何使用不同版本的一个依赖项构建和部署包? - How to build and deploy package with different versions of one dependency? CMake和不同版本的Visual Studio - CMake and different versions of Visual Studio 如何使Visual Studio的构建变得非常冗长? - How can I make Visual Studio's build be very verbose? 如何将环境变量持久保存到Visual Studio构建助手? - How can I persist an environment variable to the visual studio build helper? 如何将Visual Studio 2005的平台工具集添加到较新IDE版本的“Platform Toolset”列表中? - How can I add the platform toolset of Visual Studio 2005 into the `Platform Toolset` list of the newer IDE versions? 在不同的 Visual Studio 版本中缺少 .dll - Missing .dll in different Visual Studio versions 将错误与Visual Studio不同版本链接 - linking error with Visual studio different versions 来自不同版本的Visual Studio的PDB文件 - PDB file from different versions of Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM