SoXt Build Instructions for Linux - magic-lantern-studio/mle-documentation GitHub Wiki
[!NOTE] Magic Lantern SDK is now using SoXt v1.4.0. See SoXt 1.4.0 Build Environment for instructions on how to build and install this version.
This page describes how to build the SoXt GUI for Coin 3D.
Table of Contents
SoXt Build Instructions
This page describes how to build the SoXt GUI library for the Ubuntu 16.04 LTS operating system. There are two approaches that may be taken:
- Build from SoXt Github project sponsored by Wizzer Works (https://github.com/coin3d/mle-SoXt).
- Build from the original source code tar package distribution.
The first approach is strongly recommended because it is based on the tar package distribution from the last official release, prior to moving the source to the open source community. The Wizzer Works code base also contains all the modifications made to work with the Magic Lantern Inventor and Rehearsal Player targets.
Building from mle-SoXt Github Project
The build instructions for utilizing the WizzerWorks sponsored code base can be found at https://github.com/coin3d/mle-SoXt/wiki/SoXt-Build-Environment.
Building from tar Package
These instructions focus on building the SoXt GUI library from a tar distribution package. The instructions are geared towards an Ubuntu 16.04 LTS host development platform.
The SoXt package can be downloaded from the Github account: https://github.com/coin3d/mle-SoXt/releases. The package is SoXt-1.3.0.tar.gz.
Dependencies
SoXt has the following dependencies:
sudo apt-get install libmotif-dev libxmu-dev libxpm-dev
Unpack the tar File
Do the following to extract the source:
tar -xvzf SoXt-1.3.0.tar.gz
Configure the Build Directory
Build the libraries and distribution elements (i.e. documentation) in a separate directory. Be sure to enable the HTML and man page generation.
mkdir soxt-build
cd soxt-build
../SoXt-1.3.0/configure --enable-html --enable-man
Build the SoXt Library
Build the SoXt library, libSoXt.so:
make
Install the SoXt Library
To install the library, header files and documentation, do the following:
make install
The library will be installed in /usr/local/lib/libSoXt.so. The header files will be installed in the /usr/local/include directory. HTML pages are populated in the /usr/local/share/doc/soxt/html directory. The manual pages are installed into /usr/local/man.
Viewer Example Code
The following is an example on how to use the SoXt library
#include <Inventor/Xt/SoXt.h>
#include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
#include <Inventor/nodes/SoBaseColor.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/nodes/SoSeparator.h>
int
main(int argc, char ** argv)
{
// Initialize SoXt and Inventor API libraries. This returns a main
// window to use.
Widget mainwin = SoXt::init(argc, argv, argv[0]);
// Make a dead simple scene graph, only containing a single
// yellow cone under the scenegraph root.
SoSeparator * root = new SoSeparator;
root->ref();
SoBaseColor * col = new SoBaseColor;
col->rgb = SbColor(1, 1, 0);
root->addChild(col);
root->addChild(new SoCone);
// Use one of the convenient viewer classes.
SoXtExaminerViewer * eviewer = new SoXtExaminerViewer(mainwin);
eviewer->setSceneGraph(root);
eviewer->show();
// Pop up the main window.
SoXt::show(mainwin);
// Loop until exit.
SoXt::mainLoop();
// Clean up resources.
delete eviewer;
root->unref();
return 0;
}