Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,296
    • Issues 3,296
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 9
    • Merge Requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #21726

Closed
Open
Created Jan 21, 2021 by Craig Scott@craig.scottMaintainer

Visual Studio Android support with a recent NDK

This was originally raised in the CMake forums. The text below is transferred from that query.


Has anyone attempted to use the new Visual Studio NDK support with a NDK more recent than what comes with Visual Studio (which is ancient r16)? I’ve been trying to get this working for a while now and with the changes made on CMake master and NDK master recently, it should work. In my testing, I can get Ninja to work with a continuous build of NDK from today (see here) and CMake master, but using the Visual Studio generator, it fails at the compiler check stage. It seems like the LLVM compilers from Visual Studio are being used instead of the ones from the NDK, but I can’t be sure since there’s a few levels of compiler flags involved which may be forwarding things on. Here’s an example command line I’ve been using:

cmake -G "Visual Studio 16" -A ARM64 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=path/to/my/toolchain.cmake path/to/project/source/dir

The -A ARM64 is a bit of an experiment. It fails with or without it. The contents of my toolchain file are pretty straightforward:

set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_ANDROID_NDK C:/Users/craig/AppData/Local/Android/Sdk/ndk/23.0.7045647)  # My copy of the continuous build
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
set(CMAKE_ANDROID_STL_TYPE c++_shared)

Here’s the CMakeError.log and CMakeOutput.log from the above setup:

  • CMakeError.log
  • CMakeOutput.log

I will also point out that the output in CMakeError.log shows that Visual Studio is ignoring CMAKE_ANDROID_NDK and is setting the NDK_ROOT environment variable to the value providing in the Visual Studio settings under the Tools > Options... > Cross Platform > C++ > Android settings. But even if I update those settings to match my desired NDK root, it still fails.

Just curious if I’m missing something or whether the Visual Studio support for NDK is not actually finished work.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None