void ProjectGenerator::buildDependencies(const string & sProjectName, StaticList & vLibs, StaticList & vAddLibs) { //Add any forced dependencies if (sProjectName.compare("libavformat") == 0) { vAddLibs.push_back("ws2_32"); //Add the additional required libs } //Determine only those dependencies that are valid for current project map<string, bool> mProjectDeps; buildProjectDependencies(sProjectName, mProjectDeps); //Loop through each known configuration option and add the required dependencies vector<string> vExternLibs; m_ConfigHelper.getConfigList("EXTERNAL_LIBRARY_LIST", vExternLibs); for (vector<string>::iterator vitLib = vExternLibs.begin(); vitLib < vExternLibs.end(); vitLib++) { //Check if enabled if (m_ConfigHelper.getConfigOption(*vitLib)->m_sValue.compare("1") == 0) { //Check if this dependency is valid for this project (if the dependency is not known default to enable) if (mProjectDeps.find(*vitLib) == mProjectDeps.end()) { cout << " Warning: Unknown dependency found (" << *vitLib << ")" << endl; } else if (!mProjectDeps[*vitLib]) { //This dependency is not valid for this project so skip it continue; } string sLib; if (vitLib->compare("avisynth") == 0) { //doesnt need any additional libs } else if (vitLib->compare("bzlib") == 0) { sLib = "libbz2"; } else if (vitLib->compare("libcdio") == 0) { sLib = "libcdio_paranoia"; } else if (vitLib->compare("libfdk_aac") == 0) { sLib = "libfdk-aac"; } else if (vitLib->compare("libnpp") == 0) { vAddLibs.push_back("nppi"); //Add the additional required libs //CUDA 7.5 onwards only provides npp for x64 } else if (vitLib->compare("libxvid") == 0) { sLib = "libxvidcore"; } else if (vitLib->compare("openssl") == 0) { //Needs ws2_32 but libavformat needs this even if not using openssl so it is already included sLib = "libssl"; } else if (vitLib->compare("decklink") == 0) { //doesnt need any additional libs } else if (vitLib->compare("opengl") == 0) { vAddLibs.push_back("Opengl32"); //Add the additional required libs } else if (vitLib->compare("opencl") == 0) { vAddLibs.push_back("OpenCL"); //Add the additional required libs } else if (vitLib->compare("openal") == 0) { vAddLibs.push_back("OpenAL32"); //Add the additional required libs } else if (vitLib->compare("nvenc") == 0) { //Doesnt require any additional libs } else if (vitLib->compare("cuda") == 0) { vAddLibs.push_back("cuda"); //Add the additional required libs } else if (vitLib->compare("schannel") == 0) { vAddLibs.push_back("Secur32"); //Add the additional required libs } else { //By default just use the lib name and prefix with lib if not already if (vitLib->find("lib") == 0) { sLib = *vitLib; } else { sLib = "lib" + *vitLib; } } if (sLib.length() > 0) { //Check already not in list vector<string>::iterator vitList = vLibs.begin(); for (vitList; vitList < vLibs.end(); vitList++) { if (vitList->compare(sLib) == 0) { break; } } if (vitList == vLibs.end()) { vLibs.push_back(sLib); } } } } //Add in extralibs used for various devices if (sProjectName.compare("libavdevice") == 0) { vExternLibs.resize(0); m_ConfigHelper.getConfigList("OUTDEV_LIST", vExternLibs); m_ConfigHelper.getConfigList("INDEV_LIST", vExternLibs); for (vector<string>::iterator vitLib = vExternLibs.begin(); vitLib < vExternLibs.end(); vitLib++) { //Check if enabled if (m_ConfigHelper.getConfigOption(*vitLib)->m_sValue.compare("1") == 0) { //Add the additional required libs if (vitLib->compare("dshow_indev") == 0) { vAddLibs.push_back("strmiids"); } else if (vitLib->compare("vfwcap_indev") == 0) { vAddLibs.push_back("vfw32"); vAddLibs.push_back("shlwapi"); } else if ((vitLib->compare("wasapi_indev") == 0) || (vitLib->compare("wasapi_outdev") == 0)) { vAddLibs.push_back("ksuser"); } } } } }
void projectGenerator::buildDependencies( const string & sProjectName, StaticList & vLibs, StaticList & vAddLibs, StaticList & vIncludeDirs, StaticList & vLib32Dirs, StaticList & vLib64Dirs ) { //Add any forced dependencies if( sProjectName.compare( "libavformat" ) == 0 ) { vAddLibs.push_back( "ws2_32" ); //Add the additional required libs } //Determine only those dependencies that are valid for current project map<string,bool> mProjectDeps; buildProjectDependencies( sProjectName, mProjectDeps ); //Loop through each known configuration option and add the required dependencies vector<string> vExternLibs; m_ConfigHelper.getConfigList( "EXTERNAL_LIBRARY_LIST", vExternLibs ); //Add extra external libraries vExternLibs.push_back( "vfwcap_indev" ); vExternLibs.push_back( "dshow_indev" ); for( vector<string>::iterator vitLib=vExternLibs.begin(); vitLib<vExternLibs.end(); vitLib++ ) { //Check if enabled if( m_ConfigHelper.getConfigOption( *vitLib )->m_sValue.compare("1") == 0 ) { //Check if this dependency is valid for this project (if the dependency is not known default to enable) if( mProjectDeps.find( *vitLib ) == mProjectDeps.end() ) { cout << " Warning: Unknown dependency found (" << *vitLib << ")" << endl; } else { if( !mProjectDeps[*vitLib] ) { //This dependency is not valid for this project so skip it continue; } } string sLib; if( vitLib->compare("avisynth") == 0 ) { //doesnt need any additional libs } else if( vitLib->compare("bzlib") == 0 ) { sLib = "libbz2"; } else if( vitLib->compare("zlib") == 0 ) { sLib = "libz"; } else if( vitLib->compare( "libcdio" ) == 0 ) { sLib = "libcdio_paranoia"; } else if( vitLib->compare("libfdk_aac") == 0 ) { sLib = "libfdk-aac"; } else if( vitLib->compare("libxvid") == 0 ) { sLib = "libxvidcore"; } else if( vitLib->compare( "libmfx" ) == 0 ) { vAddLibs.push_back( "libmfx" ); //Only 1 lib for debug/release } else if( vitLib->compare("openssl") == 0 ) { //Needs ws2_32 but libavformat needs this even if not using openssl so it is already included sLib = "libopenssl"; } else if( vitLib->compare("vfwcap_indev") == 0 ) { vAddLibs.push_back( "vfw32" ); //Add the additional required libs vAddLibs.push_back( "shlwapi" ); } else if( vitLib->compare("dshow_indev") == 0 ) { vAddLibs.push_back( "strmiids" ); //Add the additional required libs } else if( vitLib->compare("decklink") == 0 ) { //doesnt need any additional libs } else if( vitLib->compare("sdl") == 0 ) { vAddLibs.push_back( "SDL" ); //Add the additional required libs } else if( vitLib->compare( "opengl" ) == 0 ) { vAddLibs.push_back( "Opengl32" ); //Add the additional required libs } else if( vitLib->compare( "opencl" ) == 0 ) { vAddLibs.push_back( "OpenCL" ); //Add the additional required libs } else if( vitLib->compare( "openal" ) == 0 ) { vAddLibs.push_back( "OpenAL32" ); //Add the additional required libs } else if( vitLib->compare( "nvenc" ) == 0 ) { //Doesnt require any additional libs } else { //By default just use the lib name and prefix with lib if not already if( vitLib->find( "lib" ) == 0 ) { sLib = *vitLib; } else { sLib = "lib" + *vitLib; } } if( sLib.length() > 0 ) { //Check already not in list vector<string>::iterator vitList=vLibs.begin(); for( vitList; vitList<vLibs.end(); vitList++ ) { if( vitList->compare( sLib ) == 0 ) { break; } } if( vitList == vLibs.end() ) { vLibs.push_back( sLib ); } } //Add in the additional include directories if( vitLib->compare("libopus") == 0 ) { vIncludeDirs.push_back("$(OutDir)\\include\\opus"); } else if( vitLib->compare("libfreetype") == 0 ) { vIncludeDirs.push_back("$(OutDir)\\include\\freetype2"); } else if( vitLib->compare( "libfribidi" ) == 0 ) { vIncludeDirs.push_back( "$(OutDir)\\include\\fribidi" ); } else if( vitLib->compare("sdl") == 0 ) { vIncludeDirs.push_back("$(OutDir)\\include\\SDL"); } else if( vitLib->compare( "opengl" ) == 0 ) { //Requires glext headers to be installed in include dir (does not require the libs) } else if( vitLib->compare( "opencl" ) == 0 ) { //Need to check for the existence of environment variables if( GetEnvironmentVariable( "AMDAPPSDKROOT", NULL, 0 ) ) { vIncludeDirs.push_back( "$(AMDAPPSDKROOT)\\include\\" ); vLib32Dirs.push_back( "$(AMDAPPSDKROOT)\\lib\\Win32" ); vLib64Dirs.push_back( "$(AMDAPPSDKROOT)\\lib\\x64" ); } else if( GetEnvironmentVariable( "INTELOCLSDKROOT", NULL, 0 ) ) { vIncludeDirs.push_back( "$(INTELOCLSDKROOT)\\include\\" ); vLib32Dirs.push_back( "$(INTELOCLSDKROOT)\\lib\\x86" ); vLib64Dirs.push_back( "$(INTELOCLSDKROOT)\\lib\\x64" ); } else if( GetEnvironmentVariable( "CUDA_PATH", NULL, 0 ) ) { cout << " Warning: NVIDIA OpenCl currently is only 1.1. OpenCl 1.2 is needed for FFMpeg support" << endl; vIncludeDirs.push_back( "$(CUDA_PATH)\\include\\" ); vLib32Dirs.push_back( "$(CUDA_PATH)\\lib\\Win32" ); vLib64Dirs.push_back( "$(CUDA_PATH)\\lib\\x64" ); } else { cout << " Warning: Could not find an OpenCl SDK environment variable." << endl; cout << " Either an OpenCL SDK is not installed or the environment variables are missing." << endl; } } else if( vitLib->compare( "openal" ) == 0 ) { if( !GetEnvironmentVariable( "OPENAL_SDK", NULL, 0 ) ) { cout << " Warning: Could not find the OpenAl SDK environment variable." << endl; cout << " Either the OpenAL SDK is not installed or the environment variable is missing." << endl; cout << " Using the default environment variable of 'OPENAL_SDK'." << endl; } vIncludeDirs.push_back( "$(OPENAL_SDK)\\include\\" ); vLib32Dirs.push_back( "$(OPENAL_SDK)\\libs\\Win32" ); vLib64Dirs.push_back( "$(CUDA_PATH)\\lib\\Win64" ); } else if( vitLib->compare( "nvenc" ) == 0 ) { //Need to check for the existence of environment variables if( !GetEnvironmentVariable( "CUDA_PATH", NULL, 0 ) ) { cout << " Warning: Could not find the CUDA SDK environment variable." << endl; cout << " Either the CUDA SDK is not installed or the environment variable is missing." << endl; cout << " NVENC requires CUDA to be installed with NVENC headers made available in the CUDA SDK include path." << endl; } vIncludeDirs.push_back( "$(CUDA_PATH)\\include\\" ); } else if( vitLib->compare( "libmfx" ) == 0 ) { if( !GetEnvironmentVariable( "INTELMEDIASDKROOT", NULL, 0 ) ) { cout << " Warning: Could not find the Intel Media SDK environment variable." << endl; cout << " Either the Intel Media is not installed or the environment variable is missing." << endl; cout << " Using the default environment variable of 'INTELMEDIASDKROOT'." << endl; } vIncludeDirs.push_back( "$(INTELMEDIASDKROOT)\\include\\" ); vLib32Dirs.push_back( "$(INTELMEDIASDKROOT)\\lib\\win32" ); vLib64Dirs.push_back( "$(INTELMEDIASDKROOT)\\lib\\x64" ); } } } }
void ProjectGenerator::buildDependencyDirs(const string & sProjectName, StaticList & vIncludeDirs, StaticList & vLib32Dirs, StaticList & vLib64Dirs) { //Determine only those dependencies that are valid for current project map<string, bool> mProjectDeps; buildProjectDependencies(sProjectName, mProjectDeps); //Loop through each known configuration option and add the required dependencies for (map<string, bool>::iterator mitLib = mProjectDeps.begin(); mitLib != mProjectDeps.end(); mitLib++) { //Check if enabled//Check if optimised value is valid for current configuration ConfigGenerator::ValuesList::iterator vitProjectDep = m_ConfigHelper.getConfigOption(mitLib->first); if (mitLib->second && (vitProjectDep != m_ConfigHelper.m_vConfigValues.end()) && (vitProjectDep->m_sValue.compare("1") == 0)) { //Add in the additional include directories if (mitLib->first.compare("libopus") == 0) { vIncludeDirs.push_back("$(OutDir)/include/opus"); } else if (mitLib->first.compare("libfreetype") == 0) { vIncludeDirs.push_back("$(OutDir)/include/freetype2"); } else if (mitLib->first.compare("libfribidi") == 0) { vIncludeDirs.push_back("$(OutDir)/include/fribidi"); } else if (mitLib->first.compare("sdl") == 0) { vIncludeDirs.push_back("$(OutDir)/include/SDL"); } else if (mitLib->first.compare("opengl") == 0) { //Requires glext headers to be installed in include dir (does not require the libs) } else if (mitLib->first.compare("opencl") == 0) { //Need to check for the existence of environment variables if (GetEnvironmentVariable("AMDAPPSDKROOT", NULL, 0)) { vIncludeDirs.push_back("$(AMDAPPSDKROOT)/include/"); vLib32Dirs.push_back("$(AMDAPPSDKROOT)/lib/Win32"); vLib64Dirs.push_back("$(AMDAPPSDKROOT)/lib/x64"); } else if (GetEnvironmentVariable("INTELOCLSDKROOT", NULL, 0)) { vIncludeDirs.push_back("$(INTELOCLSDKROOT)/include/"); vLib32Dirs.push_back("$(INTELOCLSDKROOT)/lib/x86"); vLib64Dirs.push_back("$(INTELOCLSDKROOT)/lib/x64"); } else if (GetEnvironmentVariable("CUDA_PATH", NULL, 0)) { vIncludeDirs.push_back("$(CUDA_PATH)/include/"); vLib32Dirs.push_back("$(CUDA_PATH)/lib/Win32"); vLib64Dirs.push_back("$(CUDA_PATH)/lib/x64"); } else { cout << " Warning: Could not find an OpenCl SDK environment variable." << endl; cout << " Either an OpenCL SDK is not installed or the environment variables are missing." << endl; cout << " The location of the OpenCl files will have to be manually specified as otherwise the project will not compile." << endl; } } else if (mitLib->first.compare("openal") == 0) { if (!GetEnvironmentVariable("OPENAL_SDK", NULL, 0)) { cout << " Warning: Could not find the OpenAl SDK environment variable." << endl; cout << " Either the OpenAL SDK is not installed or the environment variable is missing." << endl; cout << " Using the default environment variable of 'OPENAL_SDK'." << endl; } vIncludeDirs.push_back("$(OPENAL_SDK)/include/"); vLib32Dirs.push_back("$(OPENAL_SDK)/libs/Win32"); vLib64Dirs.push_back("$(OPENAL_SDK)/lib/Win64"); } else if (mitLib->first.compare("nvenc") == 0) { //Need to check for the existence of environment variables if (!GetEnvironmentVariable("CUDA_PATH", NULL, 0)) { cout << " Warning: Could not find the CUDA SDK environment variable." << endl; cout << " Either the CUDA SDK is not installed or the environment variable is missing." << endl; cout << " NVENC requires CUDA to be installed with NVENC headers made available in the CUDA SDK include path." << endl; } vIncludeDirs.push_back("$(CUDA_PATH)/include/"); } else if (mitLib->first.compare("cuda") == 0) { //Need to check for the existence of environment variables if (!GetEnvironmentVariable("CUDA_PATH", NULL, 0)) { cout << " Warning: Could not find the CUDA SDK environment variable." << endl; cout << " Either the CUDA SDK is not installed or the environment variable is missing." << endl; } vIncludeDirs.push_back("$(CUDA_PATH)/include/"); vLib32Dirs.push_back("$(CUDA_PATH)/lib/Win32"); vLib64Dirs.push_back("$(CUDA_PATH)/lib/x64"); } } } }