- Overview
- Video
- Steps
- 1.4.1. Find Xcode
- 1.4.2. Authorize at Apple Developer network site
- 1.4.3. Download Xcode
- 1.4.4. Move Xcode to Applications
- 1.4.5. Launch Xcode
- 1.4.6. Agree to open Xcode
- 1.4.7. Accept Xcode and iOS SDK license agreement
- 1.4.8. Provide your password to install additional components
- 1.4.9. Find OpenSceneGraph repository
- 1.4.10. Get latest OpenSceneGraph
- 1.4.11. Create build directory
- 1.4.12. Find and download CMake
- 1.4.13. Install CMake
- 1.4.14. Launch CMake
- 1.4.15. Specify build and source directories
- 1.4.16. Configure OpenSceneGraph
- 1.4.17. Observe configuration notice
- 1.4.18. Generate Xcode project file
- 1.4.19. Build OpenSceneGraph
- 1.4.20. Observe installation error
- 1.4.21. Install OpenSceneGraph
- 1.4.22. Check 'box.osgt' with 'osgviewer'
This tutorial is part of OpenSceneGraph cross-platform guide.
In this tutorial we install OpenSceneGraph under macOS and take a look at the cube with osgviewer tool.
Note: this tutorial requires OpenSceneGraph model created in 1.1. Create a cube.
Video depicts OpenSceneGraph installation under macOS El Capitan (10.11).
Note: steps below use frames from the video as screenshots. Watch the video to see all details.
Xcode is an integrated development environment for macOS. It contains C/C++ compiler that we will use to build OpenSceneGraph.
You need a valid Apple ID to download Xcode.
Choose the latest Xcode version that suits your macOS version. In case of El Capitan, it's Xcode 8.2.
Move Xcode from Downloads directory into Applications directory. This lets CMake, which we install later, find Xcode development tools without additional help.
Since Xcode has been downloaded from the Internet, macOS first verifies the file. This may take up some time.
Since Xcode has been downloaded from the Internet, macOS needs your permission to open the file.
Accept Xcode and iOS SDK license agreement to be able to use the product.
Provide your password to allow Xcode to install necessary additional components like Git and xcodebuild.
Close Xcode after it has been launched.
Find OpenSceneGraph repository at the website.
Get the latest copy of OpenSceneGraph with the following command:
git clone https://github.com/openscenegraph/OpenSceneGraph.git
OpenSceneGraph uses CMake build system, which supports out-of-source builds. We create a build directory to keep generated (built) content separate from the original source.
Find CMake and download its macOS version.
Launch downloaded dmg
package and follow instructions to install CMake.
Open CMake.
Build directory is the one we created to host binaries.
Source directory is the one where we cloned OpenSceneGraph using Git.
Before we can build OpenSceneGraph, we need to configure the build.
Do it by pressing Configure
button.
Make sure to select Xcode
generator when prompted.
By default, OpenSceneGraph libraries are installed into /usr/local/lib
,
which is not where libraries usually reside.
However, macOS El Capitan is aware of /usr/local/lib
location, so we don't
need to do anything about it.
Press Generate
to generate Xcode specific project file.
We are finally ready to build OpenSceneGraph with the following command:
xcodebuild -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=6 -target install -configuration Release
xcodebuild
is a command line utility to build Xcode projects. Of course,
we could use Xcode itself, but then this tutorial would be a lot longer.
Here's a brief overview of the parameters we used:
-IDEBuildOperationMaxNumberOfConcurrentCompileTasks=6
requests 6 parallel jobs to speed up the build process;-target install
makes installation phase start right after the building one;-configuration Release
strips binaries of debug information, which we don't need in this tutorial.
Installation failed, because xcodebuild
needs administrative privileges to
install OpenSceneGraph into /usr/local/lib
.
Run xcodebuild
with administrative privileges using the following command:
sudo xcodebuild -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=6 -target install -configuration Release
Make sure to provide your password for sudo
when prompted.
Finally, take a look at the cube with osgviewer
:
/usr/local/bin/osgviewer /path/to/box.osgt