Hey, I need another help with SDL2 + CMake for Android. I almost got my cross-build demo working - Linux, Mac, iOS, and Windows are running, but Android is still somewhat draconian.
What works: A little test program based on the android-project within the SDL2 sources.
What I try: Build this same demo with CMake to simplify cross-platform development,
… but first I need to build SDL2 with CMake:
For that project I rely on the android-cmake (http://code.google.com/p/android-cmake/) toolchain, and its very outdated boost tutorial. Anyway, it works somehow and I only have to figure out the build process. Now, I try to apply it for my project, creating the CMakeLists.txt file based on the boost tutorial and modify it based on the Android.mk file inside the SDL package. This is my CMakeLists.txt (http://pastebin.com/P4iWfPHs) so far:
Code:
cmake_minimum_required(VERSION 2.8)
project(SDL2)
set(SDL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/SDL)
include_directories(${SDL_ROOT}/include)
file (GLOB SOURCES
${SDL_ROOT}/src/.c
# …
${SDL_ROOT}/src/render//.c
# …
${SDL_ROOT}/src/test/.c
)
add_library (SDL2 ${SOURCES})
target_link_libraries (SDL2 dl GLESv1_CM GLESv2 log android)
Looks to simple to work out of the box, and unfortunately it is true. The generation of the makefiles works, but the actual make process fails:
Code:
Scanning dependencies of target SDL2
[ 0%] Building C object CMakeFiles/SDL2.dir/SDL/src/SDL_hints.c.o
…
[ 35%] Building C object CMakeFiles/SDL2.dir/SDL/src/render/opengles/SDL_render_gles.c.o
In file included from /AndroidCMake/SDL/src/render/opengles/SDL_render_gles.c:203:0:
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h: In function ‘GLES_LoadFunctions’:
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:3:1: error: ‘glBlendFuncSeparateOES’ undeclared (first use in this function)
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:3:1: note: each undeclared identifier is reported only once for each function it appears in
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:11:1: error: ‘glDrawTexfOES’ undeclared (first use in this function)
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:15:1: error: ‘glGenFramebuffersOES’ undeclared (first use in this function)
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:33:1: error: ‘glBindFramebufferOES’ undeclared (first use in this function)
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:34:1: error: ‘glFramebufferTexture2DOES’ undeclared (first use in this function)
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:35:1: error: ‘glCheckFramebufferStatusOES’ undeclared (first use in this function)
/AndroidCMake/SDL/src/render/opengles/SDL_glesfuncs.h:40:1: error: ‘glDeleteFramebuffersOES’ undeclared (first use in this function)
make[2]: *** [CMakeFiles/SDL2.dir/SDL/src/render/opengles/SDL_render_gles.c.o] Error 1
make[1]: *** [CMakeFiles/SDL2.dir/all] Error 2
make: *** [all] Error 2
There’s a similar thread (http://forums.libsdl.org/viewtopic.php?t=9696) on in this forum, but I don’t get it. Btw. there’s a confusing thread in the thread.
Okay, that’s where I stuck. Any help is welcome to get it done, thanks.
Michael