简体   繁体   English

如何通过QBS附加PostgreSQL C库?

[英]How I can attach PostgreSQL C library via QBS?

I have a project that should use postgresql c-library (libpq) and project is configured. 我有一个应该使用postgresql c-library(libpq)的项目,并且该项目已配置。 How I can configure QBS module to import all required headers and libs into project? 如何配置QBS模块以将所有必需的标头和库导入项目?

I found solution: 我找到了解决方案:

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",
   ]
}

You just have to import cpp dependency, set cpp.includePaths with libpg srcs, pgtypes header and include files set cpp.dynamicLibraries with name of dynamic lib (by default library compiled as dynamic lib via make) 您只需要导入cpp依赖项,使用libpg srcs,pgtypes标头设置cpp.includePaths并包含文件集cpp.dynamicLibraries,其名称为动态lib(默认情况下,通过make编译为动态lib的库)

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

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