Inviwo Setup for Mac

The steps below detail how to get Inviwo running on a computer with MacOS (tested on High Sierra). The video shows all of those steps as well. In parts it is heavily sped up. Especially the last step - building Inviwo - does take some time. 

If you are working on a new Mac with the Apple Silicon chip, it is currently not easily possible to compile and run Inviwo as one of the dependencies (Qt) does not yet provide a version for the new chip. Closely coordinate with your group to complete the practical Assignment together. 

(Note: The video was created for a prior version of Inviwo. Since then sub modules have been introduced and the newest XCode version uses a slightly different build system (see below for both).)

Play media comment.

Step 1: Installing Dependencies

In order to work with Inviwo, you will need to install Git, XCode, Qt and CMake. If there is some dependency you already have installed, check below if the versions are recent enough.

Git

Download git (Git Download Links to an external site.) and follow the install prompt.

XCode

Install XCode from here: XCode Download Links to an external site.. Make sure your installation contains the Command Line Tools which contain the C++ compiler. Restart after this step.

You can check if installation was successful by running 

xcode-select -p

which will return the location of the Command Line Tools (usually /Library/Developer/CommandLineTools).

If CMake is not successful in finding XCode or a C++ Compiler, open XCode and navigate to XCode -> Preferences.. -> Locations and select your XCode version under Command Line Tools:

CommandLineToolsXCode.png  

QT (>= 5.12)

Install Qt from here: Qt Download Links to an external site.. Choose the MacOs component and then add Qt folder to the CMAKE_PREFIX_PATH environment variable

export CMAKE_PREFIX_PATH=/Users/username/Qt5.12/5.12.4/clang_64/

If the installer claims the size of the install is several Gb large, you probably selected more than just the specified component above.

CMake (>= 3.12)

Use the installer for your Mac OS version from here: CMake Download Links to an external site.

Step 2: Cloning Inviwo

The source code is available on Github. You can clone the Inviwo repository by running

git clone https://github.com/KTHVisualization/inviwo

on the command line (or by using some graphical user interface for git). This will make a local copy of the source code on your computer in the current folder of the command line. Navigate to the newly created folder with

cd inviwo

Then, clone the repositories submodules with 

git submodule update --init --recursive

Step 3: Running CMake

Run the CMakeProgram. In the window that opens you need to specify two paths. The first is the path of the folder with the Inviwo source (this is the folder with the contents of the git repository, so something like /Users/Username/inviwo). The other path is the one where CMake will place the build-files (e.g. /Users/Username/inviwo-output). Specify these two paths and hit the Configure button. 

You will be asked if you want to create the output folder (Yes) and to choose which generator to use. You want to use the XCode generator. This is often already the default setting. Then CMake will do some checks for what system your are using and set up the build environment accordingly.

You will see some variables with either values or checkboxes. These specify which parts of Inviwo we will be using and where certain dependencies are located. If everything worked correctly, you will not have to make any changes here. Continue to press Configure until none of the entries are marked red anymore. However, one common problem is that CMake is unable to find Qt or uses a version that is incorporated into another program. Therefore check that the variables QT_QMAKE_EXECUTABLE (the location where you have installed Qt has a subfolder structure that should be something like /Users/username/Qt5.12/5.12.4/clang_64/bin- specify the qmake file) and the variables Qt5*_DIR (e.g. Qt5Core_DIR should be something like /Users/username/Qt5.12/5.12.4/clang_64/lib/cmake/Qt5Core, again you need the location where you installed Qt) are set to the correct folders.

If all settings are correct and no errors occurred, you can hit Generate.

Step 4: Building Inviwo

The button Open Project should now directly open the Visual Studio solution of Inviwo. You can also navigate to the output folder you have specified and open the file inviwo-projects.xcodeproj from there. You furthermore have to edit the build scheme (Product → Scheme → Edit Scheme...) while ALL_BUILD is selected and set the executable for Run as inviwo.app.

For faster execution you may want to choose Release in the Build Configuration. The Debug mode is needed when you want to step through your code.

Now all that is left to do is build Inviwo (Product → Build) .  If the build fails, you may have to enable the legacy build system (File > Project Settings > Build System: Legacy Build System).

If Inviwo does not start from XCode, you might need to navigate to the folder and open the Inviwo app from there. You will then be asked if it is okay to run programs in this folder. Inviwo should be able to start from XCode as well after confirming this.

Once Inviwo runs on your machine, you can take a look at the different example workspaces (File → Example Workspaces).