Skip to content

Commit 8b6f6f8

Browse files
link math.h when its needed
1 parent d02d9f9 commit 8b6f6f8

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

Makefile

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ CUSTOM_CFLAGS =
1212
# used for the examples
1313
CFLAGS =
1414

15-
DX11_LIBS = -static -lgdi32 -lm -lwinmm -ldxgi -ld3d11 -luuid -ld3dcompiler
16-
VULKAN_LIBS = -lgdi32 -lm -lwinmm -I $(VULKAN_SDK)\Include -L $(VULKAN_SDK)\Lib -lvulkan-1
17-
LIBS := -static -luser32 -lgdi32 -lm -lopengl32 -lwinmm -ggdb
15+
DX11_LIBS = -static -lgdi32 -lwinmm -ldxgi -ld3d11 -luuid -ld3dcompiler
16+
VULKAN_LIBS = -lgdi32 -lwinmm -I $(VULKAN_SDK)\Include -L $(VULKAN_SDK)\Lib -lvulkan-1
17+
LIBS := -static -luser32 -lgdi32 -lopengl32 -lwinmm -ggdb
1818
EXT = .exe
1919
LIB_EXT = .dll
2020

@@ -34,16 +34,16 @@ ifeq (,$(filter $(CC),x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc x86_64-w64-min
3434
detected_OS := $(shell uname 2>/dev/null || echo Unknown)
3535

3636
ifeq ($(detected_OS),Darwin) # Mac OS X
37-
LIBS := -lm -framework Foundation -framework AppKit -framework OpenGL -framework IOKit
38-
VULKAN_LIBS = -lm -framework Foundation -framework AppKit -lvulkan
37+
LIBS := -framework Foundation -framework AppKit -framework OpenGL -framework IOKit
38+
VULKAN_LIBS = -framework Foundation -framework AppKit -lvulkan
3939
EXT =
4040
LIB_EXT = .dylib
4141
OS_DIR = /
4242
NO_VULKAN = 1
4343
endif
4444
ifeq ($(detected_OS),Linux)
45-
LIBS := -lXrandr -lX11 -lm -lGL -ldl -lpthread
46-
VULKAN_LIBS = -lX11 -lXrandr -lm -ldl -lpthread -lvulkan
45+
LIBS := -lXrandr -lX11 -lGL -ldl -lpthread
46+
VULKAN_LIBS = -lX11 -lXrandr -ldl -lpthread -lvulkan
4747
EXT =
4848
LIB_EXT = .so
4949
OS_DIR = /
@@ -59,7 +59,7 @@ else
5959
endif
6060

6161
ifeq ($(RGFW_WAYLAND),1)
62-
LIBS = -D RGFW_WAYLAND relative-pointer-unstable-v1-client-protocol.c xdg-decoration-unstable-v1.c xdg-shell.c -lwayland-cursor -lwayland-client -lEGL -lxkbcommon -lGL -lwayland-egl -lm
62+
LIBS = -D RGFW_WAYLAND relative-pointer-unstable-v1-client-protocol.c xdg-decoration-unstable-v1.c xdg-shell.c -lwayland-cursor -lwayland-client -lEGL -lxkbcommon -lGL -lwayland-egl
6363
endif
6464

6565
LINK_GL1 =
@@ -89,14 +89,15 @@ endif
8989

9090
EXAMPLE_OUTPUTS = \
9191
examples/basic/basic \
92-
examples/gamepad/gamepad \
9392
examples/buffer/buffer \
9493
examples/silk/silk \
9594
examples/events/events \
96-
examples/callbacks/callbacks \
97-
examples/first-person-camera/camera
95+
examples/callbacks/callbacks
96+
9897

9998
EXAMPLE_OUTPUTS_CUSTOM = \
99+
examples/gamepad/gamepad \
100+
examples/first-person-camera/camera \
100101
examples/microui_demo/microui_demo \
101102
examples/gl33/gl33 \
102103
examples/portableGL/pgl \
@@ -155,7 +156,7 @@ endif
155156
examples/metal/metal: examples/metal/metal.m RGFW.h
156157
ifeq ($(detected_OS),Darwin) # Mac OS X
157158
gcc $(CUSTOM_CFLAGS) -x c -c RGFW.h -D RGFW_NO_API -D RGFW_EXPORT -D RGFW_IMPLEMENTATION -o RGFW.o
158-
gcc $(CUSTOM_CFLAGS) examples/metal/metal.m RGFW.o -I. -lm -framework Metal -framework Foundation -framework AppKit -framework Cocoa -framework IOKit -framework QuartzCore -o $@
159+
gcc $(CUSTOM_CFLAGS) examples/metal/metal.m RGFW.o -I. -framework Metal -framework Foundation -framework AppKit -framework Cocoa -framework IOKit -framework QuartzCore -o $@
159160
else
160161
@echo metal is not supported on $(detected_OS)
161162
endif
@@ -202,6 +203,13 @@ else
202203
$(CC) $(CFLAGS) -I. $< examples/microui_demo/microui.c -s USE_WEBGL2 $(LIBS) $(LINK_GL1) -o $@$(EXT)
203204
endif
204205

206+
examples/gamepad/gamepad: examples/gamepad/gamepad.c RGFW.h
207+
$(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LIBS) -lm $(LINK_GL1) -o $@$(EXT)
208+
209+
examples/first-person-camera/camera: examples/first-person-camera/camera.c RGFW.h
210+
$(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LIBS) -lm $(LINK_GL1) -o $@$(EXT)
211+
212+
205213
examples/gl33/gl33: examples/gl33/gl33.c RGFW.h
206214
$(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LIBS) $(LINK_GL3) -o $@$(EXT)
207215

@@ -213,14 +221,16 @@ debug: all
213221
echo "Running $$exe..."; \
214222
.$(OS_DIR)$$exe$(EXT); \
215223
done
216-
224+
225+
./examples/gamepad/gamepad
226+
./examples/first-person-camera/camera
217227
./examples/portableGL/pgl$(EXT)
218228
./examples/gl33/gl33$(EXT)
219229
ifneq ($(NO_GLES), 1)
220230
./examples/gles2/gles2$(EXT)
221231
endif
222232
ifneq ($(NO_OSMESA), 1)
223-
./examples/gles2/gles2$(EXT)
233+
./examples/osmesa/osmesa$(EXT)
224234
endif
225235
ifneq ($(NO_VULKAN), 1)
226236
./examples/vk10/vk10$(EXT)

examples/first-person-camera/camera.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define RGFW_IMPLEMENTATION
22
#include "RGFW.h"
33

4+
#include <math.h>
45
#define DEG2RAD 3.14/180.0
56

67
float pitch = 0.0, yaw= 0.0;

examples/gamepad/gamepad.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "RGFW.h"
66
#include <stdio.h>
7+
#include <math.h>
78

89
void drawGamepad(RGFW_window* w, size_t gamepad);
910

0 commit comments

Comments
 (0)