2016-11-21 89 views

回答

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的依賴, 集cpp.includePaths與索馬里紅新月會libpg,pgtypes頭,包括文件與動態LIB的名字 集cpp.dynamicLibraries(默認庫通過make編譯爲動態庫)