custom raylib
This commit is contained in:
parent
c6308cc532
commit
382b0e4bb0
7 changed files with 7 additions and 300 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "raylib"]
|
||||||
|
path = raylib
|
||||||
|
url = ./raylib
|
2
build_raylib.ps1
Normal file
2
build_raylib.ps1
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Rebuild raylib
|
||||||
|
pushd .\raylib\src\ && mingw32-make clean RAYLIB_MODULE_RAYGUI=TRUE RAYLIB_MODULE_PHYSAC=true && mingw32-make RAYLIB_MODULE_RAYGUI=TRUE RAYLIB_MODULE_PHYSAC=true && copy .\libraylib.a ..\..\lib\ && popd
|
1
lib/.gitignore
vendored
Normal file
1
lib/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
libraylib.a
|
BIN
lib/libraylib.a
BIN
lib/libraylib.a
Binary file not shown.
1
raylib
Submodule
1
raylib
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit ff2627dd10f1a6d013001611ae7947bee96aefeb
|
|
@ -1,299 +0,0 @@
|
||||||
#******************************************************************************
|
|
||||||
#
|
|
||||||
# raylib makefile
|
|
||||||
#
|
|
||||||
# Platforms supported:
|
|
||||||
# PLATFORM_DESKTOP: Windows (Win32, Win64)
|
|
||||||
# PLATFORM_DESKTOP: Linux (i386, x64)
|
|
||||||
# PLATFORM_DESKTOP: OSX/macOS (arm64, x86_64)
|
|
||||||
# PLATFORM_DESKTOP: FreeBSD, OpenBSD, NetBSD, DragonFly
|
|
||||||
# PLATFORM_ANDROID: Android (arm, i686, arm64, x86_64)
|
|
||||||
# PLATFORM_RPI: Raspberry Pi (Raspbian)
|
|
||||||
# PLATFORM_DRM: Linux native mode, including Raspberry Pi 4 with V3D fkms driver
|
|
||||||
# PLATFORM_WEB: HTML5 (Chrome, Firefox)
|
|
||||||
#
|
|
||||||
# Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline.
|
|
||||||
# Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
|
|
||||||
#
|
|
||||||
# This software is provided "as-is", without any express or implied warranty.
|
|
||||||
# In no event will the authors be held liable for any damages arising from
|
|
||||||
# the use of this software.
|
|
||||||
#
|
|
||||||
# Permission is granted to anyone to use this software for any purpose,
|
|
||||||
# including commercial applications, and to alter it and redistribute it
|
|
||||||
# freely, subject to the following restrictions:
|
|
||||||
#
|
|
||||||
# 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
# claim that you wrote the original software. If you use this software in a
|
|
||||||
# product, an acknowledgment in the product documentation would be
|
|
||||||
# appreciated but is not required.
|
|
||||||
#
|
|
||||||
# 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
# be misrepresented as being the original software.
|
|
||||||
#
|
|
||||||
# 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
#
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
# Please read the wiki to know how to compile raylib, because there are different methods.
|
|
||||||
# https://github.com/raysan5/raylib/wiki
|
|
||||||
|
|
||||||
.PHONY: all clean
|
|
||||||
|
|
||||||
# Define required raylib variables
|
|
||||||
RAYLIB_VERSION = 4.0.0
|
|
||||||
RAYLIB_API_VERSION = 400
|
|
||||||
|
|
||||||
# Define raylib source code path
|
|
||||||
RAYLIB_SRC_PATH ?= ../src
|
|
||||||
|
|
||||||
# Define output directory for compiled library, defaults to src directory
|
|
||||||
# NOTE: If externally provided, make sure directory exists
|
|
||||||
RAYLIB_RELEASE_PATH ?= $(RAYLIB_SRC_PATH)
|
|
||||||
|
|
||||||
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
|
|
||||||
RAYLIB_LIBTYPE ?= STATIC
|
|
||||||
|
|
||||||
# Build mode for library: DEBUG or RELEASE
|
|
||||||
RAYLIB_BUILD_MODE ?= RELEASE
|
|
||||||
|
|
||||||
# Build output name for the library
|
|
||||||
RAYLIB_LIB_NAME ?= raylib
|
|
||||||
|
|
||||||
# Define resource file for DLL properties
|
|
||||||
RAYLIB_RES_FILE ?= ./raylib.dll.rc.data
|
|
||||||
|
|
||||||
# Define raylib platform
|
|
||||||
# Options: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
|
||||||
|
|
||||||
# Include raylib modules on compilation
|
|
||||||
# NOTE: Some programs like tools could not require those modules
|
|
||||||
RAYLIB_MODULE_AUDIO ?= TRUE
|
|
||||||
RAYLIB_MODULE_MODELS ?= TRUE
|
|
||||||
RAYLIB_MODULE_RAYGUI ?= FALSE
|
|
||||||
RAYLIB_MODULE_PHYSAC ?= FALSE
|
|
||||||
|
|
||||||
RAYLIB_MODULE_RAYGUI_PATH ?= $(RAYLIB_SRC_PATH)/extras
|
|
||||||
RAYLIB_MODULE_PHYSAC_PATH ?= $(RAYLIB_SRC_PATH)/extras
|
|
||||||
|
|
||||||
# Use external GLFW library instead of rglfw module
|
|
||||||
USE_EXTERNAL_GLFW ?= FALSE
|
|
||||||
|
|
||||||
# Use Wayland display server protocol on Linux desktop
|
|
||||||
# by default it uses X11 windowing system
|
|
||||||
USE_WAYLAND_DISPLAY ?= FALSE
|
|
||||||
|
|
||||||
# Use cross-compiler for PLATFORM_RPI
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
USE_RPI_CROSS_COMPILER ?= FALSE
|
|
||||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
||||||
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
|
|
||||||
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Determine if the file has root access (only for installing raylib)
|
|
||||||
# "whoami" prints the name of the user that calls him (so, if it is the root
|
|
||||||
# user, "whoami" prints "root").
|
|
||||||
ROOT = $(shell whoami)
|
|
||||||
|
|
||||||
# By default we suppose we are working on Windows
|
|
||||||
HOST_PLATFORM_OS ?= WINDOWS
|
|
||||||
|
|
||||||
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
||||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
|
||||||
# ifeq ($(UNAME),Msys) -> Windows
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
PLATFORM_OS = WINDOWS
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define raylib graphics api depending on selected platform
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
||||||
# By default use OpenGL 3.3 on desktop platforms
|
|
||||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define default C compiler and archiver to pack library
|
|
||||||
CC = tcc
|
|
||||||
AR = ar
|
|
||||||
|
|
||||||
# Define compiler flags:
|
|
||||||
# -O1 defines optimization level
|
|
||||||
# -g include debug information on compilation
|
|
||||||
# -s strip unnecessary data from build
|
|
||||||
# -Wall turns on most, but not all, compiler warnings
|
|
||||||
# -std=c99 defines C language mode (standard C from 1999 revision)
|
|
||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
|
||||||
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
|
|
||||||
# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing)
|
|
||||||
CFLAGS += -Wall -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
|
|
||||||
|
|
||||||
CFLAGS += -std=c99
|
|
||||||
|
|
||||||
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
|
||||||
CFLAGS += -g
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(RAYLIB_BUILD_MODE),RELEASE)
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
||||||
CFLAGS += -s -O1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
|
||||||
# -Wextra enables some extra warning flags that are not enabled by -Wall
|
|
||||||
# -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration
|
|
||||||
# -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types
|
|
||||||
# -Werror=implicit-function-declaration catch function calls without prior declaration
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
||||||
CFLAGS += -Werror=implicit-function-declaration
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define include paths for required headers
|
|
||||||
# NOTE: Several external required libraries (stb and others)
|
|
||||||
INCLUDE_PATHS = -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
|
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
||||||
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
|
|
||||||
# Check the version name. If GLFW3 was built manually, it may have produced
|
|
||||||
# a static library known as libglfw3.a. In that case, the name should be -lglfw3
|
|
||||||
LDFLAGS += -lglfw
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define all object files required with a wildcard
|
|
||||||
# The wildcard takes all files that finish with ".c",
|
|
||||||
# and replaces extentions with ".o", that are the object files
|
|
||||||
# NOTE: Some objects depend on the PLATFORM to be added or not!
|
|
||||||
# OBJS = $(patsubst %.c, %.o, $(wildcard *.c))
|
|
||||||
|
|
||||||
# Define object required on compilation
|
|
||||||
OBJS = rcore.o \
|
|
||||||
rshapes.o \
|
|
||||||
rtextures.o \
|
|
||||||
rtext.o \
|
|
||||||
utils.o
|
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
||||||
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
|
||||||
OBJS += rglfw.o
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(RAYLIB_MODULE_MODELS),TRUE)
|
|
||||||
OBJS += rmodels.o
|
|
||||||
endif
|
|
||||||
ifeq ($(RAYLIB_MODULE_AUDIO),TRUE)
|
|
||||||
OBJS += raudio.o
|
|
||||||
endif
|
|
||||||
ifeq ($(RAYLIB_MODULE_RAYGUI),TRUE)
|
|
||||||
OBJS += raygui.o
|
|
||||||
endif
|
|
||||||
ifeq ($(RAYLIB_MODULE_PHYSAC),TRUE)
|
|
||||||
OBJS += physac.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Default target entry
|
|
||||||
all: raylib
|
|
||||||
|
|
||||||
# Compile raylib library
|
|
||||||
# NOTE: Release directory is created if not exist
|
|
||||||
raylib: $(OBJS)
|
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
|
||||||
# Compile raylib static library version $(RAYLIB_VERSION)
|
|
||||||
# WARNING: You should type "make clean" before doing this target.
|
|
||||||
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS)
|
|
||||||
@echo "raylib static library generated (lib$(RAYLIB_LIB_NAME).a) in $(RAYLIB_RELEASE_PATH)!"
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Compile all modules with their prerequisites
|
|
||||||
|
|
||||||
# Compile core module
|
|
||||||
rcore.o : rcore.c raylib.h rlgl.h utils.h raymath.h rcamera.h rgestures.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
|
|
||||||
|
|
||||||
# Compile rglfw module
|
|
||||||
rglfw.o : rglfw.c
|
|
||||||
$(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
|
|
||||||
|
|
||||||
# Compile shapes module
|
|
||||||
rshapes.o : rshapes.c raylib.h rlgl.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
|
|
||||||
|
|
||||||
# Compile textures module
|
|
||||||
rtextures.o : rtextures.c raylib.h rlgl.h utils.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
|
|
||||||
|
|
||||||
# Compile text module
|
|
||||||
rtext.o : rtext.c raylib.h utils.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
|
|
||||||
|
|
||||||
# Compile utils module
|
|
||||||
utils.o : utils.c utils.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
|
|
||||||
|
|
||||||
# Compile models module
|
|
||||||
rmodels.o : rmodels.c raylib.h rlgl.h raymath.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
|
|
||||||
|
|
||||||
# Compile audio module
|
|
||||||
raudio.o : raudio.c raylib.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
|
|
||||||
|
|
||||||
# Compile raygui module
|
|
||||||
# NOTE: raygui header should be distributed with raylib.h
|
|
||||||
raygui.o : raygui.c
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -DRAYGUI_IMPLEMENTATION
|
|
||||||
raygui.c:
|
|
||||||
echo #define RAYGUI_IMPLEMENTATION > raygui.c
|
|
||||||
echo #include "$(RAYLIB_MODULE_RAYGUI_PATH)/raygui.h" >> raygui.c
|
|
||||||
|
|
||||||
# Compile physac module
|
|
||||||
# NOTE: physac header should be distributed with raylib.h
|
|
||||||
physac.o : physac.c
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -DPHYSAC_IMPLEMENTATION
|
|
||||||
physac.c:
|
|
||||||
@echo #define PHYSAC_IMPLEMENTATION > physac.c
|
|
||||||
@echo #include "$(RAYLIB_MODULE_PHYSAC_PATH)/physac.h" >> physac.c
|
|
||||||
|
|
||||||
# Compile android_native_app_glue module
|
|
||||||
android_native_app_glue.o : $(NATIVE_APP_GLUE)/android_native_app_glue.c
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
|
||||||
|
|
||||||
|
|
||||||
# Install generated and needed files to desired directories.
|
|
||||||
# On GNU/Linux and BSDs, there are some standard directories that contain extra
|
|
||||||
# libraries and header files. These directories (often /usr/local/lib and
|
|
||||||
# /usr/local/include) are for libraries that are installed manually
|
|
||||||
# (without a package manager). We'll use /usr/local/lib/raysan5 and /usr/local/include/raysan5
|
|
||||||
# for our -L and -I specification to simplify management of the raylib source package.
|
|
||||||
# Customize these locations if you like but don't forget to pass them to make
|
|
||||||
# for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig.
|
|
||||||
# HINT: Add -L$(RAYLIB_INSTALL_PATH) -I$(RAYLIB_H_INSTALL_PATH) to your own makefiles.
|
|
||||||
# See below and ../examples/Makefile for more information.
|
|
||||||
# TODO: Add other platforms. Remove sudo requirement, i.e. add USER mode.
|
|
||||||
|
|
||||||
# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths.
|
|
||||||
DESTDIR ?= /usr/local
|
|
||||||
RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib
|
|
||||||
# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files.
|
|
||||||
RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include
|
|
||||||
|
|
||||||
# Clean everything
|
|
||||||
clean:
|
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
del *.o /s
|
|
||||||
cd $(RAYLIB_RELEASE_PATH)
|
|
||||||
del lib$(RAYLIB_LIB_NAME).a /s
|
|
||||||
del lib$(RAYLIB_LIB_NAME)dll.a /s
|
|
||||||
del $(RAYLIB_LIB_NAME).dll /s
|
|
||||||
@echo "removed all generated files!"
|
|
||||||
endif
|
|
|
@ -1 +0,0 @@
|
||||||
mingw32-make clean RAYLIB_MODULE_RAYGUI=TRUE RAYLIB_MODULE_PHYSAC=true && mingw32-make RAYLIB_MODULE_RAYGUI=TRUE RAYLIB_MODULE_PHYSAC=true
|
|
Reference in a new issue