summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt78
1 files changed, 78 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..636cd94
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,78 @@
+###########################################
+## For building with the rest of OpenSim ##
+###########################################
+
+cmake_minimum_required(VERSION 2.6)
+
+# Define project
+PROJECT (LocomotorPrimitives)
+
+INCLUDE_DIRECTORIES(${OpenSim_SOURCE_DIR} ${OpenSim_SOURCE_DIR}/Vendors)
+
+SET(OPENSIM_INSTALL_DIR $ENV{OPENSIM_HOME}
+ CACHE PATH "Top-level directory of OpenSim install")
+
+# Change name of build target
+SET(TARGET exampleMain CACHE TYPE STRING)
+# Identify the cpp file(s) that were to be built
+FILE(GLOB SOURCE_FILES *.h *.cpp)
+SET(SOURCE ${SOURCE_FILES})
+
+# To add Debug feature add ";Debug" after Release on the line below
+SET(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release"
+ CACHE STRING "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored." FORCE )
+
+# Location of headers
+SET(SIMTK_HEADERS_DIR ${OPENSIM_INSTALL_DIR}/sdk/include/SimTK/include)
+SET(OPENSIM_HEADERS_DIR ${OPENSIM_INSTALL_DIR}/sdk/include)
+INCLUDE_DIRECTORIES(${SIMTK_HEADERS_DIR} ${OPENSIM_HEADERS_DIR})
+# Libraries and dlls
+SET(OPENSIM_LIBS_DIR ${OPENSIM_INSTALL_DIR}/sdk/lib)
+SET(OPENSIM_DLLS_DIR ${OPENSIM_INSTALL_DIR}/bin)
+LINK_DIRECTORIES(${OPENSIM_LIBS_DIR} ${OPENSIM_DLLS_DIR})
+
+# Namespace
+SET(NameSpace "OpenSim_" CACHE STRING "Prefix for simtk lib names, includes trailing '_'. Leave empty to use stock SimTK libraries.")
+MARK_AS_ADVANCED(NameSpace)
+
+ADD_EXECUTABLE(${TARGET} ${SOURCE})
+
+TARGET_LINK_LIBRARIES(${TARGET}
+ debug osimSimulation_d optimized osimSimulation
+ debug osimActuators_d optimized osimActuators
+ debug osimCommon_d optimized osimCommon
+ debug osimAnalyses_d optimized osimAnalyses
+ debug osimTools_d optimized osimTools
+ debug ${NameSpace}SimTKcommon_d optimized ${NameSpace}SimTKcommon
+ debug ${NameSpace}SimTKmath_d optimized ${NameSpace}SimTKmath
+ debug ${NameSpace}SimTKsimbody_d optimized ${NameSpace}SimTKsimbody
+ SimTKlapack
+ ${PLATFORM_LIBS}
+)
+
+IF(WIN32)
+ SET(PLATFORM_LIBS pthreadVC2)
+ELSE (WIN32)
+ SET(NameSpace "")
+ IF(APPLE)
+ SET(PLATFORM_LIBS SimTKAtlas)
+ ELSE(APPLE)
+ SET(PLTAFORM_LIBS SimTKAtlas_Lin_generic)
+ ENDIF(APPLE)
+ENDIF (WIN32)
+
+# This block copies the additional files into the running directory
+# For example vtp, obj files. Add to the end for more extentions
+FILE(GLOB DATA_FILES *.vtp *.obj)
+FOREACH (dataFile ${DATA_FILES})
+ ADD_CUSTOM_COMMAND(
+ TARGET ${TARGET}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy
+ ${dataFile}
+ ${OpenSimTugOfWar_BINARY_DIR})
+ ENDFOREACH (dataFile)
+
+MARK_AS_ADVANCED(CMAKE_INSTALL_PREFIX)
+MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH)
+MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH)