Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: tools/clang/scripts/update.sh

Issue 615083006: Fix clang tooling build on Linux (shim CMake in LLVM tree). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor formatting tweak Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/clang/rewrite_scoped_refptr/CMakeLists.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/scripts/update.sh
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
index eabed4bff7b4edac599345769e2949665b4339d8..bfd586e470788bd6258c4553869cd845e4c0c98a 100755
--- a/tools/clang/scripts/update.sh
+++ b/tools/clang/scripts/update.sh
@@ -22,7 +22,9 @@ LIBCXX_DIR="${LLVM_DIR}/projects/libcxx"
LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi"
ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk"
STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
+CHROMIUM_TOOLS_DIR="${THIS_DIR}/.."
+ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}"
ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}"
ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}"
ABS_LLVM_DIR="${PWD}/${LLVM_DIR}"
@@ -430,6 +432,22 @@ if [ "${OS}" = "Darwin" ]; then
LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild"
fi
+# Hook the Chromium tools into the LLVM build. Several Chromium tools have
+# dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools
+# in the tools subdirectory, so install a shim CMakeLists.txt that forwards to
+# the real directory for the Chromium tools.
+# Note that the shim directory name intentionally has no _ or _. The implicit
+# tool detection logic munges them in a weird way.
+CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools
hans 2014/10/03 01:23:45 Why aren't we inserting the shim under tools/clang
dcheng 2014/10/03 03:47:51 There's only one call to add_llvm_implicit_externa
hans 2014/10/03 17:07:14 OK. Let's keep it here, then.
+rm -rfv ${CHROME_TOOLS_SHIM_DIR}
+mkdir -v ${CHROME_TOOLS_SHIM_DIR}
+cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF
+# Since tools/clang isn't actually a subdirectory, use the two argument version
+# to specify where build artifacts go. CMake doesn't allow reusing the same
+# binary dir for multiple source dirs, so the build artifacts have to go into a
+# subdirectory...
+add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a)
+EOF
rm -fv CMakeCache.txt
MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
@@ -442,6 +460,9 @@ MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
+ -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \
+ -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \
+ -DCHROMIUM_TOOLS="${chrome_tools}" \
"${ABS_LLVM_DIR}"
env
@@ -452,6 +473,10 @@ if [[ -n "${gcc_toolchain}" ]]; then
fi
ninja
+# If any Chromium tools were built, install those now.
+if [[ -n "${chrome_tools}" ]]; then
+ ninja cr-install
+fi
STRIP_FLAGS=
if [ "${OS}" = "Darwin" ]; then
@@ -528,34 +553,9 @@ if [[ -n "${with_android}" ]]; then
popd
fi
-# Build Chrome-specific clang tools. Paths in this list should be relative to
-# tools/clang.
-TOOL_SRC_DIR="${PWD}/${THIS_DIR}/../"
-TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-extras"
-
-rm -rf "${TOOL_BUILD_DIR}"
-mkdir -p "${TOOL_BUILD_DIR}"
-pushd "${TOOL_BUILD_DIR}"
-rm -fv CMakeCache.txt
-MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
- -DLLVM_BUILD_DIR="${ABS_LLVM_BUILD_DIR}" \
- -DLLVM_SRC_DIR="${ABS_LLVM_DIR}" \
- -DCMAKE_C_COMPILER="${CC}" \
- -DCMAKE_CXX_COMPILER="${CXX}" \
- -DCMAKE_C_FLAGS="${CFLAGS}" \
- -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
- -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
- -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
- -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
- -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \
- -DCHROMIUM_TOOLS="${chrome_tools}" \
- "${TOOL_SRC_DIR}"
-popd
-ninja -C "${TOOL_BUILD_DIR}" install
-
if [[ -n "$run_tests" ]]; then
# Run Chrome tool tests.
- ninja -C "${TOOL_BUILD_DIR}" check-all
+ ninja -C "${LLVM_BUILD_DIR}" cr-check-all
# Run the LLVM and Clang tests.
ninja -C "${LLVM_BUILD_DIR}" check-all
fi
« no previous file with comments | « tools/clang/rewrite_scoped_refptr/CMakeLists.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698