Skip to content
Permalink
Browse files
cmake fixes to static providers (#44326)
  • Loading branch information
3nids committed Jul 22, 2021
1 parent 9af959a commit 30e3f46edfd2a960f8508121849c7a914be697ec
Showing with 43 additions and 65 deletions.
  1. +0 −5 src/core/CMakeLists.txt
  2. +0 −5 src/gui/CMakeLists.txt
  3. +35 −33 src/providers/postgres/CMakeLists.txt
  4. +8 −22 src/providers/wms/CMakeLists.txt
@@ -2091,11 +2091,6 @@ if (HAVE_PDAL)
endif()

if (FORCE_STATIC_LIBS)
include_directories(
${CMAKE_SOURCE_DIR}/src/providers/wms
${CMAKE_SOURCE_DIR}/src/providers/postgres
)

target_link_libraries(qgis_core
provider_wms_a
provider_postgres_a
@@ -1507,11 +1507,6 @@ target_link_libraries(qgis_gui
)

if (FORCE_STATIC_LIBS)
include_directories(
${CMAKE_SOURCE_DIR}/src/providers/wms
${CMAKE_SOURCE_DIR}/src/providers/postgres
)

target_link_libraries(qgis_gui
provider_wms_gui_a
provider_postgres_gui_a
@@ -37,32 +37,16 @@ set(PG_HDRS
########################################################
# Build

include_directories(SYSTEM
# static library
add_library (provider_postgres_a STATIC ${PG_SRCS} ${PG_HDRS})

target_include_directories(provider_postgres_a SYSTEM PRIVATE
${POSTGRES_INCLUDE_DIR}
${QCA_INCLUDE_DIR}
${QTKEYCHAIN_INCLUDE_DIR}
${GDAL_INCLUDE_DIR}
${SPATIALINDEX_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)

if (WITH_GUI)
include_directories(SYSTEM
${QSCINTILLA_INCLUDE_DIR}
)
include_directories (
${CMAKE_BINARY_DIR}/src/providers/postgres
${CMAKE_SOURCE_DIR}/src/providers/postgres
${CMAKE_BINARY_DIR}/src/providers/postgres/raster
${CMAKE_SOURCE_DIR}/src/providers/postgres/raster
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/ui
)
endif()

# static library
add_library (provider_postgres_a STATIC ${PG_SRCS} ${PG_HDRS})
target_include_directories(provider_postgres_a PUBLIC
${CMAKE_SOURCE_DIR}/src/providers/postgres
)

# require c++17
target_compile_features(provider_postgres_a PRIVATE cxx_std_17)
@@ -81,6 +65,14 @@ if (WITH_GUI)

add_library(provider_postgres_gui_a STATIC ${PG_GUI_SRCS} ${PG_UIS_H})

target_include_directories(provider_postgres_gui_a SYSTEM PRIVATE
${POSTGRES_INCLUDE_DIR}
)

target_include_directories(provider_postgres_gui_a PUBLIC
${CMAKE_BINARY_DIR}/src/providers/postgres
)

# require c++17
target_compile_features(provider_postgres_gui_a PRIVATE cxx_std_17)

@@ -106,20 +98,20 @@ set(PGRASTER_SRCS
# static library
add_library (provider_postgresraster_a STATIC ${PGRASTER_SRCS} ${PG_HDRS})

target_include_directories(provider_postgresraster_a SYSTEM PRIVATE
${POSTGRES_INCLUDE_DIR}
)
target_include_directories(provider_postgresraster_a PUBLIC
${CMAKE_SOURCE_DIR}/src/providers/postgres/raster
)

# require c++17
target_compile_features(provider_postgresraster_a PRIVATE cxx_std_17)

target_link_libraries (provider_postgresraster_a
qgis_core
provider_postgres_a
${POSTGRES_LIBRARY}
${${QT_VERSION_BASE}Xml_LIBRARIES}
${${QT_VERSION_BASE}Core_LIBRARIES}
${${QT_VERSION_BASE}Svg_LIBRARIES}
${${QT_VERSION_BASE}Network_LIBRARIES}
${${QT_VERSION_BASE}Sql_LIBRARIES}
${${QT_VERSION_BASE}Concurrent_LIBRARIES}
${${QT_VERSION_BASE}Gui_LIBRARIES}
${${QT_VERSION_BASE}Widgets_LIBRARIES}
)

if (WITH_GUI)
@@ -143,18 +135,28 @@ else()
add_library(provider_postgres MODULE ${PG_SRCS} ${PG_GUI_SRCS} ${PG_HDRS})
add_library(provider_postgresraster MODULE ${PGRASTER_SRCS} ${PG_HDRS})

target_include_directories(provider_postgres SYSTEM PRIVATE
${POSTGRES_INCLUDE_DIR}
)
target_include_directories(provider_postgresraster SYSTEM PRIVATE
${POSTGRES_INCLUDE_DIR}
)
target_include_directories(provider_postgresraster PRIVATE
${CMAKE_SOURCE_DIR}/src/providers/postgres
)

# require c++17
target_compile_features(provider_postgres PRIVATE cxx_std_17)
target_compile_features(provider_postgresraster PRIVATE cxx_std_17)

target_link_libraries(provider_postgres
${POSTGRES_LIBRARY}
qgis_core
${POSTGRES_LIBRARY}
)

target_link_libraries(provider_postgresraster
${POSTGRES_LIBRARY}
qgis_core
${POSTGRES_LIBRARY}
)

if (WITH_GUI)
@@ -25,18 +25,14 @@ endif()
# static library
add_library(provider_wms_a STATIC ${WMS_SRCS})

target_include_directories(provider_wms_a PUBLIC
${CMAKE_SOURCE_DIR}/src/providers/wms
)

# require c++17
target_compile_features(provider_wms_a PRIVATE cxx_std_17)

if (WITH_GUI)
include_directories (
${CMAKE_BINARY_DIR}/src/providers/wms
${CMAKE_SOURCE_DIR}/src/providers/wms
${CMAKE_BINARY_DIR}/src/ui
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)

if (WITH_QT6)
QT6_WRAP_UI(WMS_UIS_H ${WMS_UIS})
else()
@@ -45,6 +41,10 @@ if (WITH_GUI)

add_library(provider_wms_gui_a STATIC ${WMS_GUI_SRCS} ${WMS_UIS_H})

target_include_directories (provider_wms_gui_a PUBLIC
${CMAKE_BINARY_DIR}/src/providers/wms
)

# require c++17
target_compile_features(provider_wms_gui_a PRIVATE cxx_std_17)

@@ -54,27 +54,13 @@ endif()

target_link_libraries(provider_wms_a
qgis_core
${${QT_VERSION_BASE}Xml_LIBRARIES}
${${QT_VERSION_BASE}Core_LIBRARIES}
${${QT_VERSION_BASE}Svg_LIBRARIES}
${${QT_VERSION_BASE}Network_LIBRARIES}
${${QT_VERSION_BASE}Sql_LIBRARIES}
${${QT_VERSION_BASE}Concurrent_LIBRARIES}
)
target_compile_definitions(provider_wms_a PRIVATE "-DQT_NO_FOREACH")

if (WITH_GUI)
target_link_libraries(provider_wms_gui_a
qgis_gui
provider_wms_a
${${QT_VERSION_BASE}Xml_LIBRARIES}
${${QT_VERSION_BASE}Core_LIBRARIES}
${${QT_VERSION_BASE}Svg_LIBRARIES}
${${QT_VERSION_BASE}Network_LIBRARIES}
${${QT_VERSION_BASE}Sql_LIBRARIES}
${${QT_VERSION_BASE}Concurrent_LIBRARIES}
${${QT_VERSION_BASE}Gui_LIBRARIES}
${${QT_VERSION_BASE}Widgets_LIBRARIES}
)
target_compile_definitions(provider_wms_gui_a PRIVATE "-DQT_NO_FOREACH")
endif()

0 comments on commit 30e3f46

Please sign in to comment.