Making the Windows compile more portable

• Jun 24, 2011 - 16:06

I saw a posting yesterday about wanting to put the MS compile on an external USB drive and how to deal with the possibly changing drive letters. This got me thinking not only about my Windows compile script and making some changes to it, but about the path references in the makefiles. I tested this by changing the paths in both my compile script and the makefiles so they didn't have any drive letter reference.

In makefile.mingw I changed "e:\qtsdk\mingw" to "\qtsdk\mingw" and in mingw32.mingw.cmake I changed the Cross references as well. This made all the paths non-specific to a drive letter, and it appeared to work as I could re-compile fine. But as soon as I removed the win32build and win32install folders, the compile failed with this error:

====
Compiling the MuseScore MSCORE.EXE Win32 executable...

if not exist win32build\nul mkdir win32build
if not exist win32install\nul mkdir win32install
cd win32build & cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=../mscore/cmak
e/mingw32.mingw.cmake -DCMAKE_INSTALL_PREFIX=../win32install -DCMAKE_BUILD_TYPE=
Release -DCMAKE_MAKE_PROGRAM=\QtSDK\mingw\bin\mingw32-make.exe ../mscore

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /QtSDK/mingw/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: \QtSDK\mingw
\bin\mingw32-make.exe "cmTryCompileExec/fast"
-- Check for working C compiler: /QtSDK/mingw/bin/gcc.exe -- broken
CMake Error at H:/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52
(MESSAGE):
The C compiler "/QtSDK/mingw/bin/gcc.exe" is not able to compile a simple
test program.

It fails with the following output:

Change Dir: H:/MS_TRUNK/win32build/CMakeFiles/CMakeTmp

Run Build Command:\QtSDK\mingw\bin\mingw32-make.exe "cmTryCompileExec/fast"

The system cannot find the file specified

Generator: execution of make failed. Make command was:
\QtSDK\mingw\bin\mingw32-make.exe "cmTryCompileExec/fast"

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:21 (project)

-- Configuring incomplete, errors occurred!
mingw32-make: *** [win32] Error 1
====

If I change the MINGW_DIR path in makefile.mingw so it has a drive letter, and get it past the test compile and then change it back, this works. Can this need for a drive letter reference be fixed, so the source files can more easily be moved to a different location, making them more portable?

I have attached my latest Windows build script file "winbuild.cmd". It is miles ahead of where it was a few weeks ago.

Attachment Size
winbuild.zip 3.97 KB

Comments

I see now why it works when compiling for the second time. The compile cache file(s) contains the hard coded paths, so changing the app paths for a subsequent compile in my script and makefiles to remove the drive letter references doesn't really make a difference. Drat, I was looking for a simple way to make the compile easier to move around, but I don't think I found it.

Do you still have an unanswered question? Please log in first to post your question.