aboutsummaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2017-11-24 16:19:41 +0100
committerDiana Picus <diana.picus@linaro.org>2017-12-15 13:08:13 +0100
commit052b7d37cefe8975f699110a5c9508b2501a97e0 (patch)
tree8d78edb8da899bfdfbab43abd6a36db816a3fd4e /helpers
parent5fec8b75ddf572779af5dc2a639c8eb15c6bfc9f (diff)
Add llvm.py configure
Add a subcommand that runs CMake in a given build directory, with a custom generator and custom CMake definitions. Also update llvm-build to use it instead of calling CMake directly, and add calls to it in llvm-projs as well to make sure we update the build directories whenever we enable or disable a project. One known issue with the current code is that the output of the CMake command is not printed out live, but rather after the command has finished execution. This is going to be more important for llvm.py build than for llvm.py configure, so we can fix it in a future commit. Change-Id: I263b2d47c2083a1778608253bbd437149375c539
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/llvm-build27
-rwxr-xr-xhelpers/llvm-projs10
2 files changed, 26 insertions, 11 deletions
diff --git a/helpers/llvm-build b/helpers/llvm-build
index 0556b6e..d40ef40 100755
--- a/helpers/llvm-build
+++ b/helpers/llvm-build
@@ -8,7 +8,11 @@
. llvm-common
+progdir=$(dirname $0)
+llvmtool=$progdir/../scripts/llvm.py
+
safe_run verify_env
+env=$(dirname $LLVM_SRC)
## CMD line options and defaults
CPUS=$(grep -c proc /proc/cpuinfo)
@@ -24,7 +28,7 @@ update=false
check=false
master=false
inst=false
-minimal_targets="-DLLVM_TARGETS_TO_BUILD='ARM;X86;AArch64'"
+minimal_targets="--cmake-def LLVM_TARGETS_TO_BUILD='ARM;X86;AArch64'"
link_jobs=
if [ "$1" = "-h" ]; then
@@ -43,7 +47,7 @@ fi
## Debug mode, make it lighter
if [ "$LLVM_DEBUG" = true ]; then
build_type=Debug
- shared=-DBUILD_SHARED_LIBS=True
+ shared="--cmake-def BUILD_SHARED_LIBS=True"
targets=$minimal_targets
fi
@@ -57,7 +61,7 @@ if grep -q "ARM.* Processor" /proc/cpuinfo; then
else
link=$((link+1))
fi
- link_jobs="-DLLVM_PARALLEL_LINK_JOBS=$link"
+ link_jobs="--cmake-def LLVM_PARALLEL_LINK_JOBS=$link"
fi
fi
@@ -75,14 +79,15 @@ fi
## Re-run CMake if files are damaged / not there
if [ ! -f build.ninja ] && [ ! -f Makefile ]; then
- echo " + Configuring Build"
- safe_run cmake -G "$generator" $LLVM_SRC \
- -DCMAKE_BUILD_TYPE=$build_type \
- -DLLVM_BUILD_TESTS=True \
- -DLLVM_ENABLE_ASSERTIONS=True \
- -DPYTHON_EXECUTABLE=/usr/bin/python2 \
- -DCMAKE_INSTALL_PREFIX=$install_dir \
- -DLLVM_LIT_ARGS="-sv $PARALLEL" \
+ echo " + Configuring Build"
+ safe_run python3 $llvmtool --env $env configure --build-dir $build_dir \
+ --cmake-generator "$generator" \
+ --cmake-def CMAKE_BUILD_TYPE=$build_type \
+ --cmake-def LLVM_BUILD_TESTS=True \
+ --cmake-def LLVM_ENABLE_ASSERTIONS=True \
+ --cmake-def PYTHON_EXECUTABLE=/usr/bin/python2 \
+ --cmake-def CMAKE_INSTALL_PREFIX=$install_dir \
+ --cmake-def LLVM_LIT_ARGS="-sv $PARALLEL" \
$LLVM_CMAKE_FLAGS $targets $shared $link_jobs
fi
diff --git a/helpers/llvm-projs b/helpers/llvm-projs
index 21b8bea..f4d5df7 100755
--- a/helpers/llvm-projs
+++ b/helpers/llvm-projs
@@ -197,3 +197,13 @@ if [ "$remove" != "" ]; then
fi
safe_run python3 $llvmtool --env $env projects --repos $repos $add $remove
+
+if [ -d $env/build ]; then
+ echo "Updating $env/build"
+ safe_run python3 $llvmtool --env $env configure --build-dir $env/build
+fi
+
+if [ -d $env/debug ]; then
+ echo "Updating $env/debug"
+ safe_run python3 $llvmtool --env $env configure --build-dir $env/debug
+fi