-
Notifications
You must be signed in to change notification settings - Fork 114
/
configure
executable file
·934 lines (843 loc) · 32.6 KB
/
configure
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
#!/bin/bash
#-----------------------------------------------------------------------------------------
# QSVEnc/NVEnc/VCEEnc by rigaya
# -----------------------------------------------------------------------------------------
# ソースコードについて
# ・無保証です。
# ・本ソースコードを使用したことによるいかなる損害・トラブルについてrigayaは責任を負いません。
# 以上に了解して頂ける場合、本ソースコードの使用、複製、改変、再頒布を行って頂いて構いません。
# -----------------------------------------------------------------------------------------
CNF_LOG=config.log
cnf_write()
{
echo "$*"
echo "$*" >> ${CNF_LOG}
}
cnf_print()
{
printf "$*"
echo "$*" >> ${CNF_LOG}
}
write_config_mak()
{
cnf_write $1
echo $1 >> config.mak
}
write_enc_config()
{
cnf_write $1
echo $1 >> NVEncCore/rgy_config.h
}
write_app_rev()
{
cnf_write $1
echo $1 >> NVEncCore/rgy_rev.h
}
cxx_check()
{
echo "" >> ${CNF_LOG}
if [ -n "$1" ]; then
printf "checking for $1..."
echo "### - checking for $1... --------------" >> ${CNF_LOG}
else
echo "### - test start --------------" >> ${CNF_LOG}
fi
echo "#include <iostream>" > cxx_check.c
if [ -n "$3" ]; then
echo "#include <$3>" >> cxx_check.c
fi
if [ -n "$4" ]; then
echo "extern \"C\" {" >> cxx_check.c
echo "#include <$4>" >> cxx_check.c
echo "}" >> cxx_check.c
fi
echo "int main(void){ $5; std::cout << \"Hello World!\" << std::endl; return 0;}" >> cxx_check.c
CXX_CMD="$CXX -w cxx_check.c $2 -o cxx_check"
echo "------ command ------------" >> ${CNF_LOG}
echo ${CXX_CMD} >> ${CNF_LOG}
echo "------ test ---------------" >> ${CNF_LOG}
cat cxx_check.c >> ${CNF_LOG}
echo "---------------------------" >> ${CNF_LOG}
$CXX_CMD 2>> ${CNF_LOG}
#$CXX cxx_check.c $1 -o cxx_check
ret=$?
rm -f cxx_check*
echo "### - test fin -> ${ret} ----------" >> ${CNF_LOG}
return $ret
}
regex_check()
{
echo "#include <iostream>" > cxx_check.c
echo "#include <string>" >> cxx_check.c
echo "#include <regex>" >> cxx_check.c
echo "int main(void){ try { std::regex re(R\"(\d+)\"); std::string test(\"1234\"); return std::regex_match(test, re) ? 0 : 1; } catch (...) { return 1; } }" >> cxx_check.c
$CXX cxx_check.c $1 -o cxx_check 2>/dev/null
ret=$?
if [ $ret -ne 0 ]; then
rm -f cxx_check*
return $ret
fi
./cxx_check 2>/dev/null
ret=$?
rm -f cxx_check*
return $ret
}
rm -f config.* .depend NVEncCore/rgy_config.h NVEncCore/rgy_rev.h
PKGCONFIG=${PKGCONFIG:-pkg-config}
USE_PKGCONFIG=1
ENABLE_DEBUG=0
NVCC=${NVCC:-nvcc}
CXX=${CXX:-g++}
PROGRAM=nvencc
PREFIX=${PREFIX:-/usr/local}
EXTRACXXFLAGS=""
EXTRALDFLAGS=""
EXTRACUDACXXFLAGS=""
EXTRACUDALDFLAGS=""
SRCS=""
SRCCUS=""
X86_64=1
ARM64=0
OBJCOPY_ARCH_ELF=
OBJCOPY_ARCH_BIN=
NO_RDTSCP_INTRIN=0
CARGO=${CARGO:-cargo}
CUDA_PATH=${CUDA_PATH:-/usr/local/cuda}
ENABLE_CPP_REGEX=1
GPU_CODE_GEN=""
CHECK_LIBAV_NAMES="libswresample libavutil libavcodec libavformat libavfilter libavdevice"
LIBAV_CFLAGS=""
LIBAV_LIBS=""
ENABLE_AVSW_READER=1
AV_CHANNEL_LAYOUT_STRUCT_AVAIL=1
AV_FRAME_DURATION_AVAIL=1
AVCODEC_PAR_CODED_SIDE_DATA_AVAIL=1
CHECK_VAPOURSYNTH_NAMES="vapoursynth vapoursynth-script"
ENABLE_VAPOURSYNTH=1
VAPOURSYNTH_LIBS=""
VAPOURSYNTH_CFLAGS=""
CHECK_AVISYNTH_NAMES="avisynth"
ENABLE_AVISYNTH=1
AVISYNTH_CFLAGS=""
CHECK_LIBASS_NAMES="libass"
LIBASS_CFLAGS=""
LIBASS_LIBS=""
ENABLE_LIBASS=1
CHECK_LIBVMAF_NAMES="libvmaf"
LIBVMAF_CFLAGS=""
LIBVMAF_LIBS=""
ENABLE_LIBVMAF=0
CHECK_LIBPLACEBO_NAMES="libplacebo"
LIBPLACEBO_CFLAGS=""
LIBPLACEBO_LIBS=""
ENABLE_LIBPLACEBO=1
LIBPLACEBO_API_VER=338
CHECK_VULKAN_NAMES="vulkan"
VULKAN_CFLAGS=""
ENABLE_VULKAN=1
LIBDOVI_CFLAGS=""
LIBDOVI_LIBS=""
ENABLE_LIBDOVI=1
LIBHDR10PLUS_CFLAGS=""
LIBHDR10PLUS_LIBS=""
ENABLE_LIBHDR10PLUS=1
DTL_CFLAGS=""
ENABLE_DTL=1
print_help()
{
cat << EOF
Usage: ./configure [options]
options:
-h, --help print this message
--prefix=PREFIX install nvencc into PREFIX/bin [${PREFIX}]
--cxx=CXX set C++ compiler path [${CXX}]
--pkg-config=PKGCONFIG set pkg-config path [${PKGCONFIG}]
--cuda-path=CUDA_PATH set cuda path [${CUDA_PATH}]
--gpu-code=GPU_CODE_GEN set gpu code gen options
--enable-debug compile in debug configuration [${ENABLE_DEBUG}]
--extra-cxxflags=XCFLAGS add XCFLAGS to CFLAGS
--extra-ldflags=XLDFLAGS add XLDFLAGS to LDFLAGS
--extra-cudacxxflags=EXTRACUDACXXFLAGS
add EXTRACUDACXXFLAGS to CUDA CXXFLAGS
--extra-cudaldflags=EXTRACUDALDFLAGS
add EXTRACUDALDFLAGS to CUDA LD FLAGS
--disable-vapoursynth disable vapoursynth support [auto]
--disable-avisynth disable avisynth support [auto]
--disable-libass disable libass support [auto]
--disable-dtl disable dtl support [auto]
EOF
}
SRCDIR=$(dirname "$0")
if [ "${SRCDIR}" == "`pwd`" ]; then
SRCDIR=.
fi
for opt; do
optarg="${opt#*=}"
case "$opt" in
-h)
print_help
exit 0
;;
--help)
print_help
exit 0
;;
--prefix=*)
PREFIX="$optarg"
;;
--cxx=*)
CXX="$optarg"
;;
--extra-cxxflags=*)
EXTRACXXFLAGS="$optarg"
;;
--extra-ldflags=*)
EXTRALDFLAGS="$optarg"
;;
--extra-cudacxxflags=*)
EXTRACUDACXXFLAGS="$optarg"
;;
--extra-cudaldflags=*)
EXTRACUDALDFLAGS="$optarg"
;;
--cuda-path=*)
CUDA_PATH="$optarg"
;;
--gpu-code=*)
GPU_CODE_GEN="$optarg"
;;
--enable-debug)
ENABLE_DEBUG=1
;;
--disable-vapoursynth)
ENABLE_VAPOURSYNTH=0
;;
--disable-avisynth)
ENABLE_AVISYNTH=0
;;
--disable-libass)
ENABLE_LIBASS=0
;;
--disable-libvmaf)
ENABLE_LIBVMAF=0
;;
--disable-dtl)
ENABLE_DTL=0
;;
--pkg-config=*)
PKGCONFIG="$optarg"
;;
*)
cnf_write "unknown option $opt"
exit 1
;;
esac
done
## log
echo "" > ${CNF_LOG}
echo "CNF_LOG=${CNF_LOG}" >> ${CNF_LOG}
echo "PKGCONFIG=${PKGCONFIG}" >> ${CNF_LOG}
echo "USE_PKGCONFIG=${USE_PKGCONFIG}" >> ${CNF_LOG}
echo "ENABLE_DEBUG=${ENABLE_DEBUG}" >> ${CNF_LOG}
echo "NVCC=${NVCC}" >> ${CNF_LOG}
echo "CXX=${CXX}" >> ${CNF_LOG}
echo "PROGRAM=${PROGRAM}" >> ${CNF_LOG}
echo "PREFIX=${PREFIX}" >> ${CNF_LOG}
echo "EXTRACXXFLAGS=${EXTRACXXFLAGS}" >> ${CNF_LOG}
echo "EXTRALDFLAGS=${EXTRALDFLAGS}" >> ${CNF_LOG}
echo "EXTRACUDACXXFLAGS=${EXTRACUDACXXFLAGS}" >> ${CNF_LOG}
echo "EXTRACUDALDFLAGS=${EXTRACUDALDFLAGS}" >> ${CNF_LOG}
echo "X86_64=${X86_64}" >> ${CNF_LOG}
echo "CUDA_PATH=${CUDA_PATH}" >> ${CNF_LOG}
echo "ENABLE_CPP_REGEX=${ENABLE_CPP_REGEX}" >> ${CNF_LOG}
echo "CHECK_LIBAV_NAMES=${CHECK_LIBAV_NAMES}" >> ${CNF_LOG}
echo "ENABLE_AVSW_READER=${ENABLE_AVSW_READER}" >> ${CNF_LOG}
echo "ENABLE_VAPOURSYNTH=${ENABLE_VAPOURSYNTH}" >> ${CNF_LOG}
echo "ENABLE_AVISYNTH=${ENABLE_AVISYNTH}" >> ${CNF_LOG}
echo "ENABLE_LIBASS=${ENABLE_LIBASS}" >> ${CNF_LOG}
echo "ENABLE_LIBVMAF=${ENABLE_LIBVMAF}" >> ${CNF_LOG}
echo "ENABLE_DTL=${ENABLE_DTL}" >> ${CNF_LOG}
cnf_print "checking for ${CXX}..."
if ! cxx_check "${CXX}" "" ; then
cnf_write "${CXX} does not work"
exit 1
fi
cnf_write "OK"
if [ `echo | ${CXX} -E -dM - | egrep "WIN32|WIN64" | wc --lines` -ne 0 ]; then
cnf_write "This script does not support Windows platform."
cnf_write "For Windows, use Visual Studio."
exit 1
fi
if [ `echo | ${CXX} -E -dM - | grep "__ARM_ARCH_ISA_A64" | wc --lines` -ne 0 ]; then
ARM64=1
X86_64=0
OBJCOPY_ARCH_ELF="elf64-littleaarch64"
OBJCOPY_ARCH_BIN="aarch64"
elif [ `echo | ${CXX} -E -dM - | grep "x86_64" | wc --lines` -ne 0 ]; then
ARM64=0
X86_64=1
OBJCOPY_ARCH_ELF="elf64-x86-64"
OBJCOPY_ARCH_BIN="i386"
else
cnf_write "Unknown architecture!"
exit 1
fi
CXXINC=" \
-I${SRCDIR} -I${SRCDIR}/NVEncSDK/Common/inc -I${SRCDIR}/NVEncCore -I${SRCDIR}/NVEncNVOFFRUC -I${SRCDIR}/NVEncNVSDKNGX \
-I${SRCDIR}/jitify -I${SRCDIR}/tinyxml2 -I${SRCDIR}/cppcodec -I${SRCDIR}/ttmath \
"
CXXFLAGS="-Wall -Wno-unknown-pragmas -Wno-unused -Wno-missing-braces \
-DLINUX -DUNIX -D_FILE_OFFSET_BITS=64 -D__USE_LARGEFILE64 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS \
"
LDFLAGS="-L. -ldl -lstdc++ -lstdc++fs"
if [ $ARM64 -ne 0 ]; then
CXXINC="${CXXINC} -DLINUX64"
elif [ $X86_64 -ne 0 ]; then
CXXINC="${CXXINC} -DLINUX64 -m64"
LDFLAGS="${LDFLAGS} -m64"
else
CXXINC="${CXXINC} -DLINUX32 -m32"
LDFLAGS="${LDFLAGS} -m32"
fi
CUDA_CFLAGS=""
CUDA_LIBS="-lnppif_static -lnppig_static -lnppc_static -lcudart_static -lculibos -lcuda -lrt"
if [ "${CUDA_PATH}" != "" ]; then
cnf_print "checking for cuda (CUDA_PATH=${CUDA_PATH})..."
CUDA_CFLAGS="-I${CUDA_PATH}/include ${EXTRACUDACXXFLAGS}"
CUDA_LIBS="-L${CUDA_PATH}/lib64 ${EXTRACUDALDFLAGS} ${CUDA_LIBS}"
export PATH=${CUDA_PATH}/bin:${PATH}
NVCC=`type -p nvcc`
cnf_write "nvcc=${NVCC}"
fi
if ! cxx_check "cuda" "${CXXFLAGS} ${CXXINC} ${CUDA_CFLAGS} ${LDFLAGS} ${CUDA_LIBS}" "cuda.h" "" "auto result = cuInit(0);" ; then
cnf_write "cuda not supported."
tail -n 100 ${CNF_LOG}
exit 1
fi
CUDA_VER_MAJOR=`${NVCC} --version | grep "release" | awk '{print $6}' | cut -c2- | cut -d . -f1`
CUDA_VER_MINOR=`${NVCC} --version | grep "release" | awk '{print $6}' | cut -c2- | cut -d . -f2`
if [ $CUDA_VER_MAJOR -le 8 ]; then
cnf_write "CUDA >= 9.0 required, but CUDA ${CUDA_VER_MAJOR}.${CUDA_VER_MINOR} found."
exit 1
fi
if [ $CUDA_VER_MAJOR -le 10 ]; then
GPU_CODE_GEN="--generate-code arch=compute_30,code=[compute_30,sm_30]"
fi
GPU_CODE_GEN="${GPU_CODE_GEN} --generate-code arch=compute_50,code=[compute_50,sm_50]"
GPU_CODE_GEN="${GPU_CODE_GEN} --generate-code arch=compute_61,code=[compute_61,sm_61]"
GPU_CODE_GEN="${GPU_CODE_GEN} --generate-code arch=compute_75,code=[compute_75,sm_75]"
if ( [ $CUDA_VER_MAJOR -ge 11 ] && [ $CUDA_VER_MINOR -ge 1 ] ) || [ $CUDA_VER_MAJOR -ge 12 ]; then
GPU_CODE_GEN="${GPU_CODE_GEN} --generate-code arch=compute_86,code=[compute_86,sm_86]"
fi
cnf_write "OK, CUDA ${CUDA_VER_MAJOR}.${CUDA_VER_MINOR}"
NVCCFLAGS="${GPU_CODE_GEN} -Wno-deprecated-gpu-targets --cudart=static -std=c++14 -Xcudafe \"--display_error_number --diag_suppress=108 --diag_suppress=63\""
if ( [ $CUDA_VER_MAJOR -ge 11 ] && [ $CUDA_VER_MINOR -ge 3 ] ) || [ $CUDA_VER_MAJOR -ge 12 ]; then
NVCCFLAGS="${NVCCFLAGS} -t 0"
fi
for file in "${CXX}"; do
if [ ! `type -p $file 2> /dev/null` ]; then
cnf_write "$file not found"
exit 1
fi
done
if cxx_check "pthread" "${CXXFLAGS} ${LDFLAGS} -pthread" ; then
CXXFLAGS="${CXXFLAGS} -pthread"
LDFLAGS="${LDFLAGS} -pthread"
else
cnf_write "pthread not installed."
exit 1
fi
cnf_write "OK"
if cxx_check "c++17" "${CXXFLAGS} -std=c++17 ${LDFLAGS}" ; then
cnf_write "OK"
else
cnf_write "${CXX} does not work with -std=c++17"
exit 1
fi
if [ $X86_64 -ne 0 ]; then
if cxx_check "-msse2" "${CXXFLAGS} -msse2 ${LDFLAGS}" ; then
CXXFLAGS="$CXXFLAGS -msse2"
else
cnf_write "SSE2 not supported with this compiler."
exit 1
fi
cnf_write "OK"
if ! cxx_check "__rdtscp()" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LDFLAGS}" "" "x86intrin.h" "unsigned int a = 0; auto i = __rdtscp(&a);" ; then
CXXFLAGS="${CXXFLAGS} -DNO_RDTSCP_INTRIN=1"
cnf_write "no"
else
cnf_write "yes"
fi
fi
if cxx_check "-fPIE" "${CXXFLAGS} -fPIE ${LDFLAGS}" ; then
CXXFLAGS="$CXXFLAGS -fPIE"
fi
if [ ! $ENABLE_DEBUG -eq 0 ]; then
cnf_write "configuring for debug..."
CXXFLAGS="${CXXFLAGS} -O0 -g -D_DEBUG"
else
cnf_write "configuring for speed..."
CXXFLAGS="${CXXFLAGS} -O3 -DNDEBUG=1"
if cxx_check "-mfpmath=sse" "${CXXFLAGS} -mfpmath=sse ${LDFLAGS}" ; then
CXXFLAGS="$CXXFLAGS -mfpmath=sse"
cnf_write "yes"
else
cnf_write "no"
fi
if cxx_check "-ffast-math" "${CXXFLAGS} -ffast-math ${LDFLAGS}" ; then
CXXFLAGS="$CXXFLAGS -ffast-math"
cnf_write "yes"
else
cnf_write "no"
fi
if cxx_check "-fomit-frame-pointer" "${CXXFLAGS} -fomit-frame-pointer ${LDFLAGS}" ; then
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
cnf_write "yes"
else
cnf_write "no"
fi
#LDFLAGS="$LDFLAGS -Wl,-s"
fi
if [ -n "$EXTRACXXFLAGS" ]; then
if ! cxx_check "--extra-cxxflags" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LDFLAGS}" ; then
cnf_write "--extra-cxxflags=${EXTRACXXFLAGS} does not work"
exit 1
fi
cnf_write "OK"
fi
if [ -n "$EXTRALDFLAGS" ]; then
if ! cxx_check "--extra-ldflags" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LDFLAGS} ${EXTRALDFLAGS}" ; then
cnf_write "--extra-ldflags=${EXTRALDFLAGS} does not work"
exit 1
fi
cnf_write "OK"
fi
cnf_print "checking for pkg-config..."
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PREFIX/lib/pkgconfig
type -p $PKGCONFIG 2>/dev/null 1>/dev/null
if [ $? -ne 0 ]; then
cnf_write "${PKGCONFIG} does not exist."
USE_PKGCONFIG=0
fi
cnf_write "OK"
if [ $ENABLE_AVSW_READER -ne 0 ]; then
if [ $USE_PKGCONFIG -ne 0 ]; then
cnf_print "checking libavcodec with pkg-config..."
if ! ${PKGCONFIG} --exists $CHECK_LIBAV_NAMES ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
else
cnf_write "OK"
LIBAV_LIBS=`${PKGCONFIG} --libs ${CHECK_LIBAV_NAMES}`
LIBAV_CFLAGS=`${PKGCONFIG} --cflags ${CHECK_LIBAV_NAMES}`
fi
fi
if [ -z "$LIBAV_LIBS" ]; then
LIBAV_LIBS=""
for lib in $CHECK_LIB_NAMES; do
LIBAV_LIBS="${LIBAV_LIBS} -l${lib#lib}"
done
cnf_write "lib settings might be inacurate."
fi
if ! cxx_check "libavutil" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavutil/avutil.h" "avutil_version();" ; then
cnf_write "no"
ENABLE_AVSW_READER=0
else
cnf_write "yes"
fi
if ! cxx_check "libavcodec" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavcodec/avcodec.h" "avcodec_find_decoder((AVCodecID)0);" ; then
cnf_write "no"
ENABLE_AVSW_READER=0
else
cnf_write "yes"
fi
if ! cxx_check "libavformat" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavformat/avformat.h" "avformat_find_stream_info(0,0);" ; then
cnf_write "no"
ENABLE_AVSW_READER=0
else
cnf_write "yes"
fi
if ! cxx_check "libavfilter" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavfilter/avfilter.h" "avfilter_version();" ; then
cnf_write "no"
ENABLE_AVSW_READER=0
else
cnf_write "yes"
fi
if ! cxx_check "AVChannelLayout" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavutil/channel_layout.h" "AVChannelLayout ch_layout;" ; then
cnf_write "no"
AV_CHANNEL_LAYOUT_STRUCT_AVAIL=0
else
cnf_write "yes"
fi
if ! cxx_check "AVFrame::duration" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavutil/frame.h" "AVFrame *frame; frame->duration = 0;" ; then
cnf_write "no"
AV_FRAME_DURATION_AVAIL=0
else
cnf_write "yes"
fi
if ! cxx_check "libswresample" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libswresample/swresample.h" "swr_alloc();" ; then
cnf_write "no"
ENABLE_AVSW_READER=0
else
cnf_write "yes"
fi
if ! cxx_check "AVCodecParameters::coded_side_data" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "libavcodec/codec_par.h" "AVCodecParameters *codecpar; codecpar->coded_side_data = 0;" ; then
cnf_write "no"
AVCODEC_PAR_CODED_SIDE_DATA_AVAIL=0
else
cnf_write "yes"
fi
if [ $ENABLE_AVSW_READER -eq 0 ]; then
cnf_write "libavutil, libavcodec, libavformat, libavfilter, libswresample are required to build nvencc."
exit 1
fi
fi
cnf_print "Checking for dovi..."
if ! ${PKGCONFIG} --exists dovi ; then
cnf_write "couldn't find system wide libdovi, trying included one."
cnf_print "checking for $CARGO..."
type -p $CARGO 2>/dev/null 1>/dev/null
if [ $? -ne 0 ]; then
cnf_write "${CARGO} does not exist."
ENABLE_LIBDOVI=0
else
cnf_write "OK"
fi
if [ $ENABLE_LIBDOVI -ne 0 ]; then
CARGO=${CARGO} ./build_libdovi.sh
LIBDOVI_PC=$(find `pwd`/build_libdovi -name 'dovi.pc')
cnf_print "checking libdovi with pkg-config..."
if ! ${PKGCONFIG} --exists ${LIBDOVI_PC} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
ENABLE_LIBDOVI=0
else
cnf_write "OK"
LIBDOVI_LIBS=`${PKGCONFIG} --libs --static ${LIBDOVI_PC}`
LIBDOVI_CFLAGS=`${PKGCONFIG} --cflags ${LIBDOVI_PC}`
fi
fi
else
cnf_write "OK"
LIBDOVI_LIBS=`${PKGCONFIG} --libs --static dovi`
LIBDOVI_CFLAGS=`${PKGCONFIG} --cflags dovi`
fi
if [ $ENABLE_LIBDOVI -ne 0 ]; then
if ! cxx_check "rpu_parser.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBDOVI_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBDOVI_LIBS}" "libdovi/rpu_parser.h" "" "dovi_parse_rpu(nullptr, 0);" ; then
cnf_write "no"
ENABLE_LIBDOVI=0
LIBDOVI_LIBS=""
LIBDOVI_CFLAGS=""
else
cnf_write "yes"
fi
fi
cnf_print "Checking for hdr10plus..."
if ! ${PKGCONFIG} --exists hdr10plus-rs ; then
cnf_write "couldn't find system wide libhdr10plus, trying included one."
cnf_print "checking for $CARGO..."
type -p $CARGO 2>/dev/null 1>/dev/null
if [ $? -ne 0 ]; then
cnf_write "${CARGO} does not exist."
ENABLE_LIBHDR10PLUS=0
else
cnf_write "OK"
fi
if [ $ENABLE_LIBHDR10PLUS -ne 0 ]; then
CARGO=${CARGO} ./build_libhdr10plus.sh
LIBHDR10PLUS_PC=$(find `pwd`/build_libhdr10plus -name 'hdr10plus-rs.pc')
cnf_print "checking libhdr10plus with pkg-config..."
if ! ${PKGCONFIG} --exists ${LIBHDR10PLUS_PC} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
ENABLE_LIBHDR10PLUS=0
else
cnf_write "OK"
LIBHDR10PLUS_LIBS=`${PKGCONFIG} --libs --static ${LIBHDR10PLUS_PC}`
LIBHDR10PLUS_CFLAGS=`${PKGCONFIG} --cflags ${LIBHDR10PLUS_PC}`
fi
fi
else
cnf_write "OK"
LIBHDR10PLUS_LIBS=`${PKGCONFIG} --libs --static hdr10plus-rs`
LIBHDR10PLUS_CFLAGS=`${PKGCONFIG} --cflags hdr10plus-rs`
fi
if [ $ENABLE_LIBHDR10PLUS -ne 0 ]; then
if ! cxx_check "hdr10plus.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBHDR10PLUS_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBHDR10PLUS_LIBS}" "libhdr10plus-rs/hdr10plus.h" "" "hdr10plus_rs_parse_json(nullptr);" ; then
cnf_write "no"
ENABLE_LIBHDR10PLUS=0
LIBHDR10PLUS_LIBS=""
LIBHDR10PLUS_CFLAGS=""
else
cnf_write "yes"
fi
fi
if [ $ENABLE_VULKAN -ne 0 ]; then
cnf_print "checking vulkan with pkg-config..."
if ! ${PKGCONFIG} --exists ${CHECK_VULKAN_NAMES} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
else
cnf_write "OK"
VULKAN_CFLAGS=`${PKGCONFIG} --cflags ${CHECK_VULKAN_NAMES}`
fi
if ! cxx_check "vulkan/vulkan.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${VULKAN_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS}" "" "vulkan/vulkan.h" "std::cout << VK_HEADER_VERSION << std::endl;" ; then
cnf_write "no"
ENABLE_VULKAN=0
else
cnf_write "yes"
fi
fi
if [ $ENABLE_VULKAN -eq 0 ]; then
ENABLE_LIBPLACEBO=0
fi
if [ $ENABLE_LIBPLACEBO -ne 0 ]; then
cnf_print "checking libplacebo with pkg-config..."
if ! ${PKGCONFIG} --exists ${CHECK_LIBPLACEBO_NAMES} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
else
cnf_write "OK"
#LIBPLACEBO_LIBS=`${PKGCONFIG} --libs ${CHECK_LIBPLACEBO_NAMES}`
LIBPLACEBO_CFLAGS=`${PKGCONFIG} --cflags ${CHECK_LIBPLACEBO_NAMES}`
fi
if ! cxx_check "libplacebo/config.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LIBPLACEBO_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS} ${LIBPLACEBO_LIBS}" "" "libplacebo/config.h" "std::cout << PL_API_VER << std::endl;" ; then
cnf_write "no"
ENABLE_LIBPLACEBO=0
else
cnf_write "yes"
fi
cnf_print "checking for libplacebo API version..."
PL_API_VER=`echo "#include <iostream>" > cxx_check.c; echo "#include <libplacebo/config.h>" >> cxx_check.c; echo "int main(void){ std::cout << PL_API_VER << std::endl; return 0;}" >> cxx_check.c; $CXX cxx_check.c ${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${LIBPLACEBO_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS} ${LIBPLACEBO_LIBS} -o cxx_check 2>/dev/null; ./cxx_check 2>/dev/null; rm -f cxx_check*`
if [ -z "$PL_API_VER" ]; then
cnf_write "fail"
ENABLE_LIBPLACEBO=0
else
if [ $PL_API_VER -lt $LIBPLACEBO_API_VER ]; then
cnf_write "fail (${PL_API_VER})"
cnf_write "libplacebo API version >= ${LIBPLACEBO_API_VER} required."
ENABLE_LIBPLACEBO=0
else
cnf_write "OK (${PL_API_VER})"
fi
fi
if [ $ENABLE_LIBPLACEBO -eq 0 ]; then
LIBPLACEBO_CFLAGS=""
LIBPLACEBO_LIBS=""
fi
fi
if [ $ENABLE_VAPOURSYNTH -ne 0 ]; then
cnf_print "checking vapoursynth with pkg-config..."
if ! ${PKGCONFIG} --exists ${CHECK_VAPOURSYNTH_NAMES} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
else
cnf_write "OK"
VAPOURSYNTH_LIBS=`${PKGCONFIG} --libs ${CHECK_VAPOURSYNTH_NAMES}`
VAPOURSYNTH_CFLAGS=`${PKGCONFIG} --cflags ${CHECK_VAPOURSYNTH_NAMES}`
fi
if ! cxx_check "VapourSynth.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${VAPOURSYNTH_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS} ${VAPOURSYNTH_LIBS}" "VapourSynth.h" "" "" ; then
cnf_write "no"
ENABLE_VAPOURSYNTH=0
else
cnf_write "yes"
fi
if ! cxx_check "VSScript.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${VAPOURSYNTH_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${LIBAV_LIBS} ${VAPOURSYNTH_LIBS}" "VSScript.h" "" "" ; then
cnf_write "no"
ENABLE_VAPOURSYNTH=0
else
cnf_write "yes"
fi
if [ $ENABLE_VAPOURSYNTH -eq 0 ]; then
VAPOURSYNTH_CFLAGS=""
VAPOURSYNTH_LIBS=""
fi
fi
if [ $ENABLE_AVISYNTH -ne 0 ]; then
cnf_print "checking avisynth with pkg-config..."
if ! ${PKGCONFIG} --exists ${CHECK_AVISYNTH_NAMES} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
else
cnf_write "OK"
AVISYNTH_LIBS=`${PKGCONFIG} --libs ${CHECK_AVISYNTH_NAMES}`
AVISYNTH_CFLAGS=`${PKGCONFIG} --cflags ${CHECK_AVISYNTH_NAMES}`
fi
if ! cxx_check "avisynth_c.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LIBAV_CFLAGS} ${AVISYNTH_CFLAGS} ${LDFLAGS} ${EXTRALDFLAGS} ${AVISYNTH_LIBS}" "avisynth_c.h" "" "" ; then
cnf_write "no"
ENABLE_AVISYNTH=0
else
cnf_write "yes"
fi
if [ $ENABLE_AVISYNTH -eq 0 ]; then
AVISYNTH_CFLAGS=""
AVISYNTH_LIBS=""
fi
fi
if [ $ENABLE_LIBASS -ne 0 ]; then
cnf_print "checking libass with pkg-config..."
if ! ${PKGCONFIG} --exists ${CHECK_LIBASS_NAMES} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
LIBASS_LIBS="-lass"
else
cnf_write "OK"
LIBASS_LIBS=`${PKGCONFIG} --libs ${CHECK_LIBASS_NAMES}`
LIBASS_CFLAGS=`${PKGCONFIG} --cflags ${CHECK_LIBASS_NAMES}`
fi
if ! cxx_check "ass/ass.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LDFLAGS} ${EXTRALDFLAGS}" "" "ass/ass.h" "" ; then
cnf_write "no"
ENABLE_LIBASS=0
else
cnf_write "yes"
fi
if [ $ENABLE_LIBASS -eq 0 ]; then
LIBASS_CFLAGS=""
LIBASS_LIBS=""
fi
fi
if [ $ENABLE_LIBVMAF -ne 0 ]; then
cnf_print "checking libvmaf with pkg-config..."
if ! ${PKGCONFIG} --exists ${CHECK_LIBVMAF_NAMES} ; then
cnf_write "libs could not be detected by ${PKGCONFIG}. [ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ]"
LIBVMAF_LIBS="-lvmaf"
else
cnf_write "OK"
LIBVMAF_LIBS=`${PKGCONFIG} --libs ${CHECK_LIBVMAF_NAMES}`
LIBVMAF_CFLAGS=`${PKGCONFIG} --cflags ${CHECK_LIBVMAF_NAMES}`
fi
if ! cxx_check "libvmaf/vmaf.h" "${CXXFLAGS} ${EXTRACXXFLAGS} ${LDFLAGS} ${EXTRALDFLAGS}" "" "libvmaf/libvmaf.h" "" ; then
cnf_write "no"
ENABLE_LIBVMAF=0
else
cnf_write "yes"
fi
if [ $ENABLE_LIBVMAF -eq 0 ]; then
LIBVMAF_CFLAGS=""
LIBVMAF_LIBS=""
fi
fi
if [ $ENABLE_DTL -ne 0 ]; then
if ! cxx_check "dtl/dtl.hpp" "${CXXFLAGS} ${CXXINC} ${EXTRACXXFLAGS} ${LDFLAGS} ${EXTRALDFLAGS}" "dtl/dtl/dtl.hpp" "" "" ; then
if ! cxx_check "dtl/dtl.hpp" "${CXXFLAGS} ${CXXINC} ${EXTRACXXFLAGS} ${LDFLAGS} ${EXTRALDFLAGS}" "dtl/dtl.hpp" "" "" ; then
cnf_write "no"
ENABLE_DTL=0
else
cnf_write "yes"
fi
else
DTL_CFLAGS="-I./dtl"
cnf_write "yes"
fi
fi
SRC_NVENCSDK=" \
dynlink_nvcuvid.cpp
"
#SRC_NVVFX="\
#nvCVImageProxy.cpp NVVideoEffectsProxy.cpp
#"
SRC_NVENCCORE=" \
CuvidDecode.cpp FrameQueue.cpp NVEncCmd.cpp NVEncCore.cpp \
NVEncDevice.cpp NVEncFilter.cpp NVEncFilterAfs.cpp NVEncFilterColorspace.cpp \
NVEncFilterCurves.cpp NVEncFilterCustom.cpp NVEncFilterDelogo.cpp NVEncFilterDenoiseFFT3D.cpp \
NVEncFilterDenoiseGauss.cpp NVEncFilterLibplacebo.cpp NVEncFilterNGX.cpp NVEncFilterNVOFFRUC.cpp \
NVEncFilterNvvfx.cpp NVEncFilterOverlay.cpp NVEncFilterPad.cpp NVEncFilterParam.cpp \
NVEncFilterRff.cpp NVEncFilterSelectEvery.cpp NVEncFilterSsim.cpp NVEncFilterSubburn.cpp \
NVEncParam.cpp NVEncUtil.cpp NVEncFilterVulkan.cpp cl_func.cpp \
convert_csp.cpp cpu_info.cpp gpu_info.cpp \
gpuz_info.cpp logo.cpp \
rgy_aspect_ratio.cpp rgy_avlog.cpp rgy_avutil.cpp rgy_bitstream.cpp \
rgy_chapter.cpp rgy_cmd.cpp rgy_codepage.cpp rgy_def.cpp \
rgy_device.cpp rgy_device_info_wmi.cpp rgy_device_vulkan.cpp \
rgy_env.cpp rgy_err.cpp rgy_event.cpp \
rgy_faw.cpp rgy_filesystem.cpp rgy_filter.cpp rgy_frame.cpp rgy_frame_info.cpp \
rgy_hdr10plus.cpp rgy_ini.cpp rgy_input.cpp rgy_input_avcodec.cpp rgy_input_avi.cpp \
rgy_input_avs.cpp rgy_input_raw.cpp rgy_input_sm.cpp rgy_input_vpy.cpp rgy_language.cpp \
rgy_level_av1.cpp rgy_level_h264.cpp rgy_level_hevc.cpp rgy_libplacebo.cpp \
rgy_log.cpp rgy_memmem.cpp rgy_nvrtc.cpp \
rgy_output.cpp rgy_output_avcodec.cpp rgy_perf_counter.cpp \
rgy_perf_monitor.cpp rgy_pipe.cpp rgy_pipe_linux.cpp rgy_prm.cpp rgy_resource.cpp \
rgy_simd.cpp rgy_status.cpp rgy_thread_affinity.cpp rgy_timecode.cpp rgy_util.cpp \
rgy_version.cpp rgy_vulkan.cpp rgy_wav_parser.cpp \
"
SRC_NVENCCORE_X86="\
convert_csp_avx.cpp convert_csp_avx2.cpp convert_csp_sse2.cpp \
convert_csp_sse41.cpp convert_csp_ssse3.cpp \
rgy_bitstream_avx2.cpp rgy_bitstream_avx512bw.cpp \
rgy_faw_avx2.cpp rgy_faw_avx512bw.cpp \
rgy_memmem_avx2.cpp rgy_memmem_avx512bw.cpp \
"
CU_NVENCCORE=" \
NVEncFilterAfsAnalyze.cu NVEncFilterAfsFilter.cu NVEncFilterAfsMerge.cu NVEncFilterAfsSynthesize.cu NVEncFilterConvolution3d.cu \
NVEncFilterCrop.cu NVEncFilterCurves.cu NVEncFilterDeband.cu NVEncFilterDecimate.cu NVEncFilterDecomb.cu \
NVEncFilterDelogo.cu NVEncFilterDenoiseDct.cu \
NVEncFilterDenoiseFFT3D8FP16.cu NVEncFilterDenoiseFFT3D8FP32.cu NVEncFilterDenoiseFFT3D16FP16.cu NVEncFilterDenoiseFFT3D16FP32.cu \
NVEncFilterDenoiseKnn.cu NVEncFilterDenoiseNLMeans.cu NVEncFilterDenoisePmd.cu \
NVEncFilterEdgelevel.cu NVEncFilterMpdecimate.cu NVEncFilterNnedi.cu \
NVEncFilterOverlay.cu NVEncFilterResize.cu NVEncFilterSmooth.cu NVEncFilterSsim.cu NVEncFilterSubburn.cu \
NVEncFilterTransform.cu NVEncFilterTweak.cu NVEncFilterUnsharp.cu NVEncFilterWarpsharp.cu NVEncFilterYadif.cu \
"
SRC_TINYXML2="tinyxml2.cpp"
SRC_NVENCC="NVEncC.cpp"
PYW_PERF_MONITOR="perf_monitor.pyw"
BINS="resource/nnedi3_weights.bin"
BINHS="NVEncCore/NVEncFilterColorspaceFunc.h"
for src in $SRC_NVENCSDK; do
SRCS="$SRCS NVEncSDK/Common/src/$src"
done
#for src in $SRC_NVVFX; do
# SRCS="$SRCS MAXINE-VFX-SDK/nvvfx/src/$src"
#done
for src in $SRC_NVENCCORE; do
SRCS="$SRCS NVEncCore/$src"
done
if [ $X86_64 -ne 0 ]; then
for src in $SRC_NVENCCORE_X86; do
SRCS="$SRCS NVEncCore/$src"
done
fi
for src in $CU_NVENCCORE; do
SRCCUS="$SRCCUS NVEncCore/$src"
done
for pyw in $PYW_PERF_MONITOR; do
PYWS="$PYWS PerfMonitor/$pyw"
done
for src in $SRC_TINYXML2; do
SRCS="$SRCS tinyxml2/$src"
done
for src in $SRC_NVENCC; do
SRCS="$SRCS NVEncC/$src"
done
ENCODER_REV=`git rev-list HEAD | wc --lines`
cnf_write ""
cnf_write "Creating config.mak, rgy_config.h..."
echo "SRCS = $SRCS" >> config.mak
echo "SRCCUS = $SRCCUS" >> config.mak
echo "BINS = $BINS" >> config.mak
echo "BINHS = $BINHS" >> config.mak
echo "PYWS = $PYWS" >> config.mak
echo "OBJCOPY_ARCH_ELF = $OBJCOPY_ARCH_ELF" >> config.mak
echo "OBJCOPY_ARCH_BIN = $OBJCOPY_ARCH_BIN" >> config.mak
write_config_mak "SRCDIR = $SRCDIR"
write_config_mak "CXX = $CXX"
write_config_mak "NVCC = $NVCC"
write_config_mak "LD = $CXX"
write_config_mak "PROGRAM = $PROGRAM"
write_config_mak "ENABLE_DEBUG = $ENABLE_DEBUG"
write_config_mak "CXXFLAGS = $CXXFLAGS -std=c++17 $CXXINC $EXTRACXXFLAGS $CUDA_CFLAGS $LIBAV_CFLAGS $VAPOURSYNTH_CFLAGS $AVISYNTH_CFLAGS $LIBASS_CFLAGS $LIBVMAF_CFLAGS $LIBDOVI_CFLAGS $LIBHDR10PLUS_CFLAGS $DTL_CFLAGS $LIBPLACEBO_CFLAGS"
write_config_mak "NVCCFLAGS = $NVCCFLAGS -std=c++14 -ccbin $CXX $CUDA_CFLAGS $CXXINC -Xcompiler \"${CXXFLAGS} ${EXTRACXXFLAGS} $LIBAV_CFLAGS $VAPOURSYNTH_CFLAGS $AVISYNTH_CFLAGS $LIBASS_CFLAGS $LIBVMAF_CFLAGS $LIBDOVI_CFLAGS $LIBHDR10PLUS_CFLAGS $DTL_CFLAGS $LIBPLACEBO_CFLAGS \""
write_config_mak "LDFLAGS = $LDFLAGS $CUDA_LIBS $EXTRALDFLAGS $LIBAV_LIBS $LIBASS_LIBS $LIBVMAF_LIBS $LIBDOVI_LIBS $LIBHDR10PLUS_LIBS $LIBPLACEBO_LIBS"
write_config_mak "PREFIX = $PREFIX"
echo "X86_64 = ${X86_64}"
write_app_rev "#define ENCODER_REV \"$ENCODER_REV\""
write_enc_config "#define ENABLE_AVI_READER 0"
write_enc_config "#define ENABLE_AVISYNTH_READER $ENABLE_AVISYNTH"
write_enc_config "#define ENABLE_VAPOURSYNTH_READER $ENABLE_VAPOURSYNTH"
write_enc_config "#define ENABLE_AVSW_READER $ENABLE_AVSW_READER"
write_enc_config "#define ENABLE_SM_READER 0"
write_enc_config "#define ENABLE_LIBASS_SUBBURN $ENABLE_LIBASS"
write_enc_config "#define ENABLE_VMAF $ENABLE_LIBVMAF"
write_enc_config "#define ENABLE_AVCODEC_OUT_THREAD 1"
write_enc_config "#define AV_CHANNEL_LAYOUT_STRUCT_AVAIL $AV_CHANNEL_LAYOUT_STRUCT_AVAIL"
write_enc_config "#define AV_FRAME_DURATION_AVAIL $AV_FRAME_DURATION_AVAIL"
write_enc_config "#define AVCODEC_PAR_CODED_SIDE_DATA_AVAIL $AVCODEC_PAR_CODED_SIDE_DATA_AVAIL"
write_enc_config "#define ENABLE_CPP_REGEX $ENABLE_CPP_REGEX"
write_enc_config "#define ENABLE_DTL $ENABLE_DTL"
write_enc_config "#define ENABLE_LIBDOVI $ENABLE_LIBDOVI"
write_enc_config "#define ENABLE_LIBHDR10PLUS $ENABLE_LIBHDR10PLUS"
write_enc_config "#define ENABLE_VULKAN ($ENABLE_VULKAN && $ENABLE_LIBPLACEBO)"
write_enc_config "#define ENABLE_LIBPLACEBO $ENABLE_LIBPLACEBO"
write_enc_config "#define ENABLE_PERF_COUNTER 0"
cnf_write "successfully generated config.mak, rgy_config.h"