0

我有一个项目应该使用 postgresql c-library (libpq) 并且项目已配置。如何配置 QBS 模块以将所有必需的标头和库导入项目?

4

1 回答 1

0

我找到了解决方案:

import qbs 1.0

Product {
   name: "PostgresqlConnector"
   type: "dynamiclibrary"

   Depends {name:"cpp"}
   Depends { name: "Qt.core" }
   Depends { name: "UniversalDataObjects" }

   property string rootPath: "/Users/romanvolkov/Desktop/postgresql-9.6.0/src/"
   cpp.includePaths: [rootPath + "/include/",
       rootPath + "/interfaces/ecpg/pgtypeslib/",
       rootPath + "interfaces/libpq/"]
   cpp.dynamicLibraries: [rootPath + "interfaces/libpq/" + "libpq.dylib"]

   files: [
       "postgresqlconnectioninfo.cpp",
       "postgresqlconnectioninfo.h",
   ]
}

您只需要导入 cpp 依赖项,使用 libpg srcs、pgtypes 标头设置 cpp.includePaths 并使用动态库名称设置 cpp.dynamicLibraries(默认情况下,通过 make 编译为动态库的库)

于 2016-11-22T05:54:30.240 回答