Add CMake building support
This commit is contained in:
parent
a77f0c6c77
commit
07c5e54f59
4 changed files with 21 additions and 12 deletions
|
@ -27,6 +27,9 @@ option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON)
|
||||||
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
||||||
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
||||||
|
|
||||||
|
# DRM build options
|
||||||
|
option(ENABLE_WAYLAND_DRM_LEASING "Enables DRM leasing in the DRM backend via the Wayland desktop" OFF)
|
||||||
|
|
||||||
include(ParseConfigHeader)
|
include(ParseConfigHeader)
|
||||||
|
|
||||||
foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS)
|
foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS)
|
||||||
|
|
|
@ -88,10 +88,21 @@ elseif ("${PLATFORM}" MATCHES "DRM")
|
||||||
find_library(GBM gbm)
|
find_library(GBM gbm)
|
||||||
|
|
||||||
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
|
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
|
||||||
include_directories(/usr/include/libdrm)
|
find_package(PkgConfig QUIET)
|
||||||
|
pkg_check_modules(DRM REQUIRED libdrm)
|
||||||
|
include_directories(${DRM_INCLUDE_DIRS})
|
||||||
endif ()
|
endif ()
|
||||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
|
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
|
||||||
|
|
||||||
|
if (ENABLE_WAYLAND_DRM_LEASING)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
add_definitions(-DENABLE_WAYLAND_DRM_LEASING)
|
||||||
|
find_library(WAYLAND_CLIENT wayland-client)
|
||||||
|
pkg_check_modules(WAYLAND_CLIENT_LIB REQUIRED wayland-client)
|
||||||
|
include_directories(${WAYLAND_CLIENT_LIB})
|
||||||
|
list(APPEND LIBS_PRIVATE ${WAYLAND_CLIENT})
|
||||||
|
endif ()
|
||||||
|
|
||||||
elseif ("${PLATFORM}" MATCHES "SDL")
|
elseif ("${PLATFORM}" MATCHES "SDL")
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
||||||
|
|
11
src/Makefile
11
src/Makefile
|
@ -634,13 +634,8 @@ OBJS = rcore.o \
|
||||||
rshapes.o \
|
rshapes.o \
|
||||||
rtextures.o \
|
rtextures.o \
|
||||||
rtext.o \
|
rtext.o \
|
||||||
utils.o
|
utils.o
|
||||||
|
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|
||||||
ifeq ($(ENABLE_WAYLAND_DRM_LEASING),yes)
|
|
||||||
OBJS += drm-lease-v1.o
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
||||||
OBJS += rglfw.o
|
OBJS += rglfw.o
|
||||||
|
@ -738,10 +733,6 @@ rcore.o : platforms/*.c
|
||||||
rcore.o : rcore.c raylib.h rlgl.h utils.h raymath.h rcamera.h rgestures.h
|
rcore.o : rcore.c raylib.h rlgl.h utils.h raymath.h rcamera.h rgestures.h
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
# Compile Wayland DRM leasing module
|
|
||||||
drm-lease-v1.o : platforms/drm-lease-v1.c
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
|
||||||
|
|
||||||
# Compile rglfw module
|
# Compile rglfw module
|
||||||
rglfw.o : rglfw.c
|
rglfw.o : rglfw.c
|
||||||
$(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
$(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
|
@ -82,7 +82,11 @@
|
||||||
|
|
||||||
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||||
#include "wayland-client.h" // Wayland client. Used to do DRM leasing.
|
#include "wayland-client.h" // Wayland client. Used to do DRM leasing.
|
||||||
#include "drm-lease-v1.h"
|
// DRM leasing protocol that's used
|
||||||
|
#if defined(ENABLE_WAYLAND_DRM_LEASING)
|
||||||
|
#include "drm-lease-v1.c"
|
||||||
|
#include "drm-lease-v1.h"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EGL_OPENGL_ES3_BIT
|
#ifndef EGL_OPENGL_ES3_BIT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue