简体   繁体   English

Visual C ++项目对多种体系结构的依赖

[英]Visual C++ project dependency on multiple architectures

I have a Visual C++ solution with multiple projects. 我有一个包含多个项目的Visual C ++解决方案。 One of the projects (let's name it Project 1) depends on both x86 and x64 versions of another Project 2. It means that when doing a rebuild of Project 1, no matter which architecture is selected I want both x86 and x64 versions of Project 2 to be compiled, prior to Project 1. 一个项目(将其命名为Project 1)同时依赖于另一个Project 2的x86和x64版本。这意味着在重建Project 1时,无论选择哪种体系结构,我都希望同时获得Project 2的x86和x64版本在项目1之前进行编译。

Standard Project Dependency feature doesn't allow to specify dependency on multiple architectures. 标准项目依赖项功能不允许指定对多种体系结构的依赖。 Is there any way to accomplish this task? 有什么办法可以完成这项任务?

Visual C++ has a command line compiler. Visual C ++具有命令行编译器。

You can execute it on the project you need built, or split your code into multiple slns and tell the command line to build the slns. 您可以在需要构建的项目上执行它,也可以将代码拆分为多个sln,然后告诉命令行来构建sln。

This dependency can be set up as a custom build step, or you could go and write a makefile that describes your project dependencies and replace your sln build with that. 可以将这种依赖关系设置为自定义构建步骤,或者您可以编写一个描述项目依赖关系的makefile并用该文件替换sln构建。

You can use a Custom Build Step or Custom Build Event to call msbuild twice, once for each architecture. 您可以使用“自定义生成步骤”或“自定义生成事件”两次调用msbuild,每种架构一次。 This is how Visual Studio builds projects, so you are effectively recursively calling the build system. 这是Visual Studio生成项目的方式,因此您可以有效地递归调用生成系统。

Here's more detailed information: 这里是更详细的信息:

Understanding Custom Build Steps and Build Events 了解自定义构建步骤和构建事件
https://msdn.microsoft.com/en-us/library/e85wte0k.aspx https://msdn.microsoft.com/zh-CN/library/e85wte0k.aspx

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM