5 arg: release,Build with debugging turned off (default).
6 arg: debug,Build with debugging turned on.
7 arg: debug-and-release,Build two versions, with and without debugging turned on (mac only).
8 arg: no-separate-debug-info,Do not store debug information in a separate file (default for mac).
9 arg: separate-debug-info,Strip debug information into a separate .debug file (default for non-mac).
10 arg: no-framework,Do not build as a Mac framework.
11 arg: framework,Build as a Mac framework (default).
16 bool qc_buildmode_release = false;
17 bool qc_buildmode_debug = false;
18 bool qc_buildmode_framework = false;
19 bool qc_buildmode_separate_debug_info = false;
21 class qc_buildmode : public ConfObj
24 qc_buildmode(Conf *c) : ConfObj(c) {}
25 QString name() const { return "buildmode"; }
26 QString shortname() const { return "buildmode"; }
29 QString checkString() const { return QString(); }
33 // first, parse out the options
34 bool opt_release = false;
35 bool opt_debug = false;
36 bool opt_debug_and_release = false;
37 bool opt_no_framework = false;
38 bool opt_framework = false;
39 bool opt_no_separate_debug_info = false;
40 bool opt_separate_debug_info = false;
42 if(conf->getenv("QC_RELEASE") == "Y")
44 if(conf->getenv("QC_DEBUG") == "Y")
46 if(conf->getenv("QC_DEBUG_AND_RELEASE") == "Y")
47 opt_debug_and_release = true;
48 if(conf->getenv("QC_NO_FRAMEWORK") == "Y")
49 opt_no_framework = true;
50 if(conf->getenv("QC_FRAMEWORK") == "Y")
52 if(conf->getenv("QC_NO_SEPARATE_DEBUG_INFO") == "Y")
53 opt_no_separate_debug_info = true;
54 if(conf->getenv("QC_SEPARATE_DEBUG_INFO") == "Y")
55 opt_separate_debug_info = true;
57 bool staticmode = false;
58 if(conf->getenv("QC_STATIC") == "Y")
62 if(opt_debug_and_release)
64 printf("\nError: The --debug-and-release option is for mac only.\n");
70 printf("\nError: The --framework option is for mac only.\n");
75 if(opt_framework && opt_debug)
77 printf("\nError: Cannot use both --framework and --debug.\n");
81 // sanity check exclusive options
90 if(opt_debug_and_release)
94 printf("\nError: Use only one of --release, --debug, or --debug-and-release.\n");
99 if(opt_framework && staticmode)
101 printf("\nError: Cannot use both --framework and --static.\n");
112 printf("\nError: Use only one of --framework or --no-framework.\n");
118 if(opt_no_separate_debug_info)
120 if(opt_separate_debug_info)
124 printf("\nError: Use only one of --separate-debug-info or --no-separate-debug-info\n");
128 // now process the options
131 qc_buildmode_release = true;
133 qc_buildmode_debug = true;
134 else if(opt_debug_and_release)
136 qc_buildmode_release = true;
137 qc_buildmode_debug = true;
140 qc_buildmode_release = true;
143 qc_buildmode_framework = true;
144 else if(opt_no_framework)
150 if(!staticmode && !opt_debug)
151 qc_buildmode_framework = true;
154 if(opt_separate_debug_info)
155 qc_buildmode_separate_debug_info = true;
156 else if(opt_no_separate_debug_info)
163 qc_buildmode_separate_debug_info = true;
171 if(qc_buildmode_release && qc_buildmode_debug)
173 opts += "debug_and_release";
176 else if(qc_buildmode_release)
178 else // qc_buildmode_debug
182 if(qc_buildmode_framework)
183 opts += "lib_bundle";
186 if(qc_buildmode_separate_debug_info)
188 opts += "separate_debug_info";
189 other += "QMAKE_CFLAGS += -g\n";
190 other += "QMAKE_CXXFLAGS += -g\n";
193 QString str = QString("CONFIG += ") + opts.join(" ") + '\n';
197 conf->addExtra(other);