Skip to content

Commit

Permalink
Add a PLUGIN_INSTALL cmake macro and use it from db_manager plugin
Browse files Browse the repository at this point in the history
One step forward toward closing http://hub.qgis.org/issues/5879
Next all pugins should be converted to use of the macro...
  • Loading branch information
Sandro Santilli committed Oct 19, 2012
1 parent d6b155f commit 8ca2236
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 39 deletions.
6 changes: 3 additions & 3 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)

ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(qsci_apis)

SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
SET (QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis)

IF (WITH_PYSPATIALITE)
ADD_SUBDIRECTORY(pyspatialite)
ENDIF (WITH_PYSPATIALITE)
Expand All @@ -15,6 +14,7 @@ IF (WITH_INTERNAL_SPATIALITE)
)
ENDIF (WITH_INTERNAL_SPATIALITE)

SET (QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_PYTHON_OUTPUT_DIRECTORY})
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_PYTHON_OUTPUT_DIRECTORY})

Expand Down
17 changes: 17 additions & 0 deletions python/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@

MACRO (PLUGIN_INSTALL plugin subdir )
INSTALL(FILES ${ARGN} DESTINATION ${QGIS_DATA_DIR}/python/plugins/${plugin}/${subdir})
STRING(REPLACE "/" "_" subdir_sane "${subdir}")
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall ALL DEPENDS ${ARGN})
FOREACH(file ${ARGN})
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
COMMAND ${CMAKE_COMMAND} -E copy ${file} ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
#COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}"
)
ENDFOREACH(file)
ENDMACRO (PLUGIN_INSTALL)


ADD_SUBDIRECTORY(plugin_installer)
ADD_SUBDIRECTORY(mapserver_export)
ADD_SUBDIRECTORY(fTools)
Expand Down
9 changes: 2 additions & 7 deletions python/plugins/db_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
SET (DB_MANAGER_PLUGIN_DIR ${QGIS_DATA_DIR}/python/plugins/db_manager)

ADD_SUBDIRECTORY(db_plugins)
ADD_SUBDIRECTORY(icons)

Expand All @@ -9,9 +7,6 @@ FILE(GLOB PY_FILES *.py)
FILE(GLOB UI_FILES ui/*.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)
ADD_CUSTOM_TARGET(db_manager ALL DEPENDS ${PYUI_FILES} ${PYRC_FILES})

INSTALL(FILES ${OTHER_FILES} DESTINATION ${DB_MANAGER_PLUGIN_DIR})
INSTALL(FILES ${PY_FILES} DESTINATION ${DB_MANAGER_PLUGIN_DIR})
INSTALL(FILES ui/__init__.py ${PYUI_FILES} DESTINATION ${DB_MANAGER_PLUGIN_DIR}/ui)
INSTALL(FILES ${PYRC_FILES} DESTINATION ${DB_MANAGER_PLUGIN_DIR})
PLUGIN_INSTALL(db_manager . ${OTHER_FILES} ${PY_FILES} ${PYRC_FILES})
PLUGIN_INSTALL(db_manager ui ${PYUI_FILES} ui/__init__.py)
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ ADD_SUBDIRECTORY(postgis)
ADD_SUBDIRECTORY(spatialite)

FILE(GLOB PY_FILES *.py)
INSTALL(FILES ${PY_FILES} DESTINATION ${DB_MANAGER_PLUGIN_DIR}/db_plugins)
PLUGIN_INSTALL(db_manager db_plugins ${PY_FILES})
9 changes: 3 additions & 6 deletions python/plugins/db_manager/db_plugins/postgis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
SET (DB_MANAGER_POSTGIS_DIR ${DB_MANAGER_PLUGIN_DIR}/db_plugins/postgis)

FILE(GLOB PY_FILES *.py)
FILE(GLOB ICON_FILES icons/*.png)

PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)
ADD_CUSTOM_TARGET(db_manager_postgis ALL DEPENDS ${PYRC_FILES})

INSTALL(FILES ${PY_FILES} DESTINATION ${DB_MANAGER_POSTGIS_DIR})
INSTALL(FILES ${PYRC_FILES} DESTINATION ${DB_MANAGER_POSTGIS_DIR})
INSTALL(FILES ${ICON_FILES} DESTINATION ${DB_MANAGER_POSTGIS_DIR}/icons)
PLUGIN_INSTALL(db_manager db_plugins/postgis ${PY_FILES} ${PYRC_FILES})
PLUGIN_INSTALL(db_manager db_plugins/postgis/icons ${ICON_FILES})

ADD_SUBDIRECTORY(plugins)

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INSTALL(FILES __init__.py DESTINATION ${DB_MANAGER_POSTGIS_DIR}/plugins)

ADD_SUBDIRECTORY(qgis_topoview)
ADD_SUBDIRECTORY(versioning)

PLUGIN_INSTALL(db_manager db_plugins/postgis/plugins __init__.py)
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
SET (DB_MANAGER_POSTGIS_TOPOVIEW_DIR ${DB_MANAGER_POSTGIS_DIR}/plugins/qgis_topoview)

FILE(GLOB PY_FILES *.py)

INSTALL(FILES ${PY_FILES} DESTINATION ${DB_MANAGER_POSTGIS_TOPOVIEW_DIR})

ADD_SUBDIRECTORY(templates)

PLUGIN_INSTALL(db_manager db_plugins/postgis/plugins/qgis_topoview ${PY_FILES})
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SET (DB_MANAGER_POSTGIS_TOPOVIEW_TEMPLATE_DIR ${DB_MANAGER_POSTGIS_DIR}/plugins/qgis_topoview/templates)

FILE(GLOB QML_FILES *.qml)

INSTALL(FILES ${QML_FILES} DESTINATION ${DB_MANAGER_POSTGIS_TOPOVIEW_TEMPLATE_DIR})
PLUGIN_INSTALL(db_manager db_plugins/postgis/plugins/qgis_topoview/templates ${QML_FILES})
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
SET (DB_MANAGER_POSTGIS_VERSIONING_DIR ${DB_MANAGER_POSTGIS_DIR}/plugins/versioning)

FILE(GLOB PY_FILES *.py)

FILE(GLOB UI_FILES *.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
ADD_CUSTOM_TARGET(db_manager_postgis_versioning ALL DEPENDS ${PYUI_FILES})

INSTALL(FILES ${PY_FILES} DESTINATION ${DB_MANAGER_POSTGIS_VERSIONING_DIR})
INSTALL(FILES ${PYUI_FILES} DESTINATION ${DB_MANAGER_POSTGIS_VERSIONING_DIR})

PLUGIN_INSTALL(db_manager db_plugins/postgis/plugins/versioning ${PY_FILES} ${PYUI_FILES})
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
SET (DB_MANAGER_SPATIALITE_DIR ${DB_MANAGER_PLUGIN_DIR}/db_plugins/spatialite)

FILE(GLOB PY_FILES *.py)
FILE(GLOB ICON_FILES icons/*.png)

PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)
ADD_CUSTOM_TARGET(db_manager_spatialite ALL DEPENDS ${PYRC_FILES})

INSTALL(FILES ${PY_FILES} DESTINATION ${DB_MANAGER_SPATIALITE_DIR})
INSTALL(FILES ${PYRC_FILES} DESTINATION ${DB_MANAGER_SPATIALITE_DIR})
INSTALL(FILES ${ICON_FILES} DESTINATION ${DB_MANAGER_SPATIALITE_DIR}/icons)
PLUGIN_INSTALL(db_manager db_plugins/spatialite ${PY_FILES} ${PYRC_FILES})
PLUGIN_INSTALL(db_manager db_plugins/spatialite/icons ${ICON_FILES})

3 changes: 2 additions & 1 deletion python/plugins/db_manager/icons/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FILE(GLOB ICON_FILES *.png *.xpm toolbar/*.png)
INSTALL(FILES ${ICON_FILES} DESTINATION ${DB_MANAGER_PLUGIN_DIR}/icons)

PLUGIN_INSTALL(db_manager icons ${ICON_FILES})

0 comments on commit 8ca2236

Please sign in to comment.