[Scummvm-git-logs] scummvm master -> 59d9975912076025ac3800a937457129a4b001db

sev- sev at scummvm.org
Thu Aug 20 21:54:37 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dfb0123d56 CREATE_PROJECT: Add a name table for MSVC library dependencies
bd34337370 CREATE_PROJECT: Update CodeBlocks library names
59d9975912 CREATE_PROJECT: Remove obsolete BuildSetup libraries property


Commit: dfb0123d56ab94ae089a01df44702202ba6797bb
    https://github.com/scummvm/scummvm/commit/dfb0123d56ab94ae089a01df44702202ba6797bb
Author: SupSuper (supsuper at gmail.com)
Date: 2020-08-20T23:54:32+02:00

Commit Message:
CREATE_PROJECT: Add a name table for MSVC library dependencies

Adds support for Debug/Release lib names and moves
Windows-specific code to the MSVC generator

Changed paths:
    devtools/create_project/msbuild.cpp
    devtools/create_project/msvc.cpp
    devtools/create_project/msvc.h
    devtools/create_project/visualstudio.cpp
    devtools/create_project/visualstudio.h


diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp
index 6b44176e93..73af8ba7fb 100644
--- a/devtools/create_project/msbuild.cpp
+++ b/devtools/create_project/msbuild.cpp
@@ -303,10 +303,14 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
 
 	// Link configuration for main project
 	if (name == setup.projectName || setup.devTools || setup.tests) {
-		std::string libraries;
+		std::string libraries = outputLibraryDependencies(setup, isRelease);
 
-		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
-			libraries += *i + ".lib;";
+		// MSBuild uses ; for separators instead of spaces
+		for (std::string::iterator i = libraries.begin(); i != libraries.end(); ++i) {
+			if (*i == ' ') {
+				*i = ';';
+			}
+		}
 
 		project << "\t\t<Link>\n"
 		        << "\t\t\t<OutputFile>$(OutDir)" << ((setup.devTools || setup.tests) ? name : setup.projectName) << ".exe</OutputFile>\n"
diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp
index 701173aee6..75c53bfc10 100644
--- a/devtools/create_project/msvc.cpp
+++ b/devtools/create_project/msvc.cpp
@@ -53,6 +53,94 @@ MSVCProvider::MSVCProvider(StringList &global_warnings, std::map<std::string, St
 	_arch_disabled_features[ARCH_ARM64] = arm64_disabled_features;
 }
 
+std::string MSVCProvider::getLibraryFromFeature(const char *feature, const BuildSetup &setup, bool isRelease) const {
+	static const MSVCLibrary s_libraries[] = {
+		// Libraries
+		{       "sdl", "SDL.lib",                   "SDLd.lib",      "winmm.lib imm32.lib version.lib setupapi.lib",    0 },
+		{      "sdl2", "SDL2.lib",                  "SDL2d.lib",     "winmm.lib imm32.lib version.lib setupapi.lib",    0 },
+		{      "libz", "zlib.lib",                  "zlibd.lib",     0,                                                 0 },
+		{       "mad", "mad.lib",                   0,               0,                                                 "libmad.lib" },
+		{   "fribidi", "libfribidi.lib",            0,               0,                                                 0 },
+		{       "ogg", "ogg.lib",                   0,               0,                                                 "libogg_static.lib" },
+		{    "vorbis", "vorbis.lib vorbisfile.lib", 0,               0,                                                 "libvorbisfile_static.lib libvorbis_static.lib" },
+		{      "flac", "FLAC.lib",                  0,               0,                                                 "libFLAC_static.lib win_utf8_io_static.lib" },
+		{       "png", "libpng16.lib",              "libpng16d.lib", 0,                                                 0 },
+		{      "faad", "faad.lib",                  0,               0,                                                 "libfaad.lib" },
+		{     "mpeg2", "mpeg2.lib",                 0,               0,                                                 "libmpeg2.lib" },
+		{    "theora", "theora.lib",                0,               0,                                                 "libtheora_static.lib" },
+		{  "freetype", "freetype.lib",              "freetyped.lib", 0,                                                 0 },
+		{      "jpeg", "jpeg.lib",                  "jpegd.lib",     0,                                                 "jpeg-static.lib" },
+		{"fluidsynth", "fluidsynth.lib",            0,               0,                                                 "libfluidsynth.lib" },
+		{   "libcurl", "libcurl.lib",               "libcurl-d.lib", "ws2_32.lib wldap32.lib crypt32.lib normaliz.lib", 0 },
+		{    "sdlnet", "SDL_net.lib",               0,               "iphlpapi.lib",                                    0 },
+		{   "sdl2net", "SDL2_net.lib",              0,               "iphlpapi.lib",                                    "SDL_net.lib" },
+		// Feature flags with library dependencies
+		{   "updates", "winsparkle.lib",            0,               0,                                                 0 },
+		{       "tts", 0,                           0,               "sapi.lib",                                        0 }
+	};
+
+	// HACK for switching SDL_net to SDL2_net
+	const char *sdl2net = "sdl2net";
+	if (std::strcmp(feature, "sdlnet") == 0 && setup.useSDL2) {
+		feature = sdl2net;
+	}
+
+	const MSVCLibrary *library = 0;
+	for (unsigned int i = 0; i < sizeof(s_libraries) / sizeof(s_libraries[0]); i++) {
+		if (std::strcmp(feature, s_libraries[i].feature) == 0) {
+			library = &s_libraries[i];
+			break;
+		}
+	}
+
+	std::string libs;
+	if (library) {
+		// Dependencies come first
+		if (library->depends) {
+			libs += library->depends;
+			libs += " ";
+		}
+
+		const char *basename = library->release;
+		if (setup.useCanonicalLibNames) {
+			// Debug name takes priority
+			if (!isRelease && library->debug) {
+				basename = library->debug;
+			}
+		} else {
+			// Legacy name ignores configuration
+			if (library->legacy) {
+				basename = library->legacy;
+			}
+		}
+		if (basename) {
+			libs += basename;
+		}
+	}
+	
+	return libs;
+}
+
+std::string MSVCProvider::outputLibraryDependencies(const BuildSetup &setup, bool isRelease) const {
+	std::string libs;
+
+	if (setup.useSDL2) {
+		libs += getLibraryFromFeature("sdl2", setup, isRelease);
+	} else {
+		libs += getLibraryFromFeature("sdl", setup, isRelease);
+	}
+	libs += " ";
+	for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
+		if (i->enable) {
+			std::string lib = getLibraryFromFeature(i->name, setup, isRelease);
+			if (!lib.empty())
+				libs += lib + " ";
+		}
+	}
+
+	return libs;
+}
+
 void MSVCProvider::createWorkspace(const BuildSetup &setup) {
 	UUIDMap::const_iterator svmUUID = _uuidMap.find(setup.projectName);
 	if (svmUUID == _uuidMap.end())
diff --git a/devtools/create_project/msvc.h b/devtools/create_project/msvc.h
index f711f165f4..8b9804f8cc 100644
--- a/devtools/create_project/msvc.h
+++ b/devtools/create_project/msvc.h
@@ -38,7 +38,21 @@ protected:
 	StringList _disableEditAndContinue;
 
 	std::list<MSVC_Architecture> _archs;
-	std::map<MSVC_Architecture, StringList> _arch_disabled_features;
+	std::map<MSVC_Architecture, StringList> _arch_disabled_features;	
+	
+	/**
+	 * MSVC properties for a library required by a feature
+	*/
+	struct MSVCLibrary {
+		const char *feature; ///< Feature ID.
+		const char *release; ///< Filename of the Release build of the library.
+		const char *debug;   ///< Filename of the Debug build of the library.
+		const char *depends; ///< Win32 libs this library must be linked against.
+		const char *legacy;  ///< Legacy name for old precompiled libraries (deprecated).
+	};
+
+	std::string getLibraryFromFeature(const char *feature, const BuildSetup &setup, bool isRelease) const;
+	std::string outputLibraryDependencies(const BuildSetup &setup, bool isRelease) const;
 
 	void createWorkspace(const BuildSetup &setup);
 
diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp
index 53dc811796..9ce8b66a87 100644
--- a/devtools/create_project/visualstudio.cpp
+++ b/devtools/create_project/visualstudio.cpp
@@ -79,19 +79,11 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
 	std::map<std::string, std::list<std::string> >::iterator warningsIterator = _projectWarnings.find(name);
 
 	if (setup.devTools || setup.tests || name == setup.projectName) {
-		std::string libraries;
-
-		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
-			libraries += ' ' + *i + ".lib";
-
-		// For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and
-		// re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the
-		// libraries list created for IA-32. If that changes in the future, we need to adjust this part!
 		for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
-			outputConfiguration(project, setup, libraries, "Debug", *arch);
-			outputConfiguration(project, setup, libraries, "Analysis", *arch);
-			outputConfiguration(project, setup, libraries, "LLVM", *arch);
-			outputConfiguration(project, setup, libraries, "Release", *arch);
+			outputConfiguration(project, setup, false, "Debug", *arch);
+			outputConfiguration(project, setup, false, "Analysis", *arch);
+			outputConfiguration(project, setup, false, "LLVM", *arch);
+			outputConfiguration(project, setup, true, "Release", *arch);
 		}
 
 	} else {
@@ -140,7 +132,9 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
 	        << "</VisualStudioProject>\n";
 }
 
-void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const MSVC_Architecture arch) {
+void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, bool isRelease, const std::string &config, const MSVC_Architecture arch) {
+	std::string libraries = outputLibraryDependencies(setup, isRelease);
+
 	project << "\t\t<Configuration Name=\"" << config << "|" << getMSVCConfigName(arch) << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << getMSVCArchName(arch) << ".vsprops\">\n"
 	        << "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" DebugInformationFormat=\"3\" />\n"
 	        << "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << setup.projectName << ".exe\"\n"
diff --git a/devtools/create_project/visualstudio.h b/devtools/create_project/visualstudio.h
index 6d9f37fac9..c89097fa0a 100644
--- a/devtools/create_project/visualstudio.h
+++ b/devtools/create_project/visualstudio.h
@@ -50,7 +50,7 @@ protected:
 	const char *getProjectExtension();
 	const char *getPropertiesExtension();
 
-	void outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const MSVC_Architecture arch);
+	void outputConfiguration(std::ostream &project, const BuildSetup &setup, bool isRelease, const std::string &config, const MSVC_Architecture arch);
 	void outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const MSVC_Architecture arch);
 	void outputBuildEvents(std::ostream &project, const BuildSetup &setup, const MSVC_Architecture arch);
 };


Commit: bd34337370fe9acffe6827f862e4d7999c75ca2a
    https://github.com/scummvm/scummvm/commit/bd34337370fe9acffe6827f862e4d7999c75ca2a
Author: SupSuper (supsuper at gmail.com)
Date: 2020-08-20T23:54:32+02:00

Commit Message:
CREATE_PROJECT: Update CodeBlocks library names

MinGW and MSVC libraries follow different conventions

Changed paths:
    devtools/create_project/codeblocks.cpp


diff --git a/devtools/create_project/codeblocks.cpp b/devtools/create_project/codeblocks.cpp
index e9dc8bf234..4d00d31bc1 100644
--- a/devtools/create_project/codeblocks.cpp
+++ b/devtools/create_project/codeblocks.cpp
@@ -24,6 +24,7 @@
 #include "codeblocks.h"
 
 #include <fstream>
+#include <cstring>
 
 namespace CreateProjectTool {
 
@@ -55,25 +56,46 @@ void CodeBlocksProvider::createWorkspace(const BuildSetup &setup) {
 	             "</CodeBlocks_workspace_file>";
 }
 
-// HACK We need to pre-process library names
-//      since the MSVC and mingw precompiled
-//      libraries have different names :(
-std::string processLibraryName(std::string name) {
-	// Remove "_static" in lib name
-	size_t pos = name.find("_static");
-	if (pos != std::string::npos)
-		return name.replace(pos, 7, "");
-
-	// Remove "-static" in lib name
-	pos = name.find("-static");
-	if (pos != std::string::npos)
-		return name.replace(pos, 7, "");
-
-	// Replace "zlib" by "libz"
-	if (name == "zlib")
-		return "libz";
-
-	return name;
+StringList getFeatureLibraries(const BuildSetup &setup) {
+	StringList libraries;
+
+	for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
+		if (i->enable && i->library) {
+			std::string libname;
+			if (!std::strcmp(i->name, "libz") || !std::strcmp(i->name, "libcurl")) {
+				libname = i->name;
+			} else if (!std::strcmp(i->name, "vorbis")) {
+				libname = "libvorbis";
+				libraries.push_back("libvorbisfile");
+			} else if (!std::strcmp(i->name, "png")) {
+				libname = "libpng16";
+			} else if (!std::strcmp(i->name, "sdlnet")) {
+				if (setup.useSDL2) {
+					libname = "libSDL2_net";
+				} else {
+					libname = "libSDL_net";
+				}
+				libraries.push_back("iphlpapi");
+			} else {
+				libname = "lib";
+				libname += i->name;
+			}
+			libraries.push_back(libname);
+		}
+	}
+
+	if (setup.useSDL2) {
+		libraries.push_back("libSDL2");
+	} else {
+		libraries.push_back("libSDL");
+	}
+
+	// Win32 libraries
+	libraries.push_back("ole32");
+	libraries.push_back("uuid");
+	libraries.push_back("winmm");
+
+	return libraries;
 }
 
 void CodeBlocksProvider::createProjectFile(const std::string &name, const std::string &, const BuildSetup &setup, const std::string &moduleDir,
@@ -94,15 +116,16 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
 	           "\t\t<Build>\n";
 
 	if (name == setup.projectName) {
-		std::string libraries;
+		StringList libraries = getFeatureLibraries(setup);
 
-		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
-			libraries += processLibraryName(*i) + ".a;";
+		std::string deps;
+		for (StringList::const_iterator i = libraries.begin(); i != libraries.end(); ++i)
+			deps += (*i) + ".a;";
 
 		project << "\t\t\t<Target title=\"default\">\n"
 		           "\t\t\t\t<Option output=\"" << setup.projectName << "\\" << setup.projectName << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
 		           "\t\t\t\t<Option object_output=\"" << setup.projectName << "\" />\n"
-		           "\t\t\t\t<Option external_deps=\"" << libraries /* + list of engines engines\name\name.a */ << "\" />\n"
+		           "\t\t\t\t<Option external_deps=\"" << deps /* + list of engines engines\name\name.a */ << "\" />\n"
 		           "\t\t\t\t<Option type=\"1\" />\n"
 		           "\t\t\t\t<Option compiler=\"gcc\" />\n"
 		           "\t\t\t\t<Option parameters=\"-d 8 --debugflags=parser\" />\n"
@@ -127,8 +150,8 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
 		// Linker
 		project << "\t\t\t\t<Linker>\n";
 
-		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
-			project << "\t\t\t\t\t<Add library=\"" << processLibraryName(*i) << "\" />\n";
+		for (StringList::const_iterator i = libraries.begin(); i != libraries.end(); ++i)
+			project << "\t\t\t\t\t<Add library=\"" << (*i) << "\" />\n";
 
 		for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
 			if (i->first == setup.projectName)


Commit: 59d9975912076025ac3800a937457129a4b001db
    https://github.com/scummvm/scummvm/commit/59d9975912076025ac3800a937457129a4b001db
Author: SupSuper (supsuper at gmail.com)
Date: 2020-08-20T23:54:32+02:00

Commit Message:
CREATE_PROJECT: Remove obsolete BuildSetup libraries property

Every generator manages their libraries, so this is no longer used

Changed paths:
    devtools/create_project/config.h
    devtools/create_project/create_project.cpp
    devtools/create_project/create_project.h


diff --git a/devtools/create_project/config.h b/devtools/create_project/config.h
index 63bf3dee26..b42c8b0ca5 100644
--- a/devtools/create_project/config.h
+++ b/devtools/create_project/config.h
@@ -32,7 +32,6 @@
 #define ENABLE_LANGUAGE_EXTENSIONS ""    // Comma separated list of projects that need language extensions
 #define DISABLE_EDIT_AND_CONTINUE "tinsel,tony,scummvm"     // Comma separated list of projects that need Edit&Continue to be disabled for co-routine support (the main project is automatically added)
 
-//#define ADDITIONAL_LIBRARY ""            // Add a single library to the list of externally linked libraries
 #define NEEDS_RTTI 1                     // Enable RTTI globally
 
 #endif // TOOLS_CREATE_PROJECT_CONFIG_H
diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index 2ee3a43c3e..3054ac8e50 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -352,7 +352,6 @@ int main(int argc, char *argv[]) {
 
 	// Setup defines and libraries
 	setup.defines = getEngineDefines(setup.engines);
-	setup.libraries = getFeatureLibraries(setup.features);
 
 	// Add features
 	StringList featureDefines = getFeatureDefines(setup.features);
@@ -382,69 +381,26 @@ int main(int argc, char *argv[]) {
 #endif
 	}
 
-	bool updatesEnabled = false, curlEnabled = false, sdlnetEnabled = false, ttsEnabled = false;
 	for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
 		if (i->enable) {
-			if (!updatesEnabled && !strcmp(i->name, "updates"))
-				updatesEnabled = true;
-			else if (!curlEnabled && !strcmp(i->name, "libcurl"))
-				curlEnabled = true;
-			else if (!sdlnetEnabled && !strcmp(i->name, "sdlnet"))
-				sdlnetEnabled = true;
-			else if (!ttsEnabled && !strcmp(i->name, "tts"))
-				ttsEnabled = true;
+			if (!strcmp(i->name, "updates"))
+				setup.defines.push_back("USE_SPARKLE");
+			else if (backendWin32 && !strcmp(i->name, "libcurl"))
+				setup.defines.push_back("CURL_STATICLIB");
 		}
 	}
 
-	if (updatesEnabled) {
-		setup.defines.push_back("USE_SPARKLE");
-		if (backendWin32)
-			setup.libraries.push_back("winsparkle");
-		else
-			setup.libraries.push_back("sparkle");
-	}
-
-	if (backendWin32) {
-		if (curlEnabled) {
-			setup.defines.push_back("CURL_STATICLIB");
-			setup.libraries.push_back("ws2_32");
-			setup.libraries.push_back("wldap32");
-			setup.libraries.push_back("crypt32");
-			setup.libraries.push_back("normaliz");
-		}
-		if (sdlnetEnabled) {
-			setup.libraries.push_back("iphlpapi");
-		}
-		if (ttsEnabled) {
-			setup.libraries.push_back("sapi");
-		}
-		setup.libraries.push_back("winmm");
-	}
-
 	setup.defines.push_back("SDL_BACKEND");
 	if (!setup.useSDL2) {
 		cout << "\nBuilding against SDL 1.2\n\n";
-		setup.libraries.push_back("sdl");
 	} else {
 		cout << "\nBuilding against SDL 2.0\n\n";
 		// TODO: This also defines USE_SDL2 in the preprocessor, we don't do
 		// this in our configure/make based build system. Adapt create_project
 		// to replicate this behavior.
 		setup.defines.push_back("USE_SDL2");
-		setup.libraries.push_back("sdl2");
-	}
-
-	if (setup.useCanonicalLibNames) {
-		for (StringList::iterator lib = setup.libraries.begin(); lib != setup.libraries.end(); ++lib) {
-			*lib = getCanonicalLibName(*lib);
-		}
 	}
 
-	// Add additional project-specific library
-#ifdef ADDITIONAL_LIBRARY
-	setup.libraries.push_back(ADDITIONAL_LIBRARY);
-#endif
-
 	// List of global warnings and map of project-specific warnings
 	// FIXME: As shown below these two structures have different behavior for
 	// Code::Blocks and MSVC. In Code::Blocks this is used to enable *and*
@@ -484,10 +440,6 @@ int main(int argc, char *argv[]) {
 
 		provider = new CreateProjectTool::CodeBlocksProvider(globalWarnings, projectWarnings);
 
-		// Those libraries are automatically added by MSVC, but we need to add them manually with mingw
-		setup.libraries.push_back("ole32");
-		setup.libraries.push_back("uuid");
-
 		break;
 
 	case kProjectMSVC:
@@ -1063,46 +1015,46 @@ TokenList tokenize(const std::string &input, char separator) {
 namespace {
 // clang-format off
 const Feature s_features[] = {
-	// Libraries
-	{      "libz",        "USE_ZLIB", "zlib",             true,  "zlib (compression) support" },
-	{       "mad",         "USE_MAD", "libmad",           true,  "libmad (MP3) support" },
-	{   "fribidi",     "USE_FRIBIDI", "fribidi",          true,  "BiDi support" },
-	{       "ogg",         "USE_OGG", "libogg_static",    true,  "Ogg support" },
-	{    "vorbis",      "USE_VORBIS", "libvorbisfile_static libvorbis_static", true, "Vorbis support" },
-	{    "tremor",      "USE_TREMOR", "libtremor", false, "Tremor support" },
-	{      "flac",        "USE_FLAC", "libFLAC_static win_utf8_io_static",   true, "FLAC support" },
-	{       "png",         "USE_PNG", "libpng16",         true,  "libpng support" },
-	{      "faad",        "USE_FAAD", "libfaad",          false, "AAC support" },
-	{     "mpeg2",       "USE_MPEG2", "libmpeg2",         false, "MPEG-2 support" },
-	{    "theora",   "USE_THEORADEC", "libtheora_static", true, "Theora decoding support" },
-	{  "freetype",   "USE_FREETYPE2", "freetype",         true, "FreeType support" },
-	{      "jpeg",        "USE_JPEG", "jpeg-static",      true, "libjpeg support" },
-	{"fluidsynth",  "USE_FLUIDSYNTH", "libfluidsynth",    true, "FluidSynth support" },
-	{   "libcurl",     "USE_LIBCURL", "libcurl",          true, "libcurl support" },
-	{    "sdlnet",     "USE_SDL_NET", "SDL_net",          true, "SDL_net support" },
+	// Libraries (must be added in generators)
+	{      "libz",        "USE_ZLIB", true, true,  "zlib (compression) support" },
+	{       "mad",         "USE_MAD", true, true,  "libmad (MP3) support" },
+	{   "fribidi",     "USE_FRIBIDI", true, true,  "BiDi support" },
+	{       "ogg",         "USE_OGG", true, true,  "Ogg support" },
+	{    "vorbis",      "USE_VORBIS", true, true,  "Vorbis support" },
+	{    "tremor",      "USE_TREMOR", true, false, "Tremor support" },
+	{      "flac",        "USE_FLAC", true, true,  "FLAC support" },
+	{       "png",         "USE_PNG", true, true,  "libpng support" },
+	{      "faad",        "USE_FAAD", true, false, "AAC support" },
+	{     "mpeg2",       "USE_MPEG2", true, false, "MPEG-2 support" },
+	{    "theora",   "USE_THEORADEC", true, true,  "Theora decoding support" },
+	{  "freetype",   "USE_FREETYPE2", true, true,  "FreeType support" },
+	{      "jpeg",        "USE_JPEG", true, true,  "libjpeg support" },
+	{"fluidsynth",  "USE_FLUIDSYNTH", true, true,  "FluidSynth support" },
+	{   "libcurl",     "USE_LIBCURL", true, true,  "libcurl support" },
+	{    "sdlnet",     "USE_SDL_NET", true, true,  "SDL_net support" },
 
 	// Feature flags
-	{            "bink",                      "USE_BINK",  "", true,  "Bink video support" },
-	{         "scalers",                   "USE_SCALERS",  "", true,  "Scalers" },
-	{       "hqscalers",                "USE_HQ_SCALERS",  "", true,  "HQ scalers" },
-	{           "16bit",                 "USE_RGB_COLOR",  "", true,  "16bit color support" },
-	{         "highres",                   "USE_HIGHRES",  "", true,  "high resolution" },
-	{         "mt32emu",                   "USE_MT32EMU",  "", true,  "integrated MT-32 emulator" },
-	{             "lua",                       "USE_LUA",  "", true,  "lua" },
-	{            "nasm",                      "USE_NASM",  "", true,  "IA-32 assembly support" }, // This feature is special in the regard, that it needs additional handling.
-	{          "opengl",                    "USE_OPENGL",  "", true,  "OpenGL support" },
-	{        "opengles",                      "USE_GLES",  "", true,  "forced OpenGL ES mode" },
-	{         "taskbar",                   "USE_TASKBAR",  "", true,  "Taskbar integration support" },
-	{           "cloud",                     "USE_CLOUD",  "", true,  "Cloud integration support" },
-	{     "translation",               "USE_TRANSLATION",  "", true,  "Translation support" },
-	{          "vkeybd",                 "ENABLE_VKEYBD",  "", false, "Virtual keyboard support"},
-	{   "eventrecorder",          "ENABLE_EVENTRECORDER",  "", false, "Event recorder support"},
-	{         "updates",                   "USE_UPDATES",  "", false, "Updates support"},
-	{         "dialogs",                "USE_SYSDIALOGS",  "", true,  "System dialogs support"},
-	{      "langdetect",                "USE_DETECTLANG",  "", true,  "System language detection support" }, // This feature actually depends on "translation", there
-	                                                                                                         // is just no current way of properly detecting this...
-	{    "text-console", "USE_TEXT_CONSOLE_FOR_DEBUGGER",  "", false, "Text console debugger" }, // This feature is always applied in xcode projects
-	{             "tts",                       "USE_TTS",  "", true,  "Text to speech support"}
+	{            "bink",                      "USE_BINK", false, true,  "Bink video support" },
+	{         "scalers",                   "USE_SCALERS", false, true,  "Scalers" },
+	{       "hqscalers",                "USE_HQ_SCALERS", false, true,  "HQ scalers" },
+	{           "16bit",                 "USE_RGB_COLOR", false, true,  "16bit color support" },
+	{         "highres",                   "USE_HIGHRES", false, true,  "high resolution" },
+	{         "mt32emu",                   "USE_MT32EMU", false, true,  "integrated MT-32 emulator" },
+	{             "lua",                       "USE_LUA", false, true,  "lua" },
+	{            "nasm",                      "USE_NASM", false, true,  "IA-32 assembly support" }, // This feature is special in the regard, that it needs additional handling.
+	{          "opengl",                    "USE_OPENGL", false, true,  "OpenGL support" },
+	{        "opengles",                      "USE_GLES", false, true,  "forced OpenGL ES mode" },
+	{         "taskbar",                   "USE_TASKBAR", false, true,  "Taskbar integration support" },
+	{           "cloud",                     "USE_CLOUD", false, true,  "Cloud integration support" },
+	{     "translation",               "USE_TRANSLATION", false, true,  "Translation support" },
+	{          "vkeybd",                 "ENABLE_VKEYBD", false, false, "Virtual keyboard support"},
+	{   "eventrecorder",          "ENABLE_EVENTRECORDER", false, false, "Event recorder support"},
+	{         "updates",                   "USE_UPDATES", false, false, "Updates support"},
+	{         "dialogs",                "USE_SYSDIALOGS", false, true,  "System dialogs support"},
+	{      "langdetect",                "USE_DETECTLANG", false, true,  "System language detection support" }, // This feature actually depends on "translation", there
+	                                                                                                           // is just no current way of properly detecting this...
+	{    "text-console", "USE_TEXT_CONSOLE_FOR_DEBUGGER", false, false, "Text console debugger" }, // This feature is always applied in xcode projects
+	{             "tts",                       "USE_TTS", false, true,  "Text to speech support"}
 };
 
 const Tool s_tools[] = {
@@ -1131,21 +1083,6 @@ const MSVCVersion s_msvc[] = {
 	{ 16,    "Visual Studio 2019",    "12.00",    "Version 16",    "16.0",    "v142",    "llvm"        }
 };
 
-const std::pair<std::string, std::string> s_canonical_lib_name_map[] = {
-	std::make_pair("jpeg-static", "jpeg"),
-	std::make_pair("libfaad", "faad"),
-	std::make_pair("libFLAC_static", "FLAC"),
-	std::make_pair("libfluidsynth", "fluidsynth"),
-	std::make_pair("libmad", "mad"),
-	std::make_pair("libmpeg2", "mpeg2"),
-	std::make_pair("libogg_static", "ogg"),
-	std::make_pair("libtheora_static", "theora"),
-	std::make_pair("libvorbis_static", "vorbis"),
-	std::make_pair("libvorbisfile_static", "vorbisfile"),
-	std::make_pair("SDL_net", "SDL2_net"), // Only support SDL2
-	std::make_pair("win_utf8_io_static", "FLAC") // This is some FLAC-specific library not needed with vcpkg, but as there's '.lib' appended to each library, we can't set it to empty, so set it to FLAC again instead
-};
-
 const char *s_msvc_arch_names[] = {"arm64", "x86", "x64"};
 const char *s_msvc_config_names[] = {"arm64", "Win32", "x64"};
 // clang-format on
@@ -1159,17 +1096,6 @@ std::string getMSVCConfigName(MSVC_Architecture arch) {
 	return s_msvc_config_names[arch];
 }
 
-std::string getCanonicalLibName(const std::string &lib) {
-	const size_t libCount = sizeof(s_canonical_lib_name_map) / sizeof(s_canonical_lib_name_map[0]);
-
-	for (size_t i = 0; i < libCount; ++i) {
-		if (s_canonical_lib_name_map[i].first == lib) {
-			return s_canonical_lib_name_map[i].second;
-		}
-	}
-	return lib;
-}
-
 FeatureList getAllFeatures() {
 	const size_t featureCount = sizeof(s_features) / sizeof(s_features[0]);
 
@@ -1191,34 +1117,6 @@ StringList getFeatureDefines(const FeatureList &features) {
 	return defines;
 }
 
-StringList getFeatureLibraries(const Feature &feature) {
-	StringList libraries;
-
-	if (feature.enable && feature.libraries && feature.libraries[0]) {
-		StringList fLibraries = tokenize(feature.libraries);
-		libraries.splice(libraries.end(), fLibraries);
-	}
-	// The libraries get sorted as they can get used in algorithms where ordering is a
-	// precondition, e.g. merge()
-	libraries.sort();
-
-	return libraries;
-}
-
-StringList getFeatureLibraries(const FeatureList &features) {
-	StringList libraries;
-
-	for (FeatureList::const_iterator i = features.begin(); i != features.end(); ++i) {
-		StringList fl = getFeatureLibraries(*i);
-		for (StringList::const_iterator flit = fl.begin(); flit != fl.end(); ++flit) {
-			libraries.push_back(*flit);
-		}
-	}
-	libraries.sort();
-
-	return libraries;
-}
-
 bool setFeatureBuildState(const std::string &name, FeatureList &features, bool enable) {
 	FeatureList::iterator i = std::find(features.begin(), features.end(), name);
 	if (i != features.end()) {
@@ -1239,16 +1137,9 @@ bool getFeatureBuildState(const std::string &name, FeatureList &features) {
 }
 
 BuildSetup removeFeatureFromSetup(BuildSetup setup, const std::string &feature) {
-	// TODO: use const_iterator in C++11
+	// TODO: disable feature instead of removing from setup
 	for (FeatureList::iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
 		if (i->enable && feature == i->name) {
-			StringList feature_libs = getFeatureLibraries(*i);
-			for (StringList::iterator lib = feature_libs.begin(); lib != feature_libs.end(); ++lib) {
-				if (setup.useCanonicalLibNames) {
-					*lib = getCanonicalLibName(*lib);
-				}
-				setup.libraries.remove(*lib);
-			}
 			if (i->define && i->define[0]) {
 				setup.defines.remove(i->define);
 			}
diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h
index 56eec93205..a3a4fd20e8 100644
--- a/devtools/create_project/create_project.h
+++ b/devtools/create_project/create_project.h
@@ -158,8 +158,7 @@ StringList getEngineDefines(const EngineDescList &engines);
 struct Feature {
 	const char *name;   ///< Name of the feature
 	const char *define; ///< Define of the feature
-
-	const char *libraries; ///< Libraries, which need to be linked, for the feature
+	bool library; ///< Whether this feature needs to be linked to a library
 
 	bool enable; ///< Whether the feature is enabled or not
 
@@ -192,22 +191,6 @@ FeatureList getAllFeatures();
  */
 StringList getFeatureDefines(const FeatureList &features);
 
-/**
- * Returns a list of all external library files, according to the
- * feature set passed.
- *
- * @param features List of features for the build (this may contain features, which are *not* enabled!)
- */
-StringList getFeatureLibraries(const FeatureList &features);
-
-/**
- * Returns a list of all external library files, according to the
- * feature passed.
- *
- * @param features Feature for the build (this may contain features, which are *not* enabled!)
- */
-StringList getFeatureLibraries(const Feature &feature);
-
 /**
  * Sets the state of a given feature. This can be used to
  * either include or exclude an feature.
@@ -247,7 +230,6 @@ struct BuildSetup {
 	FeatureList features;   ///< Feature list for the build (this may contain features, which are *not* enabled!).
 
 	StringList defines;   ///< List of all defines for the build.
-	StringList libraries; ///< List of all external libraries required for the build.
 	StringList testDirs;  ///< List of all folders containing tests
 
 	bool devTools;             ///< Generate project files for the tools
@@ -335,14 +317,6 @@ const MSVCVersion *getMSVCVersion(int version);
  */
 int getInstalledMSVC();
 
-/**
- * Return a "canonical" library name, so it is easier to integrate other providers of dependencies.
- *
- * @param lib The link library as provided by ScummVM libs.
- * @return Canonical link library.
- */
-std::string getCanonicalLibName(const std::string &lib);
-
 /**
  * Removes given feature from setup.
  *




More information about the Scummvm-git-logs mailing list