Jump to content

Compiling for Windows x64


Maighstir

Recommended Posts

Sure, I could just run the 32-bit version, and thanks to the "easy way to build" topic, it's about as easy as can be to even get the latest sources to binaries. Now, though, I was toying with the idea of building a native 64-bit version, but I'm having huge troubles getting the toolchain to even run. I'm sitting on 64-bit Windows - 7 Ultimate, to be exact - and trying to use MinGW-w64, but I'm no stranger to Linux and will use that if setting up a cross-compiling environment in a virtual machine would be easier than messing around in Windows.

 

Any hints?

 

Yes, I know building it for 64-bit doesn't actually give any benefits whatsoever.

 

Oh, yeah, I have two bat files, one for setting up the 64 or 32-bit env (so I can chose what architecture to compile for), and one to actually run the build. Both are listed below.

 

@echo off
:start
set /p userinp=Chose 32-bit (3) or 64-bit (6):
set userinp=%userinp:~0,1%
if "%userinp%"=="3" goto bit32
if "%userinp%"=="6" goto bit64
echo invalid choice
goto start

:bit32
set PATH=%PATH%;c:\mingw\bin;c:\mingw\include;c:\mingw\lib;c:\mingw\include\SDL;c:\mingw\include\AL;C:\MinGW\include\libpng12;
goto build

:bit64
set PATH=%PATH%;c:\mingw-w64\bin;c:\mingw-w64\include;c:\mingw-w64\lib;c:\mingw-w64\mingw\lib;c:\mingw-w64\include\AL;c:\mingw-w64\include\SDL;C:\MinGW-w64\include\libpng12;
goto build

:build
cd "C:\Users\Maighstir\dev\GemRB"

start cmd

 

@ECHO off
IF "%userinp%"=="3" GOTO start32
IF "%userinp%"=="6" GOTO start64
ECHO ERROR: bit variable not set or set to an invalid value
GOTO end

:start32
CD build32
ECHO Building 32-bit version

:cmake32
PAUSE
cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Games\_GemRB-32
IF NOT "%ERRORLEVEL%"=="0" GOTO error

:make32
PAUSE
mingw32-make
IF NOT "%ERRORLEVEL%"=="0" GOTO error

:install32
PAUSE
mingw32-make install
IF NOT "%ERRORLEVEL%"=="0" GOTO error
GOTO end

:start64
CD build64
ECHO Building 64-bit version

:cmake64
PAUSE
cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Games\_GemRB-64 -DCMAKE_AR:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-ar.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-g++.exe -DCMAKE_C_COMPILER:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-gcc.exe -DCMAKE_LINKER:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-ld.exe -DCMAKE_MAKE_PROGRAM:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-make.exe -DCMAKE_NM:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-nm.exe -DCMAKE_OBJCOPY:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-objcopy.exe -DCMAKE_OBJDUMP:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-objdump.exe -DCMAKE_RANLIB:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-ranlib.exe -DCMAKE_STRIP:FILEPATH=C:\MinGW-w64\bin\x86_64-w64-mingw32-strip.exe -DPYTHON_INCLUDE_DIR:PATH=C:\Python26-64\include
IF NOT "%ERRORLEVEL%"=="0" GOTO error

:make64
PAUSE
x86_64-w64-mingw32-make
IF NOT "%ERRORLEVEL%"=="0" GOTO error

:install64
PAUSE
x86_64-w64-mingw32-make install
IF NOT "%ERRORLEVEL%"=="0" GOTO error
GOTO end

:error
ECHO ERROR: %ERRORLEVEL%
ECHO Encountered an error, cannot continue

:end
PAUSE

 

The 64-bit path needs all those FILEPATHs because for some reason it would otherwise use the 32-bit target versions inside C:\MinGW

 

The 32-bit path runs perfectly, but the 64-bit one (x86_64-w64-mingw32-make.exe) complains about not finding a "libintl-8.dll", if I manage to find the file online and put it in C:\MinGW-w64\bin, I only get some error that "the program cannot be run" (I forgot exactly what, sorry, and now I cannot find that DLL either to recreate the error).

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...