時間
2017年11月8日
參考
環(huán)境與關鍵工具
系統(tǒng)
macOS Sierra (10.12.6)-
Xcode
- Version 8.3.3 (8E3004b)
- CXX Compiler: AppleClang 8.1.0.8020042
-
CMake
- Version 3.0.2
- 安裝包
鏈接:http://pan.baidu.com/s/1o7GZJiq 密碼:0c63
依賴庫 Fat 文件
鏈接:http://pan.baidu.com/s/1qY6xGMK 密碼:v3ok
步驟
- 代碼
Download OSG trunk
cd /Users/wangmiao/projects/osgearth-build/osg-ios/
git clone https://github.com/openscenegraph/OpenSceneGraph.git
code version:
commit ad45bf1d616816413f490c3eb116928a56db36ba
Author: Robert Osfield robert@openscenegraph.com
Date: Mon Oct 16 11:52:54 2017 +0100
- cmake 運行
export THIRDPARTY_PATH=/Volumes/mac/Cateye/3rdParty
export IPHONE_SDK_USR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr
/Applications/CMake.app/Contents/bin/cmake ./ -G Xcode -DOSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
-DIPHONE_SDKVER="10.3" \
-DIPHONE_VERSION_MIN="8.0" \
-DOPENGL_PROFILE:STRING=GLES3 \
-DBUILD_OSG_APPLICATIONS:BOOL=OFF \
-DBUILD_OSG_EXAMPLES:BOOL=ON \
-DOSG_WINDOWING_SYSTEM:STRING=IOS \
-DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX="imageio" \
-DOSG_GL1_AVAILABLE:BOOL=OFF \
-DOSG_GL2_AVAILABLE:BOOL=OFF \
-DOSG_GLES1_AVAILABLE:BOOL=OFF \
-DOSG_GLES2_AVAILABLE:BOOL=OFF \
-DOSG_GLES3_AVAILABLE:BOOL=ON \
-DDYNAMIC_OPENSCENEGRAPH:BOOL=OFF \
-DDYNAMIC_OPENTHREADS:BOOL=OFF \
-DZLIB_INCLUDE_DIR:PATH="$IPHONE_SDK_USR/include" \
-DZLIB_LIBRARY:PATH="$IPHONE_SDK_USR/lib/libz.tbd" \
-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"
- xcode 工程編譯
3.1 打開xcode
3.2 選擇目標 example_osgViewerIPhone
設置: In the 'Build Settings' tab search for 'Other Linker Flags', then for each target type (debug, release etc) that you want to use open the list of arguments and delete the 'OpenGL' line and the '-framework' line above it. This is because cmake has tried to add the desktop OpenGL library which we don't want.
-lz
選擇 iOS Deployment Target : 10.3
3.3 選擇設備
真機調(diào)試扣蜻,連接真機 build即可袖肥。
- next: OSGEarth
為了編譯 osgEarth,還需要編譯其他庫,其中 osgdb_fastdxt 編譯會有語法錯誤夯辖,且 osgEarth用不著赫编,可以去掉。