11# fortran-raylib
22
33A work-in-progress collection of interface bindings to
4- [ raylib] ( https://www.raylib.com/ ) 4.5, for 2-D and 3-D game programming in
5- Fortran 2018.
4+ [ raylib] ( https://www.raylib.com/ ) 4.5/4.6/5.0/5.1 , for 2-D and 3-D game
5+ programming in Fortran 2018.
66
77## Build Instructions
88
99Install the raylib package suitable for your operating system, or build from
10- [ source] ( https://github.com/raysan5/raylib/releases/tag/4. 5.0 ) :
10+ [ source] ( https://github.com/raysan5/raylib/releases/tag/5.0 ) :
1111
1212```
13- $ cd raylib-4. 5.0/
13+ $ cd raylib-5.0/
1414$ mkdir build && cd build/
15- $ cmake -DUSE_EXTERNAL_GLFW=ON ..
16- $ make
15+ $ cmake ..
16+ $ make PLATFORM=PLATFORM_DESKTOP
17+ ```
18+ Select platform ` PLATFORM_DESKTOP_SDL ` for the SDL 2.0 backend instead:
19+
1720```
21+ $ make PLATFORM=PLATFORM_DESKTOP_SDL
22+ ```
23+
24+ ### Make
1825
1926Build the * fortran-raylib* library by executing the provided Makefile:
2027
@@ -24,10 +31,19 @@ $ cd fortran-raylib/
2431$ make
2532```
2633
27- You may have to overwrite the libraries to link (argument ` LDLIBS ` ), depending
28- on you operating system.
34+ Pass argument ` RAYLIB ` to override the raylib library to link. For example, if
35+ the static library ` libraylib.a ` is in the same directory:
2936
30- Or, instead with * fpm* :
37+ ```
38+ $ make RAYLIB=libraylib.a
39+ ```
40+
41+ You may have to set the libraries to link manually (argument ` LDLIBS ` ),
42+ depending on you operating system.
43+
44+ ### Fortran Package Manager
45+
46+ Building the library and all examples with * fpm* :
3147
3248```
3349$ fpm build --profile release --flag "-fno-range-check"
@@ -41,12 +57,14 @@ your project:
4157fortran-raylib = { git = " https://github.com/interkosmos/fortran-raylib.git" }
4258```
4359
60+ ### Linking
61+
4462Link your Fortran application against ` libfortran-raylib.a ` , ` -lraylib ` , and
4563additional platform-dependent libraries:
4664
4765| System | Linker Libraries |
4866| -----------------| ----------------------------------------------------------------------------------------------------------|
49- | FreeBSD | ` -lraylib -lglfw - lGL -lpthread -lm ` |
67+ | FreeBSD | ` -lraylib -lGL -lpthread -lm ` |
5068| Linux | ` -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 ` |
5169| Linux (Wayland) | ` -lraylib -lGL -lm -lpthread -ldl -lrt -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon ` |
5270| macOS | ` -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo ` |
@@ -85,7 +103,7 @@ Compile and link the example program:
85103
86104```
87105$ gfortran -L/usr/local/lib -I/usr/local/include -o example example.f90 \
88- libfortran-raylib.a -lraylib -lGL -lglfw - lpthread -lm
106+ libfortran-raylib.a -lraylib -lGL -lpthread -lm
89107$ ./example
90108```
91109
@@ -119,7 +137,7 @@ Build all examples with:
119137$ make examples
120138```
121139
122- To link against the static raylib library, run:
140+ To link against a static raylib library, run:
123141
124142```
125143$ make examples RAYLIB=libraylib.a
@@ -129,6 +147,8 @@ $ make examples RAYLIB=libraylib.a
129147
130148Some issues have to be regarded when calling raylib from Fortran:
131149
150+ * Model loading is broken in raylib 5.0
151+ ([ issue] ( https://github.com/raysan5/raylib/issues/3576 ) ).
132152* All procedure names and dummy arguments have been converted to snake case.
133153* As Fortran does not feature unsigned data types, use the compiler flag
134154 ` -fno-range-check ` to allow signed values to be written into unsigned
0 commit comments