使用CMake在XCode 6.4 for iOS中构建OpenSceneGraph 3.4.0

时间:2015-08-06 07:40:22

标签: xcode cmake openscenegraph

我是OSG& CMake,我正在尝试按照README文件中的指定构建适用于iOS的OpenSceneGraph。 以下是平台和工具规范。 MAC OSX 10.10.4 XCode 6.4 iOS 8.4 iOS模拟器8.4 OpenSceneGraph 3.4.0-rc9 CMake 3.3.0

重现错误的步骤: 1:修改并保存OSG文件夹中的CMakeLists.txt     选项(OSG_BUILD_PLATFORM_IPHONE"启用IPhoneSDK设备支持" ON)     选项(OSG_BUILD_PLATFORM_IPHONE_SIMULATOR"启用IPhoneSDK模拟器支持"关闭)

2:在CMake GUI更新中'源代码在哪里:'和'在哪里建立二进制文件:'到OSG文件夹。设置以下选项。

  • OSG_BUILD_PLATFORM_IPHONE:BOOL = ON \
  • CMAKE_CXX_FLAGS:STRING =" -ftree-vectorize -fvisibility-inlines-hidden -mno-thumb -arch armv6 -pipe -no-cpp-precomp -miphoneos-version-min = 3.1 -mno-thumb&#34 ; \
  • BUILD_OSG_APPLICATIONS:BOOL = OFF \
  • OSG_BUILD_FRAMEWORKS:BOOL = OFF \
  • OSG_WINDOWING_SYSTEM:STRING = IOS \
  • CMAKE_OSX_ARCHITECTURES:STRING ="用于ARMv6; ARMv7的" \
  • CMAKE_OSX_SYSROOT:STRING = / Applications / Xcode.app / Contents / Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS8.4.sdk \
  • OSG_GL1_AVAILABLE:BOOL = OFF \
  • OSG_GL2_AVAILABLE:BOOL = OFF \
  • OSG_GLES1_AVAILABLE:BOOL = ON \
  • OSG_GL_DISPLAYLISTS_AVAILABLE:BOOL = OFF \
  • OSG_GL_FIXED_FUNCTION_AVAILABLE:BOOL = ON \
  • OSG_GL_LIBRARY_STATIC:BOOL = OFF \
  • OSG_GL_MATRICES_AVAILABLE:BOOL = ON \
  • OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE:BOOL = ON \
  • OSG_GL_VERTEX_FUNCS_AVAILABLE:BOOL = OFF \
  • DYNAMIC_OPENSCENEGRAPH:BOOL = OFF \
  • DYNAMIC_OPENTHREADS:BOOL = OFF。

尝试使用这些配置进行配置,但收到以下错误。

The C compiler identification is AppleClang 6.1.0.6020053
The CXX compiler identification is AppleClang 6.1.0.6020053
Check for working C compiler using: Xcode
Check for working C compiler using: Xcode -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.3/Modules/CMakeTestCCompiler.cmake:61
(message):
  The C compiler
  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/adithiathreya/Downloads/OpenSceneGraph-3.4.0-rc9/CMakeFiles/CMakeTmp



  Run Build Command:"/usr/bin/xcodebuild" "-project"
  "CMAKE_TRY_COMPILE.xcodeproj" "build" "-target" "cmTC_665b5"
  "-configuration" "Debug"

  === BUILD TARGET cmTC_665b5 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION
  Debug ===



  Check dependencies

  target specifies product type 'com.apple.product-type.tool', but there's no
  such product type for the 'iphoneos' platform



  ** BUILD FAILED **





  The following build commands failed:

      Check dependencies

  (1 failure)





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:52 (PROJECT)


Configuring incomplete, errors occurred!

我尝试了这些配置,对iPhone模拟器也进行了必要的更改,但是出现了类似的错误。你能告诉我哪里出错了吗?

1 个答案:

答案 0 :(得分:0)

您应该在cmake中指定IOS SDK版本和iPhone版本。

cmake ../ -G Xcode -DOSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
-DIPHONE_SDKVER="10.3" \
-DIPHONE_VERSION_MIN="8.0" \
-DOPENGL_PROFILE:STRING=GLES2 \
-DBUILD_OSG_APPLICATIONS:BOOL=OFF \
-DBUILD_OSG_EXAMPLES:BOOL=ON \
-DOSG_WINDOWING_SYSTEM:STRING=IOS \
-DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX="imageio" \
-DDYNAMIC_OPENSCENEGRAPH:BOOL=OFF \
-DDYNAMIC_OPENTHREADS:BOOL=OFF \
-DCURL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/curl-ios-device/include" \
-DCURL_LIBRARY:PATH="$THIRDPARTY_PATH/curl-ios-device/lib/libcurl.a"     \
-DFREETYPE_INCLUDE_DIR_freetype2:PATH="$THIRDPARTY_PATH/freetype-ios-          universal/include/freetype" \
-DFREETYPE_INCLUDE_DIR_ft2build:PATH="$THIRDPARTY_PATH/freetype-ios-  universal/include" \
-DFREETYPE_LIBRARY:PATH="$THIRDPARTY_PATH/freetype-ios-universal/lib/libFreeType_iphone_universal.a" \
-DTIFF_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/tiff-ios-device/include" \
-DTIFF_LIBRARY:PATH="$THIRDPARTY_PATH/tiff-ios-device/lib/libtiff.a" \
-DGDAL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/gdal-ios-device/include" \
-DGDAL_LIBRARY:PATH="$THIRDPARTY_PATH/gdal-ios-device/lib/libgdal.a"

$ THIRDPARTY_PATH是您下载的第三方的目录。