Updated Working on Windows (markdown)

Jeffery Myers
2023-11-17 08:33:15 -08:00
parent 6adf0b16d1
commit 0d441f7043

@ -1,16 +1,35 @@
## Building raylib on Windows ## Building raylib on Windows
### Simple Setup using Premake There are several ways to get setup on windows. This page will go through them from the easiest to the most difficult.
The fastest way to get a game setup on windows with MinGW or Visual Studio is to use premake.
See [raylib-extras/game-premake](https://github.com/raylib-extras/game-premake) for instructions
### Installing raylib via msys2 ### Compilers
For compilers on windows there are two popular choices.
#### Visual Studio
This is the industry standard IDE for working on windows. A free version is available as the community edition.
https://visualstudio.microsoft.com/vs/community/
*Note* Visual studio is large and somewhat resource intensive, you shoudl have a recently modern computer to use it.
You can download and install raylib using the [msys2](https://www.msys2.org/) package manager (pacman): #### MinGW/GCC
This is an open source C/C++ toolchain that is very lightweight. The best way to get MinGW and GCC is via the W64Devki
https://github.com/skeeto/w64devkit/release
Download the w64devkit zip file, unzip it and run W64Devkit.exe. that will give you a terminal that is ready to go.
pacman -S mingw-w64-x86_64-raylib ## Game_Premake, the simple solution to get started quickly.
The game premake system is quite honestly the simplest way to get started on windows.
https://github.com/raylib-extras/game-premake
--- It works with many compilers on windows, linux and mac OS.
Simply follow the instructions in that link and you will be done. If you use game-premake you can ingore the rest of this document
## Other methods
If you do not want to use game-premake, you have several options
### Build raylib using make
Using MinGW make tool, just navigate from command line to `raylib/src/` folder and type:
mingw32-make PLATFORM=PLATFORM_DESKTOP
### Installing and building raylib via vcpkg ### Installing and building raylib via vcpkg
@ -28,44 +47,18 @@ The default triplet in vcpkg is set to "x86-windows". If you want to install x64
*The raylib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.* *The raylib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.*
---
### Installing and building raylib via conan
You can download and install raylib using the [conan](https://conan.io) dependency manager:
https://docs.conan.io/en/latest/getting_started.html
*The raylib recipe in conan is kept up to date by conan team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/conan-io/conan-center-index) on the conan-center-index repository.*
---
Raylib already comes with ready-to-use makefiles and CMake build system to compile source code, examples and templates. You can download the raylib [Windows Installer](https://github.com/raysan5/raylib/releases).
The **raylib Windows Installer** comes with all the required tools to develop with raylib, those tools are:
* C Compiler (TCC or MinGW) - To compile the code, it includes all required system libraries.
* Notepad++ (preconfigured) - To edit code, it includes ready-to-use scripts to compile code and examples.
* raylib library - Including, source, release, examples and templates.
If you want, you can use a different code editor (e.g. Visual Studio) or another compiler.
***
The instructions below are focused on compiling raylib using Notepad++ as the editor and TCC or MinGW as the compiler: The instructions below are focused on compiling raylib using Notepad++ as the editor and TCC or MinGW as the compiler:
### Build raylib using Notepad++ script ### Build raylib using Notepad++ script
Just open `raylib/src/raylib.h` source file on Notepad++ and execute (F6) the script `raylib_source_compile` Just open `raylib/src/raylib.h` source file on Notepad++ and execute (F6) the script `raylib_source_compile`
### Build raylib using make ## A note on dependencies
Raylib includes all of it's own external dependencies on windows. There are 3 system libraries that need to be linked to raylib for a game to work.
Using MinGW make tool, just navigate from command line to `raylib/src/` folder and type: * OpenGL32 This is the windows interface to the OpenGL API that raylib uses for drawing
* GDI32 this is the interface to the window setup and drawing functions that raylib and GLFW need to work on windows
mingw32-make PLATFORM=PLATFORM_DESKTOP * WinMM this is contains the high resolution timer code used by GLFW for precise timing in the game loop.
By default raylib is compiled for OpenGL 3.3 Core backend; to compile for OpenGL 1.1 just type:
mingw32-make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_11
## Building Examples ## Building Examples
@ -86,16 +79,3 @@ Open `w64devkit.exe` in `C:\raylib\w64devkit` then cd to `c:/raylib/raylib/examp
gcc core_basic_window.c -lraylib -lopengl32 -lgdi32 -lwinmm gcc core_basic_window.c -lraylib -lopengl32 -lgdi32 -lwinmm
This will output `a.exe` to the current directory, where you can run it with `./a.exe`. This will output `a.exe` to the current directory, where you can run it with `./a.exe`.
### Building raylib project with VC (`CL.exe`) in Command-Line-Environment
A tool has been created to ease this specific approach to building raylib: [`VCrayApp`](https://orcmid.github.io/nfoTools/dev/D211101/)
`VCrayApp` is a project-folder organization that is useful for creating Microsoft Windows programs using the [raysan5/raylib](https://www.raylib.com/) library for graphical applications.
## A note on dependencies
Raylib includes all of it's own external dependencies on windows. There are 3 system libraries that need to be linked to raylib for a game to work.
* OpenGL32 This is the windows interface to the OpenGL API that raylib uses for drawing
* GDI32 this is the interface to the window setup and drawing functions that raylib and GLFW need to work on windows
* WinMM this is contains the high resolution timer code used by GLFW for precise timing in the game loop.