PrerequisitesCategory | Software | How to obtain |
---|
Operating system | Windows XP, 7, 8, 8.1 |
| Cross-platform build system | CMake >= 2.8 | Cmake Download | Compiler / Integrated Development Environment | - Microsoft Visual Studio 2010 (OpenSim 3.2 and earlier)
- Microsoft Visual Studio 2013 (OpenSim 3.2 and later)
- Microsoft Visual Studio 2015 (OpenSim 3.3 and later)
- Microsoft Visual Studio Community (same versions)
| | Python access to OpenSim API | - SWIG 2.0.12 (not 3.0+)
- Python 2.7 (tested with 2.7.10)
| swigwin-2.0.12 python-2.7.10 (be sure to get 32 or 64 bit to match your OpenSim build) | Git repository and version control (optional) | Any of the following: - GitBash
- TortoiseGit
- GitHub for Windows
| |
Build SimbodyYou must build and install Simbody first. The instructions below should be sufficient; if you need more detail see the README.md file for the appropriate Simbody branch on GitHub at https://github.com/simbody/simbody (Simbody 3.5.3 build instructions at GitHub). Expand |
---|
title | Abbreviated instructions for building Simbody from source. |
---|
| - Create a local Simbody directory to hold the Simbody source code (e.g. C:/Projects/Simbody)
- Obtain the Simbody source code from its GitHub repository . Look for "releases" and get the right source zip file (3.3.1 for use with OpenSim 3.2, 3.5.3 with OpenSim 3.3). Unzip the Simbody source into your chosen directory; this will create a subdirectory with a name like simbody-Simbody3.5.3.
- Launch CMake:
- Where is the source code? Choose the Simbody source code directory you created in step 2 (e.g. C:/Projects/Simbody/simbody-Simbody3.5.3).
- Where to build the binaries? Choose a build location (e.g. C:/Projects/Simbody/build).
Press the Configure button (near the bottom). Let CMake create the build directory. Choose a “generator” that best matches the compiler you are using, for example “Visual Studio 12 2013”, or "Visual Studio 12 2013 Win64" to make 64-bit binaries. Select “Use default native compilers” and click Finish. - Specify an installation location for Simbody (e.g. CMAKE_INSTALL_PREFIX = C:/Projects/Simbody/install). (Older versions used SimTK_INSTALL_PREFIX for this purpose.)
Hit Configure again. There should be nothing in red now and the Generate button will be available. - Hit Generate, which will create the Visual Studio solution files in the Simbody build directory (e.g., C:/Projects/Simbody/build).
- Go to the directory that you specified as your Simbody build directory. Click on Simbody.sln to launch it in Visual Studio.
- If you want a Debug build, build it first. Select the Debug configuration (selection in the top center of the screen). Otherwise use RelWithDebInfo.
- Build the project ALL_BUILD (right click and select "Build").
- Build RUN_TESTS to make sure everything built correctly.
- Build the project INSTALL to make a local installation of binaries (dll’s and exe’s) and documentation (into, e.g., C:/Projects/Simbody/install).
- If you built a Debug configuration, now repeat steps 10 to 12 in the “RelWithDebInfo” configuration (right click project - Properties - Configuration drop down box). While the debug configuration is very useful for testing and debugging, it will be too slow to use for most purposes. The production configuration we recommend is RelWithDebInfo. That runs just as fast as Release, but keeps extra debugging information around that can be helpful if you encounter a problem.
|
Build OpenSimBuilding OpenSim consists of three primary steps; obtain the source code, generate solution file, then build binaries. 1. Obtain OpenSim Source Code- You can download the OpenSim 3.x source code in a zip file from the OpenSim download page. As of 3.0, this is the main way we are distributing the OpenSim source code.
- Unzip the source to a project folder on your machine (e.g. C:/Projects/OpenSim3x). This will create a subdirectory with a name like OpenSim33-source.
2. Use CMake to Build the Visual Studio Solution (.sln) File- Launch CMake:
- Where is the source code? Choose the OpenSim source code directory you specified (e.g. C:/Projects/OpenSim3x/OpenSim33-source). This designates the folder containing the top-level CMake file named CMakeLists.txt.
- Where to build the binaries? Choose a build location (e.g. C:/Projects/OpenSim3x/build). This designates the folder for compiler files, debug and release sub-folders, etc.
- Press the Configure button (near the bottom). Let CMake create the build directory. Choose a “generator” that best matches the compiler you are using, for example “Visual Studio 12 2013 Win64”. Important: your generator choice must be the same as you used when you built Simbody. Select “Use default native compilers” and click Finish.
- To avoid building the command line utilities and associated tests (faster), check BUILD_API_ONLY. This is an Advanced Option in the CMake GUI.
- Specify an installation location for OpenSim (e.g. CMAKE_INSTALL_PREFIX = C:/OpenSimLocal). You should choose a location for which you have write permission.
- To build python wrapping, set BUILD_PYTHON_WRAPPING to ON.
- Verify that BUILD_USING_NAMESPACE is set to the same value used when building Simbody (Blank is the default).
- Point SIMBODY_HOME (SimTK_INSTALL_DIR in earlier versions) to where you installed Simbody (e.g. C:/Projects/Simbody/install).
- After you hit configure again, make sure Simbody_DIR have been set based on SIMBODY_HOME (these are shown only in Advanced View in CMake)
- Hit Configure again. This time there should be nothing in red and the Generate button will be available.
- Hit "Generate", which will create the Visual Studio solution files in the OpenSim build directory
3. Build Binaries and Install- Click on OpenSim.sln from the OpenSim build directory to launch Visual Studio.
- If you want to build Debug libraries, make sure you are in "Debug" configuration (selection in the top center of the screen). Otherwise use RelWithDebInfo.
- Build the project ALL_BUILD (right click and select "Build").
- Build RUN_TESTS to make sure everything built correctly. Some tests may time-out in the Debug configuration.
- Build the project INSTALL to make a local installation of binaries (dll’s and exe’s) and documentation. The INSTALL may fail if you do not have write permission for the OpenSim install location that you chose in CMake. Running Visual Studio as Administrator (right click on Visual Studio and select "Run as Administrator") should address any permission issues. Note that if you start Visual Studio as Administrator, you will need to navigate to the OpenSim.sln file rather than double clicking it.
- Repeat steps 2 to 5 in the “RelWithDebInfo” configuration (right click project - Properties - Configuration drop down box). While the debug configuration is very useful for testing and debugging, it will be too slow to use for most purposes. The production configuration we recommend is RelWithDebInfo, which runs just as fast as Release, but keeps extra debugging information around that can be helpful if you encounter a problem.
- Ensure the ${install directory}/bin folder is on a path specified in your computer’s PATH environment variable, (e.g., ensure PATH includes C:\OpenSimLocal\bin)
- If you turned on BUILD_PYTHON_WRAPPING above, you can install the "opensim" python package by opening a command window, navigating to C:/OpenSimLocal/sdk/python and running "python setup.py install" from a Command Prompt. See this page for more information and some troubleshooting tips. If you are having trouble, please post to the OpenSim forum.
|