SFML community forums

General => General discussions => Topic started by: 8Observer8 on January 03, 2024, 12:02:14 pm

Title: [Solved] The NDK root directory specified by CMAKE_ANDROID_NDK: /path/to/ndk
Post by: 8Observer8 on January 03, 2024, 12:02:14 pm
Hello,

I try to follow this guide: https://github.com/SFML/SFML/wiki/Tutorial%3A-Building-SFML-for-Android

But have a problem on the first step. I try to execute this command:

Quote
cmake -G "MinGW Makefiles" ../.. -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=/path/to/ndk -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug

Log:

Quote
E:\Libs\SFML-2.6.1\build\armeabi-v7a>cmake -G "MinGW Makefiles" ../.. -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=/path/to/ndk -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/Platform/Android-Determine.cmake:141 (message):
  Android: The NDK root directory specified by CMAKE_ANDROID_NDK:

    /path/to/ndk

  does not exist.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake:212 (include)
  CMakeLists.txt:38 (project)


CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

I created the CMAKE_ANDROID_NDK variable. I reopened CMD after adding.

(https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=29361.0;attach=5931)
Title: Re: Android: The NDK root directory specified by CMAKE_ANDROID_NDK: /path/to/ndk
Post by: 8Observer8 on January 03, 2024, 12:20:33 pm
I found my mistake. I must replace `/path/to/ndk` to "E:\AppData\Android\SDK\ndk\25.1.8937393" in the command:

Quote
cmake -G "MinGW Makefiles" ../.. -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="E:/AppData/Android/SDK/ndk/25.1.8937393" -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug

But how to write this path in right way? I tried:


Log:

Quote
E:\Libs\SFML-2.6.1\build\armeabi-v7a>cmake -G "MinGW Makefiles" ../.. -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="E:/AppData/Android/SDK/ndk/25.1.8937393" -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug
CMake Error at build/armeabi-v7a/CMakeFiles/3.28.1/CMakeSystem.cmake:13 (set):
  Syntax error in cmake code at

    E:/Libs/SFML-2.6.1/build/armeabi-v7a/CMakeFiles/3.28.1/CMakeSystem.cmake:13

  when parsing string

    E:\AppData\Android\SDK\ndk\25.1.8937393

  Invalid character escape '\A'.
Call Stack (most recent call first):
  CMakeLists.txt:38 (project)


CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Title: Re: Android: The NDK root directory specified by CMAKE_ANDROID_NDK: /path/to/ndk
Post by: 8Observer8 on January 03, 2024, 12:34:39 pm
The problem with path was solved. I should clean the build folder.

Quote
cmake -G "MinGW Makefiles" ../.. -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="E:/AppData/Android/SDK/ndk/25.1.8937393" -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug

The next problem is: A problem occurred evaluating project ':app' (http://en.sfml-dev.org/forums/index.php?topic=29362.0)