From ba0e4540b68f32d4f179aecf305e7c71cfadfb26 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sat, 29 Jun 2013 18:33:50 -0400 Subject: TOOLS: Add support for MSVC12 in create_project --- devtools/create_project/create_project.cpp | 8 +- devtools/create_project/msbuild.cpp | 15 +-- devtools/create_project/msvc12/create_project.sln | 20 ++++ .../create_project/msvc12/create_project.vcxproj | 132 +++++++++++++++++++++ .../msvc12/create_project.vcxproj.filters | 71 +++++++++++ 5 files changed, 235 insertions(+), 11 deletions(-) create mode 100644 devtools/create_project/msvc12/create_project.sln create mode 100644 devtools/create_project/msvc12/create_project.vcxproj create mode 100644 devtools/create_project/msvc12/create_project.vcxproj.filters (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index a8e09ff5eb..84a6185eda 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) { msvcVersion = atoi(argv[++i]); - if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11) { + if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11 && msvcVersion != 12) { std::cerr << "ERROR: Unsupported version: \"" << msvcVersion << "\" passed to \"--msvc-version\"!\n"; return -1; } @@ -609,9 +609,9 @@ void displayHelp(const char *exe) { " (default: false)\n" " --installer Create NSIS installer after the build (implies --build-events)\n" " (default: false)\n" - " --tools Create project files for the devtools\n" - " (ignores --build-events and --installer, as well as engine settings)\n" - " (default: false)\n" + " --tools Create project files for the devtools\n" + " (ignores --build-events and --installer, as well as engine settings)\n" + " (default: false)\n" "\n" "Engines settings:\n" " --list-engines list all available engines and their default state\n" diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 0f77d91852..dd9917e4ee 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -52,6 +52,9 @@ int MSBuildProvider::getVisualStudioVersion() { if (_version == 11) return 2012; + if (_version == 12) + return 2013; + error("Unsupported version passed to getVisualStudioVersion"); } @@ -88,7 +91,7 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri error("Could not open \"" + projectFile + "\" for writing"); project << "\n" - "\n" + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" "\t\n"; outputConfiguration(project, "Debug", "Win32"); @@ -105,7 +108,7 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri "\t\t{" << uuid << "}\n" "\t\t" << name << "\n" "\t\tWin32Proj\n" - "\t\t$(VCTargetsPath11)\n" + "\t\t$(VCTargetsPath" << _version << ")\n" "\t\n"; // Shared configuration @@ -184,7 +187,7 @@ void MSBuildProvider::createFiltersFile(const BuildSetup &setup, const std::stri error("Could not open \"" + filtersFile + "\" for writing"); filters << "\n" - "\n"; + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"; // Output the list of filters filters << "\t\n"; @@ -314,9 +317,8 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea definesList += REVISION_DEFINE ";"; properties << "\n" - "\n" + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" "\t\n" - "\t\t<_ProjectFileVersion>10.0.40219.1\n" "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global\n" "\t\t$(" << LIBS_DEFINE << ")\\bin;$(ExecutablePath)\n" "\t\t$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)\n" @@ -368,12 +370,11 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); properties << "\n" - "\n" + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" "\t\n" "\t\t\n" "\t\n" "\t\n" - "\t\t<_ProjectFileVersion>10.0.40219.1\n" "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << outputType << outputBitness << "\n" "\t\t" << (isRelease ? "false" : "true") << "\n" "\t\n" diff --git a/devtools/create_project/msvc12/create_project.sln b/devtools/create_project/msvc12/create_project.sln new file mode 100644 index 0000000000..759d5430f5 --- /dev/null +++ b/devtools/create_project/msvc12/create_project.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_project", "create_project.vcxproj", "{CF177559-077D-4A08-AABE-BE0FD35F6C63}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.ActiveCfg = Debug|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.Build.0 = Debug|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.ActiveCfg = Release|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/devtools/create_project/msvc12/create_project.vcxproj b/devtools/create_project/msvc12/create_project.vcxproj new file mode 100644 index 0000000000..c26b1e5f45 --- /dev/null +++ b/devtools/create_project/msvc12/create_project.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {CF177559-077D-4A08-AABE-BE0FD35F6C63} + create_project + $(VCTargetsPath11) + + + + Application + MultiByte + true + v120 + + + Application + MultiByte + v120 + + + + + + + + + + + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + + + + Disabled + true + EnableFastChecks + MultiThreadedDebugDLL + Level4 + EditAndContinue + false + 4003;4512;4127 + + + Rpcrt4.lib;%(AdditionalDependencies) + true + MachineX86 + false + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc12\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\" + + + + + MaxSpeed + true + MultiThreadedDLL + true + Level3 + ProgramDatabase + 4003;4512;4127 + + + Rpcrt4.lib;%(AdditionalDependencies) + true + true + true + MachineX86 + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc12\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/create_project/msvc12/create_project.vcxproj.filters b/devtools/create_project/msvc12/create_project.vcxproj.filters new file mode 100644 index 0000000000..436d1d3436 --- /dev/null +++ b/devtools/create_project/msvc12/create_project.vcxproj.filters @@ -0,0 +1,71 @@ + + + + + {2e3580c8-ec3a-4c81-8351-b668c668db2a} + + + {31aaf58c-d3cb-4ed6-8eca-163b4a9b31a6} + + + {f980f6fb-41b6-4161-b035-58b200c85cad} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + scripts + + + scripts + + + scripts + + + scripts + + + -- cgit v1.2.3 From 42e3c18ed3de4b143b10a1652d53061e750d5d8b Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Wed, 3 Jul 2013 00:22:27 +0200 Subject: CREATE_PROJECT: Fix a typo in the help-message (--codeblocks) --- devtools/create_project/create_project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 84a6185eda..6b6e86a187 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -588,7 +588,7 @@ void displayHelp(const char *exe) { " Additionally there are the following switches for changing various settings:\n" "\n" "Project specific settings:\n" - " --codeblock build Code::Blocks project files\n" + " --codeblocks build Code::Blocks project files\n" " --msvc build Visual Studio project files\n" " --xcode build XCode project files\n" " --file-prefix prefix allow overwriting of relative file prefix in the\n" -- cgit v1.2.3 From d089658fb84f67652e9569bc03c76bcc65e7b881 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Jul 2013 12:06:22 -0400 Subject: CREATE_PROJECT: Fix compilation for Visual Studio now the built-in theme is more than 64kb --- devtools/create_project/msbuild.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index dd9917e4ee..6af9323fcd 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -384,7 +384,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b if (isRelease) { properties << "\t\t\ttrue\n" "\t\t\ttrue\n" - "\t\t\tWIN32;RELEASE_BUILD;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tfalse\n" "\t\t\t\n" @@ -396,7 +396,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b "\t\t\ttrue\n"; } else { properties << "\t\t\tDisabled\n" - "\t\t\tWIN32;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tEnableFastChecks\n" "\t\t\tMultiThreadedDebug\n" -- cgit v1.2.3 From a5e969087b419710276ae08cac0565e144827292 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jul 2013 02:57:21 +0300 Subject: CREATE_PROJECT: Add the event recorder to the feature flags --- devtools/create_project/create_project.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 6b6e86a187..129e9f2367 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -809,19 +809,20 @@ const Feature s_features[] = { {"freetype", "USE_FREETYPE2", "freetype", true, "FreeType 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" }, - { "mt32emu", "USE_MT32EMU", "", true, "integrated MT-32 emulator" }, - { "nasm", "USE_NASM", "", true, "IA-32 assembly support" }, // This feature is special in the regard, that it needs additional handling. - { "opengl", "USE_OPENGL", "opengl32", true, "OpenGL support" }, - { "taskbar", "USE_TASKBAR", "", true, "Taskbar integration support" }, - { "translation", "USE_TRANSLATION", "", true, "Translation support" }, - { "vkeybd", "ENABLE_VKEYBD", "", false, "Virtual keyboard support"}, - { "keymapper","ENABLE_KEYMAPPER", "", false, "Keymapper 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... + { "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" }, + { "mt32emu", "USE_MT32EMU", "", true, "integrated MT-32 emulator" }, + { "nasm", "USE_NASM", "", true, "IA-32 assembly support" }, // This feature is special in the regard, that it needs additional handling. + { "opengl", "USE_OPENGL", "opengl32", true, "OpenGL support" }, + { "taskbar", "USE_TASKBAR", "", true, "Taskbar integration support" }, + { "translation", "USE_TRANSLATION", "", true, "Translation support" }, + { "vkeybd", "ENABLE_VKEYBD", "", false, "Virtual keyboard support"}, + { "keymapper", "ENABLE_KEYMAPPER", "", false, "Keymapper support"}, + { "eventrecorder", "ENABLE_EVENTRECORDER", "", false, "Event recorder 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... }; const Tool s_tools[] = { -- cgit v1.2.3 From 4a12c691620de09011fda6f06b3a389566a4823c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jul 2013 13:10:04 +0300 Subject: CREATE_PROJECT: Don't allow the keymapper and the event recorder to be enabled simultaneously --- devtools/create_project/create_project.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 129e9f2367..480f6a926a 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -310,6 +310,17 @@ int main(int argc, char *argv[]) { cout << " " << i->description << '\n'; } + // Check if the keymapper and the event recorder are enabled simultaneously + bool keymapperEnabled = false; + for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) { + if (i->enable && !strcmp(i->name, "keymapper")) + keymapperEnabled = true; + if (i->enable && !strcmp(i->name, "eventrecorder") && keymapperEnabled) { + std::cerr << "ERROR: The keymapper and the event recorder cannot be enabled simultaneously currently, please disable one of the two\n"; + return -1; + } + } + // Setup defines and libraries setup.defines = getEngineDefines(setup.engines); setup.libraries = getFeatureLibraries(setup.features); -- cgit v1.2.3 From 747863e4f5a2ea7f5988f4ea38fe6dffa4e37854 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 7 Jul 2013 16:48:52 +0300 Subject: CREATE_PROJECT: Add the libfaad and libmpeg2 libraries --- devtools/create_project/create_project.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 480f6a926a..8b8aaef042 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -816,6 +816,8 @@ const Feature s_features[] = { { "vorbis", "USE_VORBIS", "libvorbisfile_static libvorbis_static libogg_static", true, "Ogg Vorbis support" }, { "flac", "USE_FLAC", "libFLAC_static", true, "FLAC support" }, { "png", "USE_PNG", "libpng", 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" }, -- cgit v1.2.3 From 98899c6ce37141e6342ed9a5062ac03e726d0b4f Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sun, 7 Jul 2013 05:42:45 -0400 Subject: CREATE_PROJECT: Add create_neverhood and create_tony to the list of tools --- devtools/create_project/create_project.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 8b8aaef042..0a77a84602 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -843,7 +843,9 @@ const Tool s_tools[] = { { "create_hugo", true}, { "create_kyradat", true}, { "create_lure", true}, + { "create_neverhood", true}, { "create_teenagent", true}, + { "create_tony", true}, { "create_toon", true}, { "create_translations", true}, { "qtable", true} -- cgit v1.2.3 From a949a88220eea86cb15182daccd34a269ff7d6dd Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sun, 7 Jul 2013 11:23:19 -0400 Subject: CREATE_PROJECT: Add support for tests - Added --tests command line switch - Parse test/module.mk to extract the list of test folders - Automatically run tests after a successful build --- devtools/create_project/create_project.cpp | 191 ++++++++++++++++++++--------- devtools/create_project/create_project.h | 10 +- devtools/create_project/msbuild.cpp | 43 +++++-- devtools/create_project/msvc.cpp | 10 ++ devtools/create_project/msvc.h | 7 ++ devtools/create_project/visualstudio.cpp | 26 +++- 6 files changed, 210 insertions(+), 77 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 0a77a84602..3ee5fc4f97 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -109,7 +109,7 @@ enum ProjectType { int main(int argc, char *argv[]) { #ifndef USE_WIN32_API // Initialize random number generator for UUID creation - std::srand((uint)std::time(0)); + std::srand((unsigned int)std::time(0)); #endif if (argc < 2) { @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) { setup.filePrefix.erase(setup.filePrefix.size() - 1); } else if (!std::strcmp(argv[i], "--output-dir")) { if (i + 1 >= argc) { - std::cerr << "ERROR: Missing \"path\" parameter for \"--output-dirx\"!\n"; + std::cerr << "ERROR: Missing \"path\" parameter for \"--output-dir\"!\n"; return -1; } @@ -279,12 +279,23 @@ int main(int argc, char *argv[]) { setup.createInstaller = true; } else if (!std::strcmp(argv[i], "--tools")) { setup.devTools = true; + } else if (!std::strcmp(argv[i], "--tests")) { + setup.tests = true; } else { std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n"; return -1; } } + // When building tests, disable some features + if (setup.tests) { + setFeatureBuildState("mt32emu", setup.features, false); + setFeatureBuildState("eventrecorder", setup.features, false); + + for (EngineDescList::iterator j = setup.engines.begin(); j != setup.engines.end(); ++j) + j->enable = false; + } + // Print status cout << "Enabled engines:\n\n"; for (EngineDescList::const_iterator i = setup.engines.begin(); i != setup.engines.end(); ++i) { @@ -321,6 +332,12 @@ int main(int argc, char *argv[]) { } } + // Check if tools and tests are enabled simultaneously + if (setup.devTools && setup.tests) { + std::cerr << "ERROR: The tools and tests projects cannot be created simultaneously\n"; + return -1; + } + // Setup defines and libraries setup.defines = getEngineDefines(setup.engines); setup.libraries = getFeatureLibraries(setup.features); @@ -358,8 +375,8 @@ int main(int argc, char *argv[]) { return -1; case kProjectCodeBlocks: - if (setup.devTools) { - std::cerr << "ERROR: Building tools is not supported for the CodeBlocks project type!\n"; + if (setup.devTools || setup.tests) { + std::cerr << "ERROR: Building tools or tests is not supported for the CodeBlocks project type!\n"; return -1; } @@ -531,8 +548,8 @@ int main(int argc, char *argv[]) { break; case kProjectXcode: - if (setup.devTools) { - std::cerr << "ERROR: Building tools is not supported for the XCode project type!\n"; + if (setup.devTools || setup.tests) { + std::cerr << "ERROR: Building tools or tests is not supported for the XCode project type!\n"; return -1; } @@ -573,6 +590,11 @@ int main(int argc, char *argv[]) { setup.projectDescription += "Tools"; } + if (setup.tests) { + setup.projectName += "-tests"; + setup.projectDescription += "Tests"; + } + provider->createProject(setup); delete provider; @@ -623,6 +645,9 @@ void displayHelp(const char *exe) { " --tools Create project files for the devtools\n" " (ignores --build-events and --installer, as well as engine settings)\n" " (default: false)\n" + " --tests Create project files for the tests\n" + " (ignores --build-events and --installer, as well as engine settings)\n" + " (default: false)\n" "\n" "Engines settings:\n" " --list-engines list all available engines and their default state\n" @@ -1130,69 +1155,66 @@ ProjectProvider::ProjectProvider(StringList &global_warnings, std::mapfirst == setup.projectName) - continue; - - in.clear(); ex.clear(); - const std::string moduleDir = setup.srcDir + "/devtools/" + i->first; - - createModuleList(moduleDir, setup.defines, in, ex); - createProjectFile(i->first, i->second, setup, moduleDir, in, ex); - } - - // Create other misc. build files - createOtherBuildFiles(setup); + // We also need to add the UUID of the main project file. + const std::string svmUUID = _uuidMap[setup.projectName] = createUUID(); - } else { - _uuidMap = createUUIDMap(setup); + createWorkspace(setup); - // We also need to add the UUID of the main project file. - const std::string svmUUID = _uuidMap[setup.projectName] = createUUID(); + StringList in, ex; - // Create Solution/Workspace file - createWorkspace(setup); + // Create project files + for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { + if (i->first == setup.projectName) + continue; - StringList in, ex; + in.clear(); ex.clear(); + const std::string moduleDir = setup.srcDir + targetFolder + i->first; - // Create engine project files - for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { - if (i->first == setup.projectName) - continue; + createModuleList(moduleDir, setup.defines, setup.testDirs, in, ex); + createProjectFile(i->first, i->second, setup, moduleDir, in, ex); + } - in.clear(); ex.clear(); - const std::string moduleDir = setup.srcDir + "/engines/" + i->first; + if (setup.tests) { + // Create the main project file. + in.clear(); ex.clear(); - createModuleList(moduleDir, setup.defines, in, ex); - createProjectFile(i->first, i->second, setup, moduleDir, in, ex); - } + createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/common", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/engines", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/graphics", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/gui", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/audio", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/test", setup.defines, setup.testDirs, in, ex); + createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex); + } else if (!setup.devTools) { // Last but not least create the main project file. in.clear(); ex.clear(); // File list for the Project file - createModuleList(setup.srcDir + "/backends", setup.defines, in, ex); - createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, in, ex); - createModuleList(setup.srcDir + "/base", setup.defines, in, ex); - createModuleList(setup.srcDir + "/common", setup.defines, in, ex); - createModuleList(setup.srcDir + "/engines", setup.defines, in, ex); - createModuleList(setup.srcDir + "/graphics", setup.defines, in, ex); - createModuleList(setup.srcDir + "/gui", setup.defines, in, ex); - createModuleList(setup.srcDir + "/audio", setup.defines, in, ex); - createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, in, ex); - createModuleList(setup.srcDir + "/video", setup.defines, in, ex); + createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/common", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/engines", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/graphics", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/gui", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/audio", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/video", setup.defines, setup.testDirs, in, ex); // Resource files in.push_back(setup.srcDir + "/icons/" + setup.projectName + ".ico"); @@ -1211,10 +1233,10 @@ void ProjectProvider::createProject(const BuildSetup &setup) { // Create the main project file. createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex); - - // Create other misc. build files - createOtherBuildFiles(setup); } + + // Create other misc. build files + createOtherBuildFiles(setup); } ProjectProvider::UUIDMap ProjectProvider::createUUIDMap(const BuildSetup &setup) const { @@ -1322,7 +1344,7 @@ void ProjectProvider::addFilesToProject(const std::string &dir, std::ofstream &p delete files; } -void ProjectProvider::createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList) const { +void ProjectProvider::createModuleList(const std::string &moduleDir, const StringList &defines, StringList &testDirs, StringList &includeList, StringList &excludeList) const { const std::string moduleMkFile = moduleDir + "/module.mk"; std::ifstream moduleMk(moduleMkFile.c_str()); if (!moduleMk) @@ -1453,6 +1475,59 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin ++i; } } + } else if (*i == "TESTS") { + if (tokens.size() < 3) + error("Malformed TESTS definition in " + moduleMkFile); + ++i; + + if (*i != ":=" && *i != "+=" && *i != "=") + error("Malformed TESTS definition in " + moduleMkFile); + ++i; + + while (i != tokens.end()) { + // Read input + std::string folder = unifyPath(*i); + + // Get include folder + const std::string source_dir = "$(srcdir)/"; + const std::string selector = getLastPathComponent(folder); + const std::string module = getLastPathComponent(moduleDir); + + folder.replace(folder.find(source_dir), source_dir.length(), ""); + folder.replace(folder.find(selector), selector.length(), ""); + folder.replace(folder.find(module), module.length(), moduleDir); + + // Scan all files in the include folder + FileList files = listDirectory(folder); + + if (files.empty()) + continue; + + // Add to list of test folders + testDirs.push_back(folder); + + for (FileList::const_iterator f = files.begin(); f != files.end(); ++f) { + if (f->isDirectory) + continue; + + std::string filename = folder + f->name; + + if (shouldInclude.top()) { + // In case we should include a file, we need to make + // sure it is not in the exclude list already. If it + // is we just drop it from the exclude list. + excludeList.remove(filename); + + includeList.push_back(filename); + } else if (std::find(includeList.begin(), includeList.end(), filename) == includeList.end()) { + // We only add the file to the exclude list in case it + // has not yet been added to the include list. + excludeList.push_back(filename); + } + } + + ++i; + } } else if (*i == "ifdef") { if (tokens.size() < 2) error("Malformed ifdef in " + moduleMkFile); diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index de77793ee7..d0f2db364c 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -221,13 +221,16 @@ struct BuildSetup { 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 + bool tests; ///< Generate project files for the tests bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder bool createInstaller; ///< Create NSIS installer after the build BuildSetup() { devTools = false; + tests = false; runBuildEvents = false; createInstaller = false; } @@ -339,7 +342,7 @@ public: * * @param setup Description of the desired build setup. */ - void createProject(const BuildSetup &setup); + void createProject(BuildSetup &setup); /** * Returns the last path component. @@ -430,10 +433,11 @@ protected: * * @param moduleDir Path to the module. * @param defines List of set defines. + * @param testDirs List of folders containing tests. * @param includeList Reference to a list, where included files should be added. * @param excludeList Reference to a list, where excluded files should be added. */ - void createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList) const; + void createModuleList(const std::string &moduleDir, const StringList &defines, StringList &testDirs, StringList &includeList, StringList &excludeList) const; /** * Creates an UUID for every enabled engine of the @@ -448,7 +452,7 @@ protected: * Creates an UUID for every enabled tool of the * passed build description. * - * @return A map, which includes UUIDs for all enabled engines. + * @return A map, which includes UUIDs for all enabled tools. */ UUIDMap createToolsUUIDMap() const; diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 6af9323fcd..23bf1bc28a 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -69,7 +69,7 @@ inline void outputConfiguration(std::ostream &project, const std::string &config inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, int version) { project << "\t\n" - "\t\t" << ((name == setup.projectName || setup.devTools) ? "Application" : "StaticLibrary") << "\n" + "\t\t" << ((name == setup.projectName || setup.devTools || setup.tests) ? "Application" : "StaticLibrary") << "\n" "\t\tv" << version << "0\n" "\t\n"; } @@ -159,10 +159,26 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri if (name == setup.projectName) writeReferences(setup, project); + // Output auto-generated test runner + if (setup.tests) { + project << "\t\n"; + project << "\t\t\n"; + project << "\t\n"; + } + project << "\t\n" "\t\n" - "\t\n" - "\n"; + "\t\n"; + + if (setup.tests) { + // We override the normal target to ignore the exit code (this allows us to have a clean output and not message about the command exit code) + project << "\t\t\n" + << "\t\t\t\n" + << "\t\t\t\n" + << "\t\t\n"; + } + + project << "\n"; // Output filter file if necessary createFiltersFile(setup, name); @@ -248,7 +264,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s bool disableEditAndContinue = find(_disableEditAndContinue.begin(), _disableEditAndContinue.end(), name) != _disableEditAndContinue.end(); // Nothing to add here, move along! - if (!setup.devTools && name != setup.projectName && !enableLanguageExtensions && !disableEditAndContinue && warningsIterator == _projectWarnings.end()) + if ((!setup.devTools || !setup.tests) && name != setup.projectName && !enableLanguageExtensions && !disableEditAndContinue && warningsIterator == _projectWarnings.end()) return; std::string warnings = ""; @@ -260,7 +276,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s "\t\t\n"; // Language Extensions - if (setup.devTools || name == setup.projectName || enableLanguageExtensions) + if (setup.devTools || setup.tests || name == setup.projectName || enableLanguageExtensions) project << "\t\t\tfalse\n"; // Edit and Continue @@ -274,18 +290,18 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s project << "\t\t\n"; // Link configuration for main project - if (name == setup.projectName || setup.devTools) { + if (name == setup.projectName || setup.devTools || setup.tests) { std::string libraries; for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) libraries += *i + ".lib;"; project << "\t\t\n" - "\t\t\t$(OutDir)" << (setup.devTools ? name : setup.projectName) << ".exe\n" + "\t\t\t$(OutDir)" << ((setup.devTools || setup.tests) ? name : setup.projectName) << ".exe\n" "\t\t\t" << libraries << "%(AdditionalDependencies)\n" "\t\t\n"; - if (!setup.devTools && setup.runBuildEvents) { + if (!setup.devTools && !setup.tests && setup.runBuildEvents) { project << "\t\t\n" "\t\t\tGenerate revision\n" "\t\t\t" << getPreBuildEvent() << "\n" @@ -296,6 +312,11 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s "\t\t\tCopy data files to the build folder\n" "\t\t\t" << getPostBuildEvent(isWin32, setup.createInstaller) << "\n" "\t\t\n"; + } else if (setup.tests) { + project << "\t\t\n" + "\t\t\tGenerate runner.cpp\n" + "\t\t\t" << getTestPreBuildEvent(setup) << "\n" + "\t\t\n"; } } @@ -330,9 +351,9 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea "\t\t\n" "\t\t\ttrue\n" "\t\t\t" << warnings << ";%(DisableSpecificWarnings)\n" - "\t\t\t$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;$(TargetDir);%(AdditionalIncludeDirectories)\n" + "\t\t\t$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir);%(AdditionalIncludeDirectories)\n" "\t\t\t" << definesList << "%(PreprocessorDefinitions)\n" - "\t\t\t" << (setup.devTools ? "Sync" : "") << "\n"; + "\t\t\t" << ((setup.devTools || setup.tests) ? "Sync" : "") << "\n"; #if NEEDS_RTTI properties << "\t\t\ttrue\n"; @@ -348,7 +369,7 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea "\t\t\t%(IgnoreSpecificDefaultLibraries)\n" "\t\t\tConsole\n"; - if (!setup.devTools) + if (!setup.devTools && !setup.tests) properties << "\t\t\tWinMainCRTStartup\n"; properties << "\t\t\n" diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp index b8d2401af9..2fedadcba5 100644 --- a/devtools/create_project/msvc.cpp +++ b/devtools/create_project/msvc.cpp @@ -161,6 +161,16 @@ std::string MSVCProvider::getPreBuildEvent() const { return cmdLine; } +std::string MSVCProvider::getTestPreBuildEvent(const BuildSetup &setup) const { + // Build list of folders containing tests + std::string target = ""; + + for (StringList::const_iterator it = setup.testDirs.begin(); it != setup.testDirs.end(); ++it) + target += " $(SolutionDir)" + *it + "*.h"; + + return ""$(SolutionDir)../../test/cxxtest/cxxtestgen.py" --runner=ParenPrinter --no-std --no-eh -o $(SolutionDir)test_runner.cpp" + target; +} + std::string MSVCProvider::getPostBuildEvent(bool isWin32, bool createInstaller) const { std::string cmdLine = ""; diff --git a/devtools/create_project/msvc.h b/devtools/create_project/msvc.h index 5a854b596a..b9b93fe109 100644 --- a/devtools/create_project/msvc.h +++ b/devtools/create_project/msvc.h @@ -87,6 +87,13 @@ protected: */ std::string getPreBuildEvent() const; + /** + * Get the command line for the test generator + * + * @param setup Description of the desired build setup. + */ + std::string getTestPreBuildEvent(const BuildSetup &setup) const; + /** * Get the command line for copying data files to the build directory. * diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index de2df96d78..23225d3435 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -83,7 +83,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // Check for project-specific warnings: std::map< std::string, std::list >::iterator warningsIterator = _projectWarnings.find(name); - if (setup.devTools || name == setup.projectName) { + if (setup.devTools || setup.tests || name == setup.projectName) { std::string libraries; for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) @@ -140,6 +140,11 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: else addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix); + // Output auto-generated test runner + if (setup.tests) { + project << "\t\t\n"; + } + project << "\t\n" "\n"; } @@ -161,7 +166,7 @@ void VisualStudioProvider::outputConfiguration(const BuildSetup &setup, std::ost } void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) { - if (!setup.devTools && setup.runBuildEvents) { + if (!setup.devTools && !setup.tests && setup.runBuildEvents) { project << "\t\t\t\n" @@ -169,6 +174,17 @@ void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildS "\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32, setup.createInstaller) << "\"\n" "\t\t\t/>\n"; } + + // Generate runner file before build for tests + if (setup.tests) { + project << "\t\t\t\n"; + + project << "\t\t\t\n"; + } } void VisualStudioProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) { @@ -212,9 +228,9 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of "\t\tName=\"VCCLCompilerTool\"\n" "\t\tDisableLanguageExtensions=\"" << (setup.devTools ? "false" : "true") << "\"\n" "\t\tDisableSpecificWarnings=\"" << warnings << "\"\n" - "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(TargetDir)\"\n" + "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir)\"\n" "\t\tPreprocessorDefinitions=\"" << definesList << "\"\n" - "\t\tExceptionHandling=\"" << (setup.devTools ? "1" : "0") << "\"\n"; + "\t\tExceptionHandling=\"" << ((setup.devTools || setup.tests) ? "1" : "0") << "\"\n"; #if NEEDS_RTTI properties << "\t\tRuntimeTypeInfo=\"true\"\n"; @@ -235,7 +251,7 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of "\t\tIgnoreDefaultLibraryNames=\"\"\n" "\t\tSubSystem=\"1\"\n"; - if (!setup.devTools) + if (!setup.devTools && !setup.tests) properties << "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n"; properties << "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n" -- cgit v1.2.3 From b830f68bacd18f51f4dd912ce3b54ec47d63f31d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 14 Aug 2013 01:57:29 +0200 Subject: DEVTOOLS: Disable builtin theme in MSVC 2005 and 2008 in create_project. This is a copy of d089658fb84f67652e9569bc03c76bcc65e7b881 for older MSVC versions. Thanks to Strangerke for noticing. --- devtools/create_project/visualstudio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 23225d3435..17e378fd0f 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -286,7 +286,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea if (isRelease) { properties << "\t\tEnableIntrinsicFunctions=\"true\"\n" "\t\tWholeProgramOptimization=\"true\"\n" - "\t\tPreprocessorDefinitions=\"WIN32;RELEASE_BUILD\"\n" + "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD\"\n" "\t\tStringPooling=\"true\"\n" "\t\tBufferSecurityCheck=\"false\"\n" "\t\tDebugInformationFormat=\"0\"\n" @@ -300,7 +300,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea "\t\tSetChecksum=\"true\"\n"; } else { properties << "\t\tOptimization=\"0\"\n" - "\t\tPreprocessorDefinitions=\"WIN32\"\n" + "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME\"\n" "\t\tMinimalRebuild=\"true\"\n" "\t\tBasicRuntimeChecks=\"3\"\n" "\t\tRuntimeLibrary=\"1\"\n" -- cgit v1.2.3 From c67508b42d4d19ff58e766e63a0f5796436b6c65 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 16 Aug 2013 07:20:51 +0100 Subject: DEVTOOLS: Enable builtin theme in MSVC 2005 and 2008 in create_project. This reverts commit b830f68bacd18f51f4dd912ce3b54ec47d63f31d as the builtin theme is less than 64K again. --- devtools/create_project/visualstudio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 17e378fd0f..23225d3435 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -286,7 +286,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea if (isRelease) { properties << "\t\tEnableIntrinsicFunctions=\"true\"\n" "\t\tWholeProgramOptimization=\"true\"\n" - "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD\"\n" + "\t\tPreprocessorDefinitions=\"WIN32;RELEASE_BUILD\"\n" "\t\tStringPooling=\"true\"\n" "\t\tBufferSecurityCheck=\"false\"\n" "\t\tDebugInformationFormat=\"0\"\n" @@ -300,7 +300,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea "\t\tSetChecksum=\"true\"\n"; } else { properties << "\t\tOptimization=\"0\"\n" - "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME\"\n" + "\t\tPreprocessorDefinitions=\"WIN32\"\n" "\t\tMinimalRebuild=\"true\"\n" "\t\tBasicRuntimeChecks=\"3\"\n" "\t\tRuntimeLibrary=\"1\"\n" -- cgit v1.2.3 From 9d36991e16e7e806bd376b10200e10bb76a03225 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 16 Aug 2013 07:22:26 +0100 Subject: CREATE_PROJECT: Enable built-in theme for MSVC builds again. This reverts commit d089658fb84f67652e9569bc03c76bcc65e7b881. --- devtools/create_project/msbuild.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 23bf1bc28a..60aa35b739 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -405,7 +405,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b if (isRelease) { properties << "\t\t\ttrue\n" "\t\t\ttrue\n" - "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;RELEASE_BUILD;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tfalse\n" "\t\t\t\n" @@ -417,7 +417,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b "\t\t\ttrue\n"; } else { properties << "\t\t\tDisabled\n" - "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tEnableFastChecks\n" "\t\t\tMultiThreadedDebug\n" -- cgit v1.2.3 From 6df36e5ecfc3f6d5879b1932ecaf0e450ac296a9 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Thu, 5 Sep 2013 23:48:33 -0400 Subject: CREATE_PROJECT: Add extra configuration for compilation with LLVM --- devtools/create_project/msbuild.cpp | 67 +++++++++++++++++++------------- devtools/create_project/msbuild.h | 4 +- devtools/create_project/msvc.cpp | 20 +++++++--- devtools/create_project/msvc.h | 2 +- devtools/create_project/visualstudio.cpp | 41 ++++++++++--------- devtools/create_project/visualstudio.h | 2 +- 6 files changed, 79 insertions(+), 57 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 60aa35b739..44055ab166 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -67,10 +67,10 @@ inline void outputConfiguration(std::ostream &project, const std::string &config "\t\t\n"; } -inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, int version) { +inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, std::string toolset) { project << "\t\n" "\t\t" << ((name == setup.projectName || setup.devTools || setup.tests) ? "Application" : "StaticLibrary") << "\n" - "\t\tv" << version << "0\n" + "\t\t" << toolset << "\n" "\t\n"; } @@ -98,6 +98,8 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri outputConfiguration(project, "Debug", "x64"); outputConfiguration(project, "Analysis", "Win32"); outputConfiguration(project, "Analysis", "x64"); + outputConfiguration(project, "LLVM", "Win32"); + outputConfiguration(project, "LLVM", "x64"); outputConfiguration(project, "Release", "Win32"); outputConfiguration(project, "Release", "x64"); @@ -108,18 +110,22 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri "\t\t{" << uuid << "}\n" "\t\t" << name << "\n" "\t\tWin32Proj\n" - "\t\t$(VCTargetsPath" << _version << ")\n" + "\t\t$(VCTargetsPath" << _version << ")\n" "\t\n"; // Shared configuration project << "\t\n"; - outputConfigurationType(setup, project, name, "Release|Win32", _version); - outputConfigurationType(setup, project, name, "Analysis|Win32", _version); - outputConfigurationType(setup, project, name, "Debug|Win32", _version); - outputConfigurationType(setup, project, name, "Release|x64", _version); - outputConfigurationType(setup, project, name, "Analysis|x64", _version); - outputConfigurationType(setup, project, name, "Debug|x64", _version); + std::string version = "v" + std::to_string(_version) + "0"; + + outputConfigurationType(setup, project, name, "Release|Win32", version); + outputConfigurationType(setup, project, name, "Analysis|Win32", version); + outputConfigurationType(setup, project, name, "LLVM|Win32", "llvm"); + outputConfigurationType(setup, project, name, "Debug|Win32", version); + outputConfigurationType(setup, project, name, "Release|x64", version); + outputConfigurationType(setup, project, name, "LLVM|x64", "llvm"); + outputConfigurationType(setup, project, name, "Analysis|x64", version); + outputConfigurationType(setup, project, name, "Debug|x64", version); project << "\t\n" "\t\n" @@ -127,20 +133,24 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri outputProperties(project, "Release|Win32", setup.projectDescription + "_Release.props"); outputProperties(project, "Analysis|Win32", setup.projectDescription + "_Analysis.props"); + outputProperties(project, "LLVM|Win32", setup.projectDescription + "_LLVM.props"); outputProperties(project, "Debug|Win32", setup.projectDescription + "_Debug.props"); outputProperties(project, "Release|x64", setup.projectDescription + "_Release64.props"); outputProperties(project, "Analysis|x64", setup.projectDescription + "_Analysis64.props"); + outputProperties(project, "LLVM|x64", setup.projectDescription + "_LLVM64.props"); outputProperties(project, "Debug|x64", setup.projectDescription + "_Debug64.props"); project << "\t\n"; // Project-specific settings (analysis uses debug properties) - outputProjectSettings(project, name, setup, false, true, false); - outputProjectSettings(project, name, setup, false, true, true); - outputProjectSettings(project, name, setup, true, true, false); - outputProjectSettings(project, name, setup, false, false, false); - outputProjectSettings(project, name, setup, false, false, true); - outputProjectSettings(project, name, setup, true, false, false); + outputProjectSettings(project, name, setup, false, true, "Debug"); + outputProjectSettings(project, name, setup, false, true, "Analysis"); + outputProjectSettings(project, name, setup, false, true, "LLVM"); + outputProjectSettings(project, name, setup, true, true, "Release"); + outputProjectSettings(project, name, setup, false, false, "Debug"); + outputProjectSettings(project, name, setup, false, false, "Analysis"); + outputProjectSettings(project, name, setup, false, false, "LLVM"); + outputProjectSettings(project, name, setup, true, false, "Release"); // Files std::string modulePath; @@ -255,9 +265,7 @@ void MSBuildProvider::writeReferences(const BuildSetup &setup, std::ofstream &ou output << "\t\n"; } -void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis) { - const std::string configuration = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug")); - +void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) { // Check for project-specific warnings: std::map::iterator warningsIterator = _projectWarnings.find(name); bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end(); @@ -382,13 +390,12 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea properties.flush(); } -void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis) { - const std::string outputType = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug")); +void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) { const std::string outputBitness = (isWin32 ? "32" : "64"); - std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str()); + std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str()); if (!properties) - error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); + error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); properties << "\n" "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" @@ -396,7 +403,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b "\t\t\n" "\t\n" "\t\n" - "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << outputType << outputBitness << "\n" + "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << configuration << outputBitness << "\n" "\t\t" << (isRelease ? "false" : "true") << "\n" "\t\n" "\t\n" @@ -410,22 +417,26 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b "\t\t\tfalse\n" "\t\t\t\n" "\t\t\tMultiThreaded\n" - "\t\t\t" << (enableAnalysis ? "true" : "false") << "\n" + "\t\t\t" << (configuration == "Analysis" ? "true" : "false") << "\n" "\t\t\n" "\t\t\n" "\t\t\t%(IgnoreSpecificDefaultLibraries)\n" "\t\t\ttrue\n"; } else { properties << "\t\t\tDisabled\n" - "\t\t\tWIN32;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;" << (configuration == "LLVM" ? "_CRT_SECURE_NO_WARNINGS;" : "") << "%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tEnableFastChecks\n" "\t\t\tMultiThreadedDebug\n" "\t\t\ttrue\n" "\t\t\tfalse\n" "\t\t\t" << (isWin32 ? "EditAndContinue" : "ProgramDatabase") << "\n" // For x64 format Edit and continue is not supported, thus we default to Program Database - "\t\t\t" << (enableAnalysis ? "true" : "false") << "\n" - "\t\t\n" + "\t\t\t" << (configuration == "Analysis" ? "true" : "false") << "\n"; + + if (configuration == "LLVM") + properties << "\t\t\t-Wno-microsoft -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder -Wpointer-arith -Wcast-qual -Wshadow -Wnon-virtual-dtor -Wwrite-strings -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants -Wno-nested-anon-types %(AdditionalOptions)\n"; + + properties << "\t\t\n" "\t\t\n" "\t\t\ttrue\n" "\t\t\tfalse\n" @@ -481,7 +492,7 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ofstream // Deal with duplicated file names if (isDuplicate) { projectFile << "\t\t\n" - "\t\t\t$(IntDir)" << (*entry).prefix << "%(Filename).obj\n"; + "\t\t\t$(IntDir)" << (*entry).prefix << "%(Filename).obj\n"; projectFile << "\t\t\n"; } else { diff --git a/devtools/create_project/msbuild.h b/devtools/create_project/msbuild.h index fa6667741a..829657beff 100644 --- a/devtools/create_project/msbuild.h +++ b/devtools/create_project/msbuild.h @@ -35,7 +35,7 @@ protected: void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir, const StringList &includeList, const StringList &excludeList); - void outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis); + void outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration); void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix); @@ -44,7 +44,7 @@ protected: void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents); - void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis); + void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration); const char *getProjectExtension(); const char *getPropertiesExtension(); diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp index 2fedadcba5..cdd2d8a7c1 100644 --- a/devtools/create_project/msvc.cpp +++ b/devtools/create_project/msvc.cpp @@ -79,9 +79,11 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) { "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n" "\t\tDebug|Win32 = Debug|Win32\n" "\t\tAnalysis|Win32 = Analysis|Win32\n" + "\t\tLLVM|Win32 = LLVM|Win32\n" "\t\tRelease|Win32 = Release|Win32\n" "\t\tDebug|x64 = Debug|x64\n" "\t\tAnalysis|x64 = Analysis|x64\n" + "\t\tLLVM|x64 = LLVM|x64\n" "\t\tRelease|x64 = Release|x64\n" "\tEndGlobalSection\n" "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n"; @@ -91,12 +93,16 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) { "\t\t{" << i->second << "}.Debug|Win32.Build.0 = Debug|Win32\n" "\t\t{" << i->second << "}.Analysis|Win32.ActiveCfg = Analysis|Win32\n" "\t\t{" << i->second << "}.Analysis|Win32.Build.0 = Analysis|Win32\n" + "\t\t{" << i->second << "}.LLVM|Win32.ActiveCfg = LLVM|Win32\n" + "\t\t{" << i->second << "}.LLVM|Win32.Build.0 = LLVM|Win32\n" "\t\t{" << i->second << "}.Release|Win32.ActiveCfg = Release|Win32\n" "\t\t{" << i->second << "}.Release|Win32.Build.0 = Release|Win32\n" "\t\t{" << i->second << "}.Debug|x64.ActiveCfg = Debug|x64\n" "\t\t{" << i->second << "}.Debug|x64.Build.0 = Debug|x64\n" "\t\t{" << i->second << "}.Analysis|x64.ActiveCfg = Analysis|x64\n" "\t\t{" << i->second << "}.Analysis|x64.Build.0 = Analysis|x64\n" + "\t\t{" << i->second << "}.LLVM|x64.ActiveCfg = LLVM|x64\n" + "\t\t{" << i->second << "}.LLVM|x64.Build.0 = LLVM|x64\n" "\t\t{" << i->second << "}.Release|x64.ActiveCfg = Release|x64\n" "\t\t{" << i->second << "}.Release|x64.Build.0 = Release|x64\n"; } @@ -114,12 +120,14 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) { // Create the configuration property files (for Debug and Release with 32 and 64bits versions) // Note: we use the debug properties for the analysis configuration - createBuildProp(setup, true, false, false); - createBuildProp(setup, true, true, false); - createBuildProp(setup, false, false, false); - createBuildProp(setup, false, false, true); - createBuildProp(setup, false, true, false); - createBuildProp(setup, false, true, true); + createBuildProp(setup, true, false, "Release"); + createBuildProp(setup, true, true, "Release"); + createBuildProp(setup, false, false, "Debug"); + createBuildProp(setup, false, true, "Debug"); + createBuildProp(setup, false, false, "Analysis"); + createBuildProp(setup, false, true, "Analysis"); + createBuildProp(setup, false, false, "LLVM"); + createBuildProp(setup, false, true, "LLVM"); } void MSVCProvider::createGlobalProp(const BuildSetup &setup) { diff --git a/devtools/create_project/msvc.h b/devtools/create_project/msvc.h index b9b93fe109..3a3eb98034 100644 --- a/devtools/create_project/msvc.h +++ b/devtools/create_project/msvc.h @@ -70,7 +70,7 @@ protected: * @param isWin32 Bitness of property file * @param enableAnalysis PREfast support */ - virtual void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis) = 0; + virtual void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) = 0; /** * Get the file extension for property files diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 23225d3435..ac3c30b169 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -92,6 +92,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // Win32 outputConfiguration(project, setup, libraries, "Debug", "Win32", "", true); outputConfiguration(project, setup, libraries, "Analysis", "Win32", "", true); + outputConfiguration(project, setup, libraries, "LLVM", "Win32", "", true); outputConfiguration(project, setup, libraries, "Release", "Win32", "", true); // x64 @@ -100,6 +101,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // libraries list created for IA-32. If that changes in the future, we need to adjust this part! outputConfiguration(project, setup, libraries, "Debug", "x64", "64", false); outputConfiguration(project, setup, libraries, "Analysis", "x64", "64", false); + outputConfiguration(project, setup, libraries, "LLVM", "Win32", "64", false); outputConfiguration(project, setup, libraries, "Release", "x64", "64", false); } else { @@ -119,9 +121,11 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // Win32 outputConfiguration(setup, project, toolConfig, "Debug", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Analysis", "Win32", ""); + outputConfiguration(setup, project, toolConfig, "LLVM", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Release", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Debug", "x64", "64"); outputConfiguration(setup, project, toolConfig, "Analysis", "x64", "64"); + outputConfiguration(setup, project, toolConfig, "LLVM", "x64", "64"); outputConfiguration(setup, project, toolConfig, "Release", "x64", "64"); } @@ -265,19 +269,18 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of properties.flush(); } -void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis) { - const std::string outputType = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug")); +void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) { const std::string outputBitness = (isWin32 ? "32" : "64"); - std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str()); + std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str()); if (!properties) - error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); + error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); properties << "\n" "\n" "\t\n" "\t\n" "\t\n" << toolLine << indentString << "\t\n" - << indentString << "\t\n" - << toolLine - << indentString << "\t\n" + << indentString << "\t\n" + << toolLine + << indentString << "\t\n" << indentString << "\t\n" << toolLine << indentString << "\t\n" @@ -369,18 +372,18 @@ void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofst << indentString << "\t\n" << toolLine << indentString << "\t\n" - << indentString << "\t\n" - << toolLine - << indentString << "\t\n" + << indentString << "\t\n" + << toolLine + << indentString << "\t\n" << indentString << "\t\n" << toolLine << indentString << "\t\n" - << indentString << "\t\n" - << toolLine - << indentString << "\t\n" - << indentString << "\t\n" - << toolLine - << indentString << "\t\n" + << indentString << "\t\n" + << toolLine + << indentString << "\t\n" + << indentString << "\t\n" + << toolLine + << indentString << "\t\n" << indentString << "\t\n" << toolLine << indentString << "\t\n" diff --git a/devtools/create_project/visualstudio.h b/devtools/create_project/visualstudio.h index 845550139c..7eb66c4f2d 100644 --- a/devtools/create_project/visualstudio.h +++ b/devtools/create_project/visualstudio.h @@ -42,7 +42,7 @@ protected: void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents); - void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis); + void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration); const char *getProjectExtension(); const char *getPropertiesExtension(); -- cgit v1.2.3 From 3079100409df05d5da47a0c2f0676659c7d9d733 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Fri, 6 Sep 2013 18:33:48 -0400 Subject: CREATE_PROJECT: Change PlatformToolset name for latest version of LLVM on Windows --- devtools/create_project/msbuild.cpp | 5 +++-- devtools/create_project/visualstudio.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 44055ab166..7bab5c1078 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -117,13 +117,14 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri project << "\t\n"; std::string version = "v" + std::to_string(_version) + "0"; + std::string llvm = "LLVM-vs" + std::to_string(getVisualStudioVersion()); outputConfigurationType(setup, project, name, "Release|Win32", version); outputConfigurationType(setup, project, name, "Analysis|Win32", version); - outputConfigurationType(setup, project, name, "LLVM|Win32", "llvm"); + outputConfigurationType(setup, project, name, "LLVM|Win32", llvm); outputConfigurationType(setup, project, name, "Debug|Win32", version); outputConfigurationType(setup, project, name, "Release|x64", version); - outputConfigurationType(setup, project, name, "LLVM|x64", "llvm"); + outputConfigurationType(setup, project, name, "LLVM|x64", llvm); outputConfigurationType(setup, project, name, "Analysis|x64", version); outputConfigurationType(setup, project, name, "Debug|x64", version); diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index ac3c30b169..438e0772f9 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -121,7 +121,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // Win32 outputConfiguration(setup, project, toolConfig, "Debug", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Analysis", "Win32", ""); - outputConfiguration(setup, project, toolConfig, "LLVM", "Win32", ""); + outputConfiguration(setup, project, toolConfig, "LLVM", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Release", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Debug", "x64", "64"); outputConfiguration(setup, project, toolConfig, "Analysis", "x64", "64"); -- cgit v1.2.3 From 8b56d0792cace06693b18af3fe848f66434fc4cd Mon Sep 17 00:00:00 2001 From: Littleboy Date: Wed, 11 Sep 2013 20:36:38 -0400 Subject: CREATE_PROJECT: Remove usage of std::to_string() --- devtools/create_project/create_project.cpp | 6 +++++- devtools/create_project/create_project.h | 8 ++++++++ devtools/create_project/msbuild.cpp | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 3ee5fc4f97..7ae2df35c8 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -39,7 +39,7 @@ #include #include - +#include #include #include #include @@ -966,6 +966,10 @@ bool producesObjectFile(const std::string &fileName) { return false; } +std::string toString(int num) { + return static_cast(&(std::ostringstream() << num))->str(); +} + /** * Checks whether the give file in the specified directory is present in the given * file list. diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index d0f2db364c..5325bf6d1b 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -302,6 +302,14 @@ void splitFilename(const std::string &fileName, std::string &name, std::string & */ bool producesObjectFile(const std::string &fileName); +/** +* Convert an integer to string +* +* @param num the integer to convert +* @return string representation of the number +*/ +std::string toString(int num); + /** * Structure representing a file tree. This contains two * members: name and children. "name" holds the name of diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 7bab5c1078..0d68b2e9c9 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -116,8 +116,8 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri // Shared configuration project << "\t\n"; - std::string version = "v" + std::to_string(_version) + "0"; - std::string llvm = "LLVM-vs" + std::to_string(getVisualStudioVersion()); + std::string version = "v" + toString(_version) + "0"; + std::string llvm = "LLVM-vs" + toString(getVisualStudioVersion()); outputConfigurationType(setup, project, name, "Release|Win32", version); outputConfigurationType(setup, project, name, "Analysis|Win32", version); -- cgit v1.2.3 From 856da53e8b232134561308328989cd12259bb063 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 17 Sep 2013 02:31:04 +0200 Subject: DEVTOOLS: Adapt create_project for libjpeg support. The library name of the static library is based on what libjpeg-turbo uses which should be fine for Windows at least. Untested except for compilation of create_project. --- devtools/create_project/codeblocks.cpp | 5 +++++ devtools/create_project/create_project.cpp | 1 + 2 files changed, 6 insertions(+) (limited to 'devtools/create_project') diff --git a/devtools/create_project/codeblocks.cpp b/devtools/create_project/codeblocks.cpp index 3458ca5a19..ec003df2d5 100644 --- a/devtools/create_project/codeblocks.cpp +++ b/devtools/create_project/codeblocks.cpp @@ -64,6 +64,11 @@ std::string processLibraryName(std::string name) { 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"; diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 7ae2df35c8..e013377241 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -845,6 +845,7 @@ const Feature s_features[] = { { "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" }, // Feature flags { "bink", "USE_BINK", "", true, "Bink video support" }, -- cgit v1.2.3 From ca5804a253c0e654ec6d6210aea9ee2574aad367 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 27 Sep 2013 12:28:25 +0300 Subject: DEVTOOLS: Make Coverity happy. This is mainly due to unhandled clang __has_featrure() buit-in. I do not like this hack, but Coverity proved to be a very good tool for us. --- devtools/create_project/create_project.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index 5325bf6d1b..2f27cc2f61 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -23,6 +23,10 @@ #ifndef TOOLS_CREATE_PROJECT_H #define TOOLS_CREATE_PROJECT_H +#ifndef __has_feature // Optional of course. + #define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + #include #include #include -- cgit v1.2.3 From 6e29e1abeefb998c97df14c6971c69822ead7959 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: DEVTOOLS: Adapt create_project for new configure.engine files. I could not try any generated project files since I do not have access to the IDEs. --- devtools/create_project/create_project.cpp | 165 ++++++++++++++++++++--------- devtools/create_project/create_project.h | 43 +++++++- 2 files changed, 151 insertions(+), 57 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index e013377241..ad3160d778 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -81,22 +81,6 @@ std::string unifyPath(const std::string &path); * @param exe Name of the executable. */ void displayHelp(const char *exe); - -/** - * Structure for describing an FSNode. This is a very minimalistic - * description, which includes everything we need. - * It only contains the name of the node and whether it is a directory - * or not. - */ -struct FSNode { - FSNode() : name(), isDirectory(false) {} - FSNode(const std::string &n, bool iD) : name(n), isDirectory(iD) {} - - std::string name; ///< Name of the file system node - bool isDirectory; ///< Whether it is a directory or not -}; - -typedef std::list FileList; } // End of anonymous namespace enum ProjectType { @@ -128,7 +112,7 @@ int main(int argc, char *argv[]) { setup.filePrefix = setup.srcDir; setup.outputDir = '.'; - setup.engines = parseConfigure(setup.srcDir); + setup.engines = parseEngines(setup.srcDir); if (setup.engines.empty()) { std::cout << "WARNING: No engines found in configure file or configure file missing in \"" << setup.srcDir << "\"\n"; @@ -672,47 +656,51 @@ void displayHelp(const char *exe) { } /** - * Try to parse a given line and create an engine definition - * out of the result. - * - * This may take *any* input line, when the line is not used - * to define an engine the result of the function will be "false". + * Parse the configure.engine file of a given engine directory and return a + * list of all defined engines. * - * Note that the contents of "engine" are undefined, when this - * function returns "false". + * @param engineDir The directory of the engine. + * @return The list of all defined engines. + */ +EngineDescList parseEngineConfigure(const std::string &engineDir); + +/** + * Compares two FSNode entries in a strict-weak fashion based on the name. * - * @param line Text input line. - * @param engine Reference to an object, where the engine information - * is to be stored in. - * @return "true", when parsing succeeded, "false" otherwise. + * @param left The first operand. + * @param right The second operand. + * @return "true" when the name of the left operand is strictly smaller than + * the name of the second operand. "false" otherwise. */ -bool parseEngine(const std::string &line, EngineDesc &engine); +bool compareFSNode(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right); } // End of anonymous namespace -EngineDescList parseConfigure(const std::string &srcDir) { - std::string configureFile = srcDir + "/engines/configure.engines"; +EngineDescList parseEngines(const std::string &srcDir) { + using CreateProjectTool::FileList; + using CreateProjectTool::listDirectory; - std::ifstream configure(configureFile.c_str()); - if (!configure) - return EngineDescList(); + EngineDescList engineList; - std::string line; - EngineDescList engines; + FileList engineFiles = listDirectory(srcDir + "/engines/"); - for (;;) { - std::getline(configure, line); - if (configure.eof()) - break; + // Sort file list alphabetically this allows for a nicer order in + // --list-engines output, for example. + engineFiles.sort(&compareFSNode); - if (configure.fail()) - error("Failed while reading from " + configureFile); + for (FileList::const_iterator i = engineFiles.begin(), end = engineFiles.end(); i != end; ++i) { + // Each engine requires its own sub directory thus we will skip all + // non directory file nodes here. + if (!i->isDirectory) { + continue; + } - EngineDesc desc; - if (parseEngine(line, desc)) - engines.push_back(desc); + // Retrieve all engines defined in this sub directory and add them to + // the list of all engines. + EngineDescList list = parseEngineConfigure(srcDir + "/engines/" + i->name); + engineList.splice(engineList.end(), list); } - return engines; + return engineList; } bool isSubEngine(const std::string &name, const EngineDescList &engines) { @@ -777,6 +765,21 @@ StringList getEngineDefines(const EngineDescList &engines) { } namespace { +/** + * Try to parse a given line and create an engine definition + * out of the result. + * + * This may take *any* input line, when the line is not used + * to define an engine the result of the function will be "false". + * + * Note that the contents of "engine" are undefined, when this + * function returns "false". + * + * @param line Text input line. + * @param engine Reference to an object, where the engine information + * is to be stored in. + * @return "true", when parsing succeeded, "false" otherwise. + */ bool parseEngine(const std::string &line, EngineDesc &engine) { // Format: // add_engine engine_name "Readable Description" enable_default ["SubEngineList"] @@ -799,6 +802,36 @@ bool parseEngine(const std::string &line, EngineDesc &engine) { return true; } + +EngineDescList parseEngineConfigure(const std::string &engineDir) { + std::string configureFile = engineDir + "/configure.engine"; + + std::ifstream configure(configureFile.c_str()); + if (!configure) + return EngineDescList(); + + std::string line; + EngineDescList engines; + + for (;;) { + std::getline(configure, line); + if (configure.eof()) + break; + + if (configure.fail()) + error("Failed while reading from " + configureFile); + + EngineDesc desc; + if (parseEngine(line, desc)) + engines.push_back(desc); + } + + return engines; +} + +bool compareFSNode(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right) { + return left.name < right.name; +} } // End of anonymous namespace TokenList tokenize(const std::string &input, char separator) { @@ -1048,13 +1081,6 @@ bool compareNodes(const FileNode *l, const FileNode *r) { } } -/** - * Returns a list of all files and directories in the specified - * path. - * - * @param dir Directory which should be listed. - * @return List of all children. - */ FileList listDirectory(const std::string &dir) { FileList result; #ifdef USE_WIN32_API @@ -1242,6 +1268,12 @@ void ProjectProvider::createProject(BuildSetup &setup) { // Create other misc. build files createOtherBuildFiles(setup); + + // In case we create the main ScummVM project files we will need to + // generate engines/plugins_table.h too. + if (!setup.tests && !setup.devTools) { + createEnginePluginsTable(setup); + } } ProjectProvider::UUIDMap ProjectProvider::createUUIDMap(const BuildSetup &setup) const { @@ -1569,6 +1601,33 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin error("Malformed file " + moduleMkFile); } +void ProjectProvider::createEnginePluginsTable(const BuildSetup &setup) { + const std::string enginePluginsTableFile = setup.outputDir + "/engines/plugins_table.h"; + std::ofstream enginePluginsTable(enginePluginsTableFile.c_str()); + if (!enginePluginsTable) { + error("Could not open \"" + enginePluginsTableFile + "\" for writing"); + } + + enginePluginsTable << "/* This file is automatically generated by create_project */\n" + << "/* DO NOT EDIT MANUALLY */\n" + << "// This file is being included by \"base/plugins.cpp\"\n"; + + for (EngineDescList::const_iterator i = setup.engines.begin(), end = setup.engines.end(); i != end; ++i) { + // We ignore all sub engines here because they require no special + // handling. + if (isSubEngine(i->name, setup.engines)) { + continue; + } + + // Make the engine name all uppercase. + std::string engineName; + std::transform(i->name.begin(), i->name.end(), std::back_inserter(engineName), toupper); + + enginePluginsTable << "#if PLUGIN_ENABLED_STATIC(" << engineName << ")\n" + << "LINK_PLUGIN(" << engineName << ")\n" + << "#endif\n"; + } +} } // End of anonymous namespace void error(const std::string &message) { diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index 2f27cc2f61..69ed551151 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -102,16 +102,17 @@ struct EngineDesc { typedef std::list EngineDescList; /** - * This function parses the project configure file and creates a list - * of available engines. + * This function parses the project directory and creates a list of + * available engines. * * It will also automatically setup the default build state (enabled - * or disabled) to the state specified in the "configure" file. + * or disabled) to the state specified in the individual configure.engine + * files. * * @param srcDir Path to the root of the project source. * @return List of available engines. */ -EngineDescList parseConfigure(const std::string &srcDir); +EngineDescList parseEngines(const std::string &srcDir); /** * Checks whether the specified engine is a sub engine. To determine this @@ -262,6 +263,22 @@ void NORETURN_PRE error(const std::string &message) NORETURN_POST; namespace CreateProjectTool { +/** + * Structure for describing an FSNode. This is a very minimalistic + * description, which includes everything we need. + * It only contains the name of the node and whether it is a directory + * or not. + */ +struct FSNode { + FSNode() : name(), isDirectory(false) {} + FSNode(const std::string &n, bool iD) : name(n), isDirectory(iD) {} + + std::string name; ///< Name of the file system node + bool isDirectory; ///< Whether it is a directory or not +}; + +typedef std::list FileList; + /** * Gets a proper sequence of \t characters for the given * indentation level. @@ -314,6 +331,15 @@ bool producesObjectFile(const std::string &fileName); */ std::string toString(int num); +/** + * Returns a list of all files and directories in the specified + * path. + * + * @param dir Directory which should be listed. + * @return List of all children. + */ +FileList listDirectory(const std::string &dir); + /** * Structure representing a file tree. This contains two * members: name and children. "name" holds the name of @@ -474,6 +500,15 @@ protected: * @return A new UUID as string. */ std::string createUUID() const; + +private: + /** + * This creates the engines/plugins_table.h file required for building + * ScummVM. + * + * @param setup Description of the desired build. + */ + void createEnginePluginsTable(const BuildSetup &setup); }; } // End of CreateProjectTool namespace -- cgit v1.2.3 From c00ab00f250205dc76890965562f5b661055826a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 7 Nov 2013 12:58:35 +0100 Subject: DEVTOOLS: Factor out function to create directories in create_project. --- devtools/create_project/create_project.cpp | 27 ++++++++++++++++++++++++++ devtools/create_project/create_project.h | 7 +++++++ devtools/create_project/xcode.cpp | 31 +----------------------------- 3 files changed, 35 insertions(+), 30 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index ad3160d778..026cbe07a4 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #endif namespace { @@ -1121,6 +1122,32 @@ FileList listDirectory(const std::string &dir) { return result; } +void createDirectory(const std::string &dir) { +#if defined(_WIN32) || defined(WIN32) + if (!CreateDirectory(dir.c_str(), NULL)) { + if (GetLastError() != ERROR_ALREADY_EXISTS) { + error("Could not create folder \"" + dir + "\""); + } + } +#else + if (mkdir(dir.c_str(), 0777) == -1) { + if (errno == EEXIST) { + // Try to open as a folder (might be a file / symbolic link) + DIR *dirp = opendir(dir.c_str()); + if (dirp == NULL) { + error("Could not create folder \"" + dir + "\""); + } else { + // The folder exists, just close the stream and return + closedir(dirp); + } + } else { + error("Could not create folder \"" + dir + "\""); + } + } +#endif + +} + /** * Scans the specified directory against files, which should be included * in the project files. It will not include files present in the exclude list. diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index 69ed551151..459342a67d 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -340,6 +340,13 @@ std::string toString(int num); */ FileList listDirectory(const std::string &dir); +/** + * Create a directory at the given path. + * + * @param dir The path to create. + */ +void createDirectory(const std::string &dir); + /** * Structure representing a file tree. This contains two * members: name and children. "name" holds the name of diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index a9b8e7a752..d95bf3e9ee 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -26,15 +26,6 @@ #include #include -#if defined(_WIN32) || defined(WIN32) -#include -#else -#include -#include -#include -#include -#endif - namespace CreateProjectTool { #define DEBUG_XCODE_HASH 0 @@ -88,27 +79,7 @@ XCodeProvider::XCodeProvider(StringList &global_warnings, std::map\n" "\t\t\t\t\t\n" "\t\t\t\t\t\n" + "\t\t\t\t\t\n" "\t\t\t\t\n"; ////////////////////////////////////////////////////////////////////////// diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 0d68b2e9c9..07ae20e7dc 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -360,7 +360,7 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea "\t\t\n" "\t\t\ttrue\n" "\t\t\t" << warnings << ";%(DisableSpecificWarnings)\n" - "\t\t\t$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir);%(AdditionalIncludeDirectories)\n" + "\t\t\t$(" << LIBS_DEFINE << ")\\include;.\\;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir);%(AdditionalIncludeDirectories)\n" "\t\t\t" << definesList << "%(PreprocessorDefinitions)\n" "\t\t\t" << ((setup.devTools || setup.tests) ? "Sync" : "") << "\n"; diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 438e0772f9..84bc674f9a 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -232,7 +232,7 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of "\t\tName=\"VCCLCompilerTool\"\n" "\t\tDisableLanguageExtensions=\"" << (setup.devTools ? "false" : "true") << "\"\n" "\t\tDisableSpecificWarnings=\"" << warnings << "\"\n" - "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir)\"\n" + "\t\tAdditionalIncludeDirectories=\".\\;" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir)\"\n" "\t\tPreprocessorDefinitions=\"" << definesList << "\"\n" "\t\tExceptionHandling=\"" << ((setup.devTools || setup.tests) ? "1" : "0") << "\"\n"; -- cgit v1.2.3 From 441ebc04b0afd2ba768c454c9a20b6320b4cf6a2 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 27 Nov 2013 23:07:57 +0100 Subject: DEVTOOLS: Include 'iterator' for std::back_inserter. --- devtools/create_project/create_project.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'devtools/create_project') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 16b8e1d166..9d7ed532cb 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3