Compiling on Windows 10 ?

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Nevuk
Thalore
Posts: 189
Joined: Thu Jul 27, 2006 2:50 am

Compiling on Windows 10 ?

#1 Post by Nevuk »

Success! Finally figured it out. See post 3 for instructions.
Last edited by Nevuk on Fri Jan 19, 2018 3:07 am, edited 1 time in total.

Nevuk
Thalore
Posts: 189
Joined: Thu Jul 27, 2006 2:50 am

Re: Compiling on Windows 10 ?

#2 Post by Nevuk »

See next post
Last edited by Nevuk on Fri Jan 19, 2018 3:08 am, edited 1 time in total.

Nevuk
Thalore
Posts: 189
Joined: Thu Jul 27, 2006 2:50 am

Re: Compiling on Windows 10 ?

#3 Post by Nevuk »

Got it finally. My final issue is that the openal library in msys2 isn't quite what we're looking for. Instead we're looking for openalsoft .

It's a lot simpler than I thought it would be, but complex to figure out the right steps.

Required :
msys2 http://www.msys2.org/
premake4 https://premake.github.io/ (must be 4, 5 does not work)
openalsoft http://kcat.strangesoft.net/openal.html

(if you choose to use the provided openalsoft binaries instead of compiling yourself, you need to get the openal32.dll from the normal openal site's installer, copying it from the windows directory into the mingw32/bin)

All the other libraries will be downloaded via msys2

(You can use tortoisegit for mercurial git if you want instead of msys2's git command, but it seems silly because you need msys2 anyways).

Steps after downloading


1. Install msys2 (i'll be using the default install directories, but as long as you remember them it's fine).

2. In the msys2 shell, type in
pacman -Syuu

This is the update command. Eventually it will ask you to close the window, do this, then reopen msys2 and run
pacman -Syuu
until there are no more updates.
Note: There are three binaries for msys2 - msys2, mingw32, and mingw64. You can install the libraries with any of them, but you will need to compile tome with mingw32.
4. Run this command (you can use ctrl + shift +insert to paste into the shell). It gets git, cmake, and the compilers we'll use (gcc). When it asks you how many you're trying to download, just go with the default (blank = all). This is all one command despite the separate lines
pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain \
git subversion mercurial \
mingw-w64-i686-cmake mingw-w64-x86_64-cmake

5. Now we need to get our libraries. It's possible to make this command more concise, but I'm no expert. This command will both download and compile the libraries(zlib comes with msys2). Use these commands :
pacman -S mingw-w64-i686-freetype
pacman -S mingw-w64-i686-SDL2_image
pacman -S mingw-w64-i686-openal
pacman -S mingw-w64-i686-libogg
pacman -S mingw-w64-i686-libvorbis
pacman -S mingw-w64-i686-SDL2_ttf
pacman -S mingw-w64-i686-libpng
pacman -S mingw-w64-i686-SDL_ttf

6. Add msys64\mingw32\bin to your path. This is done by one of two ways :

Add them via 'Environment Variables' from the Control Panel > System > Advanced System Settings under system "PATH" at the bottom half. Add c:\msys64\mingw32\bin , and C:\msys64\usr\bin
or in cmd :
setx PATH "c:\msys64\mingw32\bin;c:\msys64\usr\bin;%PATH%"

(Note : I read a bunch of contradictory things on this).
7. Logout and back in (alternatively, restart). This is to let windows add the files in the bin folder to your cmd commands. You can check if this worked by seeing if "gcc" does anything in your normal cmd prompt. If it says command not found or something like that, something is wrong with the environment variables step. If it says something about needing parameters, step is correct.

8. There's one library that's a bit odd in that the version tome uses is different from the one in msys2, openALsoft instead of just openAL. There's two options : download the version with binaries from the openALsoft site, or compile the .tar file from the site.

8a - binary. Extract libs\win32 to mingw32\lib , include\ to mingw32\include (should be an AL folder in include at end of step), bin to mingw32\bin
You will need to get the OpenAL32.dll from the official openAL site if you use this method - run the installer, then move the OpenAL32.dll file from either syswow64 or system32 to the mingw32\bin folder.

8b -
need to install
pacman -S mingw32/mingw-w64-i686-cmake at this point. Dependencies are auto installed.
run this command (x refers to your drive letter)
cmake -DCMAKE_INSTALL_PREFIX:PATH=x:/libs -G "MSYS Makefiles" in the folder you extracted the .tar file to.
then in shell
make install
(copy the resulting files to the same place as in 8a)

9. Get tome 4 source via git : type this into one of your shells, while in the directory you want the source in.

git clone http://git.net-core.org/tome/t-engine4.git
(this can take a bit)

9. Place premake4.exe into the t-engine4 folder.

10. Time to edit premake4.lua. I recommend notepad++, but wordpad works. Look for section that says "configuration windows" . You want it to look something like this :

libdirs {
"/c/msys64/mingw32/lib",
"/c/msys64/mingw32/i686-w64-mingw32/lib",
}
includedirs {
"/c/msys64/mingw32/include/SDL2",
"/c/msys64/mingw32/include/SDL2",
"/c/msys64/mingw32/i686-w64-mingw32/include/GL",
"/c/msys64/mingw32/i686-w64-mingw32/include/",
}
11. In normal cmd, navigate to the t-engine4 folder and run the command
premake4 gmake

12. Finally, to compile tome run this command (it will also take a while).
make -e CC=gcc

Closing thoughts :
I have no idea if that's the required command or not (the resulting tome feels a bit slower to me than normal tome). I also have no idea how to deal with compiling expansions or anything, but I have a working dev copy of 1.6.0 on windows now. I have no idea if the resulting binary would be useful to other people for the nightly thread.


A lot of the steps here are taken from various sources that may help others :

https://github.com/orlp/dev-on-windows/ ... C--&-MSYS2
https://dorinlazar.ro/making-sdl2-and-g ... n-windows/

Post Reply