...Hello again.
Now that I've got SFML working, I realise that the android C++11 STL support is rather shoddynamely:
here is the trouble: unique_ptr
this is the minimal example I've been working on.
Can't compile this while linking with SFML.
#include <memory>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main(int argc, char *argv[]) {
std::unique_ptr<sf::RenderWindow> upW(new sf::RenderWindow(sf::VideoMode::getDesktopMode(), "OMG!!!"));
sf::RenderWindow& window = *upW;
sf::View view = window.getDefaultView();
while (window.isOpen())
{
window.clear(sf::Color::Black);
window.display();
}
}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:externalNativeBuildDebug'.
> Build command failed.
Error while executing process /Users/lio/Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /Users/lio/StudioProjects/SFML_Template/app/.externalNativeBuild/cmake/debug/armeabi --target my-app}
[1/2] Building CXX object CMakeFiles/my-app.dir/main.cpp.o
FAILED: /Users/lio/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv5te-none-linux-androideabi --gcc-toolchain=/Users/lio/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/lio/Library/Android/sdk/ndk-bundle/sysroot -Dmy_app_EXPORTS -I/Users/lio/StudioProjects/SFML_Template/app/src/main/cpp/../../../../sfml/include -isystem /Users/lio/Library/Android/sdk/ndk-bundle/sources/cxx-stl/stlport/stlport -isystem /Users/lio/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gabi++/include -isystem /Users/lio/Library/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=15 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -fexceptions -frtti -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/my-app.dir/main.cpp.o -MF CMakeFiles/my-app.dir/main.cpp.o.d -o CMakeFiles/my-app.dir/main.cpp.o -c /Users/lio/StudioProjects/SFML_Template/app/src/main/cpp/main.cpp
/Users/lio/StudioProjects/SFML_Template/app/src/main/cpp/main.cpp:18:8: error: no member named 'unique_ptr' in namespace 'std'
std::unique_ptr<sf::RenderWindow> upW(new sf::RenderWindow(sf::VideoMode::getDesktopMode(), "OMG!!!"));
~~~~~^
any idea?
good one, I did, you'll find it at the top of my code
Meanwhile it hit me as I chatted with a friend about the absurdity of so many STL implementations:
STLPORT is from 2008... so NO smart pointers! :o
I rebuilt SFML with GNUSTL instead
cmake -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=$SFML/cmake/toolchains/android.toolchain.cmake -DCMAKE_FIND_FRAMEWORK="NEVER" -DANDROID_STL=gnustl_shared $SFML
and defined it in build.gradle (module: app) as well
defaultConfig {
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -fexceptions -frtti"
arguments '-DANDROID_STL=gnustl_shared'
}
}
}
and TADA! ;D
now back to TacWars (http://movo-design.com)