Reviewing compilation and linking of libs

This commit is contained in:
Joseph Ferano 2023-10-15 15:14:13 +07:00
parent 181303a362
commit e214539fe0
6 changed files with 25 additions and 8 deletions

View File

@ -1,8 +1,8 @@
P=main P=main
OBJECTS=libs/glad/glad.o OBJECTS=objs/glad.o objs/stb_image_precompiled.o
CFLAGS=-g -Wall -Wextra -O0 CFLAGS=-g -Wall -Wextra -O0
LDLIBS=-lglfw -lOpenGL -lm LDLIBS=-lglfw -lOpenGL -lm -L objs/libcglm.so
INCLUDES=-Ilibs/glad/include/ -Ilibs/ INCLUDES=-Ilibs/glad/include/ -Ilibs/ -Iobjs/
CC=gcc CC=gcc
RM=rm -vf RM=rm -vf
@ -10,9 +10,9 @@ RM=rm -vf
build: clean build: clean
$(CC) $(CFLAGS) $(LDLIBS) $(INCLUDES) $(OBJECTS) $(P).c -o $(P) $(CC) $(CFLAGS) $(LDLIBS) $(INCLUDES) $(OBJECTS) $(P).c -o $(P)
.PHONY: all .PHONY: texturepacker
headers: clean texturepacker:
$(CC) $(CFLAGS) $(LDLIBS) $(INCLUDES) $(OBJECTS) all.h -o all.h.gch $(CC) $(CFLAGS) $(LDLIBS) $(INCLUDES) $(OBJECTS) tools/texturepacker.c -o texturepacker
.PHONY: run .PHONY: run
run: build run: build

14
lib.h
View File

@ -1,6 +1,20 @@
#pragma once #pragma once
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <string.h> #include <string.h>
#include <stdint.h>
typedef uint8_t u8;
// typedef char16_t c16;
typedef int32_t b32;
typedef int32_t i32;
typedef uint32_t u32;
typedef uint64_t u64;
typedef float f32;
typedef double f64;
typedef uintptr_t uptr;
typedef char byte;
typedef ptrdiff_t size;
typedef size_t usize;
void checkCode(int code, char* errorMsg) { void checkCode(int code, char* errorMsg) {
if (code < 0) { if (code < 0) {

View File

@ -0,0 +1,5 @@
#define STB_IMAGE_IMPLEMENTATION
#define STBI_FAILURE_USERMSG
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"

2
main.c
View File

@ -5,8 +5,6 @@
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include "cglm/cglm.h" #include "cglm/cglm.h"
#include "lib.h" #include "lib.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
#define PI 3.14159f #define PI 3.14159f

Binary file not shown.