1Welcome to the OpenSceneGraph (OSG).
3For up-to-date information on the project, in-depth details on how to
4compile and run libraries and examples, see the documentation on the
9For support subscribe to our public mailing list or forum, details at:
13For the impatient, we've included quick build instructions below, these
14are are broken down is three parts:
16 1) General notes on building the OpenSceneGraph
17 2) OSX release notes
18 3) iOS release notes
20If details below are not sufficient then head over to the openscenegraph.org
21to the Documentation/GettingStarted and Documentation/PlatformSpecifics sections for
22more indepth instructions.
2612th August 2015.
30Section 1. How to build the OpenSceneGraph
33The OpenSceneGraph uses the CMake build system to generate a
34platform-specific build environment. CMake reads the CMakeLists.txt
35files that you'll find throughout the OpenSceneGraph directories,
36checks for installed dependenciesand then generates the appropriate
39If you don't already have CMake installed on your system you can grab
40it from http://www.cmake.org, use version 2.4.6 or later. Details on the
41OpenSceneGraph's CMake build can be found at:
45Under unices (i.e. Linux, IRIX, Solaris, Free-BSD, HP-Ux, AIX, OSX)
46use the cmake or ccmake command-line utils. Note that cmake . defaults
47to building Release to ensure that you get the best performance from
48your final libraries/applications.
50 cd OpenSceneGraph
51 cmake .
53 sudo make install
55Alternatively, you can create an out-of-source build directory and run
56cmake or ccmake from there. The advantage to this approach is that the
57temporary files created by CMake won't clutter the OpenSceneGraph
58source directory, and also makes it possible to have multiple
59independent build targets by creating multiple build directories. In a
60directory alongside the OpenSceneGraph use:
62 mkdir build
63 cd build
64 cmake ../OpenSceneGraph
66 sudo make install
68Under Windows use the GUI tool CMakeSetup to build your VisualStudio
69files. The following page on our wiki dedicated to the CMake build
70system should help guide you through the process:
74Under OSX you can either use the CMake build system above, or use the
75Xcode projects that you will find in the OpenSceneGraph/Xcode
76directory. See release notes on OSX CMake build below.
78For further details on compilation, installation and platform-specific
79information read "Getting Started" guide:
84Section 2. Release notes on OSX build, by Eric Sokolowsky, August 5, 2008
87There are several ways to compile OpenSceneGraph under OSX. The
88recommended way is to use CMake 2.6 to generate Xcode projects, then use
89Xcode to build the library. The default project will be able to build
90Debug or Release libraries, examples, and sample applications. Here are
91some key settings to consider when using CMake:
93BUILD_OSG_EXAMPLES - By default this is turned off. Turn this setting on
94to compile many great example programs.
96CMAKE_OSX_ARCHITECTURES - Xcode can create applications, executables,
97libraries, and frameworks that can be run on more than one architecture.
98Use this setting to indicate the architectures on which to build OSG.
99Possibilities include ppc, ppc64, i386, and x86_64. Building OSG using
100either of the 64-bit options (ppc64 and x86_64) has its own caveats
103OSG_BUILD_APPLICATION_BUNDLES - Normally only executable binaries are
104created for the examples and sample applications. Turn this option on if
105you want to create real OSX .app bundles. There are caveats to creating
106.app bundles, see below.
108OSG_WINDOWING_SYSTEM - You have the choice to use Carbon or X11 when
109building applications on OSX. Under Leopard and later, X11 applications,
110when started, will automatically launch X11 when needed. However,
111full-screen X11 applications will still show the menu bar at the top of
112the screen. Since many parts of the Carbon user interface are not
11364-bit, X11 is the only supported option for OSX applications compiled
114for ppc64 or x86_64.
116There is an Xcode directory in the base of the OSG software
117distribution, but its future is limited, and will be discontinued once
118the CMake project generator completely implements its functionality.
121APPLICATION BUNDLES (.app bundles)
123The example programs when built as application bundles only contain the
124executable file. They do not contain the dependent libraries as would a
125normal bundle, so they are not generally portable to other machines.
126They also do not know where to find plugins. An environmental variable
127OSG_LIBRARY_PATH may be set to point to the location where the plugin
128.so files are located. OSG_FILE_PATH may be set to point to the location
129where data files are located. Setting OSG_FILE_PATH to the
130OpenSceneGraph-Data directory is very useful when testing OSG by running
131the example programs.
133Many of the example programs use command-line arguments. When
134double-clicking on an application (or using the equivalent "open"
135command on the command line) only those examples and applications that
136do not require command-line arguments will successfully run. The
137executable file within the .app bundle can be run from the command-line
138if command-line arguments are needed.
14164-BIT APPLICATION SUPPORT
143OpenSceneGraph will not compile successfully when OSG_WINDOWING_SYSTEM is
144Carbon and either x86_64 or ppc64 is selected under CMAKE_OSX_ARCHITECTURES,
145as Carbon is a 32bit only API. A version of the osgviewer library written in
146Cocoa is needed. However, OSG may be compiled under 64-bits if the X11
147windowing system is selected. However, Two parts of the OSG default
148distribution will not work with 64-bit X11: the osgviewerWX example
149program and the osgdb_qt (Quicktime) plugin. These must be removed from
150the Xcode project after Cmake generates it in order to compile with
15164-bit architectures. The lack of the latter means that images such as
152jpeg, tiff, png, and gif will not work, nor will animations dependent on
153Quicktime. A new ImageIO-based plugin is being developed to handle the
154still images, and a QTKit plugin will need to be developed to handle
158Section 3. Release notes on iOS build, by Thomas Hoghart
161* Run CMake with either OSG_BUILD_PLATFORM_IPHONE or OSG_BUILD_PLATFORM_IPHONE_SIMULATOR set:
162 $ mkdir build-iOS ; cd build-iOS
163 $ ccmake -DOSG_BUILD_PLATFORM_IPHONE_SIMULATOR=YES -G Xcode ..
164* Check that CMAKE_OSX_ARCHITECTURE is i386 for the simulator or armv6;armv7 for the device
165* Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS
166 This will give us the static build we need for iPhone.
167* Disable OSG_GL1_AVAILABLE, OSG_GL2_AVAILABLE, OSG_GL3_AVAILABLE,
168 OSG_GL_DISPLAYLISTS_AVAILABLE, OSG_GL_VERTEX_FUNCS_AVAILABLE
169* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE *OR* OSG_GLES3_AVAILABLE (GLES3 will enable GLES2 features)
170* Ensure OSG_WINDOWING_SYSTEM is set to IOS
171* Change FREETYPE include and library paths to an iPhone version
172 (OpenFrameworks has one bundled with its distribution)
173* Ensure that CMake_OSX_SYSROOT points to your iOS SDK.
174* Generate the Xcode project
175* Open the Xcode project
176 $ open OpenSceneGraph.xcodeproj
177* Under Sources -> osgDB, select FileUtils.cpp and open the 'Get Info' panel, change File Type
178 to source.cpp.objcpp
180Here's an example for the command-line:
181$ cmake -G Xcode \
182-D OSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
183-D CMAKE_CXX_FLAGS:STRING="-ftree-vectorize -fvisibility-inlines-hidden -mno-thumb -arch armv6 -pipe -no-cpp-precomp -miphoneos-version-min=3.1 -mno-thumb" \
184-D BUILD_OSG_APPLICATIONS:BOOL=OFF \
185-D OSG_BUILD_FRAMEWORKS:BOOL=OFF \
186-D OSG_WINDOWING_SYSTEM:STRING=IOS \
187-D OSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
188-D CMAKE_OSX_ARCHITECTURES:STRING="armv6;armv7" \
189-D CMAKE_OSX_SYSROOT:STRING=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk \
190-D OSG_GL1_AVAILABLE:BOOL=OFF \
191-D OSG_GL2_AVAILABLE:BOOL=OFF \
192-D OSG_GLES1_AVAILABLE:BOOL=ON \
193-D OSG_GL_DISPLAYLISTS_AVAILABLE:BOOL=OFF \
194-D OSG_GL_FIXED_FUNCTION_AVAILABLE:BOOL=ON \
195-D OSG_GL_LIBRARY_STATIC:BOOL=OFF \
196-D OSG_GL_MATRICES_AVAILABLE:BOOL=ON \
197-D OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE:BOOL=ON \
198-D OSG_GL_VERTEX_FUNCS_AVAILABLE:BOOL=OFF \
199-D DYNAMIC_OPENSCENEGRAPH:BOOL=OFF \
200-D DYNAMIC_OPENTHREADS:BOOL=OFF .
204* When Linking final app against ive plugin, you need to add -lz to
205 the 'Other linker flags' list.
206* Apps and exes don't get created
207* You can only select Simulator, or Device projects. In the XCode
208 project you will see both types but the sdk they link will
209 be the same.