我有一个项目应该使用postgresql c-library(libpq)并配置项目。我如何配置QBS模块将所有必需的头文件和库导入到项目中?
答案 0 :(得分: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 设置名为dynamic lib的cpp.dynamicLibraries(默认库通过make编译为动态lib)