diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-31 08:16:41 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-31 08:16:47 +0100 |
commit | d128790d6b9aa7809461eecd3d3e05cc1744742b (patch) | |
tree | 30962914386dc6322371550c698a361ea536311b /backend/ninja | |
parent | 3468d636169479882bf9ff26ac19a00c7c8bc5dd (diff) |
Add static linking for msvc
Diffstat (limited to 'backend/ninja')
-rw-r--r-- | backend/ninja/Ninja.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index b6314f0..db7394a 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -484,15 +484,31 @@ namespace backend } case LibraryType::STATIC: { - // TODO: Write equivalent code for msvc - result += "rule cpp_COMPILER\n"; - result += " command = ccache c++ $ARGS -c -fPIC $in -o $out\n\n"; - - result += "rule cpp_BUILD_STATIC\n"; - result += " command = ar rcs lib"; - result += config.getPackageName(); - result += ".a"; - result += " $in\n\n"; + switch (config.getCompiler()) + { + case Compiler::GCC: + { + result += "rule cpp_COMPILER\n"; + result += " command = ccache c++ $ARGS -c -fPIC $in -o $out\n\n"; + + result += "rule cpp_BUILD_STATIC\n"; + result += " command = ar rcs lib"; + result += config.getPackageName(); + result += ".a"; + result += " $in\n\n"; + break; + } + case Compiler::MSVC: + { + result += "rule cpp_COMPILER\n"; + result += " command = cl.exe $ARGS /c $in /Fo$out\n\n"; + + result += "rule cpp_BUILD_STATIC\n"; + result += " command = lib.exe /OUT:$out $in\n\n"; + break; + } + } + buildJob = "cpp_BUILD_STATIC"; break; } |