-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
522 lines (447 loc) · 19.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
PROJECT (OpenSim)
#
# Build of OpenSim. There are three steps:
# (1) Choose appropriate platform
# (2) Locate Simbody and its dependent libraries
# (3) Build OpenSim libraries and executables
#
#
#----------------------------------------------------
cmake_minimum_required(VERSION 2.6)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0005 NEW)
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
# MACOSX_RPATH enabled by default; policy introduced with cmake 3.0.
cmake_policy(SET CMP0042 NEW)
endif()
endif(COMMAND cmake_policy)
# OPENSIM_LIBRARY_PREFIX
# This is used to allow the OpenSim 3 binaries to sit next to OpenSim 4 binaries without name clashes
SET( OPENSIM_LIBRARY_PREFIX "osim" CACHE STRING "All OpenSim libraries will start with this prefix" )
SET(BUILD_BINARY_DIR ${CMAKE_BINARY_DIR}
CACHE PATH
"The OpenSim build (not the install) puts all the libraries and executables together here (with /Release, etc. appended on some platforms).")
# Make everything go in the same binary directory. (These are CMake-defined
# variables.)
SET(EXECUTABLE_OUTPUT_PATH ${BUILD_BINARY_DIR})
SET(LIBRARY_OUTPUT_PATH ${BUILD_BINARY_DIR})
# Use this to generate a private set of libraries whose names
# won't conflict with installed versions.
SET(BUILD_USING_NAMESPACE "" CACHE STRING
"All library names will be prefixed with 'xxx_' if this is set to xxx.")
SET(NameSpace)
IF(BUILD_USING_NAMESPACE)
SET(NameSpace "${BUILD_USING_NAMESPACE}_")
ENDIF(BUILD_USING_NAMESPACE)
# Simbody.
# --------
# This will be initialized to the environment variable of the same name
# if it is set, otherwise it will be empty.
SET(SIMBODY_HOME $ENV{SIMBODY_HOME} CACHE
PATH "The location of the Simbody installation to use; you can change this. Set as empty to let CMake search for Simbody automatically.")
# Specify number of cores to run for build
SET(PROCESSOR_COUNT 8 CACHE STRING "Number of processors in the CPU")
MARK_AS_ADVANCED(PROCESSOR_COUNT)
#
# These are the names of all the libraries we depend on. These are
# target names so can be used to specify dependencies of one library
# on another. (In Debug mode the actual targets will have "_d" appended.)
#
SET(SimTKSIMBODY_LIBRARY_NAME ${NameSpace}SimTKsimbody CACHE STRING
"Base name of the library being built; can't be changed here; see BUILD_USING_NAMESPACE variable."
FORCE)
SET(SimTKMATH_LIBRARY_NAME ${NameSpace}SimTKmath CACHE STRING
"Base name of the library being built; can't be changed here; see BUILD_USING_NAMESPACE variable."
FORCE)
SET(SimTKCOMMON_LIBRARY_NAME ${NameSpace}SimTKcommon CACHE STRING
"Base name of the library being built; can't be changed here; see BUILD_USING_NAMESPACE variable."
FORCE)
MARK_AS_ADVANCED( SimTKSIMBODY_LIBRARY_NAME )
MARK_AS_ADVANCED( SimTKMATH_LIBRARY_NAME )
MARK_AS_ADVANCED( SimTKCOMMON_LIBRARY_NAME )
SET(SimTKCOMMON_SHARED_LIBRARY ${SimTKCOMMON_LIBRARY_NAME})
SET(SimTKMATH_SHARED_LIBRARY ${SimTKMATH_LIBRARY_NAME})
SET(SimTKSIMBODY_SHARED_LIBRARY ${SimTKSIMBODY_LIBRARY_NAME})
#
## Platform
#
# Create a platform name useful for finding things in the Platform
# directory.
IF(WIN32)
SET(Platform "Windows")
SET(NATIVE_COPY_CMD copy)
ELSEIF(APPLE)
SET(Platform Mac)
SET(PLATFORM_NAME Mac)
SET(NATIVE_COPY_CMD cp)
ELSE()
SET(Platform Linux)
SET(PLATFORM_NAME Linux)
SET(NATIVE_COPY_CMD cp)
ENDIF()
# In addition to the platform name we need to know the Application Binary
# Interface (ABI) we're building for. Currently that is either x86, meaning
# 32 bit Intel instruction set, or x64 for 64 bit Intel instruction set.
# Kevin: Since Ubuntu 12 64bit libraries are in lib not lib64 (This in
# response of Sherm's change on Simbody)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(PLATFORM_ABI x64)
SET(ARCH64 ON)
# SET(LIB64 64) Ubuntu 12.05
ELSE()
SET(PLATFORM_ABI x86)
ENDIF()
SET(BUILD_PLATFORM "${PLATFORM_NAME}:${PLATFORM_ABI}" CACHE STRING
"This is the platform and ABI we're building for. Not changeable here; use a different CMake generator instead."
FORCE)
IF(UNIX AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release build" FORCE)
ENDIF (UNIX AND NOT CMAKE_BUILD_TYPE)
## Choose the maximum level of x86 instruction set that the compiler is
## allowed to use. SSE2 is ubiquitous enough now that we don't mind
## abandoning machines that can't handle those instructions. SSE3 might
## also be reasonable by now (April 2009) so this default should be
## revisited soon. This can be set to a different value by the person
## running CMake.
SET(BUILD_INST_SET "" # use SSE2 instruction set by default
CACHE STRING "CPU instruction level compiler is permitted to use.")
MARK_AS_ADVANCED( BUILD_INST_SET )
## When building in any of the Release modes, tell gcc to use full optimization and
## to generate SSE2 floating point instructions. Here we are specifying *all* of the
## Release flags, overriding CMake's defaults.
## Watch out for optimizer bugs in particular gcc versions!
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" OR
${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
# C++17.
# ------
# If using either of these compilers, provide the option of
# compiling using the c++17 standard.
OPTION(OPENSIM_STANDARD_17
"Compile using the C++17 standard, if using GCC or Clang." ON)
IF(OPENSIM_STANDARD_17)
# Using C++11 on OSX requires using libc++ instead of libstd++.
# libc++ is an implementation of the C++ standard library for OSX.
IF(APPLE)
IF(XCODE)
SET(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
SET(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()
ENDIF()
ELSE() # not APPLE
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
ENDIF()
ENDIF()
if(BUILD_INST_SET)
string(TOLOWER ${BUILD_INST_SET} GCC_INST_SET)
set(GCC_INST_SET "-m${GCC_INST_SET}")
else()
set(GCC_INST_SET)
endif()
# Get the gcc version number in major.minor.build format
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
# Unrolling fixed-count loops is a useful optimization for Simmatrix.
SET(GCC_OPT_ENABLE "-funroll-loops")
# If you know of optimization bugs that affect SimTK in particular
# gcc versions, this is the place to turn off those optimizations.
SET(GCC_OPT_DISABLE)
# C++
SET(CMAKE_CXX_FLAGS_DEBUG "-g ${GCC_INST_SET}"
CACHE STRING "g++ Debug build compile flags" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE
"-DNDEBUG -O3 ${GCC_OPT_ENABLE} ${GCC_OPT_DISABLE} ${GCC_INST_SET}"
CACHE STRING "g++ Release build compile flags" FORCE)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-DNDEBUG -O3 -g ${GCC_OPT_ENABLE} ${GCC_OPT_DISABLE} ${GCC_INST_SET}"
CACHE STRING "g++ RelWithDebInfo build compile flags" FORCE)
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${GCC_INST_SET}"
CACHE STRING "g++ MinSizeRel build compile flags" FORCE)
# C
SET(CMAKE_C_FLAGS_DEBUG "-g ${GCC_INST_SET}"
CACHE STRING "gcc Debug build compile flags" FORCE)
SET(CMAKE_C_FLAGS_RELEASE
"-DNDEBUG -O3 ${GCC_OPT_ENABLE} ${GCC_OPT_DISABLE} ${GCC_INST_SET}"
CACHE STRING "gcc Release build compile flags" FORCE)
SET(CMAKE_C_FLAGS_RELWITHDEBINFO
"-DNDEBUG -O3 -g ${GCC_OPT_ENABLE} ${GCC_OPT_DISABLE} ${GCC_INST_SET}"
CACHE STRING "gcc RelWithDebInfo build compile flags" FORCE)
SET(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os ${GCC_INST_SET}"
CACHE STRING "gcc MinSizeRel build compile flags" FORCE)
ENDIF()
## When building in any of the Release modes, tell VC++ cl compiler to use intrinsics
## (i.e. sqrt instruction rather than sqrt subroutine) with flag /Oi.
IF(WIN32 AND ${CMAKE_C_COMPILER} MATCHES "cl")
# STRING(TOUPPER ${BUILD_INST_SET} CL_INST_SET)
set(BUILD_LIMIT_PARALLEL_COMPILES "" CACHE STRING
"Set a maximum number of simultaneous compilations.")
mark_as_advanced(BUILD_LIMIT_PARALLEL_COMPILES)
set(mxcpu ${BUILD_LIMIT_PARALLEL_COMPILES}) # abbreviation
## C++
SET(CMAKE_CXX_FLAGS_DEBUG
"/MP${mxcpu} /D _DEBUG /MDd /Od /Ob0 /RTC1 /Zi /bigobj /GS- "
CACHE STRING "VC++ Debug build compile flags" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE
"/MP${mxcpu} /D NDEBUG /MD /O2 /Ob2 /Oi /bigobj /GS- "
CACHE STRING "VC++ Release build compile flags" FORCE)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"/MP${mxcpu} /D NDEBUG /MD /O2 /Ob2 /Oi /Zi /bigobj /GS- "
CACHE STRING "VC++ RelWithDebInfo build compile flags" FORCE)
SET(CMAKE_CXX_FLAGS_MINSIZEREL
"/MP${mxcpu} /D NDEBUG /MD /O1 /Ob1 /Oi /bigobj /GS- "
CACHE STRING "VC++ MinSizeRel build compile flags" FORCE)
## C
SET(CMAKE_C_FLAGS_DEBUG
"/MP${mxcpu} /D _DEBUG /MDd /Od /Ob0 /RTC1 /Zi /GS- "
CACHE STRING "VC++ Debug build compile flags" FORCE)
SET(CMAKE_C_FLAGS_RELEASE
"/MP${mxcpu} /D NDEBUG /MD /O2 /Ob2 /Oi /GS- "
CACHE STRING "VC++ Release build compile flags" FORCE)
SET(CMAKE_C_FLAGS_RELWITHDEBINFO
"/MP${mxcpu} /D NDEBUG /MD /O2 /Ob2 /Oi /Zi /GS- "
CACHE STRING "VC++ RelWithDebInfo build compile flags" FORCE)
SET(CMAKE_C_FLAGS_MINSIZEREL
"/MP${mxcpu} /D NDEBUG /MD /O1 /Ob1 /Oi /GS- "
CACHE STRING "VC++ MinSizeRel build compile flags" FORCE)
ENDIF()
SET(BUILD_PYTHON_WRAPPING OFF CACHE BOOL "Build Python wrapping (needed if you're building the Python wrapping and have SWIG and Python installed on your machine.)")
MARK_AS_ADVANCED( BUILD_PYTHON_WRAPPING )
# You can enable this advanced-variable feature to cause Visual Studio
# or Makefiles to print the compile/link commands they are executing. Very
# useful for debugging CMake stuff but messy and obscures errors and warnings
# so should be off by default.
SET(CMAKE_VERBOSE_MAKEFILE OFF CACHE BOOL
"Enable this for verbose build output.")
IF(WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ELSE(WIN32)
ENDIF(WIN32)
##################################################
## Define Platform to
## Win32/VC${version}
## or Mac
## or Linux
##
## Also translate ARCH64 to platform specific flags
##
##################################################
INCLUDE(InstallRequiredSystemLibraries)
# Disable Build using the simtk headers and libraries checked in the repository.
SET(USE_LIBRARIES_FROM_REPOSITORY OFF)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
SET(BUILD_USING_NAMESPACE "OpenSim")
# Find Simbody.
# -------------
# As of Simbody 3.4, Simbody has a SimbodyConfig.cmake file, which is a
# preferred way to find Simbody over the previous FindSimbody.cmake script.
# NO_MODULE means we will not allow the use of a FindSimbody.cmake script.
SET(SIMBODY_VERSION_TO_USE 3.5)
# Find Simbody freshly by unsetting this CMake-generated variable.
UNSET(Simbody_DIR CACHE)
IF("${SIMBODY_HOME}" STREQUAL "")
# We assume the only case in which the user
# wants us to search for Simbody is if they left SIMBODY_HOME empty.
# If the user specifies an invalid SIMBODY_HOME by accident,
# we shouldn't let that fail silently and still search for
# Simbody elsewhere; they may never realize
# we are not using their requested installation of Simbody.
FIND_PACKAGE(Simbody ${SIMBODY_VERSION_TO_USE}
NO_MODULE)
ELSE()
# Find the package using the user-specified path.
# NO_DEFAULT_PATH will cause find_package to only
# look in the provided PATHS.
FIND_PACKAGE(Simbody ${SIMBODY_VERSION_TO_USE}
PATHS "${SIMBODY_HOME}" NO_MODULE NO_DEFAULT_PATH)
ENDIF()
# This variable appears in the CMake GUI and could confuse users,
# since this variable can't be changed manually.
MARK_AS_ADVANCED(Simbody_DIR)
include_directories(${Simbody_INCLUDE_DIR})
link_directories(${Simbody_LIB_DIR})
# MESSAGE("Simbody_LIB_DIR="${Simbody_LIB_DIR})
# MESSAGE("Simbody_BIN_DIR="${Simbody_BIN_DIR})
# MESSAGE("Simbody_INCLUDE_DIR="${Simbody_INCLUDE_DIR})
# Determine which math libraries to use for this platform.
SET(BUILD_USING_OTHER_LAPACK "" CACHE STRING
"If you have your own Lapack, put its library basename here. Default is to use lapack.")
set(default_lapack_libs "lapack;blas")
if (WIN32)
set(default_lapack_libs "liblapack;libblas")
endif()
SET(LAPACK_BEING_USED ${default_lapack_libs} CACHE STRING
"Basename of the actual Lapack library we're depending on; can't change here; see variable BUILD_USING_OTHER_LAPACK." FORCE)
IF(BUILD_USING_OTHER_LAPACK)
SET(LAPACK_BEING_USED ${BUILD_USING_OTHER_LAPACK} CACHE STRING
"Basename of the actual Lapack library we're depending on; can't change here; see variable BUILD_USING_OTHER_LAPACK." FORCE)
ENDIF(BUILD_USING_OTHER_LAPACK)
#IF(${CMAKE_C_COMPILER} MATCHES "cl")
## Assume Microsoft Visual Studio
# SET(MATH_LIBS_TO_USE ${LAPACK_BEING_USED} pthreadVC2)
#ELSE(${CMAKE_C_COMPILER} MATCHES "cl")
# IF(APPLE)
# SET(REALTIME_LIB)
# ELSE()
# SET(REALTIME_LIB rt)
# ENDIF()
#SET(MATH_LIBS_TO_USE ${LAPACK_BEING_USED} pthread ${REALTIME_LIB} dl)
#ENDIF(${CMAKE_C_COMPILER} MATCHES "cl")
IF(${CMAKE_C_COMPILER} MATCHES "cc" OR ${CMAKE_C_COMPILER} MATCHES "clang")
IF(APPLE)
SET(REALTIME_LIB)
ELSE()
SET(REALTIME_LIB rt)
ENDIF()
SET(MATH_LIBS_TO_USE ${LAPACK_BEING_USED} pthread ${REALTIME_LIB} dl)
SET(MATH_LIBS_TO_USE_VN ${LAPACK_BEING_USED} pthread ${REALTIME_LIB} dl)
ELSE()
## Assume Microsoft Visual Studio
if(${PLATFORM_ABI} MATCHES "x64")
SET(MATH_LIBS_TO_USE ${LAPACK_BEING_USED} pthreadVC2_x64)
SET(MATH_LIBS_TO_USE_VN ${LAPACK_BEING_USED} pthreadVC2_x64)
else()
SET(MATH_LIBS_TO_USE ${LAPACK_BEING_USED} pthreadVC2)
SET(MATH_LIBS_TO_USE_VN ${LAPACK_BEING_USED} pthreadVC2)
endif()
ENDIF()
# Copy libraries from ${SIMTK_BIN_DIR} to ${BUILD_BINARY_DIR}
FILE(GLOB LIB_FILES "${Simbody_LIB_DIR}/*.a"
"${Simbody_LIB_DIR}/*.so"
"${Simbody_LIB_DIR}/*.so.*"
"${Simbody_LIB_DIR}/*.dylib"
"${Simbody_BIN_DIR}/*.dll"
S "${Simbody_BIN_DIR}/*") # .dll, .exe, no suffix executable
# This is where we're going to put these binaries.
SET(COPIED_LIB_FILES)
FOREACH(LIBF ${LIB_FILES})
GET_FILENAME_COMPONENT(LIBF_ROOT ${LIBF} NAME)
SET(COPIED_LIB_FILES ${COPIED_LIB_FILES}
"${BUILD_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LIBF_ROOT}")
ENDFOREACH()
# This target depends on the destination copies of the Simbody files (in the
# binary build directory). Those are produced by the OUTPUT custom command
# below, which depends on the source files from the Simbody installation
# directory.
ADD_CUSTOM_TARGET(SimbodyFiles ALL DEPENDS ${COPIED_LIB_FILES})
SET_TARGET_PROPERTIES(SimbodyFiles
PROPERTIES PROJECT_LABEL "Library - Simbody Files")
FOREACH(LIBF ${LIB_FILES})
# MESSAGE("LIB_FILE" ${LIBF})
GET_FILENAME_COMPONENT(LIBF_ROOT ${LIBF} NAME)
GET_FILENAME_COMPONENT(LIBF_SUFFIX ${LIBF} EXT)
SET(COPIED_LIBF "${BUILD_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LIBF_ROOT}")
FILE(TO_NATIVE_PATH "${LIBF}" LIBF_SRC)
FILE(TO_NATIVE_PATH "${COPIED_LIBF}" LIBF_DEST)
# Copy Simbody files if they are out of date. This is invoked because
# the SimbodyFiles target depends on these output files.
ADD_CUSTOM_COMMAND(OUTPUT "${COPIED_LIBF}"
COMMAND ${NATIVE_COPY_CMD} "${LIBF_SRC}" "${LIBF_DEST}"
DEPENDS "${LIBF}"
COMMENT "Copy ${LIBF_SRC} -> ${LIBF_DEST}"
VERBATIM)
ENDFOREACH()
INSTALL(DIRECTORY ${Simbody_INCLUDE_DIR} DESTINATION sdk/include/SimTK
PATTERN ".svn" EXCLUDE)
SET(OPENSIM_INSTALL_PACKAGE_BUILD OFF CACHE BOOL "Build an installer (to post on simtk.org)")
MARK_AS_ADVANCED(OPENSIM_INSTALL_PACKAGE_BUILD)
IF(OPENSIM_INSTALL_PACKAGE_BUILD)
IF(WIN32)
SET(VTK_LIB_DIR ${OpenSim_SOURCE_DIR}/Vendors/vtk_dll/${PLATFORM_ABI}/ CACHE PATH "Prebuilt VTK-shared libraries")
ENDIF(WIN32)
ENDIF(OPENSIM_INSTALL_PACKAGE_BUILD)
SET(OpenSim_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH})
SET(OpenSim_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH})
# Other than Windows we can debug without debuggable SimTK libraries
IF(WIN32)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ELSE(WIN32)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Suffix for debug libraries")
ENDIF(WIN32)
#
IF(WIN32 AND USE_LIBRARIES_FROM_REPOSITORY)
INCLUDE_DIRECTORIES(${SIMTK_INCLUDE_DIR} ${SIMTK_INCLUDE_DIR}/${Platform} )
ELSE(WIN32 AND USE_LIBRARIES_FROM_REPOSITORY)
INCLUDE_DIRECTORIES(${Simbody_INCLUDE_DIR})
ENDIF(WIN32 AND USE_LIBRARIES_FROM_REPOSITORY)
IF(WIN32)
LINK_DIRECTORIES(${Simbody_LIB_DIR} ${OpenSim_LIBRARY_DIR})
ELSE(WIN32)
IF(APPLE)
LINK_DIRECTORIES(${Simbody_LIB_DIR} ${OpenSim_LIBRARY_DIR})
ELSE(APPLE) # Linux?
LINK_DIRECTORIES(${Simbody_LIB_DIR}/ ${OpenSim_LIBRARY_DIR})
ENDIF(APPLE)
ENDIF(WIN32)
SET(SIMTK_COMMON_LIB debug ${NameSpace}SimTKcommon${CMAKE_DEBUG_POSTFIX} optimized ${NameSpace}SimTKcommon)
SET(SIMTK_MATH_LIB debug ${NameSpace}SimTKmath${CMAKE_DEBUG_POSTFIX} optimized ${NameSpace}SimTKmath)
SET(SIMTK_SIMBODY_LIB debug ${NameSpace}SimTKsimbody${CMAKE_DEBUG_POSTFIX} optimized ${NameSpace}SimTKsimbody)
SET(SIMTK_ALL_LIBS ${SIMTK_COMMON_LIB}
${SIMTK_MATH_LIB}
${SIMTK_SIMBODY_LIB}
${MATH_LIBS_TO_USE})
# Now figure out which 3rd party files need to be installed in the /bin
# directory and which in the lib directory. Executables go in /bin on all
# platforms. Libraries (shared or otherwise) go in /lib, except on Windows
# where the ".dll" files go in bin along with executables. Anything that
# is only needed for programmers goes in sdk/lib.
IF(WIN32)
FILE(GLOB THIRDPARTY_BIN_FILES
${Simbody_BIN_DIR}/*.dll # non repository layout
${Simbody_BIN_DIR}/*.exe)
FILE(GLOB THIRDPARTY_SDKLIB_FILES
${Simbody_LIB_DIR}/*.lib)
ELSE(WIN32)
FILE(GLOB THIRDPARTY_BIN_FILES
${Simbody_BIN_DIR}/*) # executables only (e.g. Visualizer)
FILE(GLOB THIRDPARTY_LIB_FILES
${Simbody_LIB_DIR}/*.so
${Simbody_LIB_DIR}/*.so.*
${Simbody_LIB_DIR}/*.dylib)
FILE(GLOB THIRDPARTY_SDKLIB_FILES
${Simbody_LIB_DIR}/*.a)
ENDIF(WIN32)
# Specify "PROGRAMS" rather than "FILES" so the execute bit gets set.
INSTALL(PROGRAMS ${THIRDPARTY_BIN_FILES}
DESTINATION bin)
INSTALL(FILES ${THIRDPARTY_LIB_FILES} DESTINATION lib)
INSTALL(FILES ${THIRDPARTY_SDKLIB_FILES} DESTINATION sdk/lib)
## These INSTALL commands should go into proper subdirectories
IF(WIN32)
IF(OPENSIM_INSTALL_PACKAGE_BUILD)
# Install windows runtime libraries to support prebuilt libraries
# and redistributable
INSTALL_FILES(/bin/ FILES
${OpenSim_SOURCE_DIR}/Vendors/vtk_dll/msvcr71.dll
${OpenSim_SOURCE_DIR}/Vendors/vtk_dll/msvcp71.dll)
ENDIF(OPENSIM_INSTALL_PACKAGE_BUILD)
ENDIF(WIN32)
## The following are required to uses Dart and the Cdash dashboard per Jesse
ENABLE_TESTING()
INCLUDE(CTest)
# Sets the number of CPUs testing would use
SET (cmd ${CMAKE_CTEST_COMMAND} -j${PROCESSOR_COUNT})
IF (MSVC)
SET (cmd ${cmd} -C ${CMAKE_CFG_INTDIR})
ELSE (MSVC)
SET (cmd ${cmd} -C ${CMAKE_BUILD_TYPE})
ENDIF (MSVC)
ADD_CUSTOM_TARGET (RUN_TESTS_PARALLEL
COMMAND ${cmd}
)
#-----------------------------------------------------------------------------
SET(BUILD_API_ONLY OFF CACHE BOOL "Build API only (headers and libs, no GUI or Applications")
MARK_AS_ADVANCED( BUILD_API_ONLY )
IF(BUILD_API_ONLY)
SUBDIRS(Vendors OpenSim)
SET(OPENSIM_INSTALL_PACKAGE_BUILD OFF)
ELSE(BUILD_API_ONLY)
IF(OPENSIM_INSTALL_PACKAGE_BUILD)
SUBDIRS(Vendors OpenSim Applications )
ELSE(OPENSIM_INSTALL_PACKAGE_BUILD)
SUBDIRS(Vendors OpenSim Applications )
ENDIF(OPENSIM_INSTALL_PACKAGE_BUILD)
ENDIF(BUILD_API_ONLY)