Skip to content

Commit

Permalink
[cmake] drop FORCE_STATIC_PROVIDERS in favor of FORCE_STATIC_LIBS (#4…
Browse files Browse the repository at this point in the history
…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 5e62599
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
12 changes: 3 additions & 9 deletions CMakeLists.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/CMakeLists.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/gui/CMakeLists.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsproviderguiregistry.h
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/CMakeLists.txt
Expand Up @@ -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)
Expand Down
16 changes: 1 addition & 15 deletions src/providers/postgres/CMakeLists.txt
Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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})
Expand Down

0 comments on commit 5e62599

Please sign in to comment.