We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3774

Summary: Cmake build fails for Android
Product: SDL Reporter: sfalexrog
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: Possible fix

Description sfalexrog 2017-08-24 17:24:45 UTC
Created attachment 2886 [details]
Possible fix

Android haptic code was not added to CMakeLists.txt, leading to build failures when targeting Android platform.

Attached patch adds Android haptic driver to source sets and adds configuration parameter to SDL_config.h.cmake.

Note that this patch also exports SDL2, SDL2-static, and SDL2-main targets in order to integrate SDL2 as a subproject in a build system (it might not be a desirable thing for some). I'm not familiar with CMake versions and when stuff got added (and whether you can even use export() function at 2.8.11), I can only say that it seems to work somehow with CMake that's bundled with Android SDK (3.6).

To someone who's familiar with CMake: please do check the FILE parameter of export() call! I'm pretty sure I got it wrong.
Comment 1 Sam Lantinga 2017-08-27 04:18:28 UTC
The haptic fix is in:
https://hg.libsdl.org/SDL/rev/598839965877j

For the targets patch, please file a separate bug and attach it with an explanation for further review. I don't know CMake well enough to comment on that one.

Thanks!