1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
#!/bin/bash
function usage ()
{
echo "configure [OPTIONS...]"
echo " --help|-h Display this help"
echo " --cmake [arg] Use arg instead of \"cmake\""
echo " --cmake-argument [arg] Pass additional arguments to cmake"
echo " --cmake-generator [arg] Use this generator for cmake (e.g. Ninja)"
echo " --enable-dev-options Set certain development options (cpack)"
echo " --asan Enable -fsanitize=address and -fsanitize=undefined"
echo " --debug Compile RTags in debug mode"
echo " --release Compile RTags in release mode (default)"
echo " --system-clang Don't build llvm/clang as part of RTags' build process (default)"
echo " --with-tests Enable testing and build test files"
echo " --without-tests Disable testing and don't build test files"
echo " --with-manual-tests Build manual test programs"
echo " --build-clang Download and build llvm/clang as part of RTags' build process"
echo " --no-install Generate a build that isn't going to be installed"
echo " --prefix [arg] Set install prefix to arg"
echo " --clang-libraries [arg] Override what libraries RTags will use to link against clang/llvm"
echo " --clang-cxxflags [arg] Override what cxxflags RTags will use for compilation to be able to include clang headers."
echo " --clang-libdir [arg] Sets the libdir RTags will use for clang."
echo " --cotire Enable cotire when building RTags"
echo " --emacs Use arg instead of \"emacs\" when byte-compiling elisp"
echo " --no-elisp-files-install Don't install RTags elisp files"
echo " --no-elisp-bytecompile Don't bytecompile RTags elisp files"
echo " --elisp-install-location [arg] Install elisp files to this location"
}
CMAKE=cmake
CMAKE_ARGS="-DCMAKE_EXPORT_COMPILE_COMMANDS=1"
BUILD=
while [ -n "$1" ]; do
case "$1" in
--help|-h)
usage > /dev/stdout
exit 0
;;
--cmake)
shift
CMAKE="$1"
;;
--cmake-argument)
shift
CMAKE_ARGS="${CMAKE_ARGS} \"$1\""
;;
--cmake-generator)
shift
CMAKE_GENERATOR="$1"
;;
--enable-dev-options)
CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_ENABLE_DEV_OPTIONS=1"
;;
--debug)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug"
;;
--release)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release"
;;
--system-clang)
BUILD=
;;
--build-clang)
BUILD=1
;;
--with-tests)
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_TESTS=1"
;;
--without-tests)
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_TESTS=0"
;;
--with-manual-tests)
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_MANUAL_TESTS=1"
;;
--no-install)
CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_NO_INSTALL=1"
;;
--prefix)
shift
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=\"$1\""
;;
--clang-libraries)
shift
CMAKE_ARGS="${CMAKE_ARGS} -DLIBCLANG_LIBRARIES=\"$1\""
;;
--clang-cxxflags)
shift
CMAKE_ARGS="${CMAKE_ARGS} -DLIBCLANG_CXXFLAGS=\"$1\""
;;
--clang-libdir)
shift
CMAKE_ARGS="${CMAKE_ARGS} -DLIBCLANG_LIBDIR=\"$1\""
;;
--cotire)
CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_COTIRE=1"
;;
--emacs)
shift
CMAKE_ARGS="${CMAKE_ARGS} -DEMACS=\"$1\""
;;
--no-elisp-files-install)
CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_NO_ELISP_FILES=1"
;;
--no-elisp-bytecompile)
CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_NO_ELISP_BYTECOMPILE=1"
;;
--asan)
CMAKE_ARGS="${CMAKE_ARGS} -DASAN=address,undefined"
;;
--asan=*)
CMAKE_ARGS="${CMAKE_ARGS} -DASAN=`echo $1 | sed -e 's,--asan=,,'`"
;;
--elisp-install-location)
shift
CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_ELISP_INSTALL_LOCATION=\"$1\""
;;
*)
usage > /dev/stderr
echo "Unknown option $1"
exit 1
;;
esac
shift
done
[ -n "$CMAKE_GENERATOR" ] && CMAKE_ARGS="${CMAKE_ARGS} -G \"$CMAKE_GENERATOR\""
[ -n "$BUILD" ] && CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_BUILD_CLANG=1"
echo -e "Running cmake:\n\"$CMAKE\" \"$(dirname ${BASH_SOURCE[0]})\" ${CMAKE_ARGS}\n"
rm -f CMakeCache.txt
eval "$CMAKE" "$(dirname ${BASH_SOURCE[0]})" ${CMAKE_ARGS}
|