-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
1031 lines (915 loc) · 24.3 KB
/
CMakeLists.txt
File metadata and controls
1031 lines (915 loc) · 24.3 KB
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
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.16.3)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
project(momentum)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Needed by mt_defs.cmake
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
include(cmake/mt_defs.cmake)
# Print intro
message(STATUS "")
message(STATUS "============================================")
message(STATUS " Momentum")
message(STATUS "============================================")
message(STATUS "")
# Print OS and architecture information
message(STATUS "[ System Info ]")
message(STATUS "- Operating System : ${CMAKE_SYSTEM_NAME}")
message(STATUS "- Processor Arch : ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "")
# Print build tool information
message(STATUS "[ Build Tools ]")
message(STATUS "- CMake : ${CMAKE_VERSION}")
message(STATUS "- CMake Generator : ${CMAKE_GENERATOR}")
message(STATUS "- C Compiler : ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
message(STATUS "- C++ Compiler : ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
if(MSVC)
message(STATUS "- CMake Toolchain File: ${CMAKE_TOOLCHAIN_FILE}")
endif()
message(STATUS "")
# Print CMake variables
message(STATUS "[ CMake Variables ]")
mt_print_flags(CMAKE_C_FLAGS)
mt_print_flags(CMAKE_CXX_FLAGS)
mt_print_flags(CMAKE_CUDA_FLAGS)
message(STATUS "")
#===============================================================================
# Build dependencies
#===============================================================================
include(GNUInstallDirs)
#===============================================================================
# Build Options
#===============================================================================
mt_option(BUILD_SHARED_LIBS "Build as shared libraries" ON)
# MOMENTUM_BUILD_WITH_FBXSDK environment variable controls whether FBX SDK is available
# If not set or OFF, MOMENTUM_ENABLE_FBX_SAVING is forced to OFF
# This ensures the open source build only uses FBX SDK when explicitly available
if(DEFINED ENV{MOMENTUM_BUILD_WITH_FBXSDK} AND "$ENV{MOMENTUM_BUILD_WITH_FBXSDK}")
# FBX SDK is available, allow enabling FBX saving
mt_option(MOMENTUM_ENABLE_FBX_SAVING "Enable FBX saving via Autodesk FBX SDK (FBX loading always available via OpenFBX)" $ENV{MOMENTUM_BUILD_WITH_FBXSDK})
else()
# FBX SDK is not available, force FBX saving to OFF
set(MOMENTUM_ENABLE_FBX_SAVING OFF CACHE BOOL "Enable FBX saving via Autodesk FBX SDK (FBX loading always available via OpenFBX)" FORCE)
if(DEFINED MOMENTUM_ENABLE_FBX_SAVING_OVERRIDE AND MOMENTUM_ENABLE_FBX_SAVING_OVERRIDE)
message(WARNING "MOMENTUM_ENABLE_FBX_SAVING was requested but MOMENTUM_BUILD_WITH_FBXSDK environment variable is not set. FBX SDK support requires MOMENTUM_BUILD_WITH_FBXSDK=ON. Forcing MOMENTUM_ENABLE_FBX_SAVING to OFF.")
endif()
endif()
mt_option(MOMENTUM_BUILD_IO_USD "Build USD I/O support" OFF)
mt_option(MOMENTUM_BUILD_PYMOMENTUM "Build Python binding" OFF)
mt_option(MOMENTUM_BUILD_TESTING "Enable building tests" OFF)
mt_option(MOMENTUM_BUILD_EXAMPLES "Enable building examples" OFF)
mt_option(MOMENTUM_BUILD_RENDERER "Build renderer and rasterizer" ON)
mt_option(MOMENTUM_ENABLE_PROFILING "Enable building with profiling annotations" OFF)
mt_option(MOMENTUM_ENABLE_SIMD "Enable building with SIMD instructions" ON)
mt_option(MOMENTUM_INSTALL_EXAMPLES "Install examples" OFF)
mt_option(MOMENTUM_USE_SYSTEM_GOOGLETEST "Use GoogleTest installed in system" OFF)
mt_option(MOMENTUM_USE_SYSTEM_PYBIND11 "Use pybind11 installed in system" OFF)
mt_option(MOMENTUM_USE_SYSTEM_RERUN_CPP_SDK "Use Rerun C++ SDK installed in system" OFF)
mt_option(MOMENTUM_USE_SYSTEM_TRACY "Use Tracy installed in system" OFF)
if(MOMENTUM_ENABLE_PROFILING AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
# Force disable profiling on Mac x86 to avoid initialization failure:
# "Tracy Profiler initialization failure: CPU doesn't support invariant TSC."
# Defining TRACY_NO_INVARIANT_CHECK=1 or TRACY_TIMER_FALLBACK is not recommended,
# as it may lead to inaccurate profiling results.
message(WARNING "MOMENTUM_ENABLE_PROFILING was set to ON, but Tracy profiling is not supported on Mac x86 due to CPU incompatibility. Disabling profiling.")
set(MOMENTUM_ENABLE_PROFILING OFF CACHE BOOL "Enable building with profiling annotations" FORCE)
endif()
if(MOMENTUM_INSTALL_EXAMPLES AND NOT MOMENTUM_BUILD_EXAMPLES)
message(WARNING "MOMENTUM_INSTALL_EXAMPLES is ON, but MOMENTUM_BUILD_EXAMPLES is OFF. No examples will be built or installed.")
endif()
mt_print_options()
#===============================================================================
# Find dependencies
#===============================================================================
# 3rd party
find_package(Ceres CONFIG REQUIRED)
find_package(CLI11 CONFIG REQUIRED)
find_package(Dispenso CONFIG REQUIRED)
find_package(drjit CONFIG REQUIRED)
find_package(Eigen3 3.4.0 CONFIG REQUIRED)
find_package(ezc3d CONFIG REQUIRED)
find_package(Microsoft.GSL CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(fx-gltf CONFIG REQUIRED)
find_package(indicators 2.3 CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(openfbx CONFIG REQUIRED)
if(MOMENTUM_BUILD_IO_USD)
find_package(pxr CONFIG REQUIRED HINTS ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_PREFIX}/cmake)
find_package(TBB CONFIG REQUIRED)
endif()
find_package(re2 MODULE REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(urdfdom CONFIG REQUIRED)
if(MOMENTUM_BUILD_RENDERER)
find_package(Kokkos CONFIG REQUIRED) # For mdspan headers (vendored in Kokkos)
endif()
if(MOMENTUM_USE_SYSTEM_RERUN_CPP_SDK)
find_package(rerun_sdk CONFIG REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(rerun_sdk
URL https://github.com/rerun-io/rerun/releases/download/0.23.3/rerun_cpp_sdk.zip
)
FetchContent_MakeAvailable(rerun_sdk)
endif()
if(MOMENTUM_ENABLE_PROFILING)
if(MOMENTUM_USE_SYSTEM_TRACY)
find_package(Tracy CONFIG REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG v0.11.1
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(tracy)
if(MSVC)
target_compile_options(TracyClient PRIVATE /W0)
else()
target_compile_options(TracyClient PRIVATE -w)
endif()
endif()
endif()
# 1st party
# TODO: Make Axel as a separate project and change to find_package(axel CONFIG REQUIRED)
add_subdirectory(axel)
#===============================================================================
# Compiler Settings
#===============================================================================
if(MOMENTUM_BUILD_TESTING)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
if(MSVC)
add_compile_options(/bigobj)
add_compile_options(/utf-8)
endif()
#===============================================================================
# Build momentum
#===============================================================================
mt_library(
NAME common
HEADERS_VARS common_public_headers
SOURCES_VARS common_sources
PUBLIC_LINK_LIBRARIES
fmt::fmt-header-only
indicators::indicators
spdlog::spdlog_header_only
PUBLIC_COMPILE_DEFINITIONS
MOMENTUM_WITH_SPDLOG=1
)
mt_library(
NAME simd
HEADERS_VARS simd_public_headers
PUBLIC_LINK_LIBRARIES
Eigen3::Eigen
drjit
)
mt_library(
NAME fmt_eigen
HEADERS_VARS fmt_eigen_public_headers
PUBLIC_LINK_LIBRARIES
fmt::fmt-header-only
Eigen3::Eigen
)
mt_library(
NAME online_qr
HEADERS_VARS online_qr_public_headers
SOURCES_VARS online_qr_sources
PUBLIC_LINK_LIBRARIES
common
fmt_eigen
Eigen3::Eigen
Microsoft.GSL::GSL
)
mt_library(
NAME math
HEADERS_VARS math_public_headers
SOURCES_VARS math_sources
PUBLIC_LINK_LIBRARIES
common
fmt_eigen
online_qr
Eigen3::Eigen
Microsoft.GSL::GSL
PRIVATE_LINK_LIBRARIES
axel
)
mt_library(
NAME simd_generalized_loss
HEADERS_VARS simd_generalized_loss_public_headers
SOURCES_VARS simd_generalized_loss_sources
PUBLIC_LINK_LIBRARIES
math
simd
)
mt_library(
NAME skeleton
HEADERS_VARS skeleton_public_headers
SOURCES_VARS skeleton_sources
PUBLIC_LINK_LIBRARIES
common
math
Eigen3::Eigen
Microsoft.GSL::GSL
)
mt_library(
NAME character
HEADERS_VARS character_public_headers
SOURCES_VARS character_sources
PUBLIC_LINK_LIBRARIES
common
math
skeleton
axel
Dispenso::dispenso
Eigen3::Eigen
Microsoft.GSL::GSL
)
mt_library(
NAME character_test_helpers
HEADERS_VARS character_test_helpers_public_headers
SOURCES_VARS character_test_helpers_sources
PUBLIC_LINK_LIBRARIES
character
NO_INSTALL
)
mt_library(
NAME solver
HEADERS_VARS solver_public_headers
SOURCES_VARS solver_sources
PUBLIC_LINK_LIBRARIES
common
math
Eigen3::Eigen
Microsoft.GSL::GSL
)
mt_library(
NAME character_solver
HEADERS_VARS character_solver_public_headers
SOURCES_VARS character_solver_sources
PUBLIC_LINK_LIBRARIES
character
solver
axel
Eigen3::Eigen
Microsoft.GSL::GSL
PRIVATE_LINK_LIBRARIES
Dispenso::dispenso
)
mt_library(
NAME simd_constraints
HEADERS_VARS simd_constraints_public_headers
SOURCES_VARS simd_constraints_sources
PUBLIC_LINK_LIBRARIES
character_solver
simd
)
mt_library(
NAME character_sequence_solver
HEADERS_VARS character_sequence_solver_public_headers
SOURCES_VARS character_sequence_solver_sources
PUBLIC_LINK_LIBRARIES
character_solver
Eigen3::Eigen
Microsoft.GSL::GSL
PRIVATE_LINK_LIBRARIES
Dispenso::dispenso
)
mt_library(
NAME momentum
PUBLIC_LINK_LIBRARIES
common
simd
online_qr
math
solver
skeleton
character
character_solver
simd_constraints
character_sequence_solver
)
mt_library(
NAME diff_ik
HEADERS_VARS diff_ik_public_headers
SOURCES_VARS diff_ik_sources
PUBLIC_LINK_LIBRARIES
character_solver
Ceres::ceres
Dispenso::dispenso
)
mt_library(
NAME io_common
HEADERS_VARS io_common_public_headers
SOURCES_VARS io_common_sources
PUBLIC_LINK_LIBRARIES
common
Microsoft.GSL::GSL
)
mt_library(
NAME io_skeleton
HEADERS_VARS io_skeleton_public_headers
SOURCES_VARS io_skeleton_sources
PUBLIC_LINK_LIBRARIES
character
PRIVATE_LINK_LIBRARIES
io_common
nlohmann_json::nlohmann_json
re2::re2
)
mt_library(
NAME io_shape
HEADERS_VARS io_shape_public_headers
SOURCES_VARS io_shape_sources
PUBLIC_LINK_LIBRARIES
character
)
if(MOMENTUM_ENABLE_FBX_SAVING)
find_package(FbxSdk MODULE REQUIRED)
# Fix FBX SDK header typos for Clang 19 compatibility
set(_fbx_header "${FBXSDK_INCLUDE_DIR}/fbxsdk/core/base/fbxredblacktree.h")
if(EXISTS "${_fbx_header}")
file(READ "${_fbx_header}" _content)
string(REPLACE "mLefttChild" "mLeftChild" _content "${_content}")
string(REPLACE "mRighttChild" "mRightChild" _content "${_content}")
set(_patched_header "${CMAKE_BINARY_DIR}/fbxsdk_patched/fbxsdk/core/base/fbxredblacktree.h")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/fbxsdk_patched/fbxsdk/core/base")
file(WRITE "${_patched_header}" "${_content}")
target_include_directories(fbxsdk::fbxsdk BEFORE INTERFACE "${CMAKE_BINARY_DIR}/fbxsdk_patched")
endif()
set(io_fbx_private_link_libraries fbxsdk::fbxsdk)
else()
# When FBX SDK is not available, use OpenFBX-only mode (OpenFBX is always available)
set(io_fbx_private_link_libraries )
endif()
# Header-only library for file save options
mt_library(
NAME io_file_save_options
HEADERS_VARS
io_file_save_options_public_headers
)
mt_library(
NAME io_fbx
HEADERS_VARS
io_fbx_public_headers
PRIVATE_HEADERS_VARS
io_fbx_private_headers
SOURCES_VARS
io_fbx_sources
PRIVATE_LINK_LIBRARIES
io_common
io_file_save_options
io_skeleton
${io_fbx_private_link_libraries}
OpenFBX
)
if(MOMENTUM_ENABLE_FBX_SAVING)
target_compile_definitions(io_fbx PRIVATE MOMENTUM_WITH_FBX_SDK)
endif()
mt_library(
NAME io_gltf
HEADERS_VARS
io_gltf_public_headers
PRIVATE_HEADERS_VARS
io_gltf_private_headers
SOURCES_VARS io_gltf_sources
PUBLIC_LINK_LIBRARIES
character
io_common
io_file_save_options
io_skeleton
fx-gltf::fx-gltf
PRIVATE_LINK_LIBRARIES
nlohmann_json::nlohmann_json
)
mt_library(
NAME io_urdf
HEADERS_VARS
io_urdf_public_headers
SOURCES_VARS io_urdf_sources
PUBLIC_LINK_LIBRARIES
character
io_common
io_skeleton
urdfdom::urdf_parser
)
if(MOMENTUM_BUILD_IO_USD)
mt_library(
NAME io_usd
HEADERS_VARS io_usd_public_headers
SOURCES_VARS io_usd_sources
PUBLIC_LINK_LIBRARIES
character
io_common
io_skeleton
PRIVATE_LINK_LIBRARIES
usd
usdGeom
usdSkel
TBB::tbb
Python3::Python # Conda USD has Python symbols on both Linux and macOS
)
set(io_usd_library io_usd)
else()
set(io_usd_library )
endif()
mt_library(
NAME io_legacy_json
HEADERS_VARS io_legacy_json_public_headers
SOURCES_VARS io_legacy_json_sources
PUBLIC_LINK_LIBRARIES
character
io_common
io_skeleton
nlohmann_json::nlohmann_json
)
mt_library(
NAME io_motion
HEADERS_VARS io_motion_public_headers
SOURCES_VARS io_motion_sources
PUBLIC_LINK_LIBRARIES
character
)
mt_library(
NAME io_marker
HEADERS_VARS io_marker_public_headers
SOURCES_VARS io_marker_sources
PUBLIC_LINK_LIBRARIES
character
PRIVATE_LINK_LIBRARIES
io_common
io_gltf
io_fbx
ezc3d
)
mt_library(
NAME io
HEADERS_VARS io_public_headers
SOURCES_VARS io_sources
PUBLIC_LINK_LIBRARIES
io_common
io_fbx
io_gltf
io_legacy_json
io_motion
io_marker
io_shape
io_skeleton
${io_usd_library}
)
mt_library(
NAME marker_tracker
HEADERS_VARS
marker_tracker_public_headers
SOURCES_VARS
marker_tracker_sources
PUBLIC_LINK_LIBRARIES
character_solver
PRIVATE_LINK_LIBRARIES
character_sequence_solver
)
mt_library(
NAME app_utils
HEADERS_VARS
app_utils_public_headers
SOURCES_VARS
app_utils_sources
PUBLIC_LINK_LIBRARIES
character
marker_tracker
CLI11::CLI11
PRIVATE_LINK_LIBRARIES
io
)
mt_library(
NAME process_markers
HEADERS_VARS
process_markers_public_headers
SOURCES_VARS
process_markers_sources
PUBLIC_LINK_LIBRARIES
app_utils
marker_tracker
skeleton
PRIVATE_LINK_LIBRARIES
io_marker
)
if(MOMENTUM_BUILD_RENDERER)
mt_library(
NAME rasterizer
HEADERS_VARS
rasterizer_public_headers
SOURCES_VARS
rasterizer_sources
PUBLIC_LINK_LIBRARIES
common
drjit
Eigen3::Eigen
Kokkos::kokkos # For mdspan headers (vendored in Kokkos)
Microsoft.GSL::GSL
)
endif()
mt_library(
NAME rerun_eigen_adapters
HEADERS_VARS
rerun_eigen_adapters_public_headers
PUBLIC_LINK_LIBRARIES
Eigen3::Eigen
rerun_sdk
)
mt_library(
NAME rerun
HEADERS_VARS
rerun_public_headers
SOURCES_VARS
rerun_sources
PUBLIC_LINK_LIBRARIES
character
rerun_sdk
PRIVATE_LINK_LIBRARIES
rerun_eigen_adapters
axel
)
#===============================================================================
# Tests
#===============================================================================
if(MOMENTUM_BUILD_TESTING)
find_package(Boost CONFIG REQUIRED)
enable_testing()
mt_setup_gtest()
mt_library(
NAME test_helpers
HEADERS_VARS test_helpers_public_headers
SOURCES_VARS test_helpers_sources
PUBLIC_LINK_LIBRARIES
common
GTest::gtest
PRIVATE_LINK_LIBRARIES
Boost::boost
NO_INSTALL
)
mt_library(
NAME character_test_helpers_gtest
HEADERS_VARS character_test_helpers_gtest_public_headers
SOURCES_VARS character_test_helpers_gtest_sources
PUBLIC_LINK_LIBRARIES
character
PRIVATE_LINK_LIBRARIES
GTest::gmock
GTest::gtest
NO_INSTALL
)
mt_library(
NAME solver_test_helper
HEADERS_VARS solver_test_helper_public_headers
PUBLIC_LINK_LIBRARIES
solver
NO_INSTALL
)
mt_library(
NAME error_function_helper
HEADERS_VARS error_function_helper_public_headers
SOURCES_VARS error_function_helper_sources
PUBLIC_LINK_LIBRARIES
character
character_solver
PRIVATE_LINK_LIBRARIES
GTest::gmock
GTest::gtest
NO_INSTALL
)
set(io_test_helper_libs )
if(APPLE)
set(io_test_helper_sources io_test_helper_sources_macos)
list(APPEND io_test_helper_libs "-framework Foundation")
elseif(UNIX)
set(io_test_helper_sources io_test_helper_sources_linux)
elseif(WIN32)
set(io_test_helper_sources io_test_helper_sources_windows)
else()
message(FATAL_ERROR "Unsupported platform")
endif()
mt_library(
NAME io_test_helper
HEADERS_VARS io_test_helper_public_headers
SOURCES_VARS ${io_test_helper_sources}
PUBLIC_LINK_LIBRARIES
test_helpers
Microsoft.GSL::GSL
PRIVATE_LINK_LIBRARIES
${io_test_helper_libs}
NO_INSTALL
)
mt_test(
NAME common_test
SOURCES_VARS common_test_sources
LINK_LIBRARIES common
)
mt_test(
NAME simd_test
SOURCES_VARS simd_test_sources
LINK_LIBRARIES simd
)
mt_test(
NAME online_qr_test
SOURCES_VARS online_qr_test_sources
LINK_LIBRARIES online_qr
)
mt_test(
NAME math_test
SOURCES_VARS math_test_sources
LINK_LIBRARIES math
)
mt_test(
NAME simd_generalized_loss_test
SOURCES_VARS simd_generalized_loss_test_sources
LINK_LIBRARIES simd_generalized_loss
)
# TODO: Add solver_test
mt_test(
NAME character_test
SOURCES_VARS character_test_sources
LINK_LIBRARIES
character
character_test_helpers
test_helpers
)
mt_test(
NAME character_solver_test
SOURCES_VARS character_solver_test_sources
LINK_LIBRARIES
character_solver
character_test_helpers
error_function_helper
solver_test_helper
)
if(NOT APPLE) # TODO: Fix
mt_test(
NAME simd_constraints_test
SOURCES_VARS simd_constraints_test_sources
LINK_LIBRARIES
character_solver
character_test_helpers
error_function_helper
simd_constraints
)
endif()
mt_test(
NAME character_sequence_solver_test
SOURCES_VARS character_sequence_solver_test_sources
LINK_LIBRARIES
character_sequence_solver
character_test_helpers
solver_test_helper
)
# TODO: Fix test failures on macOS
if(NOT APPLE)
mt_test(
NAME diff_ik_test
HEADERS_VARS diff_ik_test_headers
SOURCES_VARS diff_ik_test_sources
LINK_LIBRARIES
character_test_helpers
diff_ik
io_gltf
io_skeleton
)
endif()
mt_test(
NAME io_common_test
LINK_LIBRARIES io_common
SOURCES_VARS io_common_test_sources
)
# TODO: Add io_gltf_test
mt_test(
NAME io_marker_test
SOURCES_VARS io_marker_test_sources
LINK_LIBRARIES
io_marker
io_test_helper
ENV
"TEST_RESOURCES_PATH=${CMAKE_SOURCE_DIR}/momentum/test/resources"
)
mt_test(
NAME io_shape_test
SOURCES_VARS io_shape_test_sources
LINK_LIBRARIES
character
character_test_helpers
io_shape
io_test_helper
)
mt_test(
NAME io_skeleton_test
SOURCES_VARS io_skeleton_test_sources
LINK_LIBRARIES
character_test_helpers
io_skeleton
io_test_helper
character_test_helpers_gtest
)
mt_test(
NAME io_motion_test
SOURCES_VARS io_motion_test_sources
LINK_LIBRARIES
character
character_test_helpers
io_motion
io_test_helper
)
mt_test(
NAME io_legacy_json_test
SOURCES_VARS io_legacy_json_test_sources
LINK_LIBRARIES
character_test_helpers
io_legacy_json
io_test_helper
ENV
"TEST_RESOURCES_PATH=${CMAKE_SOURCE_DIR}/momentum/test/resources"
)
if(MOMENTUM_BUILD_IO_USD)
mt_test(
NAME io_usd_test
SOURCES_VARS io_usd_test_sources
LINK_LIBRARIES
character_test_helpers
io_usd
io_test_helper
Python3::Python
ENV
"TEST_RESOURCES_PATH=${CMAKE_SOURCE_DIR}/momentum/test/resources"
)
endif()
mt_test(
NAME rasterizer_test
SOURCES_VARS rasterizer_test_sources
LINK_LIBRARIES
rasterizer
axel
)
endif()
#===============================================================================
# Examples
#===============================================================================
if(MOMENTUM_BUILD_EXAMPLES)
mt_executable(
NAME hello_world
SOURCES_VARS hello_world_sources
LINK_LIBRARIES
momentum
)
mt_executable(
NAME convert_model
SOURCES_VARS convert_model_sources
LINK_LIBRARIES
momentum io CLI11::CLI11
)
mt_executable(
NAME glb_viewer
SOURCES_VARS glb_viewer_sources
LINK_LIBRARIES
io_gltf
rerun
CLI11::CLI11
rerun_sdk
)
mt_executable(
NAME fbx_viewer
SOURCES_VARS fbx_viewer_sources
LINK_LIBRARIES
io_fbx
rerun
CLI11::CLI11
rerun_sdk
)
mt_executable(
NAME c3d_viewer
SOURCES_VARS c3d_viewer_sources
LINK_LIBRARIES
io_marker
rerun
CLI11::CLI11
rerun_sdk
)
mt_executable(
NAME urdf_viewer
SOURCES_VARS urdf_viewer_sources
LINK_LIBRARIES
io_urdf
rerun
CLI11::CLI11
rerun_sdk
)
mt_executable(
NAME animate_shapes
SOURCES_VARS animate_shapes_sources
LINK_LIBRARIES
momentum io CLI11::CLI11
)
mt_executable(
NAME process_markers_app
SOURCES_VARS process_markers_app_sources
LINK_LIBRARIES
app_utils
common
process_markers
)
mt_executable(
NAME refine_motion
SOURCES_VARS refine_motion_sources
LINK_LIBRARIES
app_utils
io
marker_tracker
)
mt_executable(
NAME export_objs
SOURCES_VARS export_objs_sources
LINK_LIBRARIES
character
io_fbx
io_gltf
CLI11::CLI11
)
endif()
#===============================================================================
# Install momentum
#===============================================================================
get_property(targets GLOBAL PROPERTY MOMENTUM_TARGETS)
get_property(executables GLOBAL PROPERTY MOMENTUM_EXECUTABLES)
if(targets)
message(STATUS "[Installing libraries]")
foreach(target ${targets})
message(STATUS " - ${target}")
endforeach()
else()
message(STATUS "No libraries to install.")
endif()
if(executables)
message(STATUS "[Installing executables]")
foreach(executable ${executables})
message(STATUS " - ${executable}")
endforeach()
else()
message(STATUS "No executables to install.")
endif()
# Generate required install artifacts for CMake buildsystem
include(CMakePackageConfigHelpers)
set(MOMENTUM_CONFIG_INPUT cmake/momentum-config.cmake.in)
set(MOMENTUM_CONFIG_OUTPUT ${CMAKE_BINARY_DIR}/cmake/momentum-config.cmake)
set(MOMENTUM_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
configure_package_config_file(
${MOMENTUM_CONFIG_INPUT}
${MOMENTUM_CONFIG_OUTPUT}
INSTALL_DESTINATION ${MOMENTUM_CONFIG_INSTALL_DIR}
)
install(
FILES ${MOMENTUM_CONFIG_OUTPUT}
DESTINATION ${MOMENTUM_CONFIG_INSTALL_DIR}
)
# Install CMake modules
install(
FILES cmake/Findre2.cmake cmake/FindFbxSdk.cmake
DESTINATION ${MOMENTUM_CONFIG_INSTALL_DIR}
)
# Install headers
install(
DIRECTORY momentum
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT headers
FILES_MATCHING PATTERN "*.h"
PATTERN "*/examples/*" EXCLUDE