From 89dfd36b60f5ea2cc96aa0a0381b148e75e4a0c9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Sep 2015 19:23:58 -0400 Subject: CREATE_PROJECT: Add support for Visual Studio 2015 --- devtools/README | 4 +- devtools/create_project/create_project.cpp | 19 +- devtools/create_project/msbuild.cpp | 27 ++- devtools/create_project/msbuild.h | 1 + devtools/create_project/msvc.cpp | 10 +- devtools/create_project/msvc.h | 5 + devtools/create_project/msvc14/create_project.sln | 28 +++ .../create_project/msvc14/create_project.vcxproj | 223 +++++++++++++++++++++ .../msvc14/create_project.vcxproj.filters | 76 +++++++ devtools/create_project/visualstudio.cpp | 2 +- 10 files changed, 379 insertions(+), 16 deletions(-) create mode 100644 devtools/create_project/msvc14/create_project.sln create mode 100644 devtools/create_project/msvc14/create_project.vcxproj create mode 100644 devtools/create_project/msvc14/create_project.vcxproj.filters (limited to 'devtools') diff --git a/devtools/README b/devtools/README index 509048bfe0..e7ff94dc05 100644 --- a/devtools/README +++ b/devtools/README @@ -72,8 +72,8 @@ create_mort (Strangerke) create_project (LordHoto, Littleboy) -------------- - Creates project files for Visual Studio 2008, 2010, 2012, 2013, Xcode and - Code::Blocks out of the configure / Makefile based build system. + Creates project files for Visual Studio 2008, 2010, 2012, 2013, 2015, + Xcode and Code::Blocks out of the configure / Makefile based build system. It also offers a way to enable or disable certain engines and the use of external libraries similar to configure. Run the tool without any arguments for further help. diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index e4cb67134a..0611646eab 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) { setup.features = getAllFeatures(); ProjectType projectType = kProjectNone; - int msvcVersion = 9; + int msvcVersion = 12; bool useSDL2 = false; // Parse command line arguments @@ -176,7 +176,7 @@ int main(int argc, char *argv[]) { msvcVersion = atoi(argv[++i]); - if (msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11 && msvcVersion != 12) { + if (msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11 && msvcVersion != 12 && msvcVersion != 14) { std::cerr << "ERROR: Unsupported version: \"" << msvcVersion << "\" passed to \"--msvc-version\"!\n"; return -1; } @@ -453,6 +453,9 @@ int main(int argc, char *argv[]) { // 4250 ('class1' : inherits 'class2::member' via dominance) // two or more members have the same name. Should be harmless // + // 4267 ('var' : conversion from 'size_t' to 'type', possible loss of data) + // throws tons and tons of warnings (no immediate plan to fix all usages) + // // 4310 (cast truncates constant value) // used in some engines // @@ -510,6 +513,7 @@ int main(int argc, char *argv[]) { globalWarnings.push_back("4127"); globalWarnings.push_back("4244"); globalWarnings.push_back("4250"); + globalWarnings.push_back("4267"); globalWarnings.push_back("4310"); globalWarnings.push_back("4345"); globalWarnings.push_back("4351"); @@ -636,6 +640,7 @@ void displayHelp(const char *exe) { " 10 stands for \"Visual Studio 2010\"\n" " 11 stands for \"Visual Studio 2012\"\n" " 12 stands for \"Visual Studio 2013\"\n" + " 14 stands for \"Visual Studio 2015\"\n" " The default is \"9\", thus \"Visual Studio 2008\"\n" " --build-events Run custom build events as part of the build\n" " (default: false)\n" @@ -658,9 +663,9 @@ void displayHelp(const char *exe) { "Optional features settings:\n" " --enable- enable inclusion of the feature \"name\"\n" " --disable- disable inclusion of the feature \"name\"\n" - "\n" - "SDL settings:\n" - " --sdl2 link to SDL 2.0, instead of SDL 1.2\n" + "\n" + "SDL settings:\n" + " --sdl2 link to SDL 2.0, instead of SDL 1.2\n" "\n" " There are the following features available:\n" "\n"; @@ -921,7 +926,7 @@ const Feature s_features[] = { { "libz", "USE_ZLIB", "zlib", true, "zlib (compression) support" }, { "mad", "USE_MAD", "libmad", true, "libmad (MP3) support" }, { "vorbis", "USE_VORBIS", "libvorbisfile_static libvorbis_static libogg_static", true, "Ogg Vorbis support" }, - { "flac", "USE_FLAC", "libFLAC_static", true, "FLAC support" }, + { "flac", "USE_FLAC", "libFLAC_static win_utf8_io_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" }, @@ -1050,7 +1055,7 @@ bool producesObjectFile(const std::string &fileName) { } std::string toString(int num) { - return static_cast(&(std::ostringstream() << num))->str(); + return static_cast(&(std::ostringstream() << num))->str(); } /** diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 87c9066199..4698ebd303 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -55,9 +55,16 @@ int MSBuildProvider::getVisualStudioVersion() { if (_version == 12) return 2013; + if (_version == 14) + return 14; + error("Unsupported version passed to getVisualStudioVersion"); } +int MSBuildProvider::getSolutionVersion() { + return (_version < 14) ? _version + 1 : _version; +} + namespace { inline void outputConfiguration(std::ostream &project, const std::string &config, const std::string &platform) { @@ -116,7 +123,7 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri // Shared configuration project << "\t\n"; - std::string version = "v" + toString(_version) + "0"; + std::string version = "v" + toString(_version) + "0"; std::string llvm = "LLVM-vs" + toString(getVisualStudioVersion()); outputConfigurationType(setup, project, name, "Release|Win32", version); @@ -177,6 +184,13 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri project << "\t\n"; } + // Visual Studio 2015 automatically imports natvis files that are part of the project + if (name == PROJECT_NAME && _version == 14) { + project << "\t\n"; + project << "\t\t\n"; + project << "\t\n"; + } + project << "\t\n" "\t\n" "\t\n"; @@ -185,7 +199,7 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri // 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\t\n" << "\t\t\n"; } @@ -305,6 +319,13 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) libraries += *i + ".lib;"; + if (_version == 14) + { + std::string debug = isRelease ? "" : "d"; + libraries += "libvcruntime" + debug + ".lib;"; + libraries += "libucrt" + debug + ".lib;"; + } + project << "\t\t\n" "\t\t\t$(OutDir)" << ((setup.devTools || setup.tests) ? name : setup.projectName) << ".exe\n" "\t\t\t" << libraries << "%(AdditionalDependencies)\n" @@ -362,7 +383,7 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea "\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" << definesList << "%(PreprocessorDefinitions)\n" - "\t\t\t" << ((setup.devTools || setup.tests) ? "Sync" : "") << "\n"; + "\t\t\t" << ((setup.devTools || setup.tests || _version == 14) ? "Sync" : "") << "\n"; #if NEEDS_RTTI properties << "\t\t\ttrue\n"; diff --git a/devtools/create_project/msbuild.h b/devtools/create_project/msbuild.h index 829657beff..f92e68ede8 100644 --- a/devtools/create_project/msbuild.h +++ b/devtools/create_project/msbuild.h @@ -49,6 +49,7 @@ protected: const char *getProjectExtension(); const char *getPropertiesExtension(); int getVisualStudioVersion(); + int getSolutionVersion(); private: struct FileEntry { diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp index cdd2d8a7c1..dbfbcc128d 100644 --- a/devtools/create_project/msvc.cpp +++ b/devtools/create_project/msvc.cpp @@ -52,7 +52,7 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) { if (!solution) error("Could not open \"" + setup.outputDir + '/' + setup.projectName + ".sln\" for writing"); - solution << "Microsoft Visual Studio Solution File, Format Version " << _version + 1 << ".00\n"; + solution << "Microsoft Visual Studio Solution File, Format Version " << getSolutionVersion() << ".00\n"; solution << "# Visual Studio " << getVisualStudioVersion() << "\n"; // Write main project @@ -157,13 +157,17 @@ void MSVCProvider::createGlobalProp(const BuildSetup &setup) { outputGlobalPropFile(setup, properties, 64, x64Defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents); } +int MSVCProvider::getSolutionVersion() { + return _version + 1; +} + std::string MSVCProvider::getPreBuildEvent() const { std::string cmdLine = ""; cmdLine = "@echo off\n" "echo Executing Pre-Build script...\n" - "echo.\n" - "@call "$(SolutionDir)../../devtools/create_project/scripts/prebuild.cmd" "$(SolutionDir)/../.." "$(TargetDir)"\n" + "echo.\n" + "@call "$(SolutionDir)../../devtools/create_project/scripts/prebuild.cmd" "$(SolutionDir)/../.." "$(TargetDir)"\n" "EXIT /B0"; return cmdLine; diff --git a/devtools/create_project/msvc.h b/devtools/create_project/msvc.h index 3a3eb98034..e75e131bd1 100644 --- a/devtools/create_project/msvc.h +++ b/devtools/create_project/msvc.h @@ -82,6 +82,11 @@ protected: */ virtual int getVisualStudioVersion() = 0; + /** + * Get the Solution version (used in the sln file header) + */ + virtual int getSolutionVersion(); + /** * Get the command line for the revision tool (shared between all Visual Studio based providers) */ diff --git a/devtools/create_project/msvc14/create_project.sln b/devtools/create_project/msvc14/create_project.sln new file mode 100644 index 0000000000..73f0b3569e --- /dev/null +++ b/devtools/create_project/msvc14/create_project.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.22609.0 +MinimumVisualStudioVersion = 10.0.40219.1 +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 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + 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}.Debug|x64.ActiveCfg = Debug|x64 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|x64.Build.0 = Debug|x64 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.ActiveCfg = Release|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.Build.0 = Release|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|x64.ActiveCfg = Release|x64 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/devtools/create_project/msvc14/create_project.vcxproj b/devtools/create_project/msvc14/create_project.vcxproj new file mode 100644 index 0000000000..3c0345f49c --- /dev/null +++ b/devtools/create_project/msvc14/create_project.vcxproj @@ -0,0 +1,223 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {CF177559-077D-4A08-AABE-BE0FD35F6C63} + create_project + + + + Application + MultiByte + true + v140 + + + Application + MultiByte + true + v140 + + + Application + MultiByte + v140 + + + Application + MultiByte + v140 + + + + + + + + + + + + + + + + + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + + + + Disabled + true + EnableFastChecks + MultiThreadedDebugDLL + Level4 + EditAndContinue + false + 4003;4512;4127 + Sync + + + Rpcrt4.lib;%(AdditionalDependencies) + true + MachineX86 + false + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc14\" +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\" + + + + + Disabled + EnableFastChecks + MultiThreadedDebugDLL + Level4 + ProgramDatabase + false + 4003;4512;4127 + + + Rpcrt4.lib;%(AdditionalDependencies) + true + false + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc14\" +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 + true + + + Rpcrt4.lib;%(AdditionalDependencies) + true + true + true + MachineX86 + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc14\" +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 + true + + + Rpcrt4.lib;%(AdditionalDependencies) + true + true + true + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc14\" +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/msvc14/create_project.vcxproj.filters b/devtools/create_project/msvc14/create_project.vcxproj.filters new file mode 100644 index 0000000000..16c6df081d --- /dev/null +++ b/devtools/create_project/msvc14/create_project.vcxproj.filters @@ -0,0 +1,76 @@ + + + + + {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 + + + + + scripts + + + \ No newline at end of file diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 9b928bf520..96fdbdf27a 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -230,7 +230,7 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of "\t\tDisableSpecificWarnings=\"" << warnings << "\"\n" "\t\tAdditionalIncludeDirectories=\".\\;" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(" << LIBS_DEFINE << ")\\include\\SDL;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir)\"\n" "\t\tPreprocessorDefinitions=\"" << definesList << "\"\n" - "\t\tExceptionHandling=\"" << ((setup.devTools || setup.tests) ? "1" : "0") << "\"\n"; + "\t\tExceptionHandling=\"" << ((setup.devTools || setup.tests || _version == 14) ? "1" : "0") << "\"\n"; #if NEEDS_RTTI properties << "\t\tRuntimeTypeInfo=\"true\"\n"; -- cgit v1.2.3