Skip to content

Commit 07ea76b

Browse files
committed
Disable building of X11/wayland libs use gles
1 parent 39df1b8 commit 07ea76b

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

app/src/main/cpp/CMakeLists.txt

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,47 @@
11
cmake_minimum_required(VERSION 3.10)
2+
project(raymob LANGUAGES C CXX)
23

3-
project("yourgame")
4+
# Define APP_LIB_NAME from gradle
5+
if(NOT DEFINED APP_LIB_NAME)
6+
set(APP_LIB_NAME raymob)
7+
endif()
48

5-
set(CMAKE_CXX_STANDARD 17)
9+
# Define GL_VERSION from gradle
10+
if(NOT DEFINED GL_VERSION)
11+
set(GL_VERSION ES30)
12+
endif()
613

7-
# Path to libraries
8-
set(RAYLIB_LUA_DIR ${CMAKE_SOURCE_DIR}/../../../../libs/raylib-lua)
9-
set(RAYGUI_DIR ${CMAKE_SOURCE_DIR}/../../../../libs/raygui)
10-
set(RAYMOB_DIR ${CMAKE_SOURCE_DIR}/../../../../libs/raymob)
14+
# Set Android-specific flags for raylib
15+
set(PLATFORM "Android" CACHE STRING "Platform" FORCE)
16+
set(GLFW_BUILD_X11 OFF CACHE BOOL "Build X11" FORCE)
17+
set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "Build Wayland" FORCE)
18+
set(USE_GLES ON CACHE BOOL "Use OpenGL ES" FORCE)
1119

12-
# Add raylib sources (edit depending if raylib is prebuilt or source)
13-
add_subdirectory(${RAYLIB_LUA_DIR}/raylib raylib-build)
20+
# Add dependencies
21+
add_subdirectory(deps/raylib)
22+
add_subdirectory(deps/raymob)
23+
add_subdirectory(deps/lua)
1424

15-
# Add executable
16-
add_library(yourgame SHARED
17-
dummy_main.c
25+
# Add source
26+
add_library(${APP_LIB_NAME} SHARED main.c)
27+
28+
# Include directories
29+
target_include_directories(${APP_LIB_NAME} PRIVATE
30+
deps/raylib
31+
deps/raymob
32+
deps/lua
33+
libs/raylib-lua/src # Include raylib-lua headers
1834
)
1935

20-
# Link with raylib
21-
target_link_libraries(yourgame
36+
# Link libraries
37+
target_link_libraries(${APP_LIB_NAME}
2238
raylib
39+
raymob
40+
lua
2341
android
2442
log
25-
EGL
26-
GLESv2
27-
OpenSLES
28-
m
29-
z
30-
)
43+
EGL # Required for OpenGL ES
44+
)
45+
46+
# Define GL version
47+
target_compile_definitions(${APP_LIB_NAME} PUBLIC GL_VERSION=${GL_VERSION})

0 commit comments

Comments
 (0)