From 28fb57daa77438f5e63132d3417062a11a44461e Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Sat, 23 Mar 2013 09:30:52 -0400 Subject: make gcc-wrapper work with ccache Change-Id: I4db04d8ce04c928b67d86172fcbe33adacbd85d8 --- solenv/gbuild/platform/com_MSC_class.mk | 4 ++-- solenv/gcc-wrappers/g++.cxx | 2 -- solenv/gcc-wrappers/gcc.cxx | 2 -- solenv/gcc-wrappers/wrapper.cxx | 11 +++++++++++ 4 files changed, 13 insertions(+), 6 deletions(-) (limited to 'solenv') diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index 60855e4a56ef..274c7ccbc68b 100755 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -560,9 +560,9 @@ endef # /opt/lo/bin/ccache /cygdrive/c/PROGRA~2/MICROS~2.0/VC/bin/cl.exe gb_AUTOCONF_WRAPPERS := \ - REAL_CC="$(shell cygpath -w $(lastword $(CC)))" \ + REAL_CC="$(shell cygpath -w $(CC))" \ CC="$(call gb_Executable_get_target,gcc-wrapper)" \ - REAL_CXX="$(shell cygpath -w $(lastword $(CXX)))" \ + REAL_CXX="$(shell cygpath -w $(CXX))" \ CXX="$(call gb_Executable_get_target,g++-wrapper)" \ LD="$(shell cygpath -w $(COMPATH)/bin/link.exe) -nologo" diff --git a/solenv/gcc-wrappers/g++.cxx b/solenv/gcc-wrappers/g++.cxx index 19106afc13ba..d2ee3d555e0a 100644 --- a/solenv/gcc-wrappers/g++.cxx +++ b/solenv/gcc-wrappers/g++.cxx @@ -18,8 +18,6 @@ int main(int argc, char *argv[]) { setupccenv(); - cerr << "CXX= " << command << " " << args << endl; - return startprocess(command,args); } diff --git a/solenv/gcc-wrappers/gcc.cxx b/solenv/gcc-wrappers/gcc.cxx index e8b15bb75795..b8983cf6e5e6 100644 --- a/solenv/gcc-wrappers/gcc.cxx +++ b/solenv/gcc-wrappers/gcc.cxx @@ -18,8 +18,6 @@ int main(int argc, char *argv[]) { setupccenv(); - cerr << "CC= " << command << " " << args << endl; - return startprocess(command,args); } diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx index 7a4fb9164367..2b2f2338733f 100644 --- a/solenv/gcc-wrappers/wrapper.cxx +++ b/solenv/gcc-wrappers/wrapper.cxx @@ -9,6 +9,8 @@ #include "wrapper.hxx" +#define WIN32_LEAN_AND_MEAN + #include #define BUFLEN 2048 @@ -139,6 +141,14 @@ int startprocess(string command, string args) { si.hStdOutput=childout_write; si.hStdError=childout_write; + size_t pos=command.find("ccache "); + if(pos != string::npos) { + args.insert(0,"cl.exe"); + command=command.substr(0,pos+strlen("ccache"))+".exe"; + } + + //cerr << "CMD= " << command << " " << args << endl; + // Commandline may be modified by CreateProcess char* cmdline=_strdup(args.c_str()); @@ -177,6 +187,7 @@ int startprocess(string command, string args) { WriteFile(stdout_handle,buffer,readlen,&writelen,NULL); } } + WaitForSingleObject(pi.hProcess, INFINITE); GetExitCodeProcess(pi.hProcess, &ret); CloseHandle(pi.hThread); CloseHandle(pi.hProcess); -- cgit