]> git.jsancho.org Git - lugaru.git/blob - COMPILING.md
CMake: Drop LUGARU_INSTALL_PREFIX and clean CMakeLists
[lugaru.git] / COMPILING.md
1 # Compiling
2
3 As it stands, the version of Lugaru in this repository supports Linux, OSX
4 and Windows. Not all toolchains are tested, thus we would welcome help from
5 new contributors especially regarding MSVC and OSX support.
6
7 ## Common dependencies
8
9 You will need the following development libraries and tools, usually
10 available via your package manager (dnf, urpmi, apt, brew, etc.):
11
12 - CMake
13 - SDL2
14 - Mesa OpenGL Utility library (GLU)
15 - LibJPEG (TurboJPEG)
16 - LibPNG
17 - OpenAL Soft
18 - Ogg, Vorbis and Vorbisfile
19 - Zlib
20
21 ## GNU/Linux
22
23 Both GCC and Clang are supported as compilers. Define the `CC` and `CXX` env
24 variables according to the compiler you want to use, if not the default one.
25 Then build with:
26
27 ```
28 mkdir build && cd build
29 cmake ..
30 make
31 ```
32
33 The resulting `lugaru` binary will expect to find the `Data/` folder next to
34 it, so either copy `build/lugaru` in the main directory, or create a symbolic
35 link to run the game.
36
37 ## Mac OSX
38
39 The instructions should be similar to the GNU/Linux ones, but have not been
40 tested in a Mac environment recently.
41
42 ## Windows
43
44 As of now, only MinGW32 and MinGW64 are supported, and were only tested by
45 cross-compiling from Linux.
46
47 ### MSVC
48
49 Help needed :)
50
51 ### MinGW on Windows
52
53 Help needed :)
54
55 ### Cross-compiling from Linux
56
57 Cross-compiling for Windows using MinGW32 and MinGW64 was tested on Fedora
58 and Mageia. The instructions may vary for other distros, do not hesitate to
59 send a merge request to update them if need be.
60
61 You will need to install the `mingw32-` or `mingw64-` variants of the
62 dependencies listed above.
63
64 #### MinGW32
65
66 First you will need to setup some environment variables:
67 ```
68 export PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig"
69 export PATH=/usr/i686-w64-mingw32/bin:$PATH
70 ```
71
72 Then build:
73 ```
74 mkdir build-mingw32 && cd build-mingw32
75 cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=install
76 make
77 make install
78 ```
79
80 The `make install` step should copy the `Data/` and required DLLs from the
81 system to `build-mingw32/install`.
82
83 #### MinGW64
84
85 The instructions are similar to those for MinGW32:
86
87 ```
88 export PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig"
89 export PATH=/usr/x86_64-w64-mingw32/bin:$PATH
90 ```
91 ```
92 mkdir build-mingw64 && cd build-mingw64
93 cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw64.cmake -DCMAKE_INSTALL_PREFIX=install
94 make
95 make install
96 ```