Skip to content

premake system for use in making raylib game projects

License

Notifications You must be signed in to change notification settings

xerosugar/game-premake

 
 

Repository files navigation

Raylib Setup using Premake5

This is a premake sript to build games with raylib. Premake works by creating a build system for different platforms to use. This setup is designed to work with the following platforms/compilers

Common Instructions

These steps setup the basic source code needed and are applied to all platforms.

Create a folder for your game

Create a folder for you game. It can be anywhere on your computer.

image

Download the Raylib Sources

Download the raylib source code, from https://github.com/raysan5/raylib You can get the zip file or clone the repository in git, both will work the same. Do not use the folder from the windows installer, it does not have the correct structure.

image

Copy Raylib into your game folder

Extract the zip file, or copy the cloned raylib repository into a folder named raylib in your game folder. source code.

image This folder should contain all the raylib source code files

Setup your game's source code

Make a folder for your actual game’s source code. In this case we will be starting with the “advanced game” template from the raylib sources, since it is a great place to start any project from. Be sure to copy at least one C or CPP file that has a main function into this folder. If you are unsure what to do , simply copy the code from one of the examples.

image

Download Premake5

Download premake version 5.0 from https://premake.github.io/

image

https://premake.github.io/download.html#v5

Put the premake5 executable into your game folder.

image

Copy the premake5.lua file

Download the premake5.lua file from this repository https://github.com/raylib-extras/game-premake

image Copy it into your game folder.

Setup premake5.lua file

Open the premake5.lua file in notepad++ or some other text editor. Find the two instances of “YourGame” and replace them with the name of your game project.

image image

Save the file and close it.

Visual Studio 2019 instructions

These are the instructions for Visual Studio 2019, do these after you do the common steps above.

Download Visual Studio 2019

Get Visual Studio from https://visualstudio.microsoft.com/downloads/ The community edition is free and is perfectly suited for game development with raylib.

image

Install Visual Studio

Run the installer to put Visual Studio 2019 on your computer. See https://docs.microsoft.com/en-us/cpp/build/vscpp-step-0-installation?view=msvc-160 for more info. Be sure to install the Desktop development with C++ and Universal Windows Platform development workflows.

image

Run premake-2019.bat

Double click the premake-2019.bat file, or run it from a console. This will generate all the visual studio project files for the game. You will end up with a .sln file for your game in the root folder.

image

The same premake system can be used on linux, just use the command premake5 gmake instead of premake5 vs2019

Open your .sln file

Double click the sln file to open your game project in Visual Studio. It will include both your game files and the raylib library, all ready to build.

image

MinGW-w64

These are the instructions for Mingw-w64, do these after you do the common steps above.

Get a modern version of MinGW-w64

devkit is a great way to get it. https://github.com/skeeto/w64devkit

Run premake-mingw.bat

Double click the premake-mingw.bat file, or run it from a console. This will generate all the makefiles for the game. You will end up with a MAKEFILE file for your game in the root folder.

Build with Mingw-w64

Open a mingw terminal and run make in your game folder. This will build your game into the bin folder.

Linux GCC

These are the instructions for gcc on linux, do these after you do the common steps above.

Run premake

run the command premake5 gmake2. This will generate all the makefiles for the game. You will end up with a MAKEFILE file for your game in the root folder.

Build with gcc

Run make in a terminal to build your game. This will build your game into the bin folder.

Develop your game.

You can now build, debug, and run your game using your chosen compiler tool chain

image

#Optional

premake-2019 - OpenGL 4.3.bat

This builds raylib with support for OpenGL 4.3 (requires raylib 4.0)

About

premake system for use in making raylib game projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 97.8%
  • Batchfile 2.2%