diff options
-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; } |