build-llvm: Default to using LLVM_ENABLE_PROJECTS even on unix

Allow setting up the projects with symlinks by passing --symlink-projects
to the build script.

The setup with symlinks is mostly useful in development setups, where
one wants to share ccache across multiple checkouts.
This commit is contained in:
Martin Storsjö committed 2022-03-23 13:07:39 +02:00
1 parent 0cffa112e0
commit b3f63b4ac8
1 file changed
+16 -16
+16 -16
View File
@@ -57,6 +57,9 @@ while [ $# -gt 0 ]; do
--with-python) --with-python)
WITH_PYTHON=1 WITH_PYTHON=1
;; ;;
--symlink-projects)
SYMLINK_PROJECTS=1
;;
*) *)
PREFIX="$1" PREFIX="$1"
;; ;;
@@ -66,7 +69,7 @@ done
BUILDDIR="$BUILDDIR$ASSERTSSUFFIX" BUILDDIR="$BUILDDIR$ASSERTSSUFFIX"
if [ -z "$CHECKOUT_ONLY" ]; then if [ -z "$CHECKOUT_ONLY" ]; then
if [ -z "$PREFIX" ]; then if [ -z "$PREFIX" ]; then
echo $0 [--enable-asserts] [--stage2] [--thinlto] [--lto] [--disable-dylib] [--full-llvm] [--with-python] [--host=triple] dest echo $0 [--enable-asserts] [--stage2] [--thinlto] [--lto] [--disable-dylib] [--full-llvm] [--with-python] [--symlink-projects] [--host=triple] dest
exit 1 exit 1
fi fi
@@ -220,19 +223,15 @@ fi
cd llvm-project/llvm cd llvm-project/llvm
case $(uname) in if [ -n "$SYMLINK_PROJECTS" ]; then
MINGW*) # If requested, hook up other tools by symlinking them into tools,
EXPLICIT_PROJECTS=1 # instead of using LLVM_ENABLE_PROJECTS. This way, all source code is
;; # under the directory tree of the toplevel cmake file (llvm-project/llvm),
*) # which makes cmake use relative paths to all source files. Using relative
# If we have working symlinks, hook up other tools by symlinking them # paths makes for identical compiler output from different source trees in
# into tools, instead of using LLVM_ENABLE_PROJECTS. This way, all # different locations (for cases where e.g. path names are included, in
# source code is under the directory tree of the toplevel cmake file # assert messages), allowing ccache to share caches across multiple
# (llvm-project/llvm), which makes cmake use relative paths to all source # checkouts.
# files. Using relative paths makes for identical compiler output from
# different source trees in different locations (for cases where e.g.
# path names are included, in assert messages), allowing ccache to speed
# up compilation.
cd tools cd tools
for p in clang lld lldb; do for p in clang lld lldb; do
if [ ! -e $p ]; then if [ ! -e $p ]; then
@@ -240,8 +239,9 @@ MINGW*)
fi fi
done done
cd .. cd ..
;; else
esac EXPLICIT_PROJECTS=1
fi
[ -z "$CLEAN" ] || rm -rf $BUILDDIR [ -z "$CLEAN" ] || rm -rf $BUILDDIR
mkdir -p $BUILDDIR mkdir -p $BUILDDIR