-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathprojectGenerator_build.cpp
More file actions
590 lines (568 loc) · 31.2 KB
/
projectGenerator_build.cpp
File metadata and controls
590 lines (568 loc) · 31.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
/*
* copyright (c) 2017 Matthew Oliver
*
* This file is part of ShiftMediaProject.
*
* ShiftMediaProject is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ShiftMediaProject is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ShiftMediaProject; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "projectGenerator.h"
#include <algorithm>
void ProjectGenerator::buildInterDependenciesHelper(
const StaticList& configOptions, const StaticList& addDeps, StaticList& libs) const
{
bool found = false;
for (const auto& i : configOptions) {
found = m_configHelper.isConfigOptionEnabled(i);
if (!found) {
break;
}
}
if (found) {
for (const auto& i : addDeps) {
string sSearchTag = "lib" + i;
if (find(libs.begin(), libs.end(), sSearchTag) == libs.end()) {
libs.push_back(sSearchTag);
}
}
}
}
void ProjectGenerator::buildInterDependencies(StaticList& libs)
{
// Get the lib dependencies from the configure file
const string libName = m_projectName.substr(3) + "_deps";
vector<string> libDeps;
if (m_configHelper.getConfigList(libName, libDeps, false)) {
for (const auto& i : libDeps) {
string searchTag = "lib" + i;
if (find(libs.begin(), libs.end(), searchTag) == libs.end()) {
libs.push_back(searchTag);
}
}
}
ConfigGenerator::InterDependencies interDependencies;
m_configHelper.buildInterDependencies(interDependencies);
const auto found = interDependencies.find(m_projectName.substr(3));
if (found != interDependencies.end()) {
for (const auto& i : found->second) {
buildInterDependenciesHelper(i.first, i.second, libs);
}
}
}
void ProjectGenerator::buildDependencies(StaticList& libs, StaticList& addLibs, const bool winrt)
{
// Add any forced dependencies
if (m_projectName == "libavformat" && !winrt) {
addLibs.push_back("ws2_32"); // Add the additional required libs
}
// Determine only those dependencies that are valid for current project
map<string, bool> projectDeps;
buildProjectDependencies(projectDeps);
// Loop through each known configuration option and add the required dependencies
vector<string> externLibs;
m_configHelper.getConfigList("EXTERNAL_AUTODETECT_LIBRARY_LIST", externLibs, false);
m_configHelper.getConfigList("EXTERNAL_LIBRARY_LIST", externLibs);
m_configHelper.getConfigList("HW_CODECS_LIST", externLibs, false); // used on some older ffmpeg versions
m_configHelper.getConfigList("HWACCEL_AUTODETECT_LIBRARY_LIST", externLibs, false);
m_configHelper.getConfigList("HWACCEL_LIBRARY_LIST", externLibs, false);
m_configHelper.getConfigList("SYSTEM_LIBRARIES", externLibs, false);
for (const auto& i : externLibs) {
// Check if enabled
if (m_configHelper.isConfigOptionEnabled(i)) {
// Check if this dependency is valid for this project (if the dependency is not known default to enable)
if (projectDeps.find(i) == projectDeps.end()) {
outputInfo("Unknown dependency found (" + i + ")");
} else if (!projectDeps[i]) {
// This dependency is not valid for this project so skip it
continue;
}
// Check if this value is conditional on winrt
if (winrt) {
// Convert to full config value
const auto name =
m_configHelper.getConfigOption(i)->m_prefix + m_configHelper.getConfigOption(i)->m_option;
if (m_configHelper.m_replaceList.find(name) != m_configHelper.m_replaceList.end()) {
// Skip this option
if (m_configHelper.m_replaceList[name].find("!HAVE_WINRT") != string::npos ||
m_configHelper.m_replaceList[name].find("!HAVE_UWP") != string::npos) {
continue;
}
}
}
string lib;
if (i == "amf") {
// doesn't need any additional libs
} else if (i == "avisynth") {
// doesn't need any additional libs
} else if (i == "bcrypt") {
addLibs.push_back("Bcrypt"); // Add the additional required libs
} else if (i == "bzlib") {
lib = "libbz2";
} else if (i == "d3d11va") {
if (winrt) {
addLibs.push_back("dxgi");
addLibs.push_back("d3d11");
}
// doesn't need any additional libs
} else if (i == "dxva2") {
// doesn't need any additional libs
} else if (i == "libcdio") {
lib = "libcdio_paranoia";
} else if (i == "libfdk_aac") {
lib = "libfdk-aac";
} else if (i == "libnpp") {
addLibs.push_back("nppi"); // Add the additional required libs
// CUDA 7.5 onwards only provides npp for x64
} else if (i == "libxvid") {
lib = "libxvidcore";
} else if (i == "openssl") {
// Needs ws2_32 but libavformat needs this even if not using openssl so it is already included
lib = "libssl";
// Also need crypto
auto list = libs.begin();
for (; list < libs.end(); ++list) {
if (*list == "libcrypto") {
break;
}
}
if (list == libs.end()) {
libs.push_back("libcrypto");
}
} else if (i == "decklink") {
// Doesn't need any additional libs
} else if (i == "opengl") {
addLibs.push_back("Opengl32"); // Add the additional required libs
} else if (i == "opencl") {
string fileName;
if (!findFile(m_configHelper.m_rootDirectory + "compat/opencl/cl.h", fileName)) {
addLibs.push_back("OpenCL"); // Add the additional required libs
}
} else if (i == "openal") {
addLibs.push_back("OpenAL32"); // Add the additional required libs
} else if (i == "ffnvcodec") {
// Doesn't require any additional libs
} else if (i == "nvenc") {
// Doesn't require any additional libs
} else if (i == "cuda") {
string fileName;
if (!m_configHelper.isConfigOptionEnabled("ffnvcodec") &&
!findFile(m_configHelper.m_rootDirectory + "compat/cuda/dynlink_cuda.h", fileName)) {
addLibs.push_back("cuda"); // Add the additional required libs
}
} else if (i == "cuda_sdk" || i == "cuda_nvcc") {
// Doesn't require any additional libs
} else if (i == "cuvid") {
string fileName;
if (!m_configHelper.isConfigOptionEnabled("ffnvcodec") &&
!findFile(m_configHelper.m_rootDirectory + "compat/cuda/dynlink_nvcuvid.h", fileName)) {
addLibs.push_back("nvcuvid"); // Add the additional required libs
}
} else if ((i == "nvdec") || (i == "nvenc")) {
// Doesn't need any additional libs
} else if (i == "mediafoundation") {
addLibs.push_back("mfplat");
addLibs.push_back("mfuuid");
if (!winrt) {
addLibs.push_back("strmiids");
}
} else if (i == "schannel") {
addLibs.push_back("Secur32"); // Add the additional required libs
} else if (i == "sdl") {
if (!m_configHelper.isConfigOptionValid("sdl2")) {
libs.push_back("libsdl"); // Only add if not sdl2
}
} else if (i == "wincrypt") {
addLibs.push_back("Advapi32"); // Add the additional required libs
} else if (i == "vaapi") {
addLibs.push_back("va");
} else if (i == "vaapi_win32") {
addLibs.push_back("va_win32");
} else {
// By default just use the lib name and prefix with lib if not already
if (i.find("lib") == 0) {
lib = i;
} else {
lib = "lib" + i;
}
}
if (lib.length() > 0) {
// Check already not in list
auto list = libs.begin();
for (; list < libs.end(); ++list) {
if (*list == lib) {
break;
}
}
if (list == libs.end()) {
libs.push_back(lib);
}
}
}
}
// Add in extralibs used for various devices
if (m_projectName == "libavdevice" && !winrt) {
externLibs.resize(0);
m_configHelper.getConfigList("OUTDEV_LIST", externLibs);
m_configHelper.getConfigList("INDEV_LIST", externLibs);
for (const auto& i : externLibs) {
// Check if enabled
if (m_configHelper.isConfigOptionEnabled(i)) {
// Add the additional required libs
if (i == "dshow_indev") {
addLibs.push_back("strmiids");
} else if (i == "vfwcap_indev") {
addLibs.push_back("vfw32");
addLibs.push_back("shlwapi");
} else if ((i == "wasapi_indev") || (i == "wasapi_outdev")) {
addLibs.push_back("ksuser");
}
}
}
}
}
void ProjectGenerator::buildDependencyValues(StaticList& includeDirs, StaticList& lib32Dirs, StaticList& lib64Dirs,
StaticList& definesShared, StaticList& definesStatic, const bool winrt) const
{
// Add hard dependencies
string dep;
string atomicCompatFile = m_configHelper.m_rootDirectory + "compat/atomics/win32/stdatomic.h";
if (findFile(atomicCompatFile, dep)) {
m_configHelper.makeFileProjectRelative(atomicCompatFile, atomicCompatFile);
uint pos = atomicCompatFile.rfind('/'); // Get path only
atomicCompatFile = atomicCompatFile.substr(0, ++pos);
includeDirs.push_back("$(ProjectDir)/" + atomicCompatFile);
}
// Add root directory
if (m_configHelper.m_rootDirectory != "./" && m_configHelper.m_rootDirectory != "../") {
m_configHelper.makeFileProjectRelative(m_configHelper.m_rootDirectory, dep);
includeDirs.push_back("$(ProjectDir)/" + dep);
}
// Determine only those dependencies that are valid for current project
map<string, bool> projectDeps;
buildProjectDependencies(projectDeps);
// Loop through each known configuration option and add the required dependencies
for (const auto& i : projectDeps) {
// Check if enabled//Check if optimised value is valid for current configuration
if (i.second && m_configHelper.isConfigOptionEnabled(i.first)) {
// Add in the additional include directories
if (i.first == "libopus") {
includeDirs.push_back("$(OutDir)/include/opus/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/opus/");
} else if (i.first == "libfreetype") {
includeDirs.push_back("$(OutDir)/include/freetype2/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/freetype2/");
} else if (i.first == "libfribidi") {
includeDirs.push_back("$(OutDir)/include/fribidi/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/fribidi/");
definesStatic.push_back("FRIBIDI_LIB_STATIC");
} else if (i.first == "libharfbuzz") {
includeDirs.push_back("$(OutDir)/include/harfbuzz/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/harfbuzz/");
} else if (i.first == "libilbc") {
definesStatic.push_back("ILBC_STATIC_DEFINE");
} else if (i.first == "libx264") {
definesShared.push_back("X264_API_IMPORTS");
} else if (i.first == "libxml2") {
includeDirs.push_back("$(OutDir)/include/libxml2/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/libxml2/");
definesStatic.push_back("LIBXML_STATIC");
} else if (i.first == "libmfx") {
includeDirs.push_back("$(OutDir)/include/mfx/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/mfx/");
} else if ((i.first == "sdl") && !m_configHelper.isConfigOptionValid("sdl2")) {
includeDirs.push_back("$(OutDir)/include/SDL/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/SDL/");
} else if (i.first == "sdl2") {
includeDirs.push_back("$(OutDir)/include/SDL/");
includeDirs.push_back("$(ProjectDir)/../../prebuilt/include/SDL/");
} else if (i.first == "opengl" && !winrt) {
// Requires glext headers to be installed in include dir (does not require the libs)
} else if (i.first == "opencl" && !winrt) {
string fileName;
if (!findFile(m_configHelper.m_rootDirectory + "compat/opencl/cl.h", fileName)) {
// Need to check for the existence of environment variables
if (findEnvironmentVariable("AMDAPPSDKROOT")) {
includeDirs.push_back("$(AMDAPPSDKROOT)/include/");
lib32Dirs.push_back("$(AMDAPPSDKROOT)/lib/Win32");
lib64Dirs.push_back("$(AMDAPPSDKROOT)/lib/x64");
} else if (findEnvironmentVariable("INTELOCLSDKROOT")) {
includeDirs.push_back("$(INTELOCLSDKROOT)/include/");
lib32Dirs.push_back("$(INTELOCLSDKROOT)/lib/x86");
lib64Dirs.push_back("$(INTELOCLSDKROOT)/lib/x64");
} else if (findEnvironmentVariable("CUDA_PATH")) {
includeDirs.push_back("$(CUDA_PATH)/include/");
lib32Dirs.push_back("$(CUDA_PATH)/lib/Win32");
lib64Dirs.push_back("$(CUDA_PATH)/lib/x64");
} else {
outputWarning("Could not find an OpenCl SDK environment variable.");
outputWarning(
"Either an OpenCL SDK is not installed or the environment variables are missing.", false);
outputWarning(
"The location of the OpenCl files will have to be manually specified as otherwise the project will not compile.",
false);
}
}
} else if (i.first == "openal" && !winrt) {
if (!findEnvironmentVariable("OPENAL_SDK")) {
outputWarning("Could not find the OpenAl SDK environment variable.");
outputWarning(
"Either the OpenAL SDK is not installed or the environment variable is missing.", false);
outputWarning("Using the default environment variable of 'OPENAL_SDK'.", false);
}
includeDirs.push_back("$(OPENAL_SDK)/include/");
lib32Dirs.push_back("$(OPENAL_SDK)/libs/Win32");
lib64Dirs.push_back("$(OPENAL_SDK)/lib/Win64");
} else if (i.first == "nvenc" && !winrt) {
string fileName;
if (!m_configHelper.isConfigOptionEnabled("ffnvcodec") &&
!findFile(m_configHelper.m_rootDirectory + "compat/nvenc/nvEncodeAPI.h", fileName)) {
// Need to check for the existence of environment variables
if (!findEnvironmentVariable("CUDA_PATH")) {
outputWarning("Could not find the CUDA SDK environment variable.");
outputWarning(
"Either the CUDA SDK is not installed or the environment variable is missing.", false);
outputWarning(
"NVENC requires CUDA to be installed with NVENC headers made available in the CUDA SDK include path.",
false);
}
// Only add if it hasnt already been added
if (find(includeDirs.begin(), includeDirs.end(), "$(CUDA_PATH)/include/") == includeDirs.end()) {
includeDirs.push_back("$(CUDA_PATH)/include/");
}
}
} else if ((i.first == "cuda") || (i.first == "cuvid") && !winrt) {
string fileName;
if (!m_configHelper.isConfigOptionEnabled("ffnvcodec") &&
!findFile(m_configHelper.m_rootDirectory + "compat/cuda/dynlink_cuda.h", fileName)) {
// Need to check for the existence of environment variables
if (!findEnvironmentVariable("CUDA_PATH")) {
outputWarning("Could not find the CUDA SDK environment variable.");
outputWarning(
"Either the CUDA SDK is not installed or the environment variable is missing.", false);
}
// Only add if it hasnt already been added
if (find(includeDirs.begin(), includeDirs.end(), "$(CUDA_PATH)/include/") == includeDirs.end()) {
includeDirs.push_back("$(CUDA_PATH)/include/");
lib32Dirs.push_back("$(CUDA_PATH)/lib/Win32");
lib64Dirs.push_back("$(CUDA_PATH)/lib/x64");
}
}
}
}
}
}
void ProjectGenerator::buildProjectDependencies(map<string, bool>& projectDeps) const
{
string notUsed;
projectDeps["amf"] = (m_projectName == "libavutil") || (m_projectName == "libavcodec");
projectDeps["avisynth"] = (m_projectName == "libavformat");
projectDeps["bcrypt"] = (m_projectName == "libavutil");
projectDeps["bzlib"] = (m_projectName == "libavformat") || (m_projectName == "libavcodec");
projectDeps["crystalhd"] = (m_projectName == "libavcodec");
projectDeps["chromaprint"] = (m_projectName == "libavformat");
projectDeps["cuda"] = ((m_projectName == "libavutil") && findSourceFile("hwcontext_cuda", ".h", notUsed)) ||
(m_projectName == "libavfilter") ||
(m_configHelper.isConfigOptionEnabled("nvenc") && (m_projectName == "libavcodec")) ||
(m_configHelper.isConfigOptionEnabled("cuvid") &&
((m_projectName == "libavcodec") || (m_projectName == "ffmpeg") || (m_projectName == "avconv")));
projectDeps["cuda_sdk"] = (m_projectName == "libavfilter");
projectDeps["cuda_nvcc"] = (m_projectName == "libavfilter");
projectDeps["cuvid"] =
(m_projectName == "libavcodec") || (m_projectName == "ffmpeg") || (m_projectName == "avconv");
projectDeps["d3d11va"] = (m_projectName == "libavutil") || (m_projectName == "libavcodec");
projectDeps["dxva2"] = (m_projectName == "libavutil") || (m_projectName == "libavcodec");
projectDeps["decklink"] = (m_projectName == "libavdevice");
projectDeps["libfontconfig"] = (m_projectName == "libavfilter");
projectDeps["ffnvcodec"] = (m_projectName == "libavutil") || (m_projectName == "libavcodec");
projectDeps["frei0r"] = (m_projectName == "libavfilter");
projectDeps["gcrypt"] = (m_projectName == "libavformat") || (m_projectName == "libavutil");
projectDeps["gmp"] = (m_projectName == "libavformat");
projectDeps["gnutls"] = (m_projectName == "libavformat");
projectDeps["iconv"] = (m_projectName == "libavformat") || (m_projectName == "libavcodec");
projectDeps["ladspa"] = (m_projectName == "libavfilter");
projectDeps["libaacplus"] = (m_projectName == "libavcodec");
projectDeps["libaom"] = (m_projectName == "libavcodec");
projectDeps["libaribb24"] = (m_projectName == "libavcodec");
projectDeps["libass"] = (m_projectName == "libavfilter");
projectDeps["libbluray"] = (m_projectName == "libavformat");
projectDeps["libbs2b"] = (m_projectName == "libavfilter");
projectDeps["libcaca"] = (m_projectName == "libavdevice");
projectDeps["libcdio"] = (m_projectName == "libavdevice");
projectDeps["libcelt"] = (m_projectName == "libavcodec");
projectDeps["libcodec2"] = (m_projectName == "libavcodec");
projectDeps["libdav1d"] = (m_projectName == "libavcodec");
projectDeps["libdavs2"] = (m_projectName == "libavcodec");
projectDeps["libdc1394"] = (m_projectName == "libavdevice");
projectDeps["libdcadec"] = (m_projectName == "libavcodec");
projectDeps["libfaac"] = (m_projectName == "libavcodec");
projectDeps["libfdk_aac"] = (m_projectName == "libavcodec");
projectDeps["libflite"] = (m_projectName == "libavfilter");
projectDeps["libfontconfig"] = (m_projectName == "libavfilter");
projectDeps["libfreetype"] = (m_projectName == "libavfilter");
projectDeps["libfribidi"] = (m_projectName == "libavfilter");
projectDeps["libgme"] = (m_projectName == "libavformat");
projectDeps["libgsm"] = (m_projectName == "libavcodec");
projectDeps["libharfbuzz"] = (m_projectName == "libavfilter");
projectDeps["libiec61883"] = (m_projectName == "libavdevice");
projectDeps["libilbc"] = (m_projectName == "libavcodec");
projectDeps["libkvazaar"] = (m_projectName == "libavcodec");
projectDeps["libmfx"] = ((m_projectName == "libavutil") && findSourceFile("hwcontext_qsv", ".h", notUsed)) ||
(m_projectName == "libavcodec") ||
((m_projectName == "libavfilter") &&
(findSourceFile("vf_deinterlace_qsv", ".c", notUsed) || findSourceFile("vf_stack_qsv", ".c", notUsed))) ||
(m_projectName == "ffmpeg") || (m_projectName == "avconv");
projectDeps["libmodplug"] = (m_projectName == "libavformat");
projectDeps["libmp3lame"] = (m_projectName == "libavcodec");
projectDeps["libnpp"] = (m_projectName == "libavfilter");
projectDeps["libnut"] = (m_projectName == "libformat");
projectDeps["libopencore_amrnb"] = (m_projectName == "libavcodec");
projectDeps["libopencore_amrwb"] = (m_projectName == "libavcodec");
projectDeps["libopencv"] = (m_projectName == "libavfilter");
projectDeps["libopenjpeg"] = (m_projectName == "libavcodec");
projectDeps["libopenh264"] = (m_projectName == "libavcodec");
projectDeps["libopenmpt"] = (m_projectName == "libavformat");
projectDeps["libopenvino"] = (m_projectName == "libavfilter");
projectDeps["libopus"] = (m_projectName == "libavcodec");
projectDeps["libpulse"] = (m_projectName == "libavdevice");
projectDeps["libquvi"] = (m_projectName == "libavformat");
projectDeps["librabbitmq"] = (m_projectName == "libavformat");
projectDeps["librav1e"] = (m_projectName == "libavcodec");
projectDeps["librist"] = (m_projectName == "libavformat");
projectDeps["librsvg"] = (m_projectName == "libavcodec");
projectDeps["librtmp"] = (m_projectName == "libavformat");
projectDeps["librubberband"] = (m_projectName == "libavfilter");
projectDeps["libschroedinger"] = (m_projectName == "libavcodec");
projectDeps["libshine"] = (m_projectName == "libavcodec");
projectDeps["libsmbclient"] = (m_projectName == "libavformat");
projectDeps["libsnappy"] = (m_projectName == "libavcodec");
projectDeps["libsoxr"] = (m_projectName == "libswresample");
projectDeps["libspeex"] = (m_projectName == "libavcodec");
projectDeps["libsrt"] = (m_projectName == "libavformat");
projectDeps["libssh"] = (m_projectName == "libavformat");
projectDeps["libstagefright_h264"] = (m_projectName == "libavcodec");
projectDeps["libsvtav1"] = (m_projectName == "libavcodec");
projectDeps["libtensorflow"] = (m_projectName == "libavfilter");
projectDeps["libtesseract"] = (m_projectName == "libavfilter");
projectDeps["libtheora"] = (m_projectName == "libavcodec");
projectDeps["libtls"] = (m_projectName == "libavformat");
projectDeps["libtwolame"] = (m_projectName == "libavcodec");
projectDeps["libuavs3d"] = (m_projectName == "libavcodec");
projectDeps["libutvideo"] = (m_projectName == "libavcodec");
projectDeps["libv4l2"] = (m_projectName == "libavdevice");
projectDeps["libvidstab"] = (m_projectName == "libavfilter");
projectDeps["libvmaf"] = (m_projectName == "libavfilter");
projectDeps["libvo_aacenc"] = (m_projectName == "libavcodec");
projectDeps["libvo_amrwbenc"] = (m_projectName == "libavcodec");
projectDeps["libvorbis"] = (m_projectName == "libavcodec");
projectDeps["libvpx"] = (m_projectName == "libavcodec");
projectDeps["libwavpack"] = (m_projectName == "libavcodec");
projectDeps["libwebp"] = (m_projectName == "libavcodec");
projectDeps["libx264"] = (m_projectName == "libavcodec");
projectDeps["libx265"] = (m_projectName == "libavcodec");
projectDeps["libxavs"] = (m_projectName == "libavcodec");
projectDeps["libxavs2"] = (m_projectName == "libavcodec");
projectDeps["libxml2"] = (m_projectName == "libavformat");
projectDeps["libxvid"] = (m_projectName == "libavcodec");
projectDeps["libzimg"] = (m_projectName == "libavfilter");
projectDeps["libzmq"] = (m_projectName == "libavfilter") || (m_projectName == "libavformat");
projectDeps["libzvbi"] = (m_projectName == "libavcodec");
projectDeps["lzma"] = (m_projectName == "libavcodec");
projectDeps["mediafoundation"] = (m_projectName == "libavcodec");
projectDeps["nvdec"] = (m_projectName == "libavcodec");
projectDeps["nvenc"] = (m_projectName == "libavcodec");
projectDeps["openal"] = (m_projectName == "libavdevice");
projectDeps["opencl"] = (m_projectName == "libavutil") || (m_projectName == "libavfilter") ||
(m_projectName == "ffmpeg") || (m_projectName == "avconv") || (m_projectName == "ffplay") ||
(m_projectName == "avplay") || (m_projectName == "ffprobe") || (m_projectName == "avprobe");
projectDeps["opengl"] = (m_projectName == "libavdevice");
projectDeps["openssl"] = (m_projectName == "libavformat") || (m_projectName == "libavutil");
projectDeps["schannel"] = (m_projectName == "libavformat");
projectDeps["sdl"] = (m_projectName == "libavdevice") || (m_projectName == "ffplay") || (m_projectName == "avplay");
projectDeps["sdl2"] =
(m_projectName == "libavdevice") || (m_projectName == "ffplay") || (m_projectName == "avplay");
projectDeps["vaapi"] = (m_projectName == "libavcodec") || (m_projectName == "libavfilter") || (m_projectName == "libavutil");
projectDeps["vaapi_win32"] = (m_projectName == "libavcodec") || (m_projectName == "libavfilter") || (m_projectName == "libavutil");
projectDeps["vapoursynth"] = m_projectName.compare("libavformat");
projectDeps["zlib"] = (m_projectName == "libavformat") || (m_projectName == "libavcodec");
}
void ProjectGenerator::buildProjectGUIDs(map<string, string>& keys) const
{
keys["libavcodec"] = "B4824EFF-C340-425D-A4A8-E2E02A71A7AE";
keys["libavdevice"] = "6E165FA4-44EB-4330-8394-9F0D76D8E03E";
keys["libavfilter"] = "BC2E1028-66CD-41A0-AF90-EEBD8CC52787";
keys["libavformat"] = "30A96E9B-8061-4F19-BD71-FDE7EA8F7929";
keys["libavresample"] = "0096CB8C-3B04-462B-BF4F-0A9970A57C91";
keys["libavutil"] = "CE6C44DD-6E38-4293-8AB3-04EE28CCA972";
keys["libswresample"] = "3CE4A9EF-98B6-4454-B76E-3AD9C03A2114";
keys["libswscale"] = "6D8A6330-8EBE-49FD-9281-0A396F9F28F2";
keys["libpostproc"] = "4D9C457D-9ADA-4A12-9D06-42D80124C5AB";
keys["libavcodec_winrt"] = "B4824EFF-C340-425D-A4A8-E2E02A71A7AF";
keys["libavdevice_winrt"] = "6E165FA4-44EB-4330-8394-9F0D76D8E03F";
keys["libavfilter_winrt"] = "BC2E1028-66CD-41A0-AF90-EEBD8CC5278F";
keys["libavformat_winrt"] = "30A96E9B-8061-4F19-BD71-FDE7EA8F792F";
keys["libavresample_winrt"] = "0096CB8C-3B04-462B-BF4F-0A9970A57C9F";
keys["libavutil_winrt"] = "CE6C44DD-6E38-4293-8AB3-04EE28CCA97F";
keys["libswresample_winrt"] = "3CE4A9EF-98B6-4454-B76E-3AD9C03A211F";
keys["libswscale_winrt"] = "6D8A6330-8EBE-49FD-9281-0A396F9F28FF";
keys["libpostproc_winrt"] = "4D9C457D-9ADA-4A12-9D06-42D80124C5AF";
if (!m_configHelper.m_isLibav) {
keys["ffmpeg"] = "4081C77E-F1F7-49FA-9BD8-A4D267C83716";
keys["ffplay"] = "E2A6865D-BD68-45B4-8130-EFD620F2C7EB";
keys["ffprobe"] = "147A422A-FA63-4724-A5D9-08B1CAFDAB59";
} else {
keys["avconv"] = "4081C77E-F1F7-49FA-9BD8-A4D267C83716";
keys["avplay"] = "E2A6865D-BD68-45B4-8130-EFD620F2C7EB";
keys["avprobe"] = "147A422A-FA63-4724-A5D9-08B1CAFDAB59";
}
}
void ProjectGenerator::buildProjectDCEs(map<string, DCEParams>&, map<string, DCEParams>& variablesDCE) const
{
// TODO: Detect these automatically
// Next we need to check for all the configurations that are project specific
struct FindThingsVars
{
string m_list;
string m_search;
string m_file;
string m_header;
};
vector<FindThingsVars> searchLists;
if (m_projectName == "libavcodec") {
searchLists.push_back({"encoder", "ENC", "libavcodec/allcodecs.c", "libavcodec/avcodec.h"});
searchLists.push_back({"decoder", "DEC", "libavcodec/allcodecs.c", "libavcodec/avcodec.h"});
searchLists.push_back({"hwaccel", "HWACCEL", "libavcodec/allcodecs.c", "libavcodec/avcodec.h"});
searchLists.push_back({"parser", "PARSER", "libavcodec/allcodecs.c", "libavcodec/avcodec.h"});
} else if (m_projectName == "libavformat") {
searchLists.push_back({"muxer", "_MUX", "libavformat/allformats.c", "libavformat/avformat.h"});
searchLists.push_back({"demuxer", "DEMUX", "libavformat/allformats.c", "libavformat/avformat.h"});
} else if (m_projectName == "libavfilter") {
searchLists.push_back({"filter", "FILTER", "libavfilter/allfilters.c", "libavfilter/avfilter.h"});
} else if (m_projectName == "libavdevice") {
searchLists.push_back({"outdev", "OUTDEV", "libavdevice/alldevices.c", "libavdevice/avdevice.h"});
searchLists.push_back({"indev", "_IN", "libavdevice/alldevices.c", "libavdevice/avdevice.h"});
}
for (const auto& i : searchLists) {
// We need to get the values from each config list
StaticList ret;
StaticList retExterns;
string list = i.m_list;
transform(list.begin(), list.end(), list.begin(), toupper);
m_configHelper.passFindThings(i.m_list, i.m_search, i.m_file, ret, &retExterns);
for (auto itRet = ret.begin(), itRet2 = retExterns.begin(); itRet < ret.end(); ++itRet, ++itRet2) {
string sType = *itRet2;
transform(itRet->begin(), itRet->end(), itRet->begin(), toupper);
variablesDCE[sType] = {"CONFIG_" + *itRet, i.m_header};
}
}
}