summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2017-12-11 11:40:46 +0100
committerGitHub <[email protected]>2017-12-11 11:40:46 +0100
commit3e1d6859db03ba379dda62281bd3867b3d43d980 (patch)
treed092d84e345a9463e8126962f23ecd30862248a7
parentde78fa69bc49afa83898e33e73b6dfbffc43f0e4 (diff)
parent4a7840b75297e2a2ea3ddf5ef6b2e0c9b9d5d057 (diff)
downloadraylib-3e1d6859db03ba379dda62281bd3867b3d43d980.tar.gz
raylib-3e1d6859db03ba379dda62281bd3867b3d43d980.zip
Merge pull request #417 from a3f/develop
Add library versioning to Make/CMake build systems
-rw-r--r--.gitignore3
-rw-r--r--meson.build15
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/Makefile39
-rw-r--r--src/meson.build22
5 files changed, 34 insertions, 54 deletions
diff --git a/.gitignore b/.gitignore
index 65b3020c..44f882d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -110,9 +110,6 @@ docs/examples/web/*/*.html
!docs/examples/web/shaders/loader.html
!docs/examples/web/models/loader.html
-# Meson build system
-builddir/
-
# CMake stuff
CMakeCache.txt
CMakeFiles
diff --git a/meson.build b/meson.build
deleted file mode 100644
index c85905cc..00000000
--- a/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-project('raylib', 'c', version: '1.8.0',
- license: 'zlib',
- meson_version: '>= 0.39.1',
- default_options : 'c_std=gnu99')
-
-cc = meson.get_compiler('c')
-
-glfw_dep = dependency('glfw3', version : '>=3.2')
-gl_dep = dependency('gl')
-openal_dep = dependency('openal')
-x11_dep = dependency('x11')
-m_dep = cc.find_library('m', required : false)
-
-subdir('src')
-
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 200ae6f9..e86bff9b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,7 +2,8 @@
project(raylib)
include("../utils.cmake")
-set(PROJECT_VERSION 1.9.1-dev)
+set(PROJECT_VERSION 1.9.2)
+set(API_VERSION 1)
set(RAYLIB raylib) # Name of the generated library
### Config options ###
@@ -123,7 +124,11 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
set(CMAKE_MACOSX_RPATH ON)
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE})
- set_target_properties(${RAYLIB}_shared PROPERTIES PUBLIC_HEADER "raylib.h")
+ set_target_properties(${RAYLIB}_shared PROPERTIES
+ VERSION ${PROJECT_VERSION}
+ SOVERSION ${API_VERSION}
+ PUBLIC_HEADER "raylib.h"
+ )
if(WIN32)
install(
TARGETS ${RAYLIB}_shared
diff --git a/src/Makefile b/src/Makefile
index e3bb91cc..b9c21929 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -42,6 +42,8 @@
.PHONY: all clean install uninstall
# Define required raylib variables
+VERSION = 1.9.2
+API_VERSION = 1
PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH = ..
@@ -172,6 +174,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler
CC = clang
+ GLFW_CFLAGS = -x objective-c
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# FreeBSD default compiler
@@ -291,7 +294,7 @@ endif
# Define linker options
ifeq ($(PLATFORM),PLATFORM_ANDROID)
- LDFLAGS = -Wl,-soname,libraylib.so -Wl,--exclude-libs,libatomic.a
+ LDFLAGS = -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a
LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings
# Force linking of library module to define symbol
LDFLAGS += -u ANativeActivity_onCreate
@@ -353,22 +356,30 @@ else
ifeq ($(PLATFORM_OS),LINUX)
# Compile raylib to shared library version for GNU/Linux.
# WARNING: you should type "make clean" before doing this target
- $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lm -lpthread -ldl -lrt
- @echo "raylib shared library generated (libraylib.so)!"
+ $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) -Wl,-soname,libraylib.$(API_VERSION).so -lGL -lm -lpthread -ldl -lrt
+ @echo "raylib shared library generated (libraylib.$(VERSION).so)!"
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so
endif
ifeq ($(PLATFORM_OS),OSX)
- $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -framework OpenGL -framework OpenAL -framework Cocoa
- install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib
- @echo "raylib shared library generated (libraylib.dylib)!"
+ $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).dylib $(OBJS) -compatibility_version $(API_VERSION) -current_version $(VERSION) -framework OpenGL -framework OpenAL -framework IOKit -framework CoreVideo -framework Cocoa
+ install_name_tool -id "libraylib.$(VERSION).dylib" $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).dylib
+ @echo "raylib shared library generated (libraylib.$(VERSION).dylib)!"
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).dylib libraylib.$(API_VERSION).dylib
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).dylib libraylib.dylib
endif
ifeq ($(PLATFORM_OS),FREEBSD)
# WARNING: you should type "gmake clean" before doing this target
- $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lpthread
- @echo "raylib shared library generated (libraylib.so)!"
+ $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) -Wl,-soname,libraylib.$(API_VERSION).so -lGL -lpthread
+ @echo "raylib shared library generated (libraylib.$(VERSION).so)!"
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
- $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS)
- @echo "raylib shared library generated (libraylib.so)!"
+ $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS)
+ @echo "raylib shared library generated (libraylib.$(VERSION).so)!"
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so
+ cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so
endif
else
# Compile raylib static library
@@ -386,7 +397,7 @@ core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h
# Compile rglfw module
rglfw.o : rglfw.c
- $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
+ $(CC) $(GLFW_CFLAGS) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# Compile rlgl module
rlgl.o : rlgl.c rlgl.h raymath.h
@@ -434,6 +445,8 @@ ifeq ($(ROOT),root)
# /usr/local/include/) are for libraries that are installed
# manually (without a package manager).
ifeq ($(RAYLIB_LIBTYPE),SHARED)
+ cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so /usr/local/lib/libraylib.$(VERSION).so
+ cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(API_VERSION).so /usr/local/lib/libraylib.$(API_VERSION).so
cp --update $(RAYLIB_RELEASE_PATH)/libraylib.so /usr/local/lib/libraylib.so
else
cp --update raylib.h /usr/local/include/raylib.h
@@ -455,6 +468,8 @@ ifeq ($(ROOT),root)
rm --force /usr/local/include/raylib.h
ifeq ($(RAYLIB_LIBTYPE),SHARED)
rm --force /usr/local/lib/libraylib.so
+ rm --force /usr/local/lib/libraylib.$(API_VERSION).so
+ rm --force /usr/local/lib/libraylib.$(VERSION).so
else
rm --force /usr/local/lib/libraylib.a
endif
@@ -471,7 +486,7 @@ clean:
ifeq ($(PLATFORM_OS),WINDOWS)
del *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o
else
- rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o
+ rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so $(RAYLIB_RELEASE_PATH)/libraylib.$(API_VERSION).so $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so external/stb_vorbis.o
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
rm -rf $(ANDROID_TOOLCHAIN)
diff --git a/src/meson.build b/src/meson.build
deleted file mode 100644
index 12385fc9..00000000
--- a/src/meson.build
+++ /dev/null
@@ -1,22 +0,0 @@
-install_headers('raylib.h')
-
-source_c = [
- 'audio.c',
- 'core.c',
- 'models.c',
- 'rlgl.c',
- 'shapes.c',
- 'text.c',
- 'textures.c',
- 'utils.c',
- 'external/stb_vorbis.c',
-]
-
-# use 'meson --default-library=static builddir' to build as static, if no builddir yet exists
-# use 'mesonconf -Ddefault_library=static builddir' to change the type
-raylib = library('raylib',
- source_c,
- dependencies : [ glfw_dep, gl_dep, openal_dep, m_dep, x11_dep],
- install : true,
- version : '1.8.0')
-