-
-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathros-noetic-teb-local-planner.win.patch
987 lines (967 loc) · 39.3 KB
/
ros-noetic-teb-local-planner.win.patch
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
diff --git a/include/teb_local_planner/h_signature.h b/include/teb_local_planner/h_signature.h
index 8837950..4cffcda 100644
--- a/include/teb_local_planner/h_signature.h
+++ b/include/teb_local_planner/h_signature.h
@@ -46,6 +46,7 @@
#include <teb_local_planner/timed_elastic_band.h>
#include <ros/ros.h>
+#include <boost/math/special_functions/sign.hpp>
#include <math.h>
#include <algorithm>
#include <functional>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97fe249..389975c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.18)
project(teb_local_planner)
# Set to Release in order to speed up the program significantly
@@ -34,6 +34,7 @@ message(STATUS "${CMAKE_MODULE_PATH}")
find_package(Boost REQUIRED COMPONENTS system thread graph)
find_package(SUITESPARSE REQUIRED)
find_package(G2O REQUIRED)
+find_package(CSparse REQUIRED)
# Eigen3 FindScript Backward compatibility (ubuntu saucy)
# Since FindEigen.cmake is deprecated starting from jade.
@@ -47,8 +48,8 @@ elseif (EXISTS "FindEigen.cmake")
e.g. by adding it to ${PROJECT_SOURCE_DIR}/cmake_modules.")
endif (EXISTS "FindEigen3.cmake")
-set(EXTERNAL_INCLUDE_DIRS ${Eigen_INCLUDE_DIRS} ${SUITESPARSE_INCLUDE_DIRS} ${G2O_INCLUDE_DIR})
-set(EXTERNAL_LIBS ${SUITESPARSE_LIBRARIES} ${G2O_LIBRARIES})
+set(EXTERNAL_INCLUDE_DIRS ${Eigen_INCLUDE_DIRS} ${SUITESPARSE_INCLUDE_DIRS} ${CSPARSE_INCLUDE_DIR})
+set(EXTERNAL_LIBS ${SUITESPARSE_LIBRARIES} ${CSPARSE_LIBRARY} ${G2O_CORE_LIBRARY} ${G2O_STUFF_LIBRARY} ${G2O_SOLVER_CSPARSE} ${G2O_SOLVER_CSPARSE_EXTENSION})
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
@@ -160,10 +161,9 @@ catkin_package(
pluginlib
roscpp
std_msgs
- tf2
- tf2_ros
+ tf2
+ tf2_ros
visualization_msgs
- DEPENDS SUITESPARSE G2O
)
###########
diff --git a/cmake_modules/FindCSparse.cmake b/cmake_modules/FindCSparse.cmake
index e69de29..5550151 100644
--- a/cmake_modules/FindCSparse.cmake
+++ b/cmake_modules/FindCSparse.cmake
@@ -0,0 +1,28 @@
+# Look for csparse; note the difference in the directory specifications!
+find_path(CSPARSE_INCLUDE_DIR NAMES cs.h
+ PATHS
+ /usr/include/suitesparse
+ /usr/include
+ /opt/local/include
+ /usr/local/include
+ /sw/include
+ /usr/include/ufsparse
+ /opt/local/include/ufsparse
+ /usr/local/include/ufsparse
+ /sw/include/ufsparse
+ PATH_SUFFIXES
+ suitesparse
+ )
+
+find_library(CSPARSE_LIBRARY NAMES cxsparse libcxsparse
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CSPARSE DEFAULT_MSG
+ CSPARSE_INCLUDE_DIR CSPARSE_LIBRARY)
+
diff --git a/cmake_modules/FindG2O.cmake b/cmake_modules/FindG2O.cmake
index b2670d3..917552f 100644
--- a/cmake_modules/FindG2O.cmake
+++ b/cmake_modules/FindG2O.cmake
@@ -1,97 +1,114 @@
-# Locate the g2o libraries
-# A general framework for graph optimization.
-#
-# This module defines
-# G2O_FOUND, if false, do not try to link against g2o
-# G2O_LIBRARIES, path to the libg2o
-# G2O_INCLUDE_DIR, where to find the g2o header files
-#
-# Niko Suenderhauf <[email protected]>
-# Adapted by Felix Endres <[email protected]>
+# Find the header files
-IF(UNIX)
+find_path(G2O_INCLUDE_DIR g2o/core/base_vertex.h
+ ${G2O_ROOT}/include
+ $ENV{G2O_ROOT}/include
+ $ENV{G2O_ROOT}
+ /usr/local/include
+ /usr/include
+ /opt/local/include
+ /sw/local/include
+ /sw/include
+ NO_DEFAULT_PATH
+ )
- #IF(G2O_INCLUDE_DIR AND G2O_LIBRARIES)
- # in cache already
- # SET(G2O_FIND_QUIETLY TRUE)
- #ENDIF(G2O_INCLUDE_DIR AND G2O_LIBRARIES)
+# Macro to unify finding both the debug and release versions of the
+# libraries; this is adapted from the OpenSceneGraph FIND_LIBRARY
+# macro.
- MESSAGE(STATUS "Searching for g2o ...")
- FIND_PATH(G2O_INCLUDE_DIR
- NAMES core math_groups types
- PATHS /usr/local /usr
- PATH_SUFFIXES include/g2o include)
+macro(FIND_G2O_LIBRARY MYLIBRARY MYLIBRARYNAME)
- IF (G2O_INCLUDE_DIR)
- MESSAGE(STATUS "Found g2o headers in: ${G2O_INCLUDE_DIR}")
- ENDIF (G2O_INCLUDE_DIR)
+ find_library("${MYLIBRARY}_DEBUG"
+ NAMES "g2o_${MYLIBRARYNAME}_d"
+ PATHS
+ ${G2O_ROOT}/lib/Debug
+ ${G2O_ROOT}/lib
+ $ENV{G2O_ROOT}/lib/Debug
+ $ENV{G2O_ROOT}/lib
+ NO_DEFAULT_PATH
+ )
- FIND_LIBRARY(G2O_CORE_LIB
- NAMES g2o_core g2o_core_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_STUFF_LIB
- NAMES g2o_stuff g2o_stuff_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_TYPES_SLAM2D_LIB
- NAMES g2o_types_slam2d g2o_types_slam2d_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_TYPES_SLAM3D_LIB
- NAMES g2o_types_slam3d g2o_types_slam3d_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_SOLVER_CHOLMOD_LIB
- NAMES g2o_solver_cholmod g2o_solver_cholmod_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_SOLVER_PCG_LIB
- NAMES g2o_solver_pcg g2o_solver_pcg_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_SOLVER_CSPARSE_LIB
- NAMES g2o_solver_csparse g2o_solver_csparse_rd
- PATHS /usr/local /usr
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_INCREMENTAL_LIB
- NAMES g2o_incremental g2o_incremental_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
- FIND_LIBRARY(G2O_CSPARSE_EXTENSION_LIB
- NAMES g2o_csparse_extension g2o_csparse_extension_rd
- PATHS /usr/local /usr ${CMAKE_PREFIX_PATH}
- PATH_SUFFIXES lib)
+ find_library("${MYLIBRARY}_DEBUG"
+ NAMES "g2o_${MYLIBRARYNAME}_d"
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+ /opt/local/lib
+ /sw/local/lib
+ /sw/lib
+ )
+
+ find_library(${MYLIBRARY}
+ NAMES "g2o_${MYLIBRARYNAME}"
+ PATHS
+ ${G2O_ROOT}/lib/Release
+ ${G2O_ROOT}/lib
+ $ENV{G2O_ROOT}/lib/Release
+ $ENV{G2O_ROOT}/lib
+ NO_DEFAULT_PATH
+ )
- SET(G2O_LIBRARIES ${G2O_CSPARSE_EXTENSION_LIB}
- ${G2O_CORE_LIB}
- ${G2O_STUFF_LIB}
- ${G2O_TYPES_SLAM2D_LIB}
- ${G2O_TYPES_SLAM3D_LIB}
- ${G2O_SOLVER_CHOLMOD_LIB}
- ${G2O_SOLVER_PCG_LIB}
- ${G2O_SOLVER_CSPARSE_LIB}
- ${G2O_INCREMENTAL_LIB}
- )
+ find_library(${MYLIBRARY}
+ NAMES "g2o_${MYLIBRARYNAME}"
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+ /opt/local/lib
+ /sw/local/lib
+ /sw/lib
+ )
+
+ if(NOT ${MYLIBRARY}_DEBUG)
+ if(MYLIBRARY)
+ set(${MYLIBRARY}_DEBUG ${MYLIBRARY})
+ endif(MYLIBRARY)
+ endif( NOT ${MYLIBRARY}_DEBUG)
+
+endmacro(FIND_G2O_LIBRARY LIBRARY LIBRARYNAME)
- IF(G2O_LIBRARIES AND G2O_INCLUDE_DIR)
- SET(G2O_FOUND "YES")
- IF(NOT G2O_FIND_QUIETLY)
- MESSAGE(STATUS "Found libg2o: ${G2O_LIBRARIES}")
- ENDIF(NOT G2O_FIND_QUIETLY)
- ELSE(G2O_LIBRARIES AND G2O_INCLUDE_DIR)
- IF(NOT G2O_LIBRARIES)
- IF(G2O_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find libg2o!")
- ENDIF(G2O_FIND_REQUIRED)
- ENDIF(NOT G2O_LIBRARIES)
+# Find the core elements
+FIND_G2O_LIBRARY(G2O_STUFF_LIBRARY stuff)
+FIND_G2O_LIBRARY(G2O_CORE_LIBRARY core)
- IF(NOT G2O_INCLUDE_DIR)
- IF(G2O_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find g2o include directory!")
- ENDIF(G2O_FIND_REQUIRED)
- ENDIF(NOT G2O_INCLUDE_DIR)
- ENDIF(G2O_LIBRARIES AND G2O_INCLUDE_DIR)
+# Find the CLI library
+FIND_G2O_LIBRARY(G2O_CLI_LIBRARY cli)
-ENDIF(UNIX)
+# Find the pluggable solvers
+FIND_G2O_LIBRARY(G2O_SOLVER_CHOLMOD solver_cholmod)
+FIND_G2O_LIBRARY(G2O_SOLVER_CSPARSE solver_csparse)
+FIND_G2O_LIBRARY(G2O_SOLVER_CSPARSE_EXTENSION csparse_extension)
+FIND_G2O_LIBRARY(G2O_SOLVER_DENSE solver_dense)
+FIND_G2O_LIBRARY(G2O_SOLVER_PCG solver_pcg)
+FIND_G2O_LIBRARY(G2O_SOLVER_SLAM2D_LINEAR solver_slam2d_linear)
+FIND_G2O_LIBRARY(G2O_SOLVER_STRUCTURE_ONLY solver_structure_only)
+FIND_G2O_LIBRARY(G2O_SOLVER_EIGEN solver_eigen)
+
+# Find the predefined types
+FIND_G2O_LIBRARY(G2O_TYPES_DATA types_data)
+FIND_G2O_LIBRARY(G2O_TYPES_ICP types_icp)
+FIND_G2O_LIBRARY(G2O_TYPES_SBA types_sba)
+FIND_G2O_LIBRARY(G2O_TYPES_SCLAM2D types_sclam2d)
+FIND_G2O_LIBRARY(G2O_TYPES_SIM3 types_sim3)
+FIND_G2O_LIBRARY(G2O_TYPES_SLAM2D types_slam2d)
+FIND_G2O_LIBRARY(G2O_TYPES_SLAM3D types_slam3d)
+
+# G2O solvers declared found if we found at least one solver
+set(G2O_SOLVERS_FOUND "NO")
+if(G2O_SOLVER_CHOLMOD OR G2O_SOLVER_CSPARSE OR G2O_SOLVER_DENSE OR G2O_SOLVER_PCG OR G2O_SOLVER_SLAM2D_LINEAR OR G2O_SOLVER_STRUCTURE_ONLY OR G2O_SOLVER_EIGEN)
+ set(G2O_SOLVERS_FOUND "YES")
+endif(G2O_SOLVER_CHOLMOD OR G2O_SOLVER_CSPARSE OR G2O_SOLVER_DENSE OR G2O_SOLVER_PCG OR G2O_SOLVER_SLAM2D_LINEAR OR G2O_SOLVER_STRUCTURE_ONLY OR G2O_SOLVER_EIGEN)
+
+# G2O itself declared found if we found the core libraries and at least one solver
+set(G2O_FOUND "NO")
+if(G2O_STUFF_LIBRARY AND G2O_CORE_LIBRARY AND G2O_INCLUDE_DIR AND G2O_SOLVERS_FOUND)
+ set(G2O_FOUND "YES")
+endif(G2O_STUFF_LIBRARY AND G2O_CORE_LIBRARY AND G2O_INCLUDE_DIR AND G2O_SOLVERS_FOUND)
diff --git a/cmake_modules/FindSUITESPARSE.cmake b/cmake_modules/FindSUITESPARSE.cmake
index 101b79b..aad8904 100644
--- a/cmake_modules/FindSUITESPARSE.cmake
+++ b/cmake_modules/FindSUITESPARSE.cmake
@@ -1,133 +1,531 @@
-# - Try to find SUITESPARSE
-# Once done this will define
-#
-# SUITESPARSE_FOUND - system has SUITESPARSE
-# SUITESPARSE_INCLUDE_DIRS - the SUITESPARSE include directory
-# SUITESPARSE_LIBRARIES - Link these to use SUITESPARSE
-# SUITESPARSE_SPQR_LIBRARY - name of spqr library (necessary due to error in debian package)
-# SUITESPARSE_SPQR_LIBRARY_DIR - name of spqr library (necessary due to error in debian package)
-# SUITESPARSE_LIBRARY_DIR - Library main directory containing suitesparse libs
-# SUITESPARSE_LIBRARY_DIRS - all Library directories containing suitesparse libs
-# SUITESPARSE_SPQR_VALID - automatic identification whether or not spqr package is installed correctly
-
-IF (SUITESPARSE_INCLUDE_DIRS)
- # Already in cache, be silent
- SET(SUITESPARSE_FIND_QUIETLY TRUE)
-ENDIF (SUITESPARSE_INCLUDE_DIRS)
-
-if( WIN32 )
- # Find cholmod part of the suitesparse library collection
-
- FIND_PATH( CHOLMOD_INCLUDE_DIR cholmod.h
- PATHS "C:\\libs\\win32\\SuiteSparse\\Include" )
-
- # Add cholmod include directory to collection include directories
- IF ( CHOLMOD_INCLUDE_DIR )
- list ( APPEND SUITESPARSE_INCLUDE_DIRS ${CHOLMOD_INCLUDE_DIR} )
- ENDIF( CHOLMOD_INCLUDE_DIR )
-
-
- # find path suitesparse library
- FIND_PATH( SUITESPARSE_LIBRARY_DIRS
- amd.lib
- PATHS "C:\\libs\\win32\\SuiteSparse\\libs" )
-
- # if we found the library, add it to the defined libraries
- IF ( SUITESPARSE_LIBRARY_DIRS )
- list ( APPEND SUITESPARSE_LIBRARIES optimized;amd;optimized;camd;optimized;ccolamd;optimized;cholmod;optimized;colamd;optimized;metis;optimized;spqr;optimized;umfpack;debug;amdd;debug;camdd;debug;ccolamdd;debug;cholmodd;debug;spqrd;debug;umfpackd;debug;colamdd;debug;metisd;optimized;blas;optimized;libf2c;optimized;lapack;debug;blasd;debug;libf2cd;debug;lapackd )
- ENDIF( SUITESPARSE_LIBRARY_DIRS )
-
-else( WIN32 )
- IF(APPLE)
- FIND_PATH( CHOLMOD_INCLUDE_DIR cholmod.h
- PATHS /opt/local/include/ufsparse
- /usr/local/include )
-
- FIND_PATH( SUITESPARSE_LIBRARY_DIR
- NAMES libcholmod.a
- PATHS /opt/local/lib
- /usr/local/lib )
- ELSE(APPLE)
- FIND_PATH( CHOLMOD_INCLUDE_DIR cholmod.h
- PATHS /usr/local/include
- /usr/include
- /usr/include/suitesparse/
- ${CMAKE_SOURCE_DIR}/MacOS/Libs/cholmod
- PATH_SUFFIXES cholmod/ CHOLMOD/ )
-
- FIND_PATH( SUITESPARSE_LIBRARY_DIR
- NAMES libcholmod.so libcholmod.a
- PATHS /usr/lib
- /usr/lib64
- /usr/lib/x86_64-linux-gnu
- /usr/lib/i386-linux-gnu
- /usr/local/lib
- /usr/lib/arm-linux-gnueabihf/
- /usr/lib/aarch64-linux-gnu/
- /usr/lib/arm-linux-gnueabi/
- /usr/lib/arm-linux-gnu)
- ENDIF(APPLE)
-
- # Add cholmod include directory to collection include directories
- IF ( CHOLMOD_INCLUDE_DIR )
- list ( APPEND SUITESPARSE_INCLUDE_DIRS ${CHOLMOD_INCLUDE_DIR} )
- ENDIF( CHOLMOD_INCLUDE_DIR )
-
- # if we found the library, add it to the defined libraries
- IF ( SUITESPARSE_LIBRARY_DIR )
-
- list ( APPEND SUITESPARSE_LIBRARIES amd)
- list ( APPEND SUITESPARSE_LIBRARIES btf)
- list ( APPEND SUITESPARSE_LIBRARIES camd)
- list ( APPEND SUITESPARSE_LIBRARIES ccolamd)
- list ( APPEND SUITESPARSE_LIBRARIES cholmod)
- list ( APPEND SUITESPARSE_LIBRARIES colamd)
- # list ( APPEND SUITESPARSE_LIBRARIES csparse)
- list ( APPEND SUITESPARSE_LIBRARIES cxsparse)
- list ( APPEND SUITESPARSE_LIBRARIES klu)
- # list ( APPEND SUITESPARSE_LIBRARIES spqr)
- list ( APPEND SUITESPARSE_LIBRARIES umfpack)
-
- IF (APPLE)
- list ( APPEND SUITESPARSE_LIBRARIES suitesparseconfig)
- ENDIF (APPLE)
-
- # Metis and spqr are optional
- FIND_LIBRARY( SUITESPARSE_METIS_LIBRARY
- NAMES metis
- PATHS ${SUITESPARSE_LIBRARY_DIR} )
- IF (SUITESPARSE_METIS_LIBRARY)
- list ( APPEND SUITESPARSE_LIBRARIES metis)
- ENDIF(SUITESPARSE_METIS_LIBRARY)
-
- if(EXISTS "${CHOLMOD_INCLUDE_DIR}/SuiteSparseQR.hpp")
- SET(SUITESPARSE_SPQR_VALID TRUE CACHE BOOL "SuiteSparseSPQR valid")
- else()
- SET(SUITESPARSE_SPQR_VALID false CACHE BOOL "SuiteSparseSPQR valid")
- endif()
-
- if(SUITESPARSE_SPQR_VALID)
- FIND_LIBRARY( SUITESPARSE_SPQR_LIBRARY
- NAMES spqr
- PATHS ${SUITESPARSE_LIBRARY_DIR} )
- IF (SUITESPARSE_SPQR_LIBRARY)
- list ( APPEND SUITESPARSE_LIBRARIES spqr)
- ENDIF (SUITESPARSE_SPQR_LIBRARY)
- endif()
-
- ENDIF( SUITESPARSE_LIBRARY_DIR )
-
-endif( WIN32 )
-
-
-IF (SUITESPARSE_INCLUDE_DIRS AND SUITESPARSE_LIBRARIES)
- IF(WIN32)
- list (APPEND SUITESPARSE_INCLUDE_DIRS ${CHOLMOD_INCLUDE_DIR}/../../UFconfig )
- ENDIF(WIN32)
- SET(SUITESPARSE_FOUND TRUE)
- MESSAGE(STATUS "Found SuiteSparse")
-ELSE (SUITESPARSE_INCLUDE_DIRS AND SUITESPARSE_LIBRARIES)
- SET( SUITESPARSE_FOUND FALSE )
- MESSAGE(FATAL_ERROR "Unable to find SuiteSparse")
-ENDIF (SUITESPARSE_INCLUDE_DIRS AND SUITESPARSE_LIBRARIES)
+# Ceres Solver - A fast non-linear least squares minimizer
+# Copyright 2015 Google Inc. All rights reserved.
+# http://ceres-solver.org/
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: [email protected] (Alex Stewart)
+#
+# FindSuiteSparse.cmake - Find SuiteSparse libraries & dependencies.
+#
+# This module defines the following variables:
+#
+# SUITESPARSE_FOUND: TRUE iff SuiteSparse and all dependencies have been found.
+# SUITESPARSE_INCLUDE_DIRS: Include directories for all SuiteSparse components.
+# SUITESPARSE_LIBRARIES: Libraries for all SuiteSparse component libraries and
+# dependencies.
+# SUITESPARSE_VERSION: Extracted from UFconfig.h (<= v3) or
+# SuiteSparse_config.h (>= v4).
+# SUITESPARSE_MAIN_VERSION: Equal to 4 if SUITESPARSE_VERSION = 4.2.1
+# SUITESPARSE_SUB_VERSION: Equal to 2 if SUITESPARSE_VERSION = 4.2.1
+# SUITESPARSE_SUBSUB_VERSION: Equal to 1 if SUITESPARSE_VERSION = 4.2.1
+#
+# SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION: TRUE iff running
+# on Ubuntu, SUITESPARSE_VERSION is 3.4.0 and found SuiteSparse is a system
+# install, in which case found version of SuiteSparse cannot be used to link
+# a shared library due to a bug (static linking is unaffected).
+#
+# The following variables control the behaviour of this module:
+#
+# SUITESPARSE_INCLUDE_DIR_HINTS: List of additional directories in which to
+# search for SuiteSparse includes,
+# e.g: /timbuktu/include.
+# SUITESPARSE_LIBRARY_DIR_HINTS: List of additional directories in which to
+# search for SuiteSparse libraries,
+# e.g: /timbuktu/lib.
+#
+# The following variables define the presence / includes & libraries for the
+# SuiteSparse components searched for, the SUITESPARSE_XX variables are the
+# union of the variables for all components.
+#
+# == Symmetric Approximate Minimum Degree (AMD)
+# AMD_FOUND
+# AMD_INCLUDE_DIR
+# AMD_LIBRARY
+#
+# == Constrained Approximate Minimum Degree (CAMD)
+# CAMD_FOUND
+# CAMD_INCLUDE_DIR
+# CAMD_LIBRARY
+#
+# == Column Approximate Minimum Degree (COLAMD)
+# COLAMD_FOUND
+# COLAMD_INCLUDE_DIR
+# COLAMD_LIBRARY
+#
+# Constrained Column Approximate Minimum Degree (CCOLAMD)
+# CCOLAMD_FOUND
+# CCOLAMD_INCLUDE_DIR
+# CCOLAMD_LIBRARY
+#
+# == Sparse Supernodal Cholesky Factorization and Update/Downdate (CHOLMOD)
+# CHOLMOD_FOUND
+# CHOLMOD_INCLUDE_DIR
+# CHOLMOD_LIBRARY
+#
+# == Multifrontal Sparse QR (SuiteSparseQR)
+# SUITESPARSEQR_FOUND
+# SUITESPARSEQR_INCLUDE_DIR
+# SUITESPARSEQR_LIBRARY
+#
+# == Common configuration for all but CSparse (SuiteSparse version >= 4).
+# SUITESPARSE_CONFIG_FOUND
+# SUITESPARSE_CONFIG_INCLUDE_DIR
+# SUITESPARSE_CONFIG_LIBRARY
+#
+# == Common configuration for all but CSparse (SuiteSparse version < 4).
+# UFCONFIG_FOUND
+# UFCONFIG_INCLUDE_DIR
+#
+# Optional SuiteSparse Dependencies:
+#
+# == Serial Graph Partitioning and Fill-reducing Matrix Ordering (METIS)
+# METIS_FOUND
+# METIS_LIBRARY
+
+# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
+# FindSuiteSparse was invoked.
+macro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
+ if (MSVC)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
+ endif (MSVC)
+endmacro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
+
+# Called if we failed to find SuiteSparse or any of it's required dependencies,
+# unsets all public (designed to be used externally) variables and reports
+# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
+macro(SUITESPARSE_REPORT_NOT_FOUND REASON_MSG)
+ unset(SUITESPARSE_FOUND)
+ unset(SUITESPARSE_INCLUDE_DIRS)
+ unset(SUITESPARSE_LIBRARIES)
+ unset(SUITESPARSE_VERSION)
+ unset(SUITESPARSE_MAIN_VERSION)
+ unset(SUITESPARSE_SUB_VERSION)
+ unset(SUITESPARSE_SUBSUB_VERSION)
+ # Do NOT unset SUITESPARSE_FOUND_REQUIRED_VARS here, as it is used by
+ # FindPackageHandleStandardArgs() to generate the automatic error message on
+ # failure which highlights which components are missing.
+
+ suitesparse_reset_find_library_prefix()
+
+ # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
+ # use the camelcase library name, not uppercase.
+ if (SuiteSparse_FIND_QUIETLY)
+ message(STATUS "Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
+ elseif (SuiteSparse_FIND_REQUIRED)
+ message(FATAL_ERROR "Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
+ else()
+ # Neither QUIETLY nor REQUIRED, use no priority which emits a message
+ # but continues configuration and allows generation.
+ message("-- Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
+ endif (SuiteSparse_FIND_QUIETLY)
+
+ # Do not call return(), s/t we keep processing if not called with REQUIRED
+ # and report all missing components, rather than bailing after failing to find
+ # the first.
+endmacro(SUITESPARSE_REPORT_NOT_FOUND)
+
+# Protect against any alternative find_package scripts for this library having
+# been called previously (in a client project) which set SUITESPARSE_FOUND, but
+# not the other variables we require / set here which could cause the search
+# logic here to fail.
+unset(SUITESPARSE_FOUND)
+
+# Handle possible presence of lib prefix for libraries on MSVC, see
+# also SUITESPARSE_RESET_FIND_LIBRARY_PREFIX().
+if (MSVC)
+ # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
+ # s/t we can set it back before returning.
+ set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ # The empty string in this list is important, it represents the case when
+ # the libraries have no prefix (shared libraries / DLLs).
+ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
+endif (MSVC)
+
+# On macOS, add the Homebrew prefix (with appropriate suffixes) to the
+# respective HINTS directories (after any user-specified locations). This
+# handles Homebrew installations into non-standard locations (not /usr/local).
+# We do not use CMAKE_PREFIX_PATH for this as given the search ordering of
+# find_xxx(), doing so would override any user-specified HINTS locations with
+# the Homebrew version if it exists.
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ find_program(HOMEBREW_EXECUTABLE brew)
+ mark_as_advanced(FORCE HOMEBREW_EXECUTABLE)
+ if (HOMEBREW_EXECUTABLE)
+ # Detected a Homebrew install, query for its install prefix.
+ execute_process(COMMAND ${HOMEBREW_EXECUTABLE} --prefix
+ OUTPUT_VARIABLE HOMEBREW_INSTALL_PREFIX
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message(STATUS "Detected Homebrew with install prefix: "
+ "${HOMEBREW_INSTALL_PREFIX}, adding to CMake search paths.")
+ list(APPEND SUITESPARSE_INCLUDE_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/include")
+ list(APPEND SUITESPARSE_LIBRARY_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/lib")
+ endif()
+endif()
+
+# Specify search directories for include files and libraries (this is the union
+# of the search directories for all OSs). Search user-specified hint
+# directories first if supplied, and search user-installed locations first
+# so that we prefer user installs to system installs where both exist.
+list(APPEND SUITESPARSE_CHECK_INCLUDE_DIRS
+ /opt/local/include
+ /opt/local/include/ufsparse # Mac OS X
+ /usr/local/homebrew/include # Mac OS X
+ /usr/local/include
+ /usr/include)
+list(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
+ /opt/local/lib
+ /opt/local/lib/ufsparse # Mac OS X
+ /usr/local/homebrew/lib # Mac OS X
+ /usr/local/lib
+ /usr/lib)
+# Additional suffixes to try appending to each search path.
+list(APPEND SUITESPARSE_CHECK_PATH_SUFFIXES
+ suitesparse) # Windows/Ubuntu
+
+# Wrappers to find_path/library that pass the SuiteSparse search hints/paths.
+#
+# suitesparse_find_component(<component> [FILES name1 [name2 ...]]
+# [LIBRARIES name1 [name2 ...]]
+# [REQUIRED])
+macro(suitesparse_find_component COMPONENT)
+ include(CMakeParseArguments)
+ set(OPTIONS REQUIRED)
+ set(MULTI_VALUE_ARGS FILES LIBRARIES)
+ cmake_parse_arguments(SUITESPARSE_FIND_${COMPONENT}
+ "${OPTIONS}" "" "${MULTI_VALUE_ARGS}" ${ARGN})
+
+ if (SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
+ list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS ${COMPONENT}_FOUND)
+ endif()
+
+ set(${COMPONENT}_FOUND TRUE)
+ if (SUITESPARSE_FIND_${COMPONENT}_FILES)
+ find_path(${COMPONENT}_INCLUDE_DIR
+ NAMES ${SUITESPARSE_FIND_${COMPONENT}_FILES}
+ HINTS ${SUITESPARSE_INCLUDE_DIR_HINTS}
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
+ if (${COMPONENT}_INCLUDE_DIR)
+ message(STATUS "Found ${COMPONENT} headers in: "
+ "${${COMPONENT}_INCLUDE_DIR}")
+ mark_as_advanced(${COMPONENT}_INCLUDE_DIR)
+ else()
+ # Specified headers not found.
+ set(${COMPONENT}_FOUND FALSE)
+ if (SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
+ suitesparse_report_not_found(
+ "Did not find ${COMPONENT} header (required SuiteSparse component).")
+ else()
+ message(STATUS "Did not find ${COMPONENT} header (optional "
+ "SuiteSparse component).")
+ # Hide optional vars from CMake GUI even if not found.
+ mark_as_advanced(${COMPONENT}_INCLUDE_DIR)
+ endif()
+ endif()
+ endif()
+
+ if (SUITESPARSE_FIND_${COMPONENT}_LIBRARIES)
+ find_library(${COMPONENT}_LIBRARY
+ NAMES ${SUITESPARSE_FIND_${COMPONENT}_LIBRARIES}
+ HINTS ${SUITESPARSE_LIBRARY_DIR_HINTS}
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
+ if (${COMPONENT}_LIBRARY)
+ message(STATUS "Found ${COMPONENT} library: ${${COMPONENT}_LIBRARY}")
+ mark_as_advanced(${COMPONENT}_LIBRARY)
+ else ()
+ # Specified libraries not found.
+ set(${COMPONENT}_FOUND FALSE)
+ if (SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
+ suitesparse_report_not_found(
+ "Did not find ${COMPONENT} library (required SuiteSparse component).")
+ else()
+ message(STATUS "Did not find ${COMPONENT} library (optional SuiteSparse "
+ "dependency)")
+ # Hide optional vars from CMake GUI even if not found.
+ mark_as_advanced(${COMPONENT}_LIBRARY)
+ endif()
+ endif()
+ endif()
+endmacro()
+
+# Given the number of components of SuiteSparse, and to ensure that the
+# automatic failure message generated by FindPackageHandleStandardArgs()
+# when not all required components are found is helpful, we maintain a list
+# of all variables that must be defined for SuiteSparse to be considered found.
+unset(SUITESPARSE_FOUND_REQUIRED_VARS)
+
+# BLAS.
+find_package(BLAS QUIET)
+if (NOT BLAS_FOUND)
+ suitesparse_report_not_found(
+ "Did not find BLAS library (required for SuiteSparse).")
+endif (NOT BLAS_FOUND)
+list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS BLAS_FOUND)
+
+# LAPACK.
+find_package(LAPACK QUIET)
+if (NOT LAPACK_FOUND)
+ suitesparse_report_not_found(
+ "Did not find LAPACK library (required for SuiteSparse).")
+endif (NOT LAPACK_FOUND)
+list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS LAPACK_FOUND)
+
+suitesparse_find_component(AMD REQUIRED FILES amd.h LIBRARIES amd)
+suitesparse_find_component(CAMD REQUIRED FILES camd.h LIBRARIES camd)
+suitesparse_find_component(COLAMD REQUIRED FILES colamd.h LIBRARIES colamd)
+suitesparse_find_component(CCOLAMD REQUIRED FILES ccolamd.h LIBRARIES ccolamd)
+suitesparse_find_component(CHOLMOD REQUIRED FILES cholmod.h LIBRARIES cholmod)
+suitesparse_find_component(
+ SUITESPARSEQR REQUIRED FILES SuiteSparseQR.hpp LIBRARIES spqr)
+if (SUITESPARSEQR_FOUND)
+ # SuiteSparseQR may be compiled with Intel Threading Building Blocks,
+ # we assume that if TBB is installed, SuiteSparseQR was compiled with
+ # support for it, this will do no harm if it wasn't.
+ find_package(TBB QUIET)
+ if (TBB_FOUND)
+ message(STATUS "Found Intel Thread Building Blocks (TBB) library "
+ "(${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} / ${TBB_INTERFACE_VERSION}) "
+ "include location: ${TBB_INCLUDE_DIRS}. Assuming SuiteSparseQR was "
+ "compiled with TBB.")
+ # Add the TBB libraries to the SuiteSparseQR libraries (the only
+ # libraries to optionally depend on TBB).
+ list(APPEND SUITESPARSEQR_LIBRARY ${TBB_LIBRARIES})
+ else()
+ message(STATUS "Did not find Intel TBB library, assuming SuiteSparseQR was "
+ "not compiled with TBB.")
+ endif()
+endif(SUITESPARSEQR_FOUND)
+
+# UFconfig / SuiteSparse_config.
+#
+# If SuiteSparse version is >= 4 then SuiteSparse_config is required.
+# For SuiteSparse 3, UFconfig.h is required.
+suitesparse_find_component(
+ SUITESPARSE_CONFIG FILES SuiteSparse_config.h LIBRARIES suitesparseconfig)
+
+if (SUITESPARSE_CONFIG_FOUND)
+ # SuiteSparse_config (SuiteSparse version >= 4) requires librt library for
+ # timing by default when compiled on Linux or Unix, but not on OSX (which
+ # does not have librt).
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
+ suitesparse_find_component(LIBRT LIBRARIES rt)
+ if (LIBRT_FOUND)
+ message(STATUS "Adding librt: ${LIBRT_LIBRARY} to "
+ "SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
+ "SuiteSparse is compiled with timing).")
+ list(APPEND SUITESPARSE_CONFIG_LIBRARY ${LIBRT_LIBRARY})
+ else()
+ message(STATUS "Could not find librt, but found SuiteSparse_config, "
+ "assuming that SuiteSparse was compiled without timing.")
+ endif ()
+ endif (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
+else()
+ # Failed to find SuiteSparse_config (>= v4 installs), instead look for
+ # UFconfig header which should be present in < v4 installs.
+ suitesparse_find_component(UFCONFIG FILES UFconfig.h)
+endif ()
+
+if (NOT SUITESPARSE_CONFIG_FOUND AND
+ NOT UFCONFIG_FOUND)
+ suitesparse_report_not_found(
+ "Failed to find either: SuiteSparse_config header & library (should be "
+ "present in all SuiteSparse >= v4 installs), or UFconfig header (should "
+ "be present in all SuiteSparse < v4 installs).")
+endif()
+
+# Extract the SuiteSparse version from the appropriate header (UFconfig.h for
+# <= v3, SuiteSparse_config.h for >= v4).
+list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSE_VERSION)
+
+if (UFCONFIG_FOUND)
+ # SuiteSparse version <= 3.
+ set(SUITESPARSE_VERSION_FILE ${UFCONFIG_INCLUDE_DIR}/UFconfig.h)
+ if (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
+ suitesparse_report_not_found(
+ "Could not find file: ${SUITESPARSE_VERSION_FILE} containing version "
+ "information for <= v3 SuiteSparse installs, but UFconfig was found "
+ "(only present in <= v3 installs).")
+ else (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
+ file(READ ${SUITESPARSE_VERSION_FILE} UFCONFIG_CONTENTS)
+
+ string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
+ SUITESPARSE_MAIN_VERSION "${UFCONFIG_CONTENTS}")
+ string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
+
+ string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
+ SUITESPARSE_SUB_VERSION "${UFCONFIG_CONTENTS}")
+ string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
+
+ string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
+ SUITESPARSE_SUBSUB_VERSION "${UFCONFIG_CONTENTS}")
+ string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
+
+ # This is on a single line s/t CMake does not interpret it as a list of
+ # elements and insert ';' separators which would result in 4.;2.;1 nonsense.
+ set(SUITESPARSE_VERSION
+ "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
+ endif (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
+endif (UFCONFIG_FOUND)
+
+if (SUITESPARSE_CONFIG_FOUND)
+ # SuiteSparse version >= 4.
+ set(SUITESPARSE_VERSION_FILE
+ ${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h)
+ if (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
+ suitesparse_report_not_found(
+ "Could not find file: ${SUITESPARSE_VERSION_FILE} containing version "
+ "information for >= v4 SuiteSparse installs, but SuiteSparse_config was "
+ "found (only present in >= v4 installs).")
+ else (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
+ file(READ ${SUITESPARSE_VERSION_FILE} SUITESPARSE_CONFIG_CONTENTS)
+
+ string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
+ SUITESPARSE_MAIN_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
+ string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
+
+ string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
+ SUITESPARSE_SUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
+ string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
+
+ string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
+ SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
+ string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
+
+ # This is on a single line s/t CMake does not interpret it as a list of
+ # elements and insert ';' separators which would result in 4.;2.;1 nonsense.
+ set(SUITESPARSE_VERSION
+ "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
+ endif (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
+endif (SUITESPARSE_CONFIG_FOUND)
+
+# METIS (Optional dependency).
+suitesparse_find_component(METIS LIBRARIES metis)
+
+# Only mark SuiteSparse as found if all required components and dependencies
+# have been found.
+set(SUITESPARSE_FOUND TRUE)
+foreach(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
+ if (NOT ${REQUIRED_VAR})
+ set(SUITESPARSE_FOUND FALSE)
+ endif (NOT ${REQUIRED_VAR})
+endforeach(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
+
+if (SUITESPARSE_FOUND)
+ list(APPEND SUITESPARSE_INCLUDE_DIRS
+ ${AMD_INCLUDE_DIR}
+ ${CAMD_INCLUDE_DIR}
+ ${COLAMD_INCLUDE_DIR}
+ ${CCOLAMD_INCLUDE_DIR}
+ ${CHOLMOD_INCLUDE_DIR}
+ ${SUITESPARSEQR_INCLUDE_DIR})
+ # Handle config separately, as otherwise at least one of them will be set
+ # to NOTFOUND which would cause any check on SUITESPARSE_INCLUDE_DIRS to fail.
+ if (SUITESPARSE_CONFIG_FOUND)
+ list(APPEND SUITESPARSE_INCLUDE_DIRS
+ ${SUITESPARSE_CONFIG_INCLUDE_DIR})
+ endif (SUITESPARSE_CONFIG_FOUND)
+ if (UFCONFIG_FOUND)
+ list(APPEND SUITESPARSE_INCLUDE_DIRS
+ ${UFCONFIG_INCLUDE_DIR})
+ endif (UFCONFIG_FOUND)
+ # As SuiteSparse includes are often all in the same directory, remove any
+ # repetitions.
+ list(REMOVE_DUPLICATES SUITESPARSE_INCLUDE_DIRS)
+
+ # Important: The ordering of these libraries is *NOT* arbitrary, as these
+ # could potentially be static libraries their link ordering is important.
+ list(APPEND SUITESPARSE_LIBRARIES
+ ${SUITESPARSEQR_LIBRARY}
+ ${CHOLMOD_LIBRARY}
+ ${CCOLAMD_LIBRARY}
+ ${CAMD_LIBRARY}
+ ${COLAMD_LIBRARY}
+ ${AMD_LIBRARY}
+ ${LAPACK_LIBRARIES}
+ ${BLAS_LIBRARIES})
+ if (SUITESPARSE_CONFIG_FOUND)
+ list(APPEND SUITESPARSE_LIBRARIES
+ ${SUITESPARSE_CONFIG_LIBRARY})
+ endif (SUITESPARSE_CONFIG_FOUND)
+ if (METIS_FOUND)
+ list(APPEND SUITESPARSE_LIBRARIES
+ ${METIS_LIBRARY})
+ endif (METIS_FOUND)
+endif()
+
+# Determine if we are running on Ubuntu with the package install of SuiteSparse
+# which is broken and does not support linking a shared library.
+set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION FALSE)
+if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
+ SUITESPARSE_VERSION VERSION_EQUAL 3.4.0)
+ find_program(LSB_RELEASE_EXECUTABLE lsb_release)
+ if (LSB_RELEASE_EXECUTABLE)
+ # Any even moderately recent Ubuntu release (likely to be affected by
+ # this bug) should have lsb_release, if it isn't present we are likely
+ # on a different Linux distribution (should be fine).
+ execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si
+ OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
+ SUITESPARSE_LIBRARIES MATCHES "/usr/lib/libamd")
+ # We are on Ubuntu, and the SuiteSparse version matches the broken
+ # system install version and is a system install.
+ set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION TRUE)
+ message(STATUS "Found system install of SuiteSparse "
+ "${SUITESPARSE_VERSION} running on Ubuntu, which has a known bug "
+ "preventing linking of shared libraries (static linking unaffected).")
+ endif (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
+ SUITESPARSE_LIBRARIES MATCHES "/usr/lib/libamd")
+ endif (LSB_RELEASE_EXECUTABLE)
+endif (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
+ SUITESPARSE_VERSION VERSION_EQUAL 3.4.0)
+
+suitesparse_reset_find_library_prefix()
+
+# Handle REQUIRED and QUIET arguments to FIND_PACKAGE
+include(FindPackageHandleStandardArgs)
+if (SUITESPARSE_FOUND)
+ find_package_handle_standard_args(SuiteSparse
+ REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
+ VERSION_VAR SUITESPARSE_VERSION
+ FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
+else (SUITESPARSE_FOUND)
+ # Do not pass VERSION_VAR to FindPackageHandleStandardArgs() if we failed to
+ # find SuiteSparse to avoid a confusing autogenerated failure message
+ # that states 'not found (missing: FOO) (found version: x.y.z)'.
+ find_package_handle_standard_args(SuiteSparse
+ REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
+ FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
+endif (SUITESPARSE_FOUND)
diff --git a/include/teb_local_planner/optimal_planner.h b/include/teb_local_planner/optimal_planner.h
index 6347470..9534b8d 100644
--- a/include/teb_local_planner/optimal_planner.h
+++ b/include/teb_local_planner/optimal_planner.h
@@ -57,7 +57,7 @@
#include <g2o/core/optimization_algorithm_gauss_newton.h>
#include <g2o/core/optimization_algorithm_levenberg.h>
#include <g2o/solvers/csparse/linear_solver_csparse.h>
-#include <g2o/solvers/cholmod/linear_solver_cholmod.h>
+//#include <g2o/solvers/cholmod/linear_solver_cholmod.h>
// g2o custom edges and vertices for the TEB planner
#include <teb_local_planner/g2o_types/edge_velocity.h>
diff --git a/src/teb_local_planner_ros.cpp b/src/teb_local_planner_ros.cpp
index c8ecafb..e7dd60a 100644
--- a/src/teb_local_planner_ros.cpp
+++ b/src/teb_local_planner_ros.cpp
@@ -55,7 +55,7 @@
#include "g2o/core/optimization_algorithm_gauss_newton.h"
#include "g2o/core/optimization_algorithm_levenberg.h"
#include "g2o/solvers/csparse/linear_solver_csparse.h"
-#include "g2o/solvers/cholmod/linear_solver_cholmod.h"
+//#include "g2o/solvers/cholmod/linear_solver_cholmod.h"
// register this planner both as a BaseLocalPlanner and as a MBF's CostmapController plugin