SoGtk Build Environment - magic-lantern-studio/sogtk GitHub Wiki

This page describes how to build version the SoGtk GUI for Coin 3D. These instructions use the new CMake build environment (autoconf method has been deprecated). Original instructions may be found on the BuildWithCMake wiki page in the coin project.

[!Note] The GTK2 implementation uses v0.1.0 because it never reached compatibility with the other Coin GUI toolkits. Note that GTK2 is essentially deprecated.

The GTK3 implementation plans to use v3.0.0 since this is a port to GTK3 and will attempt to have better compatibility with the other Coin GUI toolkits.

Versions v1.x.x and v2.x.x will be skipped.

Table of Contents

Dependencies

GTK2 Dependencies (SoGtk v0.1.0)

SoGtk for GTK2 has the following dependencies:

sudo apt-get install gtk2.0 libgtk2.0-dev libgtkgl2.0-dev cmake

GTK3 Dependencies (SoGtk v3.0.0)

SoGtk for GTK3 has the following dependencies:

sudo apt-get install libgtk-3-dev cmake

Use the following to determine the version of GTK3 that is installed:

$ dpkg -l libgtk-3-0
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version            Architecture Description
+++-================-==================-============-====================================
ii  libgtk-3-0:amd64 3.24.33-1ubuntu2.2 amd64        GTK graphical user interface library

This shows that version 3.24.33 has been installed.

Download the Source

The Coin 3D SoGtk source code resides on Github (https://github.com/magic-lantern-studio/sogtk). It is in a Git repository and the following commands can be used to retrieve the source.

GTK2 Source

The source for GTK2 compatibility is found in the master branch.

git clone --recurse-submodules https://github.com/magic-lantern-studio/sogtk sogtk

This will create the sogtk directory and set the branch to master, bringing in the sogui modifications made for the Magic Lantern project.

GTK3 Source

The source for the GTK3 compatibility is found in the gtk3 branch.

git clone --recurse-submodules --branch gtk3 https://github.com/magic-lantern-studio/sogtk sogtk

This will create the sogtk directory and set the branch to gtk3, bringing in the sogui modifications made for the Magic Lantern project.

Note that the master branch contains the source from the original Coin3D SoGtk v1.0.0 repository on Github. The master branch will not be modified unless it is necessary to be maintained (i.e. bug fixes) outside the scope of Magic Lantern.

SoGtk Build Instructions

These instructions focus on building the SoGtk GUI library using CMake. The instructions are geared towards an Ubuntu 22.04 LTS host development platform.

Run CMake

Use cmake to generate a build environment with UNIX Makefiles.

cmake -Hsogtk -Bsogtk_build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH="/usr/local" -DSOGTK_BUILD_DOCUMENTATION=OFF

This will create a sogtk_build directory containing the build Makefile hierarchy.

[!Note]

To create a Debug version of SoGtk, use "-DCMAKE_BUILD_TYPE=Debug".

[!Note]

To build the documentation for SoGtk, use "-DSOGTK_BUILD_DOCUMENTATION=ON"

Build SoGtk

Build the SoGtk library, libSoGtk.so:

cd sogtk_build
make

Install SoGtk

To install the library, header files and documentation, do the following:

make install

The library will be installed in /usr/local/lib/libSoGtk.so. The header files will be installed in the /usr/local/include directory. HTML pages are populated in the /usr/local/share/doc/sogtk/html directory. The manual pages are installed into /usr/local/man.