Skip to content

Commit 6c04f57

Browse files
committed
Fix includes and use pkg-config to find libraries in C examples
1 parent 271d700 commit 6c04f57

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

examples/c_canvas_glfw_minimal/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ RUST_TARGET_DIR?=../../target
55
RUST_SRC_DIR?=../../c
66
RUSTFLAGS?=
77

8-
CFLAGS?=-Wall -g -I../../c/build/include
9-
LIBS?=-lpathfinder_c -lglfw
8+
CFLAGS?=-Wall -g $(shell pkg-config --cflags pathfinder_c glfw3)
9+
LIBS?=$(shell pkg-config --libs pathfinder_c glfw3)
1010
MKDIR?=mkdir -p
1111
RM?=rm
1212
CARGO?=cargo

examples/c_canvas_glfw_minimal/c_canvas_glfw_minimal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#include <GLFW/glfw3.h>
12-
#include <pathfinder/pathfinder.h>
12+
#include <pathfinder_c.h>
1313
#include <stdarg.h>
1414
#include <stdbool.h>
1515
#include <stdio.h>

examples/c_canvas_minimal/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ RUST_TARGET_DIR?=../../target
55
RUST_SRC_DIR?=../../c
66
RUSTFLAGS?=-C target-cpu=native
77

8-
CFLAGS?=-Wall -g -I../../c/build/include
9-
LIBS?=-lpathfinder_c
8+
CFLAGS?=-Wall -g $(shell pkg-config --cflags pathfinder_c sdl2)
9+
LIBS?=$(shell pkg-config --libs pathfinder_c sdl2)
1010
MKDIR?=mkdir -p
1111
RM?=rm
1212
CARGO?=cargo
@@ -35,10 +35,10 @@ all: $(TARGET_DIR)/c_canvas_minimal
3535
.PHONY: clean rustlib
3636

3737
$(TARGET_DIR)/c_canvas_minimal: $(OBJ_DIR)/c_canvas_minimal.o rustlib
38-
$(MKDIR) $(TARGET_DIR) && $(CC) $(LDFLAGS) $(LIBS) `sdl2-config --libs` -o $@ $<
38+
$(MKDIR) $(TARGET_DIR) && $(CC) $(LDFLAGS) $(LIBS) -o $@ $<
3939

4040
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
41-
$(MKDIR) $(OBJ_DIR) && $(CC) -c $(CFLAGS) `sdl2-config --cflags` -o $@ $<
41+
$(MKDIR) $(OBJ_DIR) && $(CC) -c $(CFLAGS) -o $@ $<
4242

4343
rustlib:
4444
cd $(RUST_SRC_DIR) && RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build $(CARGOFLAGS)

examples/c_canvas_minimal/c_canvas_minimal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <SDL2/SDL.h>
1212
#include <SDL2/SDL_opengl.h>
13-
#include <pathfinder/pathfinder.h>
13+
#include <pathfinder_c.h>
1414
#include <stdarg.h>
1515
#include <stdbool.h>
1616
#include <stdio.h>

0 commit comments

Comments
 (0)