Skip to content

Commit e96ce64

Browse files
committed
Patch raylib and our project to not build x11/wayland and use gles for android
1 parent 3056542 commit e96ce64

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

app/src/main/cpp/CMakeLists.txt

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
cmake_minimum_required(VERSION 3.10)
22
project(raymob LANGUAGES C CXX)
33

4-
# Define APP_LIB_NAME from gradle
54
if(NOT DEFINED APP_LIB_NAME)
6-
set(APP_LIB_NAME raymob)
5+
set(APP_LIB_NAME raymob)
76
endif()
87

9-
# Define GL_VERSION from gradle
108
if(NOT DEFINED GL_VERSION)
11-
set(GL_VERSION ES30)
9+
set(GL_VERSION ES30)
1210
endif()
1311

14-
# Configure raylib for Android
15-
set(PLATFORM
16-
"Android"
17-
CACHE STRING "Platform" FORCE)
18-
set(GLFW_BUILD_X11
19-
OFF
20-
CACHE BOOL "Build X11" FORCE)
21-
set(GLFW_BUILD_WAYLAND
22-
OFF
23-
CACHE BOOL "Build Wayland" FORCE)
24-
set(OPENGL_ES
25-
ON
26-
CACHE BOOL "Use OpenGL ES" FORCE)
27-
set(GRAPHICS
28-
GRAPHICS_API_OPENGL_ES3
29-
CACHE STRING "Graphics API" FORCE)
12+
# Force Android platform settings for raylib
13+
set(CMAKE_SYSTEM_NAME Android CACHE STRING "System name" FORCE)
14+
set(PLATFORM Android CACHE STRING "Platform" FORCE)
15+
set(OPENGL_ES ON CACHE BOOL "Use OpenGL ES" FORCE)
16+
set(GRAPHICS GRAPHICS_API_OPENGL_ES3 CACHE STRING "Graphics API" FORCE)
17+
set(USE_GLFW OFF CACHE BOOL "Disable GLFW" FORCE)
18+
set(GLFW_BUILD_X11 OFF CACHE BOOL "Disable X11" FORCE)
19+
set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "Disable Wayland" FORCE)
20+
set(SUPPORT_X11 OFF CACHE BOOL "Disable X11 support" FORCE)
21+
set(SUPPORT_WAYLAND OFF CACHE BOOL "Disable Wayland support" FORCE)
3022

3123
# Add dependencies
3224
add_subdirectory(../../../../libs/raylib raylib)
@@ -42,14 +34,15 @@ target_include_directories(
4234
../../../../libs/raylib-lua/src ../../../../libs/raygui/src)
4335

4436
# Link libraries
45-
target_link_libraries(
46-
${APP_LIB_NAME}
47-
raylib
48-
raymob
49-
lua
50-
android
51-
log
52-
EGL)
37+
target_link_libraries(${APP_LIB_NAME}
38+
raylib
39+
raymob
40+
lua
41+
android
42+
log
43+
EGL
44+
GLESv3
45+
)
5346

5447
# Define GL version
55-
target_compile_definitions(${APP_LIB_NAME} PUBLIC GL_VERSION=${GL_VERSION})
48+
target_compile_definitions(${APP_LIB_NAME} PUBLIC GL_VERSION=${GL_VERSION})

0 commit comments

Comments
 (0)