使用 QtCreator 和 QMake 组织项目
我正在尝试在 Qt Creator 中创建一个项目,其中表示层和业务逻辑层分为子项目。我举个例子:
MainProject.pro | ---- BusinessLogic.pro | | | ---- source/header files | ---- PresentationLayer.pro | ---- source/header files
目前,我在表示层的代码通过在.pro文件中指定INCLUDEPATH = ../BusinessLogic/headers
来引用业务逻辑项目中的头文件。它似乎有效,但是有更好的方法吗?也许甚至是推荐的方式?
我正在尝试对 lib 文件执行类似的操作,但由于这些文件是在编译时生成的,并且它们可以位于发布或调试文件夹中,所以我不确定如何执行此操作。
这似乎是一种非常常见的组织项目的方式,但我似乎没有找到太多关于如何使用 QtCreator 或 QMake 来完成此任务的信息。
I'm trying to create a project in Qt creator where the presentation layer and and business logic layer are separated into sub projects. Here's an illustration I'm talking about:
MainProject.pro | ---- BusinessLogic.pro | | | ---- source/header files | ---- PresentationLayer.pro | ---- source/header files
Currently, my code in the presentation layer refers to the header files in the business logic project by specifying INCLUDEPATH = ../BusinessLogic/headers
in the .pro file. It appears to work, but is there a better way of doing this? Perhaps even a recommended way?
I'm trying to do something similar with the lib files, but as these are generated at compile time and they can be in either a release or debug folder, I'm not sure how I'd go about doing this.
This seems like a very common way of organizing projects but I don't seem to find much information on how to accomplish this with QtCreator or QMake.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑到包含不同的调试/发布库,您可以在项目文件中执行以下操作:
假设您的 BusinessLogic/bin/debug 文件夹中有一个 BusinessLogicd.lib,并且 BusinessLogic/bin/release 文件夹中有一个 BusinessLogic.lib。
关于包含路径,我认为只要您位于同一个主项目中,相对路径就可以。
Considering inclusion of different debug/release libraries, you can do the following in the project file:
This is assuming you have a BusinessLogicd.lib in your BusinessLogic/bin/debug folder and a BusinessLogic.lib in your BusinessLogic/bin/release folder.
Concerning the includepath, I think a relative path is alright as long as you are within the same main project.