diff options
Diffstat (limited to 'devtools/create_project/create_project.cpp')
-rw-r--r-- | devtools/create_project/create_project.cpp | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index e71816f575..0aba511491 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -20,7 +20,7 @@ * */ -//#define ENABLE_XCODE +#define ENABLE_XCODE // HACK to allow building with the SDL backend on MinGW // see bug #1800764 "TOOLS: MinGW tools building broken" @@ -124,7 +124,8 @@ 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 using std::cout; @@ -175,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; } @@ -267,6 +268,8 @@ int main(int argc, char *argv[]) { setup.devTools = true; } else if (!std::strcmp(argv[i], "--tests")) { setup.tests = true; + } else if (!std::strcmp(argv[i], "--sdl2")) { + useSDL2 = true; } else { std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n"; return -1; @@ -333,9 +336,20 @@ int main(int argc, char *argv[]) { setup.defines.splice(setup.defines.begin(), featureDefines); // Windows only has support for the SDL backend, so we hardcode it here (along with winmm) - setup.defines.push_back("WIN32"); + if (projectType != kProjectXcode) { + setup.defines.push_back("WIN32"); + } else { + setup.defines.push_back("POSIX"); + setup.defines.push_back("MACOSX"); // This will break iOS, but allows OS X to catch up on browser_osx. + } setup.defines.push_back("SDL_BACKEND"); - setup.libraries.push_back("sdl"); + if (!useSDL2) { + cout << "\nLinking to SDL 1.2\n\n"; + setup.libraries.push_back("sdl"); + } else { + cout << "\nLinking to SDL 2.0\n\n"; + setup.libraries.push_back("sdl2"); + } setup.libraries.push_back("winmm"); // Add additional project-specific library @@ -401,7 +415,6 @@ int main(int argc, char *argv[]) { globalWarnings.push_back("-Wwrite-strings"); // The following are not warnings at all... We should consider adding them to // a different list of parameters. - globalWarnings.push_back("-fno-rtti"); globalWarnings.push_back("-fno-exceptions"); globalWarnings.push_back("-fcheck-new"); @@ -440,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 // @@ -455,6 +471,8 @@ int main(int argc, char *argv[]) { // 4512 ('class' : assignment operator could not be generated) // some classes use const items and the default assignment operator cannot be generated // + // 4577 ('noexcept' used with no exception handling mode specified) + // // 4702 (unreachable code) // mostly thrown after error() calls (marked as NORETURN) // @@ -510,6 +528,11 @@ int main(int argc, char *argv[]) { globalWarnings.push_back("6385"); globalWarnings.push_back("6386"); + if (msvcVersion == 14) { + globalWarnings.push_back("4267"); + globalWarnings.push_back("4577"); + } + projectWarnings["agi"].push_back("4510"); projectWarnings["agi"].push_back("4610"); @@ -563,7 +586,7 @@ int main(int argc, char *argv[]) { globalWarnings.push_back("-fno-exceptions"); globalWarnings.push_back("-fcheck-new"); - provider = new CreateProjectTool::XCodeProvider(globalWarnings, projectWarnings); + provider = new CreateProjectTool::XcodeProvider(globalWarnings, projectWarnings); break; } @@ -623,6 +646,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" @@ -646,6 +670,9 @@ void displayHelp(const char *exe) { " --enable-<name> enable inclusion of the feature \"name\"\n" " --disable-<name> disable inclusion of the feature \"name\"\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"; @@ -905,7 +932,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" }, @@ -1027,14 +1054,14 @@ bool producesObjectFile(const std::string &fileName) { std::string n, ext; splitFilename(fileName, n, ext); - if (ext == "cpp" || ext == "c" || ext == "asm") + if (ext == "cpp" || ext == "c" || ext == "asm" || ext == "m" || ext == "mm") return true; else return false; } std::string toString(int num) { - return static_cast<std::ostringstream*>(&(std::ostringstream() << num))->str(); + return static_cast<std::ostringstream*>(&(std::ostringstream() << num))->str(); } /** @@ -1267,8 +1294,9 @@ void ProjectProvider::createProject(BuildSetup &setup) { for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { if (i->first == setup.projectName) continue; - + // Retain the files between engines if we're creating a single project in.clear(); ex.clear(); + const std::string moduleDir = setup.srcDir + targetFolder + i->first; createModuleList(moduleDir, setup.defines, setup.testDirs, in, ex); @@ -1278,7 +1306,6 @@ void ProjectProvider::createProject(BuildSetup &setup) { if (setup.tests) { // Create the main project file. in.clear(); ex.clear(); - 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); @@ -1293,7 +1320,6 @@ void ProjectProvider::createProject(BuildSetup &setup) { } 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, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); |