Android executable CMake import

Sysprogs forums Forums VisualGDB Android executable CMake import

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #13485
    robiwan
    Participant

    I’d like to create an Android project, but I already have a CMake based application (with “main”) which I’d like to use instead creating a new one, is this possible ?

    #13492
    support
    Keymaster

    Hi,

    Sorry, unfortunately that is not directly supported. However as for CMake projects the Solution Explorer contents is dynamically built from the CMake project structure, you can simply copy-paste the CMakeLists.txt file structure to a newly created project (and also copy all relevant sources) and VisualGDB will automatically update Solution Explorer to show the contents of your project.

    #13502
    robiwan
    Participant

    Ok, sounds interesting, although I’m not sure how to (don’t know which Android project type I need to select f.i.), can you show roughly the steps I need to take ?

    #13512
    support
    Keymaster

    Hi,

    No problem. Please let us know what are you trying to create a – stand-alone command-line Android tool, a native Android app or a Java App with C++ part built by CMake.

    #13516
    robiwan
    Participant

    In this case a stand-alone command-line Android tool (built in C++), I’m also interested in setting up unit tests, but that’s later.

    #13529
    support
    Keymaster

    Hi,

    Thanks for clarifying. This is supported out-of-the-box for the regular ndk-build + Make project type (can be created via the Android Project Wizard), but not yet for CMake. We would advise simply creating a new command-line Android application via VisualGDB wizard and then adding your files to the project. You can also create a unit test project from the same wizard – VisualGDB will automatically setup the unit testing framework and forward the test results from the Android device to Visual Studio.

    #13541
    robiwan
    Participant

    Thanks, there are a lot of files to add though, that’s why I was hoping for CMake support šŸ™‚ Is this planned for the future ?

    #13554
    support
    Keymaster

    Hi,

    Sorry, we currently don’t have specific plans for supporting CMake-based stand-alone Android executables. The good news is that you can easily add multiple files and subdirectories to a VisualGDB project via Add->Add Existing Item->Import Folder Recursively.

    #13607
    robiwan
    Participant

    Ok,Ā imported all files, now I seem to have a problem with all STL #include <…>Ā  directives, adding #include <algorithm> gives:

    1>C:\Users\robi\source\repos\AndroidProject1\AndroidProject1\jni\AndroidProject1.c(3,10): error : ‘algorithm’ file not found

    Ideas ?

    EDIT: Ok, I missed to set toolchain and c++ library šŸ™‚

    #13610
    support
    Keymaster

    Hi,

    Good to know it works. If you encounter further problems, feel free to let us know and we will help.

    #16035
    robiwan
    Participant

    Thanks, I’m now having a problem. VisualGDB seems to include a lot of c/cpp files that are not present in the solution, leading to a lot of multiply defined symbols, the ones I have problems with are related to googletest/googlemock. F.i. I have

    1>[armeabi-v7a] Compile++ thumb: AndroidProject1 <= gmock-all.cc

    but gmock-all.cc is nowhere to be found in the solution folder, but it is present in the Android.mk file, which is generated by VisualGDB.

     

    #19882
    support
    Keymaster

    Hi,

    This looks likeĀ a missing (or incorrectly configured) test framework directory. Normally, VisualGDB would referenceĀ the test framework files as shown below:

    LOCAL_SRC_FILES := $(TESTFW_BASE)/com.sysprogs.unittest.googletest/src/gtest-death-test.cc <...>

    Then it would pass the TESTFW_BASE variable via environment. Could you please check whetherĀ the LOCAL_SRC_FILES statement uses this syntax? If yes, does setting TESTFW_BASE to $(LOCALAPPDATA)\VisualGDB\TestFrameworks solve the problem?

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.