-
Notifications
You must be signed in to change notification settings - Fork 25
/
configure.cmd
1043 lines (882 loc) · 31.7 KB
/
configure.cmd
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
@echo off
rem Copyright 2020-2023 Bloomberg Finance L.P.
rem SPDX-License-Identifier: Apache-2.0
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
setlocal enableextensions enabledelayedexpansion
set NTF_CONFIGURE_REPOSITORY=%~dp0
rem Remove trailing slash
IF %NTF_CONFIGURE_REPOSITORY:~-1%==\ SET NTF_CONFIGURE_REPOSITORY=%NTF_CONFIGURE_REPOSITORY:~0,-1%
set "NTF_CONFIGURE_REPOSITORY=%NTF_CONFIGURE_REPOSITORY:/=\%"
set NTF_CONFIGURE_UNAME=Windows
IF NOT DEFINED NTF_CONFIGURE_REFROOT (
set NTF_CONFIGURE_REFROOT=C:\
)
IF NOT DEFINED NTF_CONFIGURE_PREFIX (
set NTF_CONFIGURE_PREFIX=\opt\bb
)
IF NOT DEFINED NTF_CONFIGURE_OUTPUT (
set NTF_CONFIGURE_OUTPUT=%NTF_CONFIGURE_REPOSITORY%\build
)
IF NOT DEFINED NTF_CONFIGURE_DISTRIBUTION (
set NTF_CONFIGURE_DISTRIBUTION=unstable
)
IF NOT DEFINED NTF_CONFIGURE_GENERATOR (
set NTF_CONFIGURE_GENERATOR=Ninja
)
IF NOT DEFINED NTF_CONFIGURE_UFID (
set NTF_CONFIGURE_UFID=opt_dbg_exc_mt_64
)
IF NOT DEFINED NTF_CONFIGURE_UNITY (
set NTF_CONFIGURE_UNITY=0
)
IF NOT DEFINED NTF_CONFIGURE_JOBS (
set NTF_CONFIGURE_JOBS=8
)
IF NOT DEFINED NTF_CONFIGURE_PROJECT (
set NTF_CONFIGURE_PROJECT=ntf
)
set NTF_CONFIGURE_WITH_BSL=1
set NTF_CONFIGURE_WITH_BDL=1
set NTF_CONFIGURE_WITH_BAL=1
set NTF_CONFIGURE_WITH_NTS=1
set NTF_CONFIGURE_WITH_NTC=1
IF NOT DEFINED NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV4 (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV4=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV6 (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV6=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_ADDRESS_FAMILY_LOCAL (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_LOCAL=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_TCP (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_TCP=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_UDP (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_UDP=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_LOCAL (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_LOCAL=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_SELECT (
set NTF_CONFIGURE_WITH_SELECT=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_POLL (
set NTF_CONFIGURE_WITH_POLL=1
)
set NTF_CONFIGURE_WITH_EPOLL=0
set NTF_CONFIGURE_WITH_DEVPOLL=0
set NTF_CONFIGURE_WITH_EVENTPORT=0
set NTF_CONFIGURE_WITH_POLLSET=0
set NTF_CONFIGURE_WITH_KQUEUE=0
IF NOT DEFINED NTF_CONFIGURE_WITH_IOCP (
set NTF_CONFIGURE_WITH_IOCP=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_OPENSSL (
set NTF_CONFIGURE_WITH_OPENSSL=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING (
set NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_THREAD_SCALING (
set NTF_CONFIGURE_WITH_THREAD_SCALING=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_DEPRECATED_FEATURES (
set NTF_CONFIGURE_WITH_DEPRECATED_FEATURES=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_LOGGING (
set NTF_CONFIGURE_WITH_LOGGING=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_METRICS (
set NTF_CONFIGURE_WITH_METRICS=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_INLINING_SUGGESTED (
set NTF_CONFIGURE_WITH_INLINING_SUGGESTED=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_INLINING_FORCED (
set NTF_CONFIGURE_WITH_INLINING_FORCED=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_INLINING_DISABLED (
set NTF_CONFIGURE_WITH_INLINING_DISABLED=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_BRANCH_PREDICTION (
set NTF_CONFIGURE_WITH_BRANCH_PREDICTION=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_SPIN_LOCKS (
set NTF_CONFIGURE_WITH_SPIN_LOCKS=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_USERSPACE_MUTEXES (
set NTF_CONFIGURE_WITH_USERSPACE_MUTEXES=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_SYSTEM_MUTEXES (
set NTF_CONFIGURE_WITH_SYSTEM_MUTEXES=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_RECURSIVE_MUTEXES (
set NTF_CONFIGURE_WITH_RECURSIVE_MUTEXES=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_USAGE_EXAMPLES (
set NTF_CONFIGURE_WITH_USAGE_EXAMPLES=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_MOCKS (
set NTF_CONFIGURE_WITH_MOCKS=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_INTEGRATION_TESTS (
set NTF_CONFIGURE_WITH_INTEGRATION_TESTS=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_WARNINGS (
set NTF_CONFIGURE_WITH_WARNINGS=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_WARNINGS_AS_ERRORS (
set NTF_CONFIGURE_WITH_WARNINGS_AS_ERRORS=1
)
IF NOT DEFINED NTF_CONFIGURE_WITH_TIME_TRACE (
set NTF_CONFIGURE_WITH_TIME_TRACE=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_TIME_REPORT (
set NTF_CONFIGURE_WITH_TIME_REPORT=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_COVERAGE (
set NTF_CONFIGURE_WITH_COVERAGE=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_VALGRIND (
set NTF_CONFIGURE_WITH_VALGRIND=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_DOCUMENTATION (
set NTF_CONFIGURE_WITH_DOCUMENTATION=0
)
IF NOT DEFINED NTF_CONFIGURE_WITH_DOCUMENTATION_INTERNAL (
set NTF_CONFIGURE_WITH_DOCUMENTATION_INTERNAL=0
)
set NTF_CONFIGURE_VERBOSE=0
set NTF_CONFIGURE_WHAT=0
set NTF_CONFIGURE_CLEAN=1
set NTF_CONFIGURE_UPDATE=1
:PARSE_COMMAND_LINE
if not "%1"=="" (
if "%1"=="--refroot" (
set NTF_CONFIGURE_REFROOT=%2
shift
)
if "%1"=="--prefix" (
set NTF_CONFIGURE_PREFIX=%2
shift
)
if "%1"=="--output" (
set NTF_CONFIGURE_OUTPUT=%2
shift
)
if "%1"=="--distribution" (
set NTF_CONFIGURE_DISTRIBUTION=%2
shift
)
if "%1"=="--ufid" (
set NTF_CONFIGURE_UFID=%2
shift
)
if "%1"=="--unity" (
set NTF_CONFIGURE_UNITY=1
)
if "%1"=="--generator" (
set NTF_CONFIGURE_GENERATOR=%2
shift
)
if "%1"=="--project" (
set NTF_CONFIGURE_PROJECT=%2
shift
)
if "%1"=="--jobs" (
set NTF_CONFIGURE_JOBS=%2
shift
)
if "%1"=="--clean" (
set NTF_CONFIGURE_CLEAN=1
)
if "%1"=="--keep" (
set NTF_CONFIGURE_CLEAN=0
)
if "%1"=="--debug" (
set NTF_CONFIGURE_UFID=dbg_exc_mt_64
set NTF_CONFIGURE_WITH_LOGGING=1
)
if "%1"=="--release" (
set NTF_CONFIGURE_UFID=opt_dbg_exc_mt_64
)
if "%1"=="--with-warnings" (
set NTF_CONFIGURE_WITH_WARNINGS=1
)
if "%1"=="--with-warnings-as-errors" (
set NTF_CONFIGURE_WITH_WARNINGS_AS_ERRORS=1
)
if "%1"=="--with-time-trace" (
set NTF_CONFIGURE_WITH_TIME_TRACE=1
)
if "%1"=="--with-time-reports" (
set NTF_CONFIGURE_WITH_TIME_REPORTS=1
)
if "%1"=="--with-coverage" (
set NTF_CONFIGURE_WITH_COVERAGE=1
)
if "%1"=="--with-valgrind" (
set NTF_CONFIGURE_WITH_VALGRIND=1
)
if "%1"=="--with-bsl" (
set NTF_CONFIGURE_WITH_BSL=1
)
if "%1"=="--with-bdl" (
set NTF_CONFIGURE_WITH_BDL=1
)
if "%1"=="--with-bal" (
set NTF_CONFIGURE_WITH_BAL=1
)
if "%1"=="--with-nts" (
set NTF_CONFIGURE_WITH_NTS=1
)
if "%1"=="--with-ntc" (
set NTF_CONFIGURE_WITH_NTC=1
)
if "%1"=="--with-address-family-ipv4" (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV4=1
)
if "%1"=="--with-address-family-ipv6" (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV4=1
)
if "%1"=="--with-address-family-local" (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_LOCAL=1
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_LOCAL=1
)
if "%1"=="--with-transport-protocol-tcp" (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_TCP=1
)
if "%1"=="--with-transport-protocol-udp" (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_UDP=1
)
if "%1"=="--with-transport-protocol-local" (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_LOCAL=1
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_LOCAL=1
)
if "%1"=="--with-select" (
set NTF_CONFIGURE_WITH_SELECT=1
)
if "%1"=="--with-poll" (
set NTF_CONFIGURE_WITH_POLL=1
)
if "%1"=="--with-iocp" (
set NTF_CONFIGURE_WITH_IOCP=1
)
if "%1"=="--with-openssl" (
set NTF_CONFIGURE_WITH_OPENSSL=1
)
if "%1"=="--with-dynamic-load-balancing" (
set NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=1
)
if "%1"=="--with-thread-scaling" (
set NTF_CONFIGURE_WITH_THREAD_SCALING=1
)
if "%1"=="--with-deprecated-features" (
set NTF_CONFIGURE_WITH_DEPRECATED_FEATURES=1
)
if "%1"=="--with-logging" (
set NTF_CONFIGURE_WITH_LOGGING=1
)
if "%1"=="--with-metrics" (
set NTF_CONFIGURE_WITH_METRICS=1
)
if "%1"=="--with-inlining-suggested" (
set NTF_CONFIGURE_WITH_INLINING_SUGGESTED=1
)
if "%1"=="--with-inlining-forced" (
set NTF_CONFIGURE_WITH_INLINING_FORCED=1
)
if "%1"=="--with-inlining-disabled" (
set NTF_CONFIGURE_WITH_INLINING_DISABLED=1
)
if "%1"=="--with-branch-prediction" (
set NTF_CONFIGURE_WITH_BRANCH_PREDICTION=1
)
if "%1"=="--with-spin-locks" (
set NTF_CONFIGURE_WITH_SPIN_LOCKS=1
)
if "%1"=="--with-userspace-mutexes" (
set NTF_CONFIGURE_WITH_USERSPACE_MUTEXES=1
)
if "%1"=="--with-system-mutexes" (
set NTF_CONFIGURE_WITH_SYSTEM_MUTEXES=1
)
if "%1"=="--with-recursive-mutexes" (
set NTF_CONFIGURE_WITH_RECURSIVE_MUTEXES=1
)
if "%1"=="--with-usage-examples" (
set NTF_CONFIGURE_WITH_USAGE_EXAMPLES=1
)
if "%1"=="--with-mocks" (
set NTF_CONFIGURE_WITH_MOCKS=1
)
if "%1"=="--with-integration-tests" (
set NTF_CONFIGURE_WITH_INTEGRATION_TESTS=1
)
if "%1"=="--with-documentation" (
set NTF_CONFIGURE_WITH_DOCUMENTATION=1
)
if "%1"=="--with-documentation-internal" (
set NTF_CONFIGURE_WITH_DOCUMENTATION_INTERNAL=1
)
if "%1"=="--without-warnings" (
set NTF_CONFIGURE_WITH_WARNINGS=0
)
if "%1"=="--without-warnings-as-errors" (
set NTF_CONFIGURE_WITH_WARNINGS_AS_ERRORS=0
)
if "%1"=="--without-time-trace" (
set NTF_CONFIGURE_WITH_TIME_TRACE=0
)
if "%1"=="--without-time-report" (
set NTF_CONFIGURE_WITH_TIME_REPORT=0
)
if "%1"=="--without-coverage" (
set NTF_CONFIGURE_WITH_COVERAGE=0
)
if "%1"=="--without-valgrind" (
set NTF_CONFIGURE_WITH_VALGRIND=0
)
if "%1"=="--without-bsl" (
set NTF_CONFIGURE_WITH_BSL=0
)
if "%1"=="--without-bdl" (
set NTF_CONFIGURE_WITH_BDL=0
)
if "%1"=="--without-bal" (
set NTF_CONFIGURE_WITH_BAL=0
)
if "%1"=="--without-nts" (
set NTF_CONFIGURE_WITH_NTS=0
)
if "%1"=="--without-ntc" (
set NTF_CONFIGURE_WITH_NTC=0
)
if "%1"=="--without-address-family-ipv4" (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV4=0
)
if "%1"=="--without-address-family-ipv6" (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_IPV4=0
)
if "%1"=="--without-address-family-local" (
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_LOCAL=0
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_LOCAL=0
)
if "%1"=="--without-transport-protocol-tcp" (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_TCP=0
)
if "%1"=="--without-transport-protocol-udp" (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_UDP=0
)
if "%1"=="--without-transport-protocol-local" (
set NTF_CONFIGURE_WITH_TRANSPORT_PROTOCOL_LOCAL=0
set NTF_CONFIGURE_WITH_ADDRESS_FAMILY_LOCAL=0
)
if "%1"=="--without-select" (
set NTF_CONFIGURE_WITH_SELECT=0
)
if "%1"=="--without-poll" (
set NTF_CONFIGURE_WITH_POLL=0
)
if "%1"=="--without-iocp" (
set NTF_CONFIGURE_WITH_IOCP=0
)
if "%1"=="--without-openssl" (
set NTF_CONFIGURE_WITH_OPENSSL=0
)
if "%1"=="--without-dynamic-load-balancing" (
set NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=0
)
if "%1"=="--without-thread-scaling" (
set NTF_CONFIGURE_WITH_THREAD_SCALING=0
)
if "%1"=="--without-deprecated-features" (
set NTF_CONFIGURE_WITH_DEPRECATED_FEATURES=0
)
if "%1"=="--without-logging" (
set NTF_CONFIGURE_WITH_LOGGING=0
)
if "%1"=="--without-metrics" (
set NTF_CONFIGURE_WITH_METRICS=0
)
if "%1"=="--without-inlining-suggested" (
set NTF_CONFIGURE_WITH_INLINING_SUGGESTED=0
)
if "%1"=="--without-inlining-forced" (
set NTF_CONFIGURE_WITH_INLINING_FORCED=0
)
if "%1"=="--without-inlining-disabled" (
set NTF_CONFIGURE_WITH_INLINING_DISABLED=0
)
if "%1"=="--without-branch-prediction" (
set NTF_CONFIGURE_WITH_BRANCH_PREDICTION=0
)
if "%1"=="--without-spin-locks" (
set NTF_CONFIGURE_WITH_SPIN_LOCKS=0
)
if "%1"=="--without-userspace-mutexes" (
set NTF_CONFIGURE_WITH_USERSPACE_MUTEXES=0
)
if "%1"=="--without-system-mutexes" (
set NTF_CONFIGURE_WITH_SYSTEM_MUTEXES=0
)
if "%1"=="--without-recursive-mutexes" (
set NTF_CONFIGURE_WITH_RECURSIVE_MUTEXES=0
)
if "%1"=="--without-usage-examples" (
set NTF_CONFIGURE_WITH_USAGE_EXAMPLES=0
)
if "%1"=="--without-mocks" (
set NTF_CONFIGURE_WITH_MOCKS=0
)
if "%1"=="--without-integration-tests" (
set NTF_CONFIGURE_WITH_INTEGRATION_TESTS=0
)
if "%1"=="--without-documentation" (
set NTF_CONFIGURE_WITH_DOCUMENTATION=0
)
if "%1"=="--without-documentation-internal" (
set NTF_CONFIGURE_WITH_DOCUMENTATION_INTERNAL=0
)
if "%1"=="--update" (
set NTF_CONFIGURE_UPDATE=1
)
if "%1"=="--what" (
set NTF_CONFIGURE_WHAT=1
)
if "%1"=="--verbose" (
set NTF_CONFIGURE_VERBOSE=1
)
if "%1"=="--clion_config" (
set NTF_GENERATE_CLION_CONFIG=%2
shift
)
if "%1"=="--help" (
call :USAGE
exit /B 0
)
shift
goto :PARSE_COMMAND_LINE
)
set NTF_CONFIGURE_UFID_BASE=%NTF_CONFIGURE_UFID%
set "NTF_CONFIGURE_UFID=%NTF_CONFIGURE_UFID%_cpp20"
set NTF_CONFIGURE_LIBDIR=lib64
set NTF_CONFIGURE_OPT_BB=%NTF_CONFIGURE_REFROOT%/%NTF_CONFIGURE_PREFIX%
call :NORMALIZEPATH %NTF_CONFIGURE_OPT_BB%
set NTF_CONFIGURE_OPT_BB=%RETVAL%
set "NTF_CONFIGURE_OPT_BB=%NTF_CONFIGURE_OPT_BB:/=\%"
set NTF_CONFIGURE_OUTPUT=%NTF_CONFIGURE_OUTPUT%/%NTF_CONFIGURE_UNAME%/%NTF_CONFIGURE_UFID_BASE%
call :NORMALIZEPATH %NTF_CONFIGURE_OUTPUT%
set NTF_CONFIGURE_OUTPUT=%RETVAL%
set "NTF_CONFIGURE_OUTPUT=%NTF_CONFIGURE_OUTPUT:/=\%"
if "%VisualStudioVersion%"=="17.0" set visualStudioDate=2022
if "%VisualStudioVersion%"=="16.0" set visualStudioDate=2019
if "%VisualStudioVersion%"=="15.0" set visualStudioDate=2017
if "%VisualStudioVersion%"=="14.0" set visualStudioDate=2015
if %NTF_CONFIGURE_CLEAN% equ 1 (
if exist %NTF_CONFIGURE_OUTPUT% (
rmdir /S /Q %NTF_CONFIGURE_OUTPUT%
)
)
if %NTF_CONFIGURE_PROJECT%==bde (
goto :BDE
) else (
goto :NTF
)
:BDE
echo Configuring with BDE CMake
set BDE_CMAKE_UPLID=windows-windows_nt-x86_64-10.0-msvc-!visualStudioDate!
set BDE_CMAKE_UFID=%NTF_CONFIGURE_UFID%
set BDE_CMAKE_BUILD_DIR=%NTF_CONFIGURE_OUTPUT%
set CXX=cl
set CC=cl
set BDE_CMAKE_TOOLCHAIN=toolchains\win32\cl-default
set BDE_CMAKE_INSTALL_DIR=%NTF_CONFIGURE_PREFIX%
rem set DISTRIBUTION_REFROOT=%NTF_CONFIGURE_REFROOT%
set PATH=%NTF_CONFIGURE_OPT_BB%\bin;%NTF_CONFIGURE_OPT_BB%\libexec\bde-tools\bin;%PATH%
set CONFIGURE_BDE_BUILD_ENV_PY=%NTF_CONFIGURE_OPT_BB%\libexec\bde-tools\bin\bde_build_env.py
set CONFIGURE_CMAKE_BUILD_PY=%NTF_CONFIGURE_OPT_BB%\libexec\bde-tools\bin\cmake_build.py
if %NTF_CONFIGURE_VERBOSE% equ 1 (
set NTF_CONFIGURE_VERBOSE_OPTION=-v
)
python %CONFIGURE_CMAKE_BUILD_PY% configure -G "%NTF_CONFIGURE_GENERATOR%" --refroot %NTF_CONFIGURE_REFROOT% --prefix %NTF_CONFIGURE_PREFIX% %NTF_CONFIGURE_VERBOSE_OPTION%
if %ERRORLEVEL% neq 0 (
echo Failed to configure
exit /B 1
)
set NTF_CONFIGURE_MAKEFILE=%NTF_CONFIGURE_REPOSITORY%\makefile
set NTF_CONFIGURE_MAKETARGET=%NTF_CONFIGURE_OUTPUT%\compile_commands.cmd
> %NTF_CONFIGURE_MAKEFILE% (
@echo..SUFFIXES:
@echo.
@echo.build: .phony
@echo. @%NTF_CONFIGURE_MAKETARGET% build
@echo.
@echo.all:
@echo. @%NTF_CONFIGURE_MAKETARGET% all
@echo.
@echo.test:
@echo. @%NTF_CONFIGURE_MAKETARGET% test
@echo.
@echo.test_usage:
@echo. @%NTF_CONFIGURE_MAKETARGET% test_usage
@echo.
@echo.install:
@echo. @%NTF_CONFIGURE_MAKETARGET% install
@echo.
@echo.documentation:
@echo. @%NTF_CONFIGURE_MAKETARGET% documentation
@echo.
@echo.format:
@echo. @%NTF_CONFIGURE_MAKETARGET% format
@echo.
@echo.info:
@echo. @%NTF_CONFIGURE_MAKETARGET% info
@echo.
@echo..phony:
)
> %NTF_CONFIGURE_MAKETARGET% (
@echo.@echo off
@echo.setlocal
@echo.
@echo.set MAKEFILE_TARGET=%%1
@echo.
@echo.set PATH=%NTF_CONFIGURE_OUTPUT%;%NTF_CONFIGURE_OPT_BB%;%%PATH%%
@echo.
@echo.if "%%MAKEFILE_TARGET%%"=="build" (
@echo. cmake --build %NTF_CONFIGURE_OUTPUT% -j %NTF_CONFIGURE_JOBS%
@echo. if %%ERRORLEVEL%% neq 0 (
@echo. echo Failed to build
@echo. exit /B 1
@echo. ^)
@echo. exit /B 0
@echo.^)
@echo.
@echo.if "%%MAKEFILE_TARGET%%"=="all" (
@echo. cmake --build %NTF_CONFIGURE_OUTPUT% -j %NTF_CONFIGURE_JOBS%
@echo. if %%ERRORLEVEL%% neq 0 (
@echo. echo Failed to build
@echo. exit /B 1
@echo. ^)
@echo. cmake --build %NTF_CONFIGURE_OUTPUT% -j %NTF_CONFIGURE_JOBS% --target all.t
@echo. if %%ERRORLEVEL%% neq 0 (
@echo. echo Failed to build test drivers
@echo. exit /B 1
@echo. ^)
@echo. exit /B 0
@echo.^)
@echo.
@echo.if "%%MAKEFILE_TARGET%%"=="test" (
@echo. cmake --build %NTF_CONFIGURE_OUTPUT% -j %NTF_CONFIGURE_JOBS% --target all.t
@echo. if %%ERRORLEVEL%% neq 0 (
@echo. echo Failed to build test drivers
@echo. exit /B 1
@echo. ^)
@echo. cmake --build %NTF_CONFIGURE_OUTPUT% -j 1 --target test
@echo. if %%ERRORLEVEL%% neq 0 (
@echo. echo Failed to execute test drivers
@echo. exit /B 1
@echo. ^)
@echo. exit /B 0
@echo.^)
@echo.
@echo.if "%%MAKEFILE_TARGET%%"=="test_usage" (
@echo. echo Not implemented
@echo. exit /B 1
@echo.^)
@echo.
@echo.if "%%MAKEFILE_TARGET%%"=="install" (
@echo. cmake --install %NTF_CONFIGURE_OUTPUT% --prefix %NTF_CONFIGURE_OPT_BB%
@echo. if %ERRORLEVEL% neq 0 (
@echo. echo Failed to install
@echo. exit /B 1
@echo. ^)
@echo. exit /B 0
@echo.^)
@echo.
@echo.if "%%MAKEFILE_TARGET%%"=="documentation" (
@echo. echo Not implemented
@echo. exit /B 1
@echo.^)
@echo.
@echo.if "%%MAKEFILE_TARGET%%"=="format" (
@echo. echo Not implemented
@echo. exit /B 1
@echo.^)
@echo.
@echo.cmake --build %NTF_CONFIGURE_OUTPUT% --target %%MAKEFILE_TARGET%%
@echo.if %%ERRORLEVEL%% neq 0 (
@echo. echo Failed to build %%MAKEFILE_TARGET%%
@echo. exit /B 1
@echo.^)
@echo.exit /B 0
)
goto :DONE
:NTF
echo Configuring with NTF CMake
set CC=cl
set CXX=cl
set NTF_CONFIGURE_CMAKE_OPTION_DISTRIBUTION_REFROOT= -DDISTRIBUTION_REFROOT:STRING=%NTF_CONFIGURE_REFROOT%
set NTF_CONFIGURE_CMAKE_OPTION_INSTALL_PREFIX= -DCMAKE_INSTALL_PREFIX:STRING=%NTF_CONFIGURE_PREFIX%
if %NTF_CONFIGURE_VERBOSE% equ 1 (
set NTF_CONFIGURE_CMAKE_OPTION_VERBOSE= -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
) else (
set NTF_CONFIGURE_CMAKE_OPTION_VERBOSE= -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
)
set NTF_CONFIGURE_CMAKE_OPTION_UFID= -DUFID:STRING=%NTF_CONFIGURE_UFID%
echo %NTF_CONFIGURE_UFID%|findstr /r "opt" 2>&1 > nul
if %ERRORLEVEL% equ 0 (
set NTF_CONFIGURE_UFID_HAS_OPT=1
) else (
set NTF_CONFIGURE_UFID_HAS_OPT=0
)
echo %NTF_CONFIGURE_UFID%|findstr /r "dbg" 2>&1 > nul
if %ERRORLEVEL% equ 0 (
set NTF_CONFIGURE_UFID_HAS_DBG=1
) else (
set NTF_CONFIGURE_UFID_HAS_DBG=0
)
if %NTF_CONFIGURE_UFID_HAS_OPT% equ 1 (
if %NTF_CONFIGURE_UFID_HAS_DBG% equ 1 (
set NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE= -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
) else (
set NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE= -DCMAKE_BUILD_TYPE:STRING=Release
)
) else (
if %NTF_CONFIGURE_UFID_HAS_DBG% equ 1 (
set NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE= -DCMAKE_BUILD_TYPE:STRING=Debug
) else (
set NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE= -DCMAKE_BUILD_TYPE:STRING=Unknown
)
)
if not exist %NTF_CONFIGURE_OUTPUT% (
mkdir %NTF_CONFIGURE_OUTPUT%
)
if defined NTF_GENERATE_CLION_CONFIG (
call :generate_clion_cmake_xml !NTF_GENERATE_CLION_CONFIG!
exit
)
cd %NTF_CONFIGURE_OUTPUT%
echo cmake%NTF_CONFIGURE_CMAKE_OPTION_DISTRIBUTION_REFROOT%%NTF_CONFIGURE_CMAKE_OPTION_INSTALL_PREFIX%%NTF_CONFIGURE_CMAKE_OPTION_UFID%%NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE%%NTF_CONFIGURE_CMAKE_OPTION_VERBOSE% -DCMAKE_TOOLCHAIN_FILE:PATH="%NTF_CONFIGURE_REPOSITORY%\toolchain.cmake" -G "Ninja" -S "%NTF_CONFIGURE_REPOSITORY%"
cmake%NTF_CONFIGURE_CMAKE_OPTION_DISTRIBUTION_REFROOT%%NTF_CONFIGURE_CMAKE_OPTION_INSTALL_PREFIX%%NTF_CONFIGURE_CMAKE_OPTION_UFID%%NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE%%NTF_CONFIGURE_CMAKE_OPTION_VERBOSE% -DCMAKE_TOOLCHAIN_FILE:PATH="%NTF_CONFIGURE_REPOSITORY%\toolchain.cmake" -G "Ninja" -S "%NTF_CONFIGURE_REPOSITORY%"
if %ERRORLEVEL% neq 0 (
echo Failed to configure
exit /B 1
)
> %NTF_CONFIGURE_REPOSITORY%\makefile (
@echo..SUFFIXES:
@echo.
@echo.build: .phony
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS%
@echo.
@echo.build_test:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS% --target build_test
@echo.
@echo.all:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS% --target all
@echo.
@echo.test:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS% --target build_test
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel 1 --target test
@echo.
@echo.test_usage:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS% --target build_test
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel 1 --target test_usage
@echo.
@echo.install:
@echo. @cmake --install %NTF_CONFIGURE_OUTPUT% --prefix %NTF_CONFIGURE_OPT_BB%
@echo.
@echo.clean:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS% --target clean
@echo.
@echo.package:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS% --target package
@echo.
@echo.package_source:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --parallel %NTF_CONFIGURE_JOBS% --target package_source
@echo.
@echo.help:
@echo. @cmake --build %NTF_CONFIGURE_OUTPUT% --target help
@echo.
@echo..phony:
)
goto :DONE
:DONE
exit /B 0
:USAGE
echo usage: configure [--clean] [--prefix ^<path^>] [--output ^<path^>] [--refroot ^<path^>] [--distribution ^<name^>] [--debug^|release] [--ufid ^<code^>] [--with-feature ^<name^>] [--without-feature ^<name^>]
echo where:
echo --prefix ^<path^> Path to the refroot where the build artifacts will be installed (default: %NTF_CONFIGURE_PREFIX%)
echo --output ^<path^> Path to the directory where the build artifacts will be staged (default: %NTF_CONFIGURE_OUTPUT%)
echo --refroot ^<path^> Path to the refroot containing build dependencies (default: %NTF_CONFIGURE_REFROOT%)
echo --distribution ^<name^> Name of the distribution (default: %NTF_CONFIGURE_DISTRIBUTION%)
echo --generator ^<name^> Name of the build system, either "Ninja" or "msvc" (default: %NTF_CONFIGURE_GENERATOR%)
echo --jobs ^<number^> Maximum number of parallel build jobs (default: %NTF_CONFIGURE_JOBS%)
echo --clean Remove the previous build output, if any, before configuring
echo --keep Retain the previous build output, if any, while configuring
echo --debug Build the standard debug UFID
echo --release Build the standard release UFID
echo --unity Perform a unity, or almagamated build
echo --with-bde Enable and build features that depend on BDE classic
echo --with-nts Enable and build features that depend on NTS
echo --with-ntc Enable and build features that depend on NTC
echo --with-select Enable the reactor driver implemented with 'select'
echo --with-poll Enable the reactor driver implemented with 'poll'
echo --with-iocp Enable the proactor driver that depends on I/O completion ports
echo --with-openssl Enable the encryption driver implemented with OpenSSL
echo --with-dynamic-load-balancing Enable processing I/O on any thread, rather than a single thread
echo --with-thread-scaling Enable automatic scaling of thread pools
echo --with-deprecated-features Enable deprecated features
echo --with-logging Build with logging
echo --with-metrics Build with metrics
echo --with-branch-prediction Build with branch prediction
echo --with-spin-locks Build with mutually-exclusive locks implemented as spin locks
echo --with-recursive-mutexes Build with mutually-exclusive locks implemented as recursive mutexes
echo --with-warnings Build with warnings enabled
echo --with-warnings-as-errors Build with warnings as errors
echo --with-time-trace Build with time traces enabled
echo --with-time-report Build with time reports enabled
echo --with-coverage Build with code coverage enabled
echo --with-valgrind Build with tests running under valgrind
echo --with-documentation Build documentation
echo --with-documentation-internal Build documentation of internals
echo --with-usage-examples Build usage examples
echo --with-mocks Build mocks
echo --with-integration-tests Build integration tests
echo --verbose Generate makefiles with verbose output
exit /B 0
:NORMALIZEPATH
SET RETVAL=%~f1
EXIT /B
:get_number_of_threads
for /f %%x in ('wmic cpu get NumberOfLogicalProcessors') do (
SET "var_check="&for /f "delims=0123456789" %%i in ("%%x") do set var_check=%%i
if not defined var_check (
set /a %~1=%%x
exit /B
)
)
exit /B
:copy_n_lines
if exist tmpFile del tmpFile
set numLinesToCopy=%1
set /a lineCounter=0
for /f "delims=" %%a in (%NTF_CLION_XML%) do (
set /a lineCounter+=1
if !lineCounter! leq %numLinesToCopy% (
echo %%a>>tmpFile
) else (
del %NTF_CLION_XML%
move tmpFile %NTF_CLION_XML%
exit /B
)
)
exit /B
:write_config_header
rem leading spaces are important for beautiful output
set line1= ^<configuration PROFILE_NAME="!NTF_CONFIGURE_UFID!" ENABLED="true"
set line2= CONFIG_NAME="!NTF_CONFIGURE_UFID!" GENERATION_OPTIONS="
set line3=!NTF_CONFIGURE_CMAKE_OPTION_DISTRIBUTION_REFROOT!
set line4= !NTF_CONFIGURE_CMAKE_OPTION_INSTALL_PREFIX! !NTF_CONFIGURE_CMAKE_OPTION_VERBOSE!
set line5= !NTF_CONFIGURE_CMAKE_OPTION_UFID! !NTF_CONFIGURE_CMAKE_OPTION_BUILD_TYPE!
set line6= -DCMAKE_TOOLCHAIN_FILE:PATH=!NTF_CONFIGURE_REPOSITORY!\toolchain.cmake
set line7= -G ^"!NTF_CONFIGURE_GENERATOR!^""^>
echo !line1!!line2!!line3!!line4!!line5!!line6!!line7! >> %NTF_CLION_XML%
(
echo. ^<ADDITIONAL_GENERATION_ENVIRONMENT^>
echo. ^<envs^>
) >> %NTF_CLION_XML%
exit /B
:process_ntf_configure_vars
for /f "tokens=*" %%a in ('set') do (
set line=%%a
if "!line:~0,13!"=="NTF_CONFIGURE" (
for /f "tokens=1,* delims==" %%a in ("!line!") do (
set "key=%%a"
set "value=%%b"
>> %NTF_CLION_XML% (
echo. ^<env name="!key!" value="!value!" /^>
)
)
)
)
exit /B
:process_param
>> %NTF_CLION_XML% (
echo. ^<env name="%1" value="!%1%!" /^>
)
exit /B
:generate_clion_cmake_xml
echo Generating Clion cmake.xml...
set /a argC=0
for %%x in (%*) do Set /A argC+=1
if /i "%argC%" NEQ "1" (
echo generate_clion_cmake_xml must be called with exactly 1 argument, aborting"
EXIT
)
set NTF_CLION_STORAGE=.idea
set NTF_CLION_XML=%NTF_CLION_STORAGE%\cmake.xml
set CLION_XML_GENERATION=%1
if not exist %NTF_CLION_STORAGE% mkdir %NTF_CLION_STORAGE%
call :get_number_of_threads num_threads
echo %%CLION_XML_GENERATION%%
if "%CLION_XML_GENERATION%"=="clean" (
echo Performing clean generation
if exist %NTF_CLION_XML% (
echo %NTF_CLION_XML% exists,it will be overwritten
)
(
echo ^<?xml version="1.0" encoding="UTF-8"?^>
echo ^<project version="4"^>
echo. ^<component name="CMakeSharedSettings"^>
echo. ^<configurations^>
) > %NTF_CLION_XML%
) else (
if "%CLION_XML_GENERATION%"=="add" (
echo Adding new configuration to existing cmake.xml
if not exist %NTF_CLION_XML% (