多目标 Visual Studio 项目:一份源代码

发布于 2024-07-14 01:29:10 字数 613 浏览 4 评论 0原文

关于如何建立一个构建系统来针对几个不同的平台/目标编译一个或两个库的任何建议。

主要项目在 Visual Studio 中。

例如,我有一个库:

nav.lib

它可以在 Windows 和 Linux 上编译,并进行一些调整。

使用该库的可执行文件 win_nav.lib 目前仅在 Windows 上使用 OpenGL 进行编译。

我正在将此代码移植到 iPhone 上。 虽然我知道我无法在 Windows 上编译和链接整个库,但我想尝试使用 OpenGL 包含和 OpenGLES 包含来编译图形代码。 (也许我也可以在 Windows 机器上测试我的 opengles 代码?)

我计划更改我的图形文件以包含基于预处理器标志的内容:

#ifdef USE_OPEN_GL_FULL
     #include <opengl/gl.h>
#else
     #include <opengles/gl.h>
#endif

那么,您将如何执行此操作?

在 Visual Studio 中使用几个不同的脚本或不同的项目?

Any suggestions on how one could go about setting up a build system that would compile one or two libraries against a couple of different platforms/targets.

The main project is in Visual Studio.

For example, I have a library:

nav.lib

It compiles on Windows and Linux with a few tweaks.

The executable that uses the library, win_nav.lib, only compiles on Windows at the moment with OpenGL.

I'm porting this code to the iPhone. Although I know I can't compile and link the entire library on windows I would like to try to compile the graphics code with OpenGL includes and OpenGLES includes. (Perhaps I can test out my opengles code on the windows machine as well?)

I plan to change my graphics file to include based on preprocessor flags:

#ifdef USE_OPEN_GL_FULL
     #include <opengl/gl.h>
#else
     #include <opengles/gl.h>
#endif

So, how would you go about doing this?

Using a couple of different scripts or different projects in Visual Studio?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蝶舞 2024-07-21 01:29:10

这就是“解决方案配置”的用途。 默认情况下,Visual Studio 创建发布和调试配置,但您也可以添加自己的自定义配置。 每个配置的项目选项都不同,因此只需在需要它的配置中设置 #define 即可。

当您运行自动构建时,只需将 /build 参数设置为您想要编译的配置的名称。

This is what "Solution Configurations" are for. By default Visual Studio creates Release and Debug configurations, but you can add your own custom configurations too. The Project options are different for each configuration, so just set your #define in the configuration that needs it.

When you are running your automated build you just set the /build parameter to the name of the configuration you want to compile with.

天荒地未老 2024-07-21 01:29:10

在 VS 中,您可以使用配置管理器来针对不同的构建并在代码中使用不同的库。

Within VS you can use the Configuration Manager to target different builds and use different libraries within your code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文