Bug 1182727 - Part 2: Run cmake through ninja to enable resumable builds; r=rail

Since CMake generated build systems can run cmake if necessary, this
will make it possible to pick up changes from the source directory if
any and resume as much of the build as possible.

This builds the foundation for removing the need to blow away any of the
work done by the previous runs of the script.
This commit is contained in:
Ehsan Akhgari 2015-07-10 21:43:37 -04:00
parent 06ba896f34
commit 0ffa419db3

View File

@ -36,10 +36,11 @@ def patch(patch, srcdir):
'-s'])
def build_package(package_build_dir, cmake_args):
def build_package(package_build_dir, run_cmake, cmake_args):
if not os.path.exists(package_build_dir):
os.mkdir(package_build_dir)
run_in(package_build_dir, ["cmake"] + cmake_args)
if run_cmake:
run_in(package_build_dir, ["cmake"] + cmake_args)
run_in(package_build_dir, ["ninja", "install"])
@ -135,7 +136,8 @@ def is_darwin():
def build_one_stage_aux(src_dir, stage_dir, build_libcxx):
os.mkdir(stage_dir)
if not os.path.exists(stage_dir):
os.mkdir(stage_dir)
build_dir = stage_dir + "/build"
inst_dir = stage_dir + "/clang"
@ -146,6 +148,10 @@ def build_one_stage_aux(src_dir, stage_dir, build_libcxx):
else:
python_path = "/usr/local/bin/python2.7"
run_cmake = True
if os.path.exists(build_dir):
run_cmake = False
cmake_args = ["-GNinja",
"-DCMAKE_BUILD_TYPE=Release",
"-DLLVM_TARGETS_TO_BUILD=X86;ARM",
@ -154,7 +160,7 @@ def build_one_stage_aux(src_dir, stage_dir, build_libcxx):
"-DCMAKE_INSTALL_PREFIX=%s" % inst_dir,
"-DLLVM_TOOL_LIBCXX_BUILD=%s" % ("ON" if build_libcxx else "OFF"),
src_dir];
build_package(build_dir, cmake_args)
build_package(build_dir, run_cmake, cmake_args)
if __name__ == "__main__":
# The directories end up in the debug info, so the easy way of getting
@ -207,9 +213,8 @@ if __name__ == "__main__":
for p in config.get("patches", {}).get(get_platform(), []):
patch(p, source_dir)
if os.path.exists(build_dir):
shutil.rmtree(build_dir)
os.makedirs(build_dir)
if not os.path.exists(build_dir):
os.makedirs(build_dir)
stage1_dir = build_dir + '/stage1'
stage1_inst_dir = stage1_dir + '/clang'