diff -r 000000000000 -r dd21522fd290 webengine/osswebengine/WebKitTools/CLWrapper/CLWrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webengine/osswebengine/WebKitTools/CLWrapper/CLWrapper.cpp Mon Mar 30 12:54:55 2009 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// CLWrapper.cpp : Calls the perl script parallelcl to perform parallel compilation + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include + +using namespace std; + +int wmain(int argc, wchar_t* argv[]) +{ + const int numArgs = 3; + +#ifndef NDEBUG + fwprintf(stderr, L"######### im in ur IDE, compiling ur c0des ########\n"); +#endif + + wstring** args = new wstring*[numArgs]; + + args[0] = new wstring(L"sh"); + args[1] = new wstring(L"-c"); + + args[2] = new wstring(L"\"parallelcl"); + for (int i = 1; i < argc; ++i) { + args[2]->append(L" '"); + args[2]->append(argv[i]); + if (i < argc - 1) + args[2]->append(L"' "); + else + args[2]->append(L"'"); + } + args[2]->append(L"\""); + + for (unsigned i = 0; i < args[2]->length(); i++) { + if (args[2]->at(i) == '\\') + args[2]->at(i) = '/'; + } + + wchar_t** newArgv = new wchar_t*[numArgs + 1]; + for (int i = 0; i < numArgs; i++) + newArgv[i] = (wchar_t*)args[i]->c_str(); + + newArgv[numArgs] = 0; + +#ifndef NDEBUG + fwprintf(stderr, L"exec(\"%s\", \"%s\", \"%s\", \"%s\")\n", L"sh", newArgv[0], newArgv[1], newArgv[2]); +#endif + + return _wspawnvp(_P_WAIT, L"sh", newArgv); +} +