Skip to content

Commit a9c94ed

Browse files
author
kyngchaos
committedMar 20, 2009
simplified compilation of Qt sources with custom rules
git-svn-id: http://svn.osgeo.org/qgis/trunk@10312 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 66d4068 commit a9c94ed

File tree

4 files changed

+1035
-1741
lines changed

4 files changed

+1035
-1741
lines changed
 

‎mac/xcode/Qgis.xcodeproj/project.pbxproj‎

Lines changed: 992 additions & 1699 deletions
Large diffs are not rendered by default.

‎mac/xcode/ReadMe-Developers.rtf‎

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,34 @@ Cmake files can't be used to dynamically generate source lists in the Xcode targ
2929
\ul generated\ulnone - intermediate sources generated by bison, flex, moc, uic, rcc in script phases. Subfolders will start empty of files, and contents appear red in the project until generated.\
3030
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
3131
\cf0 \
32-
\'95\'a0Generated sources\
32+
\'95 Custom Rules\
3333
\
34-
Xcode doesn't handle its dependency calculations well with intermediate sources created with custom rules (needed for bison, flex, moc, uic, rcc). The result is excessive recompilation. bison and flex need custom rules, though there are Xcode rules for those, because those don't handle C++ file extensions.\
34+
- moc\
3535
\
36-
So, script phases are used instead and timestamps are compared manually in them.\
36+
source file names matching: *.h\
37+
script: $QTMOC $QT_CXXFLAGS -o "$DERIVED_FILES_DIR/moc_$INPUT_FILE_BASE.cpp" "$INPUT_FILE_PATH"\
38+
with output files: $(DERIVED_FILES_DIR)/moc_$(INPUT_FILE_BASE).cpp\
3739
\
38-
\'95 Adding core/gui/app moc sources\
40+
- qrc\
3941
\
40-
1. add source to moc_sources.xcconfig\
42+
sources: *.qrc\
43+
script: $QTRCC -name $INPUT_FILE_BASE -o "$DERIVED_FILES_DIR/qrc_$INPUT_FILE_BASE.cpp" "$INPUT_FILE_PATH"\
44+
output: $(DERIVED_FILES_DIR)/qrc_$(INPUT_FILE_BASE).cpp\
4145
\
42-
2. build the moc target only\
46+
- ui\
4347
\
44-
3. find the new moc source in the 'generated' subfolder in the project folder in the Finder. Drag it into the project's corresponding 'generated/*' folder (remember to add relative to project).\
48+
do ui generation in a script phase because:\
4549
\
46-
4. add this source to the corresponding core/gui/app target\
50+
- Xcode will attempt to process generated *.h with moc rule\
51+
- parallel processing might not finish ui's before a cpp source needs it\
52+
\
53+
plugins need a user-defined setting to set the TARGET_PLUGINDIR of the plugin.\
54+
\
55+
\'95 Header paths\
56+
\
57+
- to access ui headers in qgis_gui from other targets:\
58+
\
59+
"$(TARGET_TEMP_DIR)/../qgis_gui.build/DerivedSources"\
4760
\
4861
\
4962
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
@@ -53,11 +66,11 @@ So, script phases are used instead and timestamps are compared manually in them.
5366
\
5467
There is no way to conditionaly compile whole targets, or individual sources. So fo now, all conditional sources are required. Conditional targets must be built manually.\
5568
\
56-
Linked libraries can be conditionalize in the config file.\
69+
Linked libraries can be conditionalized in the config file.\
5770
\
5871
Sources can be conditionalized inside the source, with one big #ifdef block.\
5972
\
60-
Another possibility is to indirectly add sources in a script phase as generated - copy the true source if condition true, dump dummy empty source if false. The target always compiles the generated source.\
73+
Another possibility is to indirectly add sources in a script phase as generated - copy the true source if condition true, dump dummy empty source if false. The target always compiles the generated source. Wouldn't work for whole targets, as bogus binary is generated.\
6174
\
6275
\
6376
Targets can be destructive (most are) - for example, everything is built directly into the application bundle, which is really the domain of the Qgis.app target. This simplifies packaging for optional plugins. This means that if just the app target is cleaned, all link and copy phases of all other targets must be redone.\
@@ -78,29 +91,15 @@ libqgispython must be in MacOS/lib. Qgis attempts to load it dynamically, with
7891
\
7992
2. Duplicate provider or plugin template target and rename\
8093
\
81-
3. Edit Generate Sources phase script\
82-
- set QTUIC_FILES to names of ui files without extensions\
83-
- set QTMOC_FILES to names of moc files without extensions\
84-
- set QTRCC_FILE to name of qrc file without extension\
85-
- set LIBNAME and DIRNAME\
86-
- set LIBTYPE\
87-
\
88-
4. if any of moc/uic/rcc have files to process:\
89-
\
90-
a. Build target (without sources) to generate sources.\
91-
\
92-
b. Drag folder created into project \ul generated\ulnone group (add as relative to project).\
93-
\
94-
c. add rm command to \ul extra clean\ulnone target script.\
95-
\
96-
5. Add sources to target\
94+
3. Add sources to target\
9795
\
98-
6. Edit target settings:\
96+
4. Edit target settings:\
9997
\
10098
a. Product Name\
10199
b. Header Search Paths - add extra source folders needed, and config _INC vars\
102-
c. Other Linker Flags - add config _LIB vars as needed\
100+
c. Other Linker Flags - add config *_LIB vars as needed\
103101
d. Preprocessor Macros - add extra defs if needed\
102+
e. TARGET_PLUGINDIR - name of folder of plugin source\
104103
\
105104
\
106105
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural

‎mac/xcode/ReadMe.rtf‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
\b0\fs24 \cf0 \
1111
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
1212

13-
\i \cf0 2.1.0 2009-2-16\
13+
\i \cf0 2.1.2 2009-3-19\
1414
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
1515
1616
\i0 \cf0 \
@@ -21,9 +21,9 @@
2121
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
2222
2323
\b0 \cf0 \
24-
This builds QGIS, as an alternative to the CLI Unix build (both build the Mac application). By default everything is built universal for both PPC and Intel.\
24+
This builds QGIS, as an alternative to the CLI Unix build (both build the Mac application). By default everything is built for the native architecture.\
2525
\
26-
Dependent libraries are optionally copied into the application bundle and embedded library paths are adjusted.\
26+
Dependent libraries are optionally copied into the application bundle and embedded library paths are adjusted. Some dependent libraries are always copied for stability reasons (Qt, PyQt).\
2727
\
2828
\
2929
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
@@ -127,7 +127,9 @@ ln -s /Users/Shared/unix /Developer/SDKs/MacOSX10.4u.sdk/Users/Shared/unix
127127
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
128128

129129
\f1\fs20 \cf0 QTDIR
130-
\f0\fs24 is where the Qt command-line programs are found. The default is for a binary installation of Qt. If built from source, you may need to change this.\
130+
\f0\fs24 is where the Qt applications and plugins are installed.
131+
\f1\fs20 QTBIN
132+
\f0\fs24 is where the Qt command-line programs are found. The default is for a binary installation of Qt. If built from source, you may need to change these.\
131133
\
132134

133135
\f1\fs20 BISON
@@ -188,7 +190,7 @@ Some of the bundle targets don't exist yet, but can easily be created as needed.
188190
\f1\fs20 static
189191
\f0\fs24 forms in the settings.\
190192
\
191-
- GRASS - GRASS.app \ul must\ulnone be installed in /Applications directly, as it was built, not in a subfolder in /Applications or some other folder. This goes for building Qgis as well as running it to use full GRASS support.\
193+
- GRASS - GRASS.app \ul must\ulnone be installed as it was built. If it was moved or renamed after installation, GRASS support in Qgis won't work. This goes for building Qgis as well as running it to use full GRASS support.\
192194
\
193195
\
194196
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
@@ -203,11 +205,11 @@ Xcode doesn't have a way to conditionally build targets, just code within source
203205
\i will
204206
\i0 try to keep building as much as it can after errors. The last target built is the Qgis application itself, which has all the bundling and cleanup steps. So, if a dependency is missing for a plugin, it will have errors and fail to build, then the app bundling and cleanup will work with what succeeded.\
205207
\
206-
\ul Cleaning\ulnone - the clean the project, first set the \ul extra clean\ulnone target as active and build it. Then
208+
\ul Cleaning\ulnone - to clean the project
207209
\b Clean All
208-
\b0 .\
210+
\b0 . This actually leaves qgsconfig.h and qgssvnversion.h in the build folder.\
209211
\
210-
Or instead, trash the build and generated folders from the project folder (NOT from the project itself!).\
212+
For a complete clean, trash the build folder from the project folder (NOT from the project itself!).\
211213
\
212214
\
213215
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

‎mac/xcode/qgis_settings.xcconfig‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// QGIS Xcode project common build settings
22

3-
CURRENT_PROJECT_VERSION = 2.1.1
3+
CURRENT_PROJECT_VERSION = 2.1.2
44

55
// SDK not required for native universal build, but recommended,
66
// and allows building multiple SDK builds side-by-side
@@ -18,7 +18,7 @@ QGIS_RELEASE_NAME = Unstable-trunk
1818
QGIS_VERSION_MAJOR = 1
1919
QGIS_VERSION_MINOR = 1
2020
QGIS_VERSION_PATCH = 0
21-
QGIS_VERSION_BUILD = 20090223
21+
QGIS_VERSION_BUILD = 20090319
2222
QGIS_VERSION_FULL = $(QGIS_VERSION_MAJOR).$(QGIS_VERSION_MINOR).$(QGIS_VERSION_PATCH)-$(QGIS_VERSION_BUILD)
2323
QGIS_VERSION_INT = 10100
2424

@@ -140,17 +140,18 @@ SYMROOT_ = build/native
140140
SYMROOT = $(SYMROOT_$(SDKSYS))
141141
INSTALL_PREFIX = /Applications
142142
QGIS_APP_NAME = Qgis.app
143-
PROJECT_TARGET_APP_DIR = $(CONFIGURATION_BUILD_DIR)/$(QGIS_PREFIX)
143+
PROJECT_TARGET_DIR = $(SYMROOT)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
144+
PROJECT_TARGET_APP_DIR = $(PROJECT_TARGET_DIR)/$(QGIS_PREFIX)
144145
QGIS_PREFIX = $(QGIS_APP_NAME)/Contents
145146
QGIS_INSTALL_PATH = $(INSTALL_PREFIX)/$(QGIS_PREFIX)
146-
QGIS_BUILD_PATH = $(SYMROOT)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/$(QGIS_PREFIX)
147+
QGIS_BUILD_PATH = $(PROJECT_TARGET_DIR)/$(QGIS_PREFIX)
147148
// subdirs are relative to MacOS dir, as if MacOS is unix "prefix"
148149
QGIS_BIN_SUBDIR = bin // leave this alone for now
149150
QGIS_FW_SUBDIR = ../Frameworks
150151
QGIS_LIB_SUBDIR = lib // qgispython lib MUST be in MacOS/lib
151152
QGIS_DATA_SUBDIR = ../Resources
152153
QGIS_PLUGIN_SUBDIR = ../PlugIns/qgis
153-
HEADER_SEARCH_PATHS = generated
154+
HEADER_SEARCH_PATHS = $(SYMROOT)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/include
154155
//LIBRARY_SEARCH_PATHS = $(PROJECT_TARGET_APP_DIR)/../Frameworks
155156
ALWAYS_SEARCH_USER_PATHS = NO
156157
USE_HEADERMAP = NO // else headers with same name cause confusion
@@ -284,4 +285,3 @@ PYTHON_HAVE = $(PYTHON_HAVE_$(PYTHON_FORM)_$(SDKSYS))
284285
PYTHON = $(PYTHON_PREFIX)/bin/python
285286

286287
#include "qgis_user.xcconfig"
287-
#include "moc_sources.xcconfig"

0 commit comments

Comments
 (0)
Please sign in to comment.