Skip to content
Permalink
Browse files
[cmake] drop FORCE_STATIC_PROVIDERS in favor of FORCE_STATIC_LIBS (#4…
…3814)

one cannot be used without the other since there is a cycle dependency between qgis_core and proiver_postgres/wms (cycle dep is only possible if the 2 libs are static
  • Loading branch information
3nids committed Jun 21, 2021
1 parent 4461d89 commit 5e62599c30a8f17376630f021b7d71c3b5296656
Showing with 8 additions and 28 deletions.
  1. +3 −9 CMakeLists.txt
  2. +1 −1 src/core/CMakeLists.txt
  3. +1 −1 src/gui/CMakeLists.txt
  4. +1 −1 src/gui/qgsproviderguiregistry.h
  5. +1 −1 src/providers/CMakeLists.txt
  6. +1 −15 src/providers/postgres/CMakeLists.txt
@@ -94,25 +94,19 @@ endif(NOT MSVC)

if (IOS)
set (DEFAULT_FORCE_STATIC_LIBS TRUE)
set (DEFAULT_FORCE_STATIC_PROVIDERS TRUE)
else()
set (DEFAULT_FORCE_STATIC_LIBS FALSE)
set (DEFAULT_FORCE_STATIC_PROVIDERS FALSE)
endif()

set (FORCE_STATIC_LIBS ${DEFAULT_FORCE_STATIC_LIBS} CACHE BOOL "Determines whether libraries should be static only")
mark_as_advanced(FORCE_STATIC_LIBS)
if (FORCE_STATIC_LIBS)
set (LIBRARY_TYPE STATIC)
else()
set (LIBRARY_TYPE SHARED)
endif()

set (FORCE_STATIC_PROVIDERS ${DEFAULT_FORCE_STATIC_PROVIDERS} CACHE BOOL "Determines whether data providers should be static only")
mark_as_advanced(FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_PROVIDERS)
# following variable is used in qgsconfig.h
set (HAVE_STATIC_PROVIDERS TRUE)
else()
set (LIBRARY_TYPE SHARED)
unset(HAVE_STATIC_PROVIDERS)
endif()

# in generated makefiles use relative paths so the project dir is moveable
@@ -2014,7 +2014,7 @@ if (HAVE_PDAL)
)
endif()

if (FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_LIBS)
include_directories(
${CMAKE_SOURCE_DIR}/src/providers/wms
${CMAKE_SOURCE_DIR}/src/providers/postgres
@@ -1495,7 +1495,7 @@ target_link_libraries(qgis_gui
${Qt5QuickWidgets_LIBRARIES}
)

if (FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_LIBS)
target_link_libraries(qgis_gui
provider_wms_gui_a
provider_postgres_gui_a
@@ -120,7 +120,7 @@ class GUI_EXPORT QgsProviderGuiRegistry

/**
* Loads the dynamic plugins on the given path
* When QGIS is compiled with FORCE_STATIC_PROVIDERS,
* When QGIS is compiled with FORCE_STATIC_LIBS,
* the function is no-op
*/
void loadDynamicProviders( const QString &pluginPath );
@@ -8,7 +8,7 @@ if (POSTGRES_FOUND)
add_subdirectory(postgres)
endif()

if (NOT FORCE_STATIC_PROVIDERS)
if (NOT FORCE_STATIC_LIBS)
add_subdirectory(arcgisrest)
add_subdirectory(delimitedtext)
add_subdirectory(geonode)
@@ -70,12 +70,6 @@ target_compile_features(provider_postgres_a PRIVATE cxx_std_17)
target_link_libraries (provider_postgres_a
qgis_core
${POSTGRES_LIBRARY}
${Qt5Xml_LIBRARIES}
${Qt5Core_LIBRARIES}
${Qt5Svg_LIBRARIES}
${Qt5Network_LIBRARIES}
${Qt5Sql_LIBRARIES}
${Qt5Concurrent_LIBRARIES}
)

if (WITH_GUI)
@@ -90,14 +84,6 @@ if (WITH_GUI)
qgis_gui
provider_postgres_a
${POSTGRES_LIBRARY}
${Qt5Xml_LIBRARIES}
${Qt5Core_LIBRARIES}
${Qt5Svg_LIBRARIES}
${Qt5Network_LIBRARIES}
${Qt5Sql_LIBRARIES}
${Qt5Concurrent_LIBRARIES}
${Qt5Gui_LIBRARIES}
${Qt5Widgets_LIBRARIES}
)
add_dependencies(provider_postgres_gui_a ui)
endif()
@@ -141,7 +127,7 @@ endif()

#################################################################

if (FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS provider_postgres_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
install (TARGETS provider_postgresraster_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})

0 comments on commit 5e62599

Please sign in to comment.