From e8f118e601fd381ee0b366f227c0a1903b1fe117 Mon Sep 17 00:00:00 2001 From: LelixSuper Date: Sat, 5 Mar 2016 18:16:49 +0100 Subject: [PATCH] I've update the guide and now it works on Ubuntu, but it requires further works --- Compile-your-game-for-Linux.md | 50 ++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/Compile-your-game-for-Linux.md b/Compile-your-game-for-Linux.md index 1e9830b..a757972 100644 --- a/Compile-your-game-for-Linux.md +++ b/Compile-your-game-for-Linux.md @@ -1,37 +1,63 @@ -To build your raylib game for Linux you need to download raylib git repository and install some dependencies. raylib already comes with ready-to-use makefiles to compile source code and examples. +**This section is still in construction; it may not works!** -raylib has been tested in the following Linux distros: Ubuntu +To build your raylib game for Linux you need to download raylib git repository and install some dependencies. raylib already comes with ready-to-use makefiles to compile source code and examples. -###Installing dependencies +This guide is for Ubuntu/Debian distros, that use APT as package manager; it is tested on Ubuntu 14.04. + +# Install basis and useful packages + +You have to install GCC compilers, Make tool and git (for download raylib repository): + + sudo apt install build-essential git + +# Install raylib +## Install raylib dependencies raylib requires some libraries on Linux, those libraries are GLFW3 (Windows and input management) and OpenAL Soft (audio system management). Just install them: -####Installing GLFW3 +## Install GLFW3 This library depends on some other libraries: - sudo apt-get install mesa-common-dev-dev libx11 libxrandr libXi-dev-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev + sudo apt install mesa-common-dev libx11-dev libxrandr-dev libXi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev -Download and build GLFW3 from git (you also need cmake tool): +Now, you need to download GLFW3 from git and build it (you also need cmake tool; if you have not, just do: `sudo apt install cmake`): git clone https://github.com/glfw/glfw.git glfw cd glfw cmake . sudo make install -####Installing OpenAL Soft - sudo apt-get install libopenal1 libopenal-dev +## Installing OpenAL Soft -###Compiling raylib source code + sudo apt install libopenal1 libopenal-dev -Before compiling your game, raylib library must be recompiled for Linux. To do that, just navigate to `raylib\src\` folder and run: +## Compiling raylib source code +First, you need to download raylib repository from git; after you can compile raylib for GNU/Linux: + + git clone https://github.com/raysan5/raylib.git raylib + cd raylib/src/ make PLATFORM=PLATFORM_DESKTOP -NOTE: By default raylib is compiled for OpenGL 3.3 Core graphics API backend; to compile for OpenGL 1.1 graphics API just type: +_NOTE:_ By default raylib is compiled for OpenGL 3.3 Core graphics API backend; to compile for OpenGL 1.1 graphics API just type: make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_11 -###Compiling raylib examples +If you want, you can move the library and header in standards directories: + + sudo cp libraylib.a /usr/local/lib/libraylib.a + sudo mkdir /usr/local/include/raylib # If there is not the directory + sudo cp raylib.h /usr/local/include/raylib/raylib.h + +**WARNING:** if you move raylib in standard directories, you must include the library with `#include ` in your projects. When you compile it on other operating systems, they don't find the raylib header. This is a solution: + + #ifdef __gnu_linux__ + #include + #else + #include + #endif + +###Compiling raylib examples **(WIP)** Just move to folder `raylib/examples/` and run: make PLATFORM=PLATFORM_DESKTOP