mk: Enable building LLVM targeting MSVC

This commit modifies the makefiles to enable building LLVM with cmake and Visual
Studio to generate an LLVM that targets MSVC. Rust's configure script requires
cmake to be installed when targeting MSVC and will configure LLVM with cmake
instead of the normal `./configure` script LLVM provides. The build will then
run cmake to execute the build instead of the normal `make`.

Currently `make clean-llvm` isn't supported on MSVC as I can't figure out how to
run a "clean" target for the Visual Studio files.
This commit is contained in:
Alex Crichton
2015-05-11 14:03:45 -07:00
parent 7cf0b1798b
commit b56d47cc80
4 changed files with 63 additions and 14 deletions

34
configure vendored
View File

@@ -1348,7 +1348,39 @@ do
done
fi
if [ ${do_reconfigure} -ne 0 ]
use_cmake=0
case "$t" in
(*-msvc)
use_cmake=1
;;
esac
if [ ${do_reconfigure} -ne 0 ] && [ ${use_cmake} -ne 0 ]
then
msg "configuring LLVM for $t with cmake"
CMAKE_ARGS="-DLLVM_INCLUDE_TESTS=OFF"
if [ ! -z "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
else
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
fi
if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
then
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=OFF"
else
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=ON"
fi
msg "configuring LLVM with:"
msg "$CMAKE_ARGS"
(cd $LLVM_BUILD_DIR && "$CFG_CMAKE" $CFG_LLVM_SRC_DIR \
-G "Visual Studio 12 2013 Win64" \
$CMAKE_ARGS)
need_ok "LLVM cmake configure failed"
fi
if [ ${do_reconfigure} -ne 0 ] && [ ${use_cmake} -eq 0 ]
then
# LLVM's configure doesn't recognize the new Windows triples yet
gnu_t=$(to_gnu_triple $t)