android osg 编译_在windows下编译Android平台的OpenSceneGraph报错,请问什么原因?

看下面的命令行参数及报错信息,cmake已经指明了编译andoird平台下的,也制定到ndk的路径,但是就报错信息来看,还是提示找不到ndk,并且还调用的msbuild简直奇怪?难道不应该使用ndk下面的编译器来编译嘛?

一下命令是在cygwin64中执行的。

$ cmake . -DANDROID_NDK=/cygdrive/E/DevelopmentKits/android-ndk-r16b -DCMAKE_TOOLCHAIN_FILE=./PlatformSpecifics/Android

/android.toolchain.cmake -DOPENGL_PROFILE="GLES2" -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DANDROID_NATI

VE_API_LEVEL=15 -DANDROID_ABI=armeabi -DCMAKE_INSTALL_PREFIX=/cygdrive/E/DevelopmentKits/osg3.4.1

CMake Deprecation Warning at CMakeLists.txt:36 (cmake_policy):

The OLD behavior for policy CMP0008 will be removed from a future version

of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all

policies are deprecated and that a policy should be set to OLD only under

specific short-term circumstances. Projects should be ported to the NEW

behavior and not rely on setting a policy to OLD.

CMake Deprecation Warning at CMakeLists.txt:43 (cmake_policy):

The OLD behavior for policy CMP0020 will be removed from a future version

of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all

policies are deprecated and that a policy should be set to OLD only under

specific short-term circumstances. Projects should be ported to the NEW

behavior and not rely on setting a policy to OLD.

CMake Error at PlatformSpecifics/Android/android.toolchain.cmake:493 (message):

Could not find neither Android NDK nor Android standalone toolchain.

You should either set an environment variable:

export ANDROID_NDK=~/my-android-ndk

or

export ANDROID_STANDALONE_TOOLCHAIN=~/my-android-toolchain

or put the toolchain or NDK in the default path:

sudo ln -s ~/my-android-ndk C:/Program Files/android-ndk

sudo ln -s ~/my-android-toolchain /opt/android-toolchain

Call Stack (most recent call first):

C:/Program Files/CMake/share/cmake-3.11/Modules/CMakeDetermineSystem.cmake:91 (include)

CMakeLists.txt:52 (PROJECT)

CMake Error at CMakeLists.txt:52 (PROJECT):

Failed to run MSBuild command:

C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe

to get the value of VCTargetsPath:

Microsoft (R) 生成引擎版本 14.0.25420.1

版权所有(C) Microsoft Corporation。保留所有权利。

生成启动时间为 2018/8/24 9:03:06。

节点 1 上的项目“E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj”(默认目标)。

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : Android SDK location is not specified. [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : Set either the global option (Tools -> Options -> Nsight Tegra -> Android SDK Location) or the project property "Android SDK Location". [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : The Android SDK can be downloaded at this URL: [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : http://developer.android.com/sdk/index.html [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

已完成生成项目“E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj”(默认目标)的操作 - 失败。

生成失败。

“E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj”(默认目标) (1) ->

(CheckNdkAndSdk 目标) ->

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : Android SDK location is not specified. [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : Set either the global option (Tools -> Options -> Nsight Tegra -> Android SDK Location) or the project property "Android SDK Location". [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : The Android SDK can be downloaded at this URL: [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(10,5): error : http://developer.android.com/sdk/index.html [E:\DevelopmentKits\OpenSceneGraph-OpenSceneGraph-3.4.1\CMakeFiles\3.11.0\VCTargetsPath.vcxproj]

0 个警告

1 个错误

已用时间 00:00:00.13

Exit code: 1

-- Configuring incomplete, errors occurred!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译 OpenSceneGraph (OSG) for Android 需要使用交叉编译工具链(cross-compilation toolchain),可以使用 Android NDK 中提供的工具链来完成。以下是编译 OSG 的大致步骤: 1. 下载并安装 Android NDK,可以从官网下载。 2. 下载 OSG 的源代码,可以从官网下载。 3. 解压 OSG 源代码,进入源代码目录。 4. 设置环境变量,使得编译器可以找到 Android NDK 中的工具链,例如: ``` export ANDROID_NDK=$HOME/android-ndk-r10e export PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH export CC=arm-linux-androideabi-gcc export CXX=arm-linux-androideabi-g++ ``` 其中 `$HOME/android-ndk-r10e` 是 Android NDK 的安装路径。 5. 运行 cmake 命令生成 Makefile: ``` mkdir build_android cd build_android cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ -DANDROID_ABI="armeabi-v7a" \ -DANDROID_NATIVE_API_LEVEL=android-14 \ -DCMAKE_INSTALL_PREFIX=/path/to/install/directory \ .. ``` 其中 `-DANDROID_ABI="armeabi-v7a"` 表示编译为 armeabi-v7a 架构,`-DANDROID_NATIVE_API_LEVEL=android-14` 表示使用 Android 14 的 API 级别。`-DCMAKE_INSTALL_PREFIX` 表示安装路径。 6. 运行 make 命令编译 OSG: ``` make -j4 ``` 其中 `-j4` 表示使用 4 个线程进行编译。 7. 运行 make install 命令安装 OSG: ``` make install ``` 至此,OSG编译就完成了。 如果需要编译 osgEarth,可以按照类似的步骤,先编译 OSG,再编译 osgEarth。在 cmake 命令中需要添加 `-DOSG_DIR=/path/to/osg/install/directory` 参数,指定 OSG 的安装路径。例如: ``` cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ -DANDROID_ABI="armeabi-v7a" \ -DANDROID_NATIVE_API_LEVEL=android-14 \ -DCMAKE_INSTALL_PREFIX=/path/to/install/directory \ -DOSG_DIR=/path/to/osg/install/directory \ .. ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值