diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-31 22:55:12 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-31 23:00:48 +0100 |
commit | f30656761ee4ba30113dc461bbef854f917763fd (patch) | |
tree | 03958ed25e7f2dbcf3bb6f6ee471981a567ce118 /backend | |
parent | eda6a8e2c66380c773db32f720ef4b6a89f9b50a (diff) |
Add windows standard lib files to build
Add optimization flag for debug/release for msvc
Diffstat (limited to 'backend')
-rw-r--r-- | backend/ninja/Ninja.cpp | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index aec3216..63624a9 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -559,14 +559,42 @@ namespace backend // TODO: Add equivalent functionality for msvc. Currently msvc always builds as debug build string optimizationFlags; - switch(config.getOptimizationLevel()) + switch (config.getOptimizationLevel()) { case OPT_LEV_DEBUG: - optimizationFlags = "'-O0'"; + { + switch (config.getCompiler()) + { + case Compiler::GCC: + { + optimizationFlags = "'-O0'"; + break; + } + case Compiler::MSVC: + { + optimizationFlags = "/Od"; + break; + } + } break; + } case OPT_LEV_RELEASE: - optimizationFlags = "'-O3' '-DNDEBUG'"; + { + switch (config.getCompiler()) + { + case Compiler::GCC: + { + optimizationFlags = "'-O3' '-DNDEBUG'"; + break; + } + case Compiler::MSVC: + { + optimizationFlags = "/Ox /DNDEBUG"; + break; + } + } break; + } } vector<string> objectNames; @@ -597,6 +625,8 @@ namespace backend } case Compiler::MSVC: { + result += " "; + result += optimizationFlags; result += " /EHsc"; switch (config.getOptimizationLevel()) { @@ -649,7 +679,7 @@ namespace backend case Compiler::MSVC: { // TODO: Do not link all of these. Find a way to only link the ones that are needed - result += " LINK_ARGS = Ws2_32.lib Wldap32.lib Crypt32.lib Advapi32.lib Gdi32.lib User32.lib Userenv.lib "; + result += " LINK_ARGS = Ws2_32.lib Wldap32.lib Crypt32.lib Advapi32.lib Gdi32.lib User32.lib Userenv.lib OpenGL32.lib GlU32.lib Shell32.lib "; break; } } @@ -712,7 +742,7 @@ namespace backend result += join(objectNames, " "); result += "\n"; // TODO: Do not link all of these. Find a way to only link the ones that are needed - result += " LINK_ARGS = Ws2_32.lib Wldap32.lib Crypt32.lib Advapi32.lib Gdi32.lib User32.lib Userenv.lib "; + result += " LINK_ARGS = Ws2_32.lib Wldap32.lib Crypt32.lib Advapi32.lib Gdi32.lib User32.lib Userenv.lib OpenGL32.lib GlU32.lib Shell32.lib "; projectGeneratedBinary += config.getPackageName() + ".lib"; break; } |