cmake: Find and build psql plugin

Change-Id: I8cbc8ab0061f67824d78198cbb926f0625fc7e41
Reviewed-by: Liang Qi <liang.qi@qt.io>
bb10
Albert Astals Cid 2019-02-12 14:34:40 +01:00
parent f94fdb3537
commit 11acba6504
4 changed files with 32 additions and 2 deletions

View File

@ -15,7 +15,7 @@ qt_feature_module_end(NO_MODULE)
if(QT_FEATURE_sql_psql)
# TODO add_subdirectory(psql)
add_subdirectory(psql)
endif()
if(QT_FEATURE_sql_mysql)

View File

@ -6,6 +6,8 @@
#### Libraries
find_package(PostgreSQL)
set_package_properties(PostgreSQL PROPERTIES TYPE OPTIONAL)
find_package(SQLite3)
set_package_properties(SQLite3 PROPERTIES TYPE OPTIONAL)
@ -38,7 +40,7 @@ qt_feature("sql_odbc" PRIVATE
)
qt_feature("sql_psql" PRIVATE
LABEL "PostgreSQL"
CONDITION libs.psql OR FIXME
CONDITION PostgreSQL_FOUND
)
qt_feature("sql_sqlite2" PRIVATE
LABEL "SQLite2"

View File

@ -0,0 +1,27 @@
# Generated from psql.pro.
# FIXME cmake FindPostgreSQL is more exhaustive than the check we have for libpq-fe.h
# it also checks for catalog/pg_type.h which is a more internal include, we should
# add a way to tell cmake FindPostgreSQL to optionally only look for the libpq-fe.h one
find_package(PostgreSQL)
#####################################################################
## qsqlpsql Plugin:
#####################################################################
add_qt_plugin(qsqlpsql
TYPE sqldrivers
SOURCES
main.cpp
qsql_psql.cpp qsql_psql_p.h
DEFINES
QT_NO_CAST_TO_ASCII
QT_NO_CAST_FROM_ASCII
LIBRARIES
Qt::CorePrivate
Qt::SqlPrivate
PostgreSQL::PostgreSQL
# OTHER_FILES = "psql.json"
# PLUGIN_CLASS_NAME = "QPSQLDriverPlugin"
# _LOADED = "qt_plugin"
)

View File

@ -80,6 +80,7 @@ def map_library(lib: str) -> Union[str, LibraryMapping, List[str]]:
'pcre2': ['PCRE2', 'REQUIRED'],
'posix_iconv': None,
'pps': 'PPS',
'psql': 'PostgreSQL',
'slog2': 'Slog2',
'sqlite3': 'SQLite3',
'sun_iconv': None,