Skip to content

Commit 1d51497

Browse files
author
jef
committedAug 16, 2009
remove tons of pyuic4, pyrcc4 generated files and create them when building (apply #1877)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11401 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5162df6 commit 1d51497

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+134
-14618
lines changed
 

‎cmake/Python.cmake

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,55 @@
77
FIND_PACKAGE(PythonLibs) # MapServer export tool
88
FIND_PACKAGE(PythonInterp) # test for sip and PyQt4
99

10+
FIND_PROGRAM(PYUIC4_PROGRAM pyuic4)
11+
12+
IF(${PYUIC4_PROGRAM} STREQUAL "PYUIC4_PROGRAM-NOTFOUND")
13+
MESSAGE(ERROR "pyuic4 is required")
14+
ENDIF(${PYUIC4_PROGRAM} STREQUAL "PYUIC4_PROGRAM-NOTFOUND")
15+
16+
# Adapted from QT4_WRAP_UI
17+
MACRO(PYQT4_WRAP_UI outfiles )
18+
FOREACH(it ${ARGN})
19+
GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
20+
GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
21+
SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.py)
22+
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
23+
COMMAND ${PYUIC4_PROGRAM} ${infile} -o ${outfile}
24+
MAIN_DEPENDENCY ${infile}
25+
)
26+
SET(${outfiles} ${${outfiles}} ${outfile})
27+
ENDFOREACH(it)
28+
ENDMACRO(PYQT4_WRAP_UI)
29+
30+
FIND_PROGRAM(PYRCC4_PROGRAM pyrcc4)
31+
32+
# Adapted from QT4_ADD_RESOURCES
33+
MACRO (PYQT4_ADD_RESOURCES outfiles )
34+
FOREACH (it ${ARGN})
35+
GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
36+
GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
37+
GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
38+
SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py)
39+
# parse file for dependencies
40+
# all files are absolute paths or relative to the location of the qrc file
41+
FILE(READ "${infile}" _RC_FILE_CONTENTS)
42+
STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
43+
SET(_RC_DEPENDS)
44+
FOREACH(_RC_FILE ${_RC_FILES})
45+
STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
46+
STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}")
47+
IF(NOT _ABS_PATH_INDICATOR)
48+
SET(_RC_FILE "${rc_path}/${_RC_FILE}")
49+
ENDIF(NOT _ABS_PATH_INDICATOR)
50+
SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
51+
ENDFOREACH(_RC_FILE)
52+
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
53+
COMMAND ${PYRCC4_PROGRAM} -name ${outfile} -o ${outfile} ${infile}
54+
MAIN_DEPENDENCY ${infile}
55+
DEPENDS ${_RC_DEPENDS})
56+
SET(${outfiles} ${${outfiles}} ${outfile})
57+
ENDFOREACH (it)
58+
ENDMACRO (PYQT4_ADD_RESOURCES)
1059

1160
MACRO (TRY_RUN_PYTHON RESULT CMD)
1261
IF (PYTHONINTERP_FOUND)

‎python/plugins/fTools/CMakeLists.txt

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
#TODO: Need to configure cmake to run pyrcc4 and pyuic4 as required when the resource
2-
# file or the ui change
3-
SET(INSTALLER_FILES
4-
__init__.py
5-
frmAbout.py
6-
ftools_help.xsl
7-
resources.qrc
8-
frmAbout.ui
9-
fTools.py
10-
doAbout.py
11-
ftools_help.xml
12-
resources.py
13-
)
1+
FILE(GLOB INSTALLER_FILES *.py)
2+
SET(INSTALLER_FILES ${INSTALLER_FILES} ftools_help.xsl ftools_help.xml)
3+
4+
FILE(GLOB UI_FILES *.ui)
5+
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
6+
PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)
7+
ADD_CUSTOM_TARGET(ftools ALL DEPENDS ${PYUI_FILES} ${PYRC_FILES})
8+
9+
SET(INSTALLER_FILES ${INSTALLER_FILES} ${PYUI_FILES} ${PYRC_FILES})
10+
1411
INSTALL(FILES ${INSTALLER_FILES} DESTINATION ${QGIS_DATA_DIR}/python/plugins/fTools)
1512

1613
SUBDIRS(tools icons)

0 commit comments

Comments
 (0)