From Ulrich Hertlein and Stephan Huber, improves to iOS build
This commit is contained in:
parent
60457486b0
commit
5723050580
36
README.txt
36
README.txt
@ -147,32 +147,30 @@ still images, and a QTKit plugin will need to be developed to handle
|
|||||||
animations.
|
animations.
|
||||||
|
|
||||||
|
|
||||||
-- Release notes on IOS build, by Thomas Hoghart
|
-- Release notes on iOS build, by Thomas Hoghart
|
||||||
|
|
||||||
* Manually set the relevant OSG_BUILD_PLATFORM_IPHONE... option in root
|
* Run CMake with either OSG_BUILD_PLATFORM_IPHONE or OSG_BUILD_PLATFORM_IPHONE_SIMULATOR set:
|
||||||
CMakeLists file. Can only have one or the other at the moment.
|
$ mkdir build-iOS ; cd build-iOS
|
||||||
* Run CMake
|
$ ccmake -DOSG_BUILD_PLATFORM_IPHONE_SIMULATOR=YES -G Xcode ..
|
||||||
* Disable all OpenGL types accodrding to OSG_GLES1_AVALIABLE or
|
* Check that CMAKE_OSX_ARCHITECTURE is i386 for the simulator or armv6;armv7 for the device
|
||||||
OSG_GLES2_AVALIABLE. Also disable OSG_GLU_AVAILABLE
|
* Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS
|
||||||
* Disable OSG_GL_DISPLAYLISTS_AVALIABLE
|
This will give us the static build we need for iPhone.
|
||||||
|
* Disable OSG_GL1_AVAILABLE, OSG_GL2_AVAILABLE, OSG_GL3_AVAILABLE, OSG_GLU_AVAILABLE
|
||||||
|
* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE
|
||||||
* Ensure OSG_WINDOWING_SYSTEM is set to IOS
|
* Ensure OSG_WINDOWING_SYSTEM is set to IOS
|
||||||
* Change FREETYPE include and library paths to an IPhone version
|
* Change FREETYPE include and library paths to an iPhone version
|
||||||
(OpenFrameworks has one bundled with its distribution)
|
(OpenFrameworks has one bundled with its distribution)
|
||||||
* Under DYNAMIC ensure you untick DYNAMIC_OPENSCENEGRAPH and
|
* Ensure that CMake_OSX_SYSROOT points to your iOS SDK.
|
||||||
DYNAMIC_OPENTHREADS. This will give us the static build we need
|
* Generate the Xcode project
|
||||||
for IPhone
|
* Open the Xcode project
|
||||||
* Under CMake ensure the CMake_OSX_SYSROOT points to your
|
$ open OpenSceneGraph.xcodeproj
|
||||||
IOS SDK. Also check that the architecture is armv6/7 for
|
* Under Sources -> osgDB, select FileUtils.cpp and open the 'Get Info' panel, change File Type
|
||||||
device or i386 for Simulator.
|
|
||||||
* Generate the XCode project
|
|
||||||
* Find osgDB FileUtis.cpp, open the 'Get Info' panel, change File Type
|
|
||||||
to source.cpp.objcpp
|
to source.cpp.objcpp
|
||||||
|
|
||||||
|
Known issues:
|
||||||
* When Linking final app against ive plugin, you need to add -lz to
|
* When Linking final app against ive plugin, you need to add -lz to
|
||||||
the 'Other linker flags' list.
|
the 'Other linker flags' list.
|
||||||
|
|
||||||
known Issues:
|
|
||||||
* Apps and exes don't get created
|
* Apps and exes don't get created
|
||||||
* You can only select Simulator, or Device projects. In the XCode
|
* You can only select Simulator, or Device projects. In the XCode
|
||||||
project you will see both types but the sdk they link will
|
project you will see both types but the sdk they link will
|
||||||
be the same.
|
be the same.
|
||||||
|
|
||||||
|
@ -243,8 +243,8 @@ ELSE(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgstaticviewer)
|
ADD_SUBDIRECTORY(osgstaticviewer)
|
||||||
|
|
||||||
# IPHONE_PORT@tom
|
# IPHONE_PORT@tom
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE || OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
||||||
ADD_SUBDIRECTORY(osgViewerIPhone)
|
ADD_SUBDIRECTORY(osgviewerIPhone)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
# IPHONE_PORT@tom
|
# IPHONE_PORT@tom
|
||||||
|
|
||||||
|
@ -6,8 +6,12 @@ SET(TARGET_SRC
|
|||||||
osgIPhoneViewer-Info.plist
|
osgIPhoneViewer-Info.plist
|
||||||
)
|
)
|
||||||
|
|
||||||
#INCLUDE_DIRECTORIES( ${GLUT_INCLUDE_DIR} )
|
#backup setting
|
||||||
SET(TARGET_LIBRARIES_VARS Foundation.framework QuartzCore.framework UIKit.framework)
|
SET(TMP_OSG_BUILD_APPLICATION_BUNDLES {$OSG_BUILD_APPLICATION_BUNDLES})
|
||||||
|
SET(OSG_BUILD_APPLICATION_BUNDLES TRUE)
|
||||||
#### end var setup ###
|
|
||||||
SETUP_EXAMPLE(osgViewerIPhone)
|
SETUP_EXAMPLE(osgViewerIPhone)
|
||||||
|
#restore setting
|
||||||
|
SET(OSG_BUILD_APPLICATION_BUNDLES {$TMP_OSG_BUILD_APPLICATION_BUNDLES})
|
||||||
|
|
||||||
|
SET(CMAKE_EXE_LINKER_FLAGS "-framework Foundation -framework OpenGLES -framework UIKit")
|
||||||
|
|
||||||
|
@ -39,26 +39,29 @@ class UIView;
|
|||||||
|
|
||||||
#include <osgViewer/GraphicsWindow>
|
#include <osgViewer/GraphicsWindow>
|
||||||
|
|
||||||
// we may not include any cocoa-header here, because this will pollute the name-sapce and tend to compile-errors
|
// Do not include any cocoa-header here, because this will pollute the name-space and causes compile errors
|
||||||
|
|
||||||
namespace osgViewer
|
namespace osgViewer
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Implementation of a GraphicsWindow for the iOS platform.
|
||||||
|
*/
|
||||||
class GraphicsWindowIOS : public osgViewer::GraphicsWindow
|
class GraphicsWindowIOS : public osgViewer::GraphicsWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class Implementation;
|
class Implementation;
|
||||||
|
|
||||||
GraphicsWindowIOS(osg::GraphicsContext::Traits* traits)
|
GraphicsWindowIOS(osg::GraphicsContext::Traits* traits) : GraphicsWindow(),
|
||||||
: GraphicsWindow(),
|
|
||||||
_valid(false),
|
_valid(false),
|
||||||
_initialized(false),
|
_initialized(false),
|
||||||
_realized(false),
|
_realized(false),
|
||||||
|
_window(NULL),
|
||||||
|
_view(NULL),
|
||||||
|
_viewController(NULL),
|
||||||
|
_context(NULL),
|
||||||
_ownsWindow(true),
|
_ownsWindow(true),
|
||||||
_adaptToDeviceOrientation(true),
|
_adaptToDeviceOrientation(true),
|
||||||
_viewContentScaleFactor(-1.0f),
|
_viewContentScaleFactor(-1.0f)
|
||||||
_window(NULL),
|
|
||||||
_context(NULL)
|
|
||||||
{
|
{
|
||||||
_traits = traits;
|
_traits = traits;
|
||||||
|
|
||||||
@ -117,10 +120,8 @@ class GraphicsWindowIOS : public osgViewer::GraphicsWindow
|
|||||||
/** Get focus on if the pointer is in this window.*/
|
/** Get focus on if the pointer is in this window.*/
|
||||||
virtual void grabFocusIfPointerInWindow();
|
virtual void grabFocusIfPointerInWindow();
|
||||||
|
|
||||||
/** Raise the window to the top.*/
|
/** Raise the window to the top.*/
|
||||||
virtual void raiseWindow();
|
virtual void raiseWindow();
|
||||||
|
|
||||||
bool requestClose() {return false; }
|
|
||||||
|
|
||||||
virtual void resizedImplementation(int x, int y, int width, int height);
|
virtual void resizedImplementation(int x, int y, int width, int height);
|
||||||
|
|
||||||
@ -137,19 +138,19 @@ class GraphicsWindowIOS : public osgViewer::GraphicsWindow
|
|||||||
WindowData(UIWindow* window = NULL, bool adaptToDeviceOrientation = true, float scaleFactor = -1.0f)
|
WindowData(UIWindow* window = NULL, bool adaptToDeviceOrientation = true, float scaleFactor = -1.0f)
|
||||||
: _window(window),
|
: _window(window),
|
||||||
_adaptToDeviceOrientation(adaptToDeviceOrientation),
|
_adaptToDeviceOrientation(adaptToDeviceOrientation),
|
||||||
_viewContentScaleFactor(scaleFactor)
|
_viewContentScaleFactor(scaleFactor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAdaptToDeviceOrientation(bool flag) { _adaptToDeviceOrientation = flag; }
|
void setAdaptToDeviceOrientation(bool flag) { _adaptToDeviceOrientation = flag; }
|
||||||
|
|
||||||
void setViewContentScaleFactor(float scaleFactor) { _viewContentScaleFactor = scaleFactor; }
|
void setViewContentScaleFactor(float scaleFactor) { _viewContentScaleFactor = scaleFactor; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
UIWindow* _window;
|
UIWindow* _window;
|
||||||
bool _adaptToDeviceOrientation;
|
bool _adaptToDeviceOrientation;
|
||||||
float _viewContentScaleFactor;
|
float _viewContentScaleFactor;
|
||||||
|
|
||||||
friend class GraphicsWindowIOS;
|
friend class GraphicsWindowIOS;
|
||||||
|
|
||||||
@ -169,10 +170,10 @@ class GraphicsWindowIOS : public osgViewer::GraphicsWindow
|
|||||||
void setAdaptToDeviceOrientation(bool flag) { _adaptToDeviceOrientation = flag; }
|
void setAdaptToDeviceOrientation(bool flag) { _adaptToDeviceOrientation = flag; }
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//helper funs for converting points to pixels
|
//helper funs for converting points to pixels
|
||||||
osg::Vec2 pointToPixel(const osg::Vec2& point);
|
osg::Vec2 pointToPixel(const osg::Vec2& point);
|
||||||
osg::Vec2 pixelToPoint(const osg::Vec2& pixel);
|
osg::Vec2 pixelToPoint(const osg::Vec2& pixel);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -194,12 +195,12 @@ class GraphicsWindowIOS : public osgViewer::GraphicsWindow
|
|||||||
GraphicsWindowIOSWindow* _window;
|
GraphicsWindowIOSWindow* _window;
|
||||||
GraphicsWindowIOSGLView* _view;
|
GraphicsWindowIOSGLView* _view;
|
||||||
GraphicsWindowIOSGLViewController* _viewController;
|
GraphicsWindowIOSGLViewController* _viewController;
|
||||||
EAGLContext* _context;
|
EAGLContext* _context;
|
||||||
bool _updateContext;
|
bool _updateContext;
|
||||||
|
|
||||||
bool _ownsWindow, _adaptToDeviceOrientation;
|
bool _ownsWindow, _adaptToDeviceOrientation;
|
||||||
|
|
||||||
float _viewContentScaleFactor;
|
float _viewContentScaleFactor;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,6 +32,14 @@ ELSE ()
|
|||||||
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
|
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF (APPLE)
|
||||||
|
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
||||||
|
# compile FileUtils.cpp as objective-c++
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(FileUtils.cpp
|
||||||
|
PROPERTIES COMPILE_FLAGS "-x objective-c++"
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
SET(LIB_NAME osgDB)
|
SET(LIB_NAME osgDB)
|
||||||
|
Loading…
Reference in New Issue
Block a user