SDL Cmake Android version

I need to use SDL in android platform. I usually compile my projects using
CMake, and android toolchain when I need to develop in Android.

I have try to compile the always painful Android.mk, following the
README-android.txt for complext project, but with android-ndk-9b, it doesn’t
compile.

Reading README-cmake.txt, I can read that it cannot be used in Android/iOS
platform. Anyway, I have try to compile it, but it doent work, of course,
the code sources that try to use is not the same that use in Android.mk

My question is, In the future, the CMake is going to support Android & iOS
Platforms? I consider that is the best option for people who work with
crossplatform project.

I have some experience working with crossplatform projects, using toolchains
when is needed, and I took a look into OpenCV cmakes that can teach a lot of
crosscompiling. If is needed I can help with that, because its a very
userful tool.

Anyway, someone know where could I find some precompiled SDL and SDL_image
libraries for Android and iOS? I can use the sample project to add the JNI
calls into my projects, but I cannot compile myself the SDL library.

Thanks for your time.–
View this message in context: http://sdl.5483.n7.nabble.com/SDL-Cmake-Android-version-tp38630.html
Sent from the SDL mailing list archive at Nabble.com.

This information isn’t directly for SDL, but will help you along with
Android-CMake. First off, I forked the OpenCV Android-CMake chain and
made a bunch of fixes/enhancements. I hope other people will
collaborate with me to continue to improve the tool chain. There are a
lot of things I would like to see improved, like not requiring the
standalone toolchain and being able to build multiple architectures
simultaneously.

I am successfully using Android-CMake with the NDK r9b. I have built
multiple projects with it: ALmixer, Chipmunk2D, Box2D, and
JavaScriptCore from WebKit. (JSCore is really hard to build because
the code base is so complex and despite some claims, I’m skeptical
anybody has actually gotten it to work on Android because some code
had to be ported just for Android. It’s taken me several weeks and I’m
just starting getting the unit tests running.)

I have a sample repository for an Android Hello World program that
uses ALmixer. ALmixer uses CMake to build. I use my own fork of
Android-CMake which contains fixes to use
the latest NDKs, as well as handle multiple architectures (arm, armv7,
x86). (And I actually got to test on an Samsung x86 based tablet that
the x86 stuff actually worked; they had bugs and the standard #3434
latency in their audio system, but the binary was fine.)

(Note that this example compiles ALmixer without SDL dependencies and
instead uses a new experimental native Android OpenSL ES decoder
backend my team and I have been working on so it won’t directly show
you how to deal with SDL. Side rant: They screwed up their API and
they lack traditional fopen/fread/fseek/fclose function pointer
abstractions found in most C libraries so things like SDL_RWops can’t
be implemented for their audio decoders. Argh! Android!!!)

Additionally, OpenAL-Soft is a dependency that ALmixer depends on,
though this uses its own supplied Makefile system. This is actually a
good example of how to get CMake to find 3rd party dependencies on
Android.

Once these components are built as dynamic libraries, the final Hello
World app build process relies on the official NDK external module system to
find ALmixer and OpenAL and build appropriately.

Because there are a lot of disjoint steps, all of this is strung
together by some Perl scripts.

The README.txt contains a lot of information on how to setup things.
Android NDK development is really painful so take your time on this.
Don’t expect to be able to grasp everything in 10 minutes. That said,
I think this example is one of the smoothest examples ever made of
building and using complicated 3rd party dependencies on Android with
the NDK.

The repository can be found at:

Thanks,
EricOn 12/17/13, piperoman <mrpiperoman.hot at gmail.com> wrote:

I need to use SDL in android platform. I usually compile my projects using
CMake, and android toolchain when I need to develop in Android.

I have try to compile the always painful Android.mk, following the
README-android.txt for complext project, but with android-ndk-9b, it
doesn’t
compile.

Reading README-cmake.txt, I can read that it cannot be used in Android/iOS
platform. Anyway, I have try to compile it, but it doent work, of course,
the code sources that try to use is not the same that use in Android.mk

My question is, In the future, the CMake is going to support Android & iOS
Platforms? I consider that is the best option for people who work with
crossplatform project.

I have some experience working with crossplatform projects, using
toolchains
when is needed, and I took a look into OpenCV cmakes that can teach a lot
of
crosscompiling. If is needed I can help with that, because its a very
userful tool.

Anyway, someone know where could I find some precompiled SDL and SDL_image
libraries for Android and iOS? I can use the sample project to add the JNI
calls into my projects, but I cannot compile myself the SDL library.

Thanks for your time.


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Hey piperoman,

I am currently working on building a simple SDL2 demo using CMake. Here’s my open thread (http://forums.libsdl.org/viewtopic.php?t=9734l).

I can build the libs, but it’s still not done. Unfortunately I’m too busy with my real job right now, and have no time to get it done. Hope this will change with the next year.

Greetings
Michael

I have testing your Cmake in my CrossplatformSample project and I also get:-------------------------
Linking C shared library
/home/piperoman/Proyectos/Personal/CrossPlatformSamples/git/crossplatformcmakes/samples/basic/figures/libs/armeabi-v7a/libSDL2.so
CMakeFiles/SDL2.dir/src/SDL_assert.c.o:SDL_assert.c:function
SDL_ReportAssertion: error: undefined reference to 'SDL_AtomicLock’
CMakeFiles/SDL2.dir/src/SDL_assert.c.o:SDL_assert.c:function
SDL_ReportAssertion: error: undefined reference to 'SDL_AtomicUnlock’
CMakeFiles/SDL2.dir/src/SDL_assert.c.o:SDL_assert.c:function
SDL_ReportAssertion: error: undefined reference to 'SDL_AtomicUnlock’
CMakeFiles/SDL2.dir/src/audio/SDL_audio.c.o:SDL_audio.c:function bootstrap:
error: undefined reference to 'DUMMYAUD_bootstrap’
CMakeFiles/SDL2.dir/src/atomic/SDL_atomic.c.o:SDL_atomic.c:function
enterLock: error: undefined reference to 'SDL_AtomicLock’
CMakeFiles/SDL2.dir/src/atomic/SDL_atomic.c.o:SDL_atomic.c:function
leaveLock: error: undefined reference to 'SDL_AtomicUnlock’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_atan: error: undefined reference to 'atan’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_atan2: error: undefined reference to 'atan2’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_acos: error: undefined reference to 'acos’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_asin: error: undefined reference to 'asin’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_ceil: error: undefined reference to 'ceil’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_copysign: error: undefined reference to 'copysign’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_cos: error: undefined reference to 'cos’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_cosf: error: undefined reference to 'cosf’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_floor: error: undefined reference to 'floor’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_log: error: undefined reference to 'log’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_pow: error: undefined reference to 'pow’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_scalbn: error: undefined reference to 'scalbn’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_sin: error: undefined reference to 'sin’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_sinf: error: undefined reference to 'sinf’
CMakeFiles/SDL2.dir/src/stdlib/SDL_stdlib.c.o:SDL_stdlib.c:function
SDL_sqrt: error: undefined reference to 'sqrt’
CMakeFiles/SDL2.dir/src/thread/SDL_thread.c.o:SDL_thread.c:function
SDL_Generic_GetTLSData: error: undefined reference to 'SDL_AtomicLock’
CMakeFiles/SDL2.dir/src/thread/SDL_thread.c.o:SDL_thread.c:function
SDL_Generic_GetTLSData: error: undefined reference to 'SDL_AtomicUnlock’
CMakeFiles/SDL2.dir/src/thread/SDL_thread.c.o:SDL_thread.c:function
SDL_GetErrBuf: error: undefined reference to 'SDL_AtomicLock’
collect2: error: ld returned 1 exit status

I think is a problem with flags or preprocessing. I had error: undefined
reference to ‘atan’ before and using #include in android solve the
problem. But here that is not the poing, because Android.mk is working fine.

Neither is a C11 problem, adding
set (CMAKE_C_FLAGS “${CMAKE_C_FLAGS} -DGL_GLEXT_PROTOTYPES -std=c11”)
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} “-DGL_GLEXT_PROTOTYPES -std=c++11”)
doesn’t work.

So, I can’t figure what is going on. Someone have and advice to solve the
linking problem?

Right now, I have compiled SDL and SDL_image using Android.MK and I’m
trying to use the precompiled library in CMake, but I don’t like this
solution, I want add the source and compile it for each platform.

2013/12/19 Laz-Roc

Hey piperoman,

I am currently working on building a simple SDL2 demo using CMake. Here’s
my open thread http://forums.libsdl.org/viewtopic.php?t=9734l.

I can build the libs, but it’s still not done. Unfortunately I’m too busy
with my real job right now, and have no time to get it done. Hope this will
change with the next year.

Greetings
Michael


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org