diff --git a/install.sh b/install.sh index 93ebc758..7000fe2c 100755 --- a/install.sh +++ b/install.sh @@ -102,25 +102,29 @@ function linux_cmake_install { } function usage { - echo "Usage: $0 [--clang-completer]" + echo "Usage: $0 [--clang-completer] [--cs-completer]" exit 0 } -if [[ $# -gt 1 ]]; then +if [[ $# -gt 2 ]]; then usage fi -case "$1" in - --clang-completer) - cmake_args='-DUSE_CLANG_COMPLETER=ON' - ;; - '') - cmake_args='' - ;; - *) - usage - ;; -esac +cmake_args='' +omnisharp_completer=false +for flag in $@; do + case "$flag" in + --clang-completer) + cmake_args='-DUSE_CLANG_COMPLETER=ON' + ;; + --omnisharp-completer) + omnisharp_completer=true + ;; + *) + usage + ;; + esac +done if ! command_exists cmake; then echo "CMake is required to build YouCompleteMe." @@ -133,3 +137,20 @@ else testrun $cmake_args $EXTRA_CMAKE_ARGS fi +if $omnisharp_completer; then + buildcommand="msbuild" + if ! command_exists msbuild; then + buildcommand="xbuild" + if ! command_exists xbuild; then + echo "msbuild or xbuild is required to build Omnisharp" + exit 1 + fi + fi + + ycm_dir=`pwd` + build_dir=$ycm_dir"/python/ycm/completers/cs/OmniSharpServer" + + cd $build_dir + $buildcommand + cd $ycm_dir +fi