-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathCompileCLibraries.m
executable file
·1129 lines (1074 loc) · 57.1 KB
/
CompileCLibraries.m
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
%%COMPILECLIBRARIES Compile all of the functions implemented in C or C++
% that are to be called from Matlab in the unlimited
% distribution portion of the Tracker Component Library.
% If a C or C++ mex function has the same name as a file
% implemented in Matlab and is compiled, then Matlab will
% execute the compiled mex function rather than the
% (usually slower) Matlab code if it finds the compiled
% version first in its path. Thus, the compiled code is
% kept in a 0_Compiled_Code folder at the root level of
% the library to ensure that the compiled versions are
% found first.
%
%The file has been successfully run on Windows 10 using MinGW64 and
%Microsoft Visual C++ 2022 under Matlab 2024a.
%
%November 2021 David F. Crouse, Naval Research Laboratory, Washington D.C.
%(UNCLASSIFIED) DISTRIBUTION STATEMENT A. Approved for public release.
function CompileCLibraries()
%We are running the clear mex command, because in some versions of Matlab
%on Windows, if one compiled the files and then tries to compile them
%again, then one might get the error
%LINK : fatal error LNK1104: cannot open file
%if one does not run the clear mex command before trying to compile.
clear mex %#ok<CLMEX>
%Get the path to this file. It should be root level in the tracker library.
ScriptPath=mfilename('fullpath');
ScriptFolder=fileparts(ScriptPath);
%Save the old working directory and switch to the location of this file.
curDir=pwd;
cd(ScriptFolder)
%Compile divRectOpt
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./','-I./3rd_Party_Libraries/direct',...
'./Mathematical_Functions/Continuous_Optimization/divRectOpt.c',...
'./3rd_Party_Libraries/direct/direct_wrap.c',...
'./3rd_Party_Libraries/direct/DIRect.c',...
'./3rd_Party_Libraries/direct/DIRserial.c',...
'./3rd_Party_Libraries/direct/DIRsubrout.c');
%Compile quasiNewtonLBFGS
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./','-I./3rd_Party_Libraries/liblbfgs/include',...
'-I./3rd_Party_Libraries/liblbfgs/lib',...
'./Mathematical_Functions/Continuous_Optimization/quasiNewtonLBFGS.c',...
'./3rd_Party_Libraries/liblbfgs/lib/lbfgs.c');
%Compile misc code
%Compile code concerning the rounding mode
mex('-v','CFLAGS="$CFLAGS -frounding-math -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./','./Misc/setProcRoundingMode.c');
%Compile index2NDim
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Misc/Shared_C++_Code/',...
'./Misc/index2NDim.cpp',...
'./Misc/Shared_C++_Code/index2NDimCPP.cpp');
%Compile nDim2Index
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'./Misc/nDim2Index.cpp');
%Compile general coordinate system code.
%Compile spher2Cart
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/spher2Cart.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spher2CartCPP.cpp');
%Compile Cart2Sphere
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Cart2Sphere.cpp',...
'./Coordinate_Systems/Shared_C++_Code/Cart2SphereCPP.cpp');
%Compile ruv2Cart
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/ruv2Cart.cpp',...
'./Coordinate_Systems/Shared_C++_Code/ruv2CartCPP.cpp');
%Compile Cart2Ruv
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Cart2Ruv.cpp',...
'./Coordinate_Systems/Shared_C++_Code/Cart2RuvCPP.cpp');
%Compile getRangeRate
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Measurement_Components/getRangeRate.cpp',...
'./Coordinate_Systems/Shared_C++_Code/getRangeRateCPP.cpp');
%Compile state2RuvRR
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/State_Conversion/state2RuvRR.cpp',...
'./Coordinate_Systems/Shared_C++_Code/getRangeRateCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/Cart2RuvCPP.cpp');
%Compile state2SpherRR
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/State_Conversion/state2SpherRR.cpp',...
'./Coordinate_Systems/Shared_C++_Code/getRangeRateCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/Cart2SphereCPP.cpp');
%Compile ECEF2ENU
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/ECEF2ENU.cpp');
%Compile ENU2ECEF
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/ENU2ECEF.cpp');
%Compile uVec2GeogHeading
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/uVec2GeogHeading.cpp');
%Compile geogHeading2uVec
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/geogHeading2uVec.cpp');
%Compile getENUAxes
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/getENUAxes.cpp');
%Compile getEllipsHarmAxes
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/getEllipsHarmAxes.cpp',...
'./Coordinate_Systems/Shared_C++_Code/getEllipsHarmAxesCPP.cpp');
%Compile Cart2EllipsHarmon
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Cart2EllipsHarmon.cpp',...
'./Coordinate_Systems/Shared_C++_Code/Cart2EllipsHarmonCPP.cpp');
%Compile Cart2Ellipse
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'./Coordinate_Systems/Cart2Ellipse.c')
%Compile coordinate system gradient code
%Compile rangeGradient
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Jacobians/Component_Gradients/rangeGradient.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeGradientCPP.cpp');
%Compile spherAngGradient
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Jacobians/Component_Gradients/spherAngGradient.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngGradientCPP.cpp');
%Compile calcSpherConvJacob
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Jacobians/Converted_Jacobians/calcSpherConvJacob.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherConvJacobCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spher2CartCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeGradientCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngGradientCPP.cpp');
%Compile calcSpherInvJacob
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Jacobians/calcSpherInvJacob.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherInvJacobCPP.cpp');
%Compile coordinate system Hessian code
%Compile rangeHessian
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Hessians/Component_Hessians/rangeHessian.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeHessianCPP.cpp');
%Compile spherAngHessian
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Hessians/Component_Hessians/spherAngHessian.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngHessianCPP.cpp');
%Compile calcSpherInvHessian
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Hessians/calcSpherInvHessian.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherInvHessianCPP.cpp');
%Compile calcSpherHessian
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Hessians/calcSpherHessian.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngHessianCPP.cpp');
%Compile calcSpherConvHessian
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/Hessians/Converted_Hessians/calcSpherConvHessian.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherConvHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spher2CartCPP.cpp');
%Compile the relativity code
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Coordinate_Systems/Relativity/Shared_C_Code/',...
'./Coordinate_Systems/Relativity/relVecAdd.c',...
'./Coordinate_Systems/Relativity/Shared_C_Code/relVecAddC.c');
%Compile the magnetic and gravitational code.
%Compile NALegendreCosRat
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'./Mathematical_Functions/Polynomials/NALegendreCosRat.cpp',...
'./Mathematical_Functions/Shared_C++_Code/NALegendreCosRatCPP.cpp');
% Compile LegendreCos
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'./Mathematical_Functions/Polynomials/LegendreCos.cpp',...
'./Mathematical_Functions/Shared_C++_Code/NALegendreCosRatCPP.cpp');
%Compile normHelmholtz
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'./Mathematical_Functions/Polynomials/normHelmholtz.cpp',...
'./Mathematical_Functions/Shared_C++_Code/normHelmholtzCPP.cpp');
%Compile spherHarmonicEval
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Mathematical_Functions/Spherical_Harmonics/spherHarmonicEval.cpp',...
'./Mathematical_Functions/Shared_C++_Code/spherHarmonicEvalCPP.cpp',...
'./Mathematical_Functions/Shared_C++_Code/NALegendreCosRatCPP.cpp',...
'./Mathematical_Functions/Shared_C++_Code/normHelmholtzCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spher2CartCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherConvJacobCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeGradientCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngGradientCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherInvJacobCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherConvHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherInvHessianCPP.cpp');
%Compile spherHarmonicSetEval
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Mathematical_Functions/Spherical_Harmonics/spherHarmonicSetEval.cpp',...
'./Mathematical_Functions/Shared_C++_Code/spherHarmonicSetEvalCPP.cpp',...
'./Mathematical_Functions/Shared_C++_Code/NALegendreCosRatCPP.cpp',...
'./Mathematical_Functions/Shared_C++_Code/normHelmholtzCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spher2CartCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherConvJacobCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeGradientCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/rangeHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngGradientCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spherAngHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherInvJacobCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherConvHessianCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/calcSpherInvHessianCPP.cpp');
%Compile spherHarmonicCov
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Mathematical_Functions/Spherical_Harmonics/spherHarmonicCov.cpp',...
'./Mathematical_Functions/Shared_C++_Code/spherHarmonicCovCPP.cpp',...
'./Mathematical_Functions/Shared_C++_Code/normHelmholtzCPP.cpp',...
'./Coordinate_Systems/Shared_C++_Code/spher2CartCPP.cpp');
%Compile the 2D_Assignment_Algorithms
%Compile calc2DAssignmentProbs
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Assignment_Algorithms/Association_Probabilities_and_Specific_Updates/calc2DAssignmentProbs.cpp',...
'./Mathematical_Functions/Combinatorics/Shared_C++_Code/permCPP.cpp');
%Compile assign2D
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Assignment_Algorithms/2D_Assignment/Shared_C_Code/',...
'./Assignment_Algorithms/2D_Assignment/assign2D.c',...
'./Assignment_Algorithms/2D_Assignment/Shared_C_Code/assign2DC.c');
%Compile assign2DMissedDetect
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Assignment_Algorithms/2D_Assignment/Shared_C_Code/',...
'./Assignment_Algorithms/2D_Assignment/assign2DMissedDetect.c',...
'./Assignment_Algorithms/2D_Assignment/Shared_C_Code/assign2DMissedDetectC.c');
%Compile assign2DFull
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Assignment_Algorithms/2D_Assignment/Shared_C_Code/',...
'./Assignment_Algorithms/2D_Assignment/assign2DFull.c',...
'./Assignment_Algorithms/2D_Assignment/Shared_C_Code/assign2DFullC.c',...
'./Assignment_Algorithms/2D_Assignment/Shared_C_Code/assign2DMissedDetectC.c');
%Compile assign2DByCol
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'./Sample_Code/2D_Assignment/assign2DByCol.c');
%Compile assign2DAlt
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Assignment_Algorithms/k-Best_2D_Assignment/Shared_C++_Code/',...
'./Sample_Code/2D_Assignment/assign2DAlt.cpp',...
'./Assignment_Algorithms/k-Best_2D_Assignment/Shared_C++_Code/ShortestPathCPP.cpp');
%Compile kBest2DAssign
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Assignment_Algorithms/k-Best_2D_Assignment/Shared_C++_Code/',...
'./Assignment_Algorithms/k-Best_2D_Assignment/kBest2DAssign.cpp',...
'./Assignment_Algorithms/k-Best_2D_Assignment/Shared_C++_Code/ShortestPathCPP.cpp');
%Compile the containers
%Compile metricTreeCPPInt
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'./Container_Classes/metricTreeCPPInt.cpp',...
'./Container_Classes/Shared_C++_Code/metricTreeCPP.cpp',...
'./Mathematical_Functions/Shared_C++_Code/findFirstMaxCPP.cpp');
%Compile kdTreeCPPInt
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'./Container_Classes/kdTreeCPPInt.cpp',...
'./Container_Classes/Shared_C++_Code/kdTreeCPP.cpp',...
'./Mathematical_Functions/Shared_C++_Code/findFirstMaxCPP.cpp');
%Compile the mathematical functions
%Compile turnOrientation
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Accurate_Arithmetic/Shared_C++_Code/',...
'./Mathematical_Functions/Geometry/turnOrientation.cpp');
%Compile exactSignOfSum
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Accurate_Arithmetic/Shared_C++_Code/',...
'./Mathematical_Functions/Accurate_Arithmetic/exactSignOfSum.cpp');
%Compile pointIsInPolygon
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Geometry/Shared_C++_Code/',...
'./Mathematical_Functions/Geometry/pointIsInPolygon.cpp',...
'./Mathematical_Functions/Geometry/Shared_C++_Code/pointIsInPolygonCPP.cpp');
%Compile twoLineIntersectionPoint2D
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Geometry/Shared_C++_Code/',...
'./Mathematical_Functions/Geometry/twoLineIntersectionPoint2D.cpp',...
'./Mathematical_Functions/Geometry/Shared_C++_Code/twoLineIntersectionPoint2DCPP.cpp');
%Compile signedPolygonArea
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Geometry/Shared_C++_Code/',...
'./Mathematical_Functions/Geometry/signedPolygonArea.cpp',...
'./Mathematical_Functions/Geometry/Shared_C++_Code/signedPolygonAreaCPP.cpp');
%Compile perm
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Mathematical_Functions/Combinatorics/perm.cpp',...
'./Mathematical_Functions/Combinatorics/Shared_C++_Code/permCPP.cpp');
%Compile getNextCombo
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Mathematical_Functions/Combinatorics/getNextCombo.cpp');
%Compile getNextTuple
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Mathematical_Functions/Combinatorics/getNextTuple.cpp');
%Compile getAllTuples
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Mathematical_Functions/Combinatorics/genAllTuples.cpp');
%Compile unrankTuple
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Mathematical_Functions/Combinatorics/unrankTuple.cpp');
%Compile getNextGrayCode
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Mathematical_Functions/Combinatorics/getNextGrayCode.cpp');
%Compile findFirstMax
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'-I./Container_Classes/Shared_C++_Code/',...
'./Mathematical_Functions/findFirstMax.cpp',...
'./Mathematical_Functions/Shared_C++_Code/findFirstMaxCPP.cpp')
%Compile binSearchDoubles
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'./Mathematical_Functions/Searching/binSearchDoubles.c',...
'./Mathematical_Functions/Shared_C_Code/binSearchC.c')
%Compile MMOSPAApprox
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Assignment_Algorithms/k-Best_2D_Assignment/Shared_C++_Code/',...
'-I./Mathematical_Functions/MMOSPAApprox/Shared_C++_Code/',...
'./Mathematical_Functions/MMOSPAApprox/MMOSPAApprox.cpp',...
'./Mathematical_Functions/MMOSPAApprox/Shared_C++_Code/MMOSPAApproxCPP.cpp',...
'./Assignment_Algorithms/k-Best_2D_Assignment/Shared_C++_Code/ShortestPathCPP.cpp');
%Compile wrapRange
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'./Mathematical_Functions/wrapRange.cpp',...
'./Mathematical_Functions/Shared_C++_Code/wrapRangeCPP.cpp')
%Compile kronSym
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'./Mathematical_Functions/Basic_Matrix_Operations/kronSym.c')
%Compile heapSortVec
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'./Mathematical_Functions/Sorting/heapSortVec.c',...
'./Mathematical_Functions/Shared_C_Code/heapSortVecC.c');
%Compile permuteMatrix
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/permuteMatrix.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/permuteMatrixC.c')
%Compile minMatOverDim
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/minMatOverDim.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/minMatOverDimC.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/basicMatOps.c');
%Compile minOverDimIdx
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/minOverDimIdx.cpp');
%Compile compressNonSelDims
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/compressNonSelDims.cpp');
%Compile permuteVector
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/permuteVector.cpp');
%Compile permuteMatrixCols
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/permuteMatrixCols.cpp');
%Compile inversePermutation
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','COMPFLAGS="$COMPFLAGS /std:c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'./Mathematical_Functions/Combinatorics/inversePermutation.cpp',...
'./Mathematical_Functions/Combinatorics/Shared_C++_Code/inversePermutationCPP.cpp');
%Compile factorialLookup
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','COMPFLAGS="$COMPFLAGS /std:c++17 -Wall"','-outdir','./0_Compiled_Code/','-I./',...
'-I./Container_Classes/Shared_C++_Code/',...
'-I./Mathematical_Functions/Shared_C++_Code/',...
'./Mathematical_Functions/factorialLookup.cpp',...
'./Mathematical_Functions/Shared_C++_Code/factorialLookupCPP.cpp');
%Functions using Eigen
%Compile RunnalsGaussMixRedCPP
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Clustering_and_Mixture_Reduction/RunnalsGaussMixRed.cpp');
%Compile forwardSubstitution
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/forwardSubstitution.cpp');
%Compile backSubstitution
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/backSubstitution.cpp');
%Compile twoMatDiag
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/Joint_Matrix_Diagonalization/twoMatDiag.cpp');
%Compile jointMatDiagFrob
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/Joint_Matrix_Diagonalization/jointMatDiagFrob.cpp');
%Compile invCondNumberApprox
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/invCondNumberApprox.cpp');
%Compile matrixRank
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/matrixRank.cpp');
%Compile pseudoInverse
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall -DEIGEN_MPL2_ONLY"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./3rd_Party_Libraries/eigen-master/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'./Mathematical_Functions/Basic_Matrix_Operations/pseudoInverse.cpp');
%Functions using LAPACK
lapackInclude=['-I',fullfile(matlabroot,'extern','include')];
if(ispc())
lapackLib=fullfile(matlabroot,'extern','lib',computer('arch'),'microsoft','libmwlapack.lib');
else
lapackLib='-lmwlapack';
end
%Compile tria
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/',lapackInclude,'-I./',...
'./Mathematical_Functions/Basic_Matrix_Operations/tria.c',lapackLib)
%Functions using BLAS
blasInclude=['-I',fullfile(matlabroot,'extern','include')];
%Matlab says that we need the -lmwblas option to use BLAS functions.
%However, when cross compiling C and C++, MinGW64 has errors if we pass
%that. On the other hand Microsfot's compiler will not work if we do NOT
%pass that option.
cc=mex.getCompilerConfigurations('C','Selected');
if(strcmp(cc(1).Name,'MinGW64 Compiler (C)'))
%We want to omit this, but it is easier to just pass a second verbose
%command. An empty matrix or string will produce an error in Matlab's
%mex function.
blasLib='-v';
else
blasLib='-lmwblas';
end
%Compile the 3D Assignment Algorithms.
%Compile assign3D
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/',blasInclude,'-I./',...
'-I./Assignment_Algorithms/2D_Assignment/Shared_C_Code/',...
'-I./Assignment_Algorithms/3D_Assignment/Shared_C_Code/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/',...
'./Assignment_Algorithms/3D_Assignment/assign3D.c',...
'./Assignment_Algorithms/2D_Assignment/Shared_C_Code/assign2DC.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/basicMatOps.c',...
'./Assignment_Algorithms/3D_Assignment/Shared_C_Code/assign3DC.c',blasLib);
%Compile assign3DBB
mex('-v',blasLib,'CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/',blasInclude,'-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'-I./Assignment_Algorithms/2D_Assignment/Shared_C_Code/',...
'-I./Assignment_Algorithms/3D_Assignment/Shared_C_Code/',...
'-I./Assignment_Algorithms/3D_Assignment/Shared_C++_Code/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C++_Code/',...
'-I./Mathematical_Functions/Combinatorics/Shared_C++_Code/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/',...
'./Assignment_Algorithms/3D_Assignment/assign3DBB.cpp',...
'./Assignment_Algorithms/3D_Assignment/Shared_C++_Code/assign3DBBCPP.cpp',...
'./Mathematical_Functions/Shared_C_Code/heapSortVecC.c',...
'./Assignment_Algorithms/2D_Assignment/Shared_C_Code/assign2DC.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/basicMatOps.c',...
'./Assignment_Algorithms/3D_Assignment/Shared_C_Code/assign3DC.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/minMatOverDimC.c',...
'./Assignment_Algorithms/3D_Assignment/Shared_C_Code/assign3DLBC.c');
%Compile assign3DLB
mex('-v','CFLAGS="$CFLAGS -std=c11 -Wall"','-R2018a','-outdir','./0_Compiled_Code/','-I./',...
'-I./Assignment_Algorithms/2D_Assignment/Shared_C_Code/',...
'-I./Assignment_Algorithms/3D_Assignment/Shared_C_Code/',...
'-I./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/',...
'./Assignment_Algorithms/3D_Assignment/assign3DLB.c',...
'./Assignment_Algorithms/2D_Assignment/Shared_C_Code/assign2DC.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/basicMatOps.c',...
'./Mathematical_Functions/Basic_Matrix_Operations/Shared_C_Code/minMatOverDimC.c',...
'./Assignment_Algorithms/3D_Assignment/Shared_C_Code/assign3DLBC.c');
%%%Compile the SOFA library
%If compiling under Windows, the compile environment must be set up so
%that external libraries can be compiled and linked. The settings that
%Matlab has for the compiler should generally work. If compiling under
%other platforms it is usually not necessary to do anything but add the
%Matlab binaries to the search path so that other scripts can call the mex
%command if they want to compile mex files externally.
if(ispc())
cc=mex.getCompilerConfigurations();
compDet=cc.Details;
%Separate out each command that sets the environment.
setCommands=strsplit(compDet.SetEnv,'\n');
numCommands=length(setCommands);
%While setting the environment, the old values will be saved and the
%restored befoer this function terminates.
numSet=0;
envVars={};
origEnvVals={};
for curCommand=1:numCommands
command=setCommands{curCommand};
if(~isempty(command))
%The commands are of the format 'set COMPFLAGS=/c....' However,
%to set the environment in matlab, one must use the setenv
%function. This means splitting the command into parts. For
%example, here, the COMPFLAGS would be the first argument to
%the setenv command and the string after the first equals sign
%would be the second argument.
splitIdx=strfind(command,'=');
commandString=command((splitIdx+1):end);
%The first entry contains the 'set' word. Get rid of it and
%find the parameter being set.
temp=strsplit(command(1:(splitIdx-1)),' ');
%The name of the thing being set, like PATH or INCLUDE. We are
%using end instead of 2, because the strsplit might have slip
%out whitespace before the word 'set'.
envVar=temp{end};
%We want the string of the thing being set. Matlab puts the
%previous environmental variables at the end of the string.
%However, that will not work here, because we have to use the
%getenv command. The previous environmental variable is called
%with a % sign in front like %PATH%, so we can split on that
%and just take the first part.
settingString=strsplit(commandString,'%');
envVars{numSet+1}=envVar; %#ok<AGROW>
origEnvVals{numSet+1}=getenv(envVar); %#ok<AGROW>
%The mex compile program must be in the path for anyting to
%compile that wishes to externally call the matlab mex
%compiler.
if(strcmp(envVar,'PATH')==1||strcmp(envVar,'Path')==1||strcmp(envVar,'path')==1)
setenv(envVar,[settingString{1},';',matlabroot,'/bin'])
else
setenv(envVar,settingString{1})
end
numSet=numSet+1;
end
end
else
numSet=1;
envVars{1}='PATH';
origEnvVals{1}=getenv('PATH');
setenv('PATH',[origEnvVals{1},':',matlabroot,'/bin'])
end
%Switch to the SOFA code directory
cd ./3rd_Party_Libraries/sofa/src
%Run commands on the command line to build the library and place it in a
%known location.
if(isunix()||ismac())%*NIX/ Mac OS X
system('make -e CFLAGF=''-c -pedantic -Wall -W -O -fPIC'' CFLAGX=''-pedantic -Wall -W -O -fPIC''');
system('mv ./libsofa_c.a ../../../0_Compiled_Code/libsofa_c.a');
system('make clean');
linkCommands{1}='./0_Compiled_Code/libsofa_c.a';
elseif(ispc())
compPath=getenv('COMPILER');
[~,compName]=fileparts(compPath);
cc=[compPath,' ',getenv('COMPFLAGS'),' '];
ll=getenv('LINKER');
if(strcmp(compName,'gcc'))%If here, then minGW is probably being used.
system(['for %f in (*.c) do ',cc,'%f -c'])
%Store the names of the object files
system('dir /b *.o > temp.lst');
%Link the object files into an archive.
system('ar rv ./libsofa_c.a @temp.lst');
system('ranlib ./libsofa_c.a');
%Move the library into the folder with the compiled code.
system('move libsofa_c.a ..\..\..\0_Compiled_Code\libsofa_c.a');
%Get rid of the object files
system('del *.o');
%Get rid of the list of names of the object files.
system('del temp.lst');
linkCommands{1}='./0_Compiled_Code/libsofa_c.a';
else%If here, Microsoft Visual Studio is probably being used.
%Create object files for all of the C files.
system(['for %f in (*.c) do ',cc,'%f'])
%Store the names of the object files
system('dir /b *.obj > temp.lst');
%Combine the object files into a library. it is assumed that the
%linker takes options akin to the link function in Microsoft Visual
%Studio, so that we can tell it to make things into a library
%rather than trying to compile it into a program.
system([ll,' -lib /nologo /out:libsofa_c.lib @temp.lst']);
%Move the library into the folder with the compiled code.
system('move libsofa_c.lib ..\..\..\0_Compiled_Code\libsofa_c.lib');
%Get rid of the object files
system('del *.obj');
%Get rid of the list of names of the object files.
system('del temp.lst');
linkCommands{1}='-llibsofa_c';
linkCommands{2}='-L./0_Compiled_Code';
end
else
error('Cannot Compile SOFA library for unknown operating system')
end
cd(ScriptFolder)
%Compile astronomical functions that use the SOFA code
%Compile changeEpoch
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Astronomical_Code/changeEpoch.c',linkCommands{:})
%Compile starCat2Obs
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'-I./',...
'./Astronomical_Code/starCat2Obs.cpp',linkCommands{:})
%Compile aberCorr
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./Coordinate_Systems/Relativity/Shared_C_Code/',...
'-I./',...
'./Astronomical_Code/aberCorr.c',...
'./Coordinate_Systems/Relativity/Shared_C_Code/relVecAddC.c',linkCommands{:})
%Compile lightDeflectCorr
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Astronomical_Code/lightDeflectCorr.c',linkCommands{:})
%Compile the atmospheric code
%Compile NRLMSISE00GasTemp
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/nrlmsise-00-bc9a2fe/',...
'-I./',...
'./Atmosphere_and_Refraction/NRLMSISE00GasTemp.c',...
'./3rd_Party_Libraries/nrlmsise-00-bc9a2fe/nrlmsise-00.c',...
'./3rd_Party_Libraries/nrlmsise-00-bc9a2fe/nrlmsise-00_data.c')
%Compile NRLMSISE00Alt4Pres
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/nrlmsise-00-bc9a2fe/',...
'-I./',...
'./Atmosphere_and_Refraction/NRLMSISE00Alt4Pres.c',...
'./3rd_Party_Libraries/nrlmsise-00-bc9a2fe/nrlmsise-00.c',...
'./3rd_Party_Libraries/nrlmsise-00-bc9a2fe/nrlmsise-00_data.c')
%Compile simpAstroRefParam
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Atmosphere_and_Refraction/simpAstroRefParam.c',linkCommands{:})
%%Compile the coordinate transforms that use the SOFA code.
%Compile GCRS2ITRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/GCRS2ITRS.c',linkCommands{:})
%Compile ITRS2GCRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/ITRS2GCRS.c',linkCommands{:})
%Compile GCRS2TIRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/GCRS2TIRS.c',linkCommands{:})
%Compile TIRS2GCRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/TIRS2GCRS.c',linkCommands{:})
%Compile TEME2ITRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/TEME2ITRS.c',linkCommands{:})
%Compile ITRS2TEME
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/ITRS2TEME.c',linkCommands{:})
%Compile TOD2GCRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/TOD2GCRS.c',linkCommands{:})
%Compile GCRS2TOD
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/GCRS2TOD.c',linkCommands{:})
%Compile MOD2GCRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/MOD2GCRS.c',linkCommands{:})
%Compile GCRS2MOD
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/GCRS2MOD.c',linkCommands{:})
%Compile J2000F2ICRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/J2000F2ICRS.c',linkCommands{:})
%Compile ICRS2J2000F
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/ICRS2J2000F.c',linkCommands{:})
%Compile TIRS2ITRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/TIRS2ITRS.c',linkCommands{:})
%Compile ITRS2TIRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/ITRS2TIRS.c',linkCommands{:})
%Compile GCRS2CIRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/GCRS2CIRS.c',linkCommands{:})
%Compile CIRS2GCRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/CIRS2GCRS.c',linkCommands{:})
%Compile CIRS2TIRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/CIRS2TIRS.c',linkCommands{:})
%Compile TIRS2CIRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/TIRS2CIRS.c',linkCommands{:})
%Compile G2ICRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/G2ICRS.c',linkCommands{:})
%Compile ICRS2G
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/ICRS2G.c',linkCommands{:})
%Compile ICRS2Ecliptic
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/ICRS2Ecliptic.c',linkCommands{:})
%Compile ecliptic2ICRS
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Celestial_and_Terrestrial_Systems/ecliptic2ICRS.c',linkCommands{:})
%Compile ellips2Cart
mex('-v','-R2018a','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-outdir','./0_Compiled_Code/',...
'-I./',...
'-I./Coordinate_Systems/Shared_C++_Code/',...
'./Coordinate_Systems/ellips2Cart.cpp')
%Compile the time conversion functions that use the SOFA code.
%Compile UTC2Cal
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'-I./Coordinate_Systems/Time/Shared_C_Code/',...
'./Coordinate_Systems/Time/UTC2Cal.c',...
'Coordinate_Systems/Time/Shared_C_Code/UTC2CalC.c',linkCommands{:})
%Compile UTC2DayCount
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'-I./Coordinate_Systems/Time/Shared_C_Code/',...
'./Coordinate_Systems/Time/UTC2DayCount.c',...
'Coordinate_Systems/Time/Shared_C_Code/UTC2DayCountC.c',linkCommands{:})
%Compile Cal2UTC
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./','./Coordinate_Systems/Time/Cal2UTC.c',linkCommands{:})
%Compile UTC2TAI
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/UTC2TAI.c',linkCommands{:})
%Compile TAI2TT
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TAI2TT.c',linkCommands{:})
%Compile TCG2TT
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TCG2TT.c',linkCommands{:})
%Compile TT2TAI
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TT2TAI.c',linkCommands{:})
%Compile TT2TCG
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TT2TCG.c',linkCommands{:})
%Compile TT2GMST
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TT2GMST.c',linkCommands{:})
%Compile TT2GAST
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TT2GAST.c',linkCommands{:})
%Compile TAI2UTC
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TAI2UTC.c',linkCommands{:})
%Compile BesselEpoch2TDB
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/BesselEpoch2TDB.c',linkCommands{:})
%Compile TDB2BesselEpoch
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TDB2BesselEpoch.c',linkCommands{:})
%Compile TDB2TCB
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TDB2TCB.c',linkCommands{:})
%Compile TCB2TDB
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/TCB2TDB.c',linkCommands{:})
%Compile cumLeapSec
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/cumLeapSec.c',linkCommands{:})
%Compile JulDate2JulEpoch
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/JulDate2JulEpoch.c',linkCommands{:})
%Compile JulEpoch2JulDate
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Coordinate_Systems/Time/JulEpoch2JulDate.c',linkCommands{:})
%Compile TT2UT1
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'-I./Coordinate_Systems/Time/Shared_C_Code/',...
'./Coordinate_Systems/Time/TT2UT1.c',linkCommands{:})
%Compile TAI2UT1
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'-I./Coordinate_Systems/Time/Shared_C_Code/',...
'./Coordinate_Systems/Time/TAI2UT1.c',linkCommands{:})
%Compile TT2TCB
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'-I./Coordinate_Systems/Time/Shared_C_Code/',...
'./Coordinate_Systems/Time/TT2TCB.c',linkCommands{:})
%Compile TT2TDB
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'-I./Coordinate_Systems/Time/Shared_C_Code/',...
'./Coordinate_Systems/Time/TT2TDB.c',linkCommands{:})
%Compile TDB2TT
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'-I./Mathematical_Functions/Shared_C_Code/',...
'-I./Coordinate_Systems/Time/Shared_C_Code/',...
'./Coordinate_Systems/Time/TDB2TT.c',linkCommands{:})
%%Compile other astronomical code
%Compile approxSolarSysVec
mex('-v','CFLAGS="$CFLAGS -std=c11"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/sofa/src/',...
'-I./',...
'./Astronomical_Code/approxSolarSysVec.c',linkCommands{:})
%Compile propagateOrbitSGP4
mex('-v','CXXFLAGS="$CXXFLAGS -std=c++17 -Wall"','-R2018a','-outdir','./0_Compiled_Code/',...
'-I./3rd_Party_Libraries/SGP4/cpp/',...
'-I./',...
'./Astronomical_Code/propagateOrbitSGP4.cpp','./3rd_Party_Libraries/SGP4/cpp/SGP4.cpp')
%Get rid of the library as nothing else is going to link to it.
if(isunix()||ismac())%*NIX/ Mac OS X
system('rm ./0_Compiled_Code/libsofa_c.a');
else%Windows
if(strcmp(compName,'gcc'))
system('del .\0_Compiled_Code\libsofa_c.a');
else
system('del .\0_Compiled_Code\libsofa_c.lib');
end
end
%Compile the AIS library
cd ./3rd_Party_Libraries/libais-0048ceb/src/libais/
%Run commands on the command line to build the library and place it in a
%known location.
if(isunix()||ismac())%*NIX/ Mac OS X
system('make -f Makefile-custom libais.a');
system('mv ./libais.a ../../../../0_Compiled_Code/libais.a');
system('make -f Makefile-custom clean');
linkCommands{1}='./0_Compiled_Code/libais.a';
elseif(ispc())%Windows
compPath=getenv('COMPILER');