Closed pkovacs86 closed 5 years ago
the issue seems to be that CMake uses the MSVC generator by default. Try using the makefile generator or the gradle generator as shown by the -G argument here: https://developer.android.com/ndk/guides/cmake
Hey,
Thank you again for your great advise. I downloaded the Ninja from here https://github.com/ninja-build/ninja/releases Then the following cmake cli command was fired: C:\ogre>cmake -DCMAKE_TOOLCHAIN_FILE=C:\NVPACK\android-ndk-r15c\build\cmake\android.toolchain.cmake -DANDROID_NDK=C:\NVPACK\android-ndk-r15c -G Ninja .
Ninja.exe must be copied to the Android NDK folder "C:\NVPACK\android-ndk-r15c" or put it to the Path. But maybe much better to copy to the NDK folder in order to avoid some confusion of Path Env. Var.
And the result is -- Configuring done -- Generating done -- Build files have been written to: C:/ogre
And the c:\ogre\SampleBrowserNDK was created and the SampleBrowserNDK gradle project was successfully opened in Android Studio.
I have to check the build time, but it seems something is working at cmake-time :)
If the build and the run-time is also working then I'll provide a short step-by-step tutorial how to generate,build and run SampleBrowserNDK from a Windows host.
Okay,
The SampleBrowserNDK Android Studio Project is able to install and run the NativeActivity APK after the cmake cli command C:\ogre>cmake -DCMAKE_TOOLCHAIN_FILE=C:\NVPACK\android-ndk-r15c\build\cmake\android.toolchain.cmake -DANDROID_NDK=C:\NVPACK\android-ndk-r15c -G Ninja . but the following error is occoured
Of course, I could start to debug what's going on, but If anybody could validate that the SampleBrowserNDK is a proper Android Studio Gradle project then it would be much easier for me because I'm completely new to android devs.
BR Peter
do you have a real device to test? I think the emulator needs a x86 JNI library, while the project only builds a armv7a one. Also note that the JNI part is not handled by Gradle, so the x86 lib is not built automatically.
Meanwhile I found that log during the cmake generation of ogre -- Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) (Required is at least version "3.0.8") CMake Warning at Components/Java/CMakeLists.txt:15 (message): Java Component disabled because SWIG or Java was not found
Then I try to set this SWIG_DIR value by cli command cmake -DCMAKE_TOOLCHAIN_FILE=C:\NVPACK\android-ndk-r15c\build\cmake\android.toolchain.cmake -DANDROID_NDK=C:\NVPACK\android-ndk-r15c -DSWIG_DIR=c:\swigwin-3.0.8 -G Ninja .
But no luck -- Could NOT find SWIG (missing: SWIG_EXECUTABLE) (Required is at least version "3.0.8") CMake Warning at Components/Java/CMakeLists.txt:15 (message): Java Component disabled because SWIG or Java was not found
I guess I should have the Java Component of Ogre? and the AndroidJNI sample of Ogre?
Regarding to your questions: "do you have a real device to test?" Currently no " I think the emulator needs a x86 JNI library, while the project only builds a armv7a one." The emulator device is armv7a. If I choose x86 device the apk installation is not executed on the emulator device. But on this armv7a emulator device the apk installation works properly. "Also note that the JNI part is not handled by Gradle" You mean the AndroidJNI sample of Ogre? "so the x86 lib is not built automatically." Maybe as far as I know the x86 would be much better on performance but maybe the armv7a should works as well....
Thank you again for your support
I guess I should have the Java Component of Ogre? and the AndroidJNI sample of Ogre?
if you want to write Java, then yes. Note that there is a prebuild SDK for that here: https://www.ogre3d.org/download/sdk
You mean the AndroidJNI sample of Ogre?
no, I mean building the native *.so
files inside the jniLibs folder.
Maybe as far as I know the x86 would be much better on performance but maybe the armv7a should works as well....
OpenGL might not work properly when emulating armv7a
I can confirm that the v1.12.1 Android SDK https://www.ogre3d.org/download/sdk is working on Windows host via Android Studio with emulator Pixel 2 XL(Android 7.0, API 24, ABI arm64-v8a)
Thank you Pavel for your support
BR Peter
After installing Nvidia Codeworks for Android and Nvidia NSight Tegra Visual Studio Edition the following error was raised after this cmake cli command cmake -DCMAKE_TOOLCHAIN_FILE=C:\NVPACK\android-ndk-r15c\build\cmake\android.toolchain.cmake -DANDROID_NDK=C:\NVPACK\android-ndk-r15c .
CMakeError.log Determining if the C compiler works failed with the following output: Change Dir: C:/ogre/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe" "cmTC_8fce2.vcxproj" "/p:Configuration=Debug" "/p:Platform=Tegra-Android" "/p:VisualStudioVersion=15.0" Microsoft (R) Build Engine version 15.5.180.51428 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2019. 07. 29. 15:11:59.
Project "C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_8fce2.dir\Debug\".
Creating directory "C:\ogre\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_8fce2.dir\Debug\cmTC_8fce2.tlog\".
InitializeBuildStatus:
Creating "cmTC_8fce2.dir\Debug\cmTC_8fce2.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\NVPACK\android-ndk-r15c\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe
testCCompiler.c
In file included from:339:
C:\ogre\CMakeFiles\CMakeTmp\12(9): '' warning : '__ANDROID_API__' macro redefined [-Wmacro-redefined] [C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj]
define __ANDROID_API__ 14
define __ANDROID_API__ 9
1 warning generated.
Link:
C:\NVPACK\android-ndk-r15c\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe cmTC_8fce2.dir/Debug/testCCompiler.o -gcc-toolchain C:/NVPACK/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 -target armv7-none-linux-androideabi -Wl,-soname,cmTC_8fce2. -shared --sysroot=C:/NVPACK/android-ndk-r15c/platforms/android-9/arch-arm -fuse-ld=bfd -Wl,-rpath-link="C:/NVPACK/android-ndk-r15c/platforms/android-9/arch-arm/usr/lib" "-l-lm" -Wl,--no-undefined -Wl,--no-allow-shlib-undefined -Wl,--unresolved-symbols=report-all -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L"C:/NVPACK/android-ndk-r15c/platforms/android-9/arch-arm/usr/lib" -L"C:/NVPACK/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a" "C:/NVPACK/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a" -lc -lm -llog -lgcc -oC:/ogre/CMakeFiles/CMakeTmp/Debug/cmTC_8fce2. -Wl,--exclude-libs,libgcc.a --sysroot C:/NVPACK/android-ndk-r15c/platforms/android-14/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc
clang++.exe : error : invalid linker name in argument '-fuse-ld=bfd' [C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj]
Done Building Project "C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj" (default target) (1) ->
(ClCompile target) ->
C:\ogre\CMakeFiles\CMakeTmp\12(9): '' warning : '__ANDROID_API__' macro redefined [-Wmacro-redefined] [C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj]
"C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj" (default target) (1) ->
(Link target) ->
clang++.exe : error : invalid linker name in argument '-fuse-ld=bfd' [C:\ogre\CMakeFiles\CMakeTmp\cmTC_8fce2.vcxproj]
Time Elapsed 00:00:03.45