The topics covered in this section include:
The requirements and examples in this guide are targeted for users running Windows or Mac OSX with Windows BootCamp or VMWare since the OpenSim application and libraries are built for Windows. (Note, for those that are familiar with CMake and the compilers for their operating system, it is possible to build the OpenSim libraries from source, but that is currently beyond the scope of this guide.) To run the examples provided in the developer's guide, you will need:
- CMake 2.6 or later (http://www.cmake.org/cmake/resources/software.html)
- Visual Studio Express 2013 (https://www.visualstudio.com/vs/older-downloads/) (for OpenSim 3.3)
- The latest version of OpenSim installed
Each of these programs is described below in more detail.
We also recommend the following tools:
- An XML Editor for editing model and setup files, for example:
CMake is a cross-platform open-source build system that will setup the build environment in a compiler-independent manner. Simple configuration files placed in each source directory (called CMakeLists.txt files) are used to generate standard build files (e.g., Makefiles on Unix and projects/solution in Windows MSVC) which are then loaded into a compiler such as Visual Studio, for further programming and compilation. In the OpenSim API examples, you will use CMake to generate the correct build "solution" files for Visual Studio.
You will need CMake 2.6.0 or later. The latest CMake version is freely available from:
Documentation for CMake is available from: http://www.cmake.org/cmake/help/cmake2.6docs.html.
Here is a fantastic slideshow, in PDF format, that describes why one would use CMake, what it does, and the basic CMake commands: learning_cmake.pdf
Visual Studio Express (VS) is a free Windows compiler that program developers at any level can use to create custom applications using basic and expert settings for the Windows operating system. In the OpenSim API examples, VS is used to view, edit and add new C++ code, and compile the resulting program to an executable or plug-in.
Install Visual Studio Express 2013 from https://www.visualstudio.com/vs/older-downloads/. We recommend this version of Visual Studio because it is the same version used to compile OpenSim itself. However, obtaining Visual Studio Express 2013 is no longer very easy; you must have a (free) "Visual Studio Subscription". In some cases, you may be able to get away with using Visual Studio 2017, from https://www.visualstudio.com/vs/. In particular, the Depreciated_CPP_From the Ground Up: Building a Passive Dynamic Walker Model example works with Visual Studio 2017.
If you are using the API on a windows machine, Simbody 3 binaries are included with OpenSim.
If you are using the API on Mac or Linux, you will need to build the Simbody 3.x release from source; see Building OpenSim from Source for instructions. Note that you are only required to build Simbody from source, not OpenSim.
1. Due to incompatibility between various versions of Microsoft Visual Studio, you need to download/install the distribution of OpenSim that is consistent with your development environment. The filename for the downloads describe which version of Visual Studio was used to build OpenSim (e.g., VC13 for Visual Studio 2013). To install OpenSim, which uses the OpenSim API, download the self-extracting executable from the download page of OpenSim (go to http://simtk.org/home/opensim and click on "Downloads"). The API is accessible with installation of the OpenSim application. Remember to make a note of where you installed OpenSim, which will be referred to as <OpenSimInstallDir>, which by default is "C:\OpenSim 3.x".
2. Run the executable, following the on-line instructions.
To be able to run the main programs from the command line (outside Visual Studio), you need to add the OpenSim libraries to your PATH. This can be done during installation by selecting the radio button as illustrated below.
Warning: Earlier installations of OpenSim will continue to be accessible but only through the GUI, which sets its own environment (PATH) variable.
3. Make sure your system PATH contains only your <OpenSimInstallDir>\bin (e.g., "C:\OpenSim 3.x\bin"). You can check this by going to Start->configuration screen->system->advanced system settings->environmental variables->system variables->Path. If the correct OpenSim\bin path is not included, then add this to your PATH. Also, make sure that no other OpenSim "\bin" directory is in your PATH. If you've ever built OpenSim from source code, make sure no directory containing .lib or .dll files for OpenSim are present in your PATH either. If you don't do this, OpenSim may get confused and possibly use .dll and .lib files from other/older versions of OpenSim instead of the files from the current version of OpenSim and you will likely experience run-time errors.
Advanced Users: Building from Source
Rather than installing from pre-built libraries, advanced users can build Simbody and OpenSim from the source code. This is an option, for example, when pre-built binaries are not available for your platform. Simbody source files can be downloaded from the OpenSim downloads page or from the Simbody GitHub repository. OpenSim source files can be downloaded from the downloads page. Detailed instructions on obtaining the source code and setting up your build environment are available on the Building OpenSim from Source page.
Obtaining the Example Programs
The examples using the OpenSim API come with the OpenSim distribution and are located in the <OpenSimInstallDir>\sdk\APIExamples directory of your OpenSim installation.