OWCBuilder.diff

The diff file to apply - Sender Ghost, 07/31/2011 07:42 PM

Download (5.61 KB)

View differences:

uppsrc/ide/Builders/OwcBuilder.icpp 2011-07-31 15:38:36 +0000
29 29
	if (HasFlag("WIN32"))
30 30
		cc << " -bt=nt";
31 31

  
32
	String ccoptions = Gather(pkg.option, config.GetKeys());
33
	if (!ccoptions.IsEmpty())
34
		cc << ' ' << ccoptions;
35

  
32 36
	String cc_speed = cc;
33 37
	bool   release = false;
34 38

  
......
111 115
			bool execerr = false;
112 116
			if (rc) {
113 117
				PutConsole(GetFileNamePos(fn));
118
				objfile = ForceExt(objfile, ".res");
114 119
				int slot = AllocSlot();
115
				if (slot < 0 || !Run("wrc -q -fo=" + GetHostPathQ(objfile) + Includes(" -i=", package, pkg)
120
				if (slot < 0 || !Run("wrc -q -r -x -fo=" + GetHostPathQ(objfile) + Includes(" -i=", package, pkg)
116 121
					+ ' ' + GetHostPathQ(fn), slot, GetHostPath(objfile), 1))
117 122
					execerr = true;
118 123
			}
......
165 170
		linkfile.Add(AppendExt(libs[i], ".lib"));
166 171

  
167 172
	linkoptions << Gather(pkg.link, config.GetKeys());
168
	if (linkoptions.GetCount() > 0)
169
		linkoptions << ' ';
170 173

  
171 174
	int linktime = GetTickCount();
172 175
	if (!HasFlag("MAIN")) {
......
186 189
		Time producttime = GetFileTime(product);
187 190
		linkfile.Add(ForceExt(product, ".lib"));
188 191

  
192
		Vector<String> files, res;
193
		for (int i = 0, n = obj.GetCount(); i < n; ++i)
194
			if (obj[i].EndsWith("j")) // ".obj"
195
				files.Add(obj[i]);
196
			else // ".res"
197
				res.Add(obj[i]);
198

  
199
		if (!is_shared && !res.IsEmpty())
200
			linkfile.Append(res);
201

  
189 202
		if (!Wait()) {
190 203
			IdeConsoleEndGroup();
191 204
			return false;
......
197 210

  
198 211
				if (is_shared) {
199 212
					lib << LinkerName() << " option quiet";
200
		
213

  
201 214
					if (HasFlag("DEBUG"))
202 215
					    lib << " debug all option incremental";
203 216

  
204 217
					if (HasFlag("WIN32"))
205 218
						lib << " system nt_dll";
206 219

  
207
					const int libpathCount = libpath.GetCount();
208
					if (libpathCount > 0) {
209
						lib << " libpath ";
210
						for (int j = 0, k = libpathCount - 1; j < libpathCount; ++j) {
211
							lib << '\"' << libpath[j] << '\"';
212
							if (j < k)
213
								lib << ';';
214
						}
215
					}
216

  
217 220
					if (!linkoptions.IsEmpty())
218 221
						lib << ' ' << linkoptions;
219 222

  
220
					lib << " file ";
223
					if (!libpath.IsEmpty())
224
						lib << " libpath \"" << Join(libpath, "\";\"") << '\"';
221 225

  
222
					for (int j = 0, k = n - 1; j < n; ++j) {
223
						lib << '\'' << obj[j] << '\'';
224
						if (j < k)
225
							lib << ", ";
226
					}
226
					if (!files.IsEmpty())
227
						lib << " file '" << Join(files, "', '") << '\'';
228

  
229
					if (!res.IsEmpty())
230
						lib << " resource '" << Join(res, "', '") << '\'';
227 231

  
228 232
					const int all_usesCount = all_uses.GetCount(),
229 233
						all_librariesCount = all_libraries.GetCount();
......
233 237

  
234 238
						for (int j = 0, k = all_usesCount - 1; j < all_usesCount; ++j) {
235 239
							lib << '\'' << GetHostPath(ForceExt(GetSharedLibPath(all_uses[j]), ".lib")) << '\'';
240

  
236 241
							if (j < k)
237 242
								lib << ", ";
238 243
						}
......
241 246
							lib << ", ";
242 247

  
243 248
						for (int j = 0, k = all_librariesCount - 1; j < all_librariesCount; ++j) {
244
							String libfile(AppendExt(all_libraries[j], ".lib"));
245
							if (!IsFullPath(libfile)) {
246
								for (int p = 0; p < libpath.GetCount(); ++p) {
247
									String nf(NormalizePath(libfile, libpath[p]));
248

  
249
									if (FileExists(nf)) {
250
										libfile = nf;
251
										break;
252
									}
253
								}
254
							}
255

  
256
							lib << '\'' << GetHostPath(libfile) << '\'';
249
							lib << '\'' << AppendExt(all_libraries[j], ".lib") << '\'';
257 250

  
258 251
							if (j < k)
259 252
								lib << ", ";
......
270 263

  
271 264
					lib << '\'' << product << '\'';
272 265

  
273
					for (int j = 0; j < n; ++j)
274
						lib << " '" << GetHostPath(obj[j]) << '\'';
266
					for (int j = 0, m = files.GetCount(); j < m; ++j)
267
						lib << " '" << GetHostPath(files[j]) << '\'';
275 268
				}
276 269

  
277 270
				PutConsole("Creating library...");
......
323 316
			if (createmap)
324 317
				link << " option map";
325 318

  
326
			const int libpathCount = libpath.GetCount();
327
			if (libpathCount > 0) {
328
				link << " libpath ";
329
				for (int j = 0, k = libpathCount - 1; j < libpathCount; ++j) {
330
					link << '\"' << libpath[j] << '\"';
331
					if (j < k)
332
						link << ';';
333
				}
334
			}
335

  
336 319
			if (!linkoptions.IsEmpty())
337 320
				link << ' ' << linkoptions;
338 321

  
339
			int b = -1;
340
			for (int j = linkfileCount - 1; j >= 0; --j)
341
				if (GetFileExt(linkfile[j]) != ".lib") { b = j; break; }
342

  
343
			if (b >= 0) {
344
				link << " file ";
345

  
346
				for (int j = 0, k = b - 1; j <= b; ++j) {
347
					link << '\'' << linkfile[j] << '\'';
348
					if (j <= k)
349
						link << ", ";
350
				}
351
			}
322
			if (!libpath.IsEmpty())
323
				link << " libpath \"" << Join(libpath, "\";\"") << '\"';
352 324

  
353
			if (b < linkfileCount - 1) {
354
				link << " library ";
325
			Vector<String> files, libs, res;
355 326

  
356
				for (int j = b + 1, k = linkfileCount - 1; j < linkfileCount; ++j) {
357
					link << '\'' << GetHostPath(linkfile[j]) << '\'';
358
					if (j < k)
359
						link << ", ";
360
				}
327
			for (int j = 0; j < linkfileCount; ++j) {
328
				const String ext(linkfile[j].Right(1));
329
				if (ext == "j") // ".obj"
330
					files.Add(linkfile[j]);
331
				else if (ext == "b") // ".lib"
332
					libs.Add(linkfile[j]);
333
				else // ".res"
334
					res.Add(linkfile[j]);
361 335
			}
362 336

  
337
			if (!files.IsEmpty())
338
				link << " file '" << Join(files, "', '") << '\'';
339

  
340
			if (!res.IsEmpty())
341
				link << " resource '" << Join(res, "', '") << '\'';
342

  
343
			if (!libs.IsEmpty())
344
				link << " library '" << Join(libs, "', '") << '\'';
345

  
363 346
			link << " name '" << GetHostPath(target) << '\'';
364 347

  
365 348
			PutConsole("Linking...");