labstreaminglayer / App-LabRecorder

An application for streaming one or more LSL streams to disk in XDF file format.
MIT License
123 stars 45 forks source link

Compile the non-Qt-parts for Android #2

Open tstenner opened 5 years ago

tstenner commented 5 years ago

Hopefully, https://github.com/labstreaminglayer/liblsl-Android/pull/1, https://github.com/labstreaminglayer/liblsl-Android/pull/2 and the newer Android toolchain work well enough together we can tackle compiling the (non-Qt) parts of LabRecorder for Android.

mgrivich commented 5 years ago

Using ninja, the latest version (important) of cmake and the android sdk and ndk, I am able to get LabRecorder to compile with

c:\labstreaminglayer\build>cmake .. -G "Ninja" -DQt5_DIR="C:/Qt5.12.0/5.12.0/android_armv7/lib/cmake/Qt5" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="c:/AndroidStudio/android-sdk/ndk-bundle" -DIS_LITTLE_ENDIAN=TRUE -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DLSLAPPS_Labrecorder=ON

c:\labstreaminglayer\build>cmake --build . --config Release

I had to remove

if (MINGW)
      target_link_libraries (${target} PUBLIC ws2_32 wsock32 winmm)
endif()

from LSL/libllsl/CMakeLists.txt. This should be removed permanently, right? No one should be linking boost libraries anymore.

It doesn't build an apk though, just a jumble of build products. Perhaps next I will attempt to build it inside of Android Studio instead.

Older versions of the android ndk fail due to missing features, such as std::to_string and std::make_unique. Older versions of CMake fail because the newest android ndk deprecated a bunch of features.

mgrivich commented 5 years ago

http://doc.qt.io/qt-5/deployment-android.html gives some hints about how to bundle qt android applications. They only use Android Studio to get the ndk and sdk.

mgrivich commented 5 years ago

For further commentary on Qt with Android, see Issue#3.