-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
72 lines (58 loc) · 2.01 KB
/
CMakeLists.txt
File metadata and controls
72 lines (58 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.22)
project(qsqlpsql)
# Enable Qt MOC processing
set(CMAKE_AUTOMOC ON)
# Find required Qt components
find_package(Qt6 REQUIRED COMPONENTS Core Sql)
# For Android cross-compilation, manually specify PostgreSQL paths
set(PostgreSQL_FOUND TRUE)
set(PostgreSQL_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/postgresql-17.6/src/include"
"${CMAKE_CURRENT_SOURCE_DIR}/postgresql-17.6/src/interfaces/libpq"
)
set(PostgreSQL_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/postgresql-17.6/src/interfaces/libpq/libpq.so")
# Verify the files exist
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/postgresql-17.6/src/include/postgres_ext.h")
message(FATAL_ERROR "PostgreSQL header not found at ${CMAKE_CURRENT_SOURCE_DIR}/postgresql-17.6/src/include/postgres_ext.h")
endif()
if(NOT EXISTS "${PostgreSQL_LIBRARIES}")
message(FATAL_ERROR "PostgreSQL library not found at ${PostgreSQL_LIBRARIES}")
endif()
message(STATUS "Using PostgreSQL headers: ${PostgreSQL_INCLUDE_DIRS}")
message(STATUS "Using PostgreSQL library: ${PostgreSQL_LIBRARIES}")
# Source files
set(SOURCES
qsql_psql.cpp
main.cpp
)
set(HEADERS
qsql_psql_p.h
)
# Create the plugin
qt6_add_plugin(qsqlpsql
CLASS_NAME QPSQLDriverPlugin
${SOURCES}
${HEADERS}
)
# Set plugin properties
set_target_properties(qsqlpsql PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/plugins/sqldrivers"
)
# Include directories - add both PostgreSQL and Qt private headers
target_include_directories(qsqlpsql PRIVATE
${PostgreSQL_INCLUDE_DIRS}
/home/hamzah/Qt/6.8.3/android_arm64_v8a/include/QtSql/6.8.3
/home/hamzah/Qt/6.8.3/android_arm64_v8a/include/QtSql/6.8.3/QtSql
/home/hamzah/Qt/6.8.3/android_arm64_v8a/include/QtCore/6.8.3
/home/hamzah/Qt/6.8.3/android_arm64_v8a/include/QtCore/6.8.3/QtCore
)
# Link libraries
target_link_libraries(qsqlpsql
Qt6::Core
Qt6::Sql
${PostgreSQL_LIBRARIES}
)
# Install the plugin to the correct location
install(TARGETS qsqlpsql
LIBRARY DESTINATION "plugins/sqldrivers"
)