From e25eb48a2b4a93d3c408b423e3cf17d9863cef9f Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Thu, 15 Aug 2019 17:53:32 -0700 Subject: [PATCH] getdeps: distinguish build vs install steps in run_cmake.py Summary: Update the generated `run_cmake.py` script to allow the caller to specify that they just want to run a build without the install step. Reviewed By: wez Differential Revision: D16778007 fbshipit-source-id: 1859aca2b80fa7b099b4790682a6508e0185f2a0 --- build/fbcode_builder/getdeps/builder.py | 29 ++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/build/fbcode_builder/getdeps/builder.py b/build/fbcode_builder/getdeps/builder.py index 34851b6ce..e59683432 100644 --- a/build/fbcode_builder/getdeps/builder.py +++ b/build/fbcode_builder/getdeps/builder.py @@ -219,10 +219,26 @@ def main(): help='Any extra arguments after an "--" argument will be passed ' "directly to CMake." ) + ap.add_argument( + "--mode", + choices=["configure", "build", "install"], + default="configure", + help="The mode to run: configure, build, or install. " + "Defaults to configure", + ) ap.add_argument( "--build", - action="store_true", - help="Run the build step rather than the configure step", + action="store_const", + const="build", + dest="mode", + help="An alias for --mode=build", + ) + ap.add_argument( + "--install", + action="store_const", + const="install", + dest="mode", + help="An alias for --mode=install", ) args = ap.parse_args() @@ -232,18 +248,21 @@ def main(): env = CMAKE_ENV - if args.build: + if args.mode == "configure": + full_cmd = CMD_PREFIX + [CMAKE, SRC_DIR] + CMAKE_DEFINE_ARGS + args.cmake_args + elif args.mode in ("build", "install"): + target = "all" if args.mode == "build" else "install" full_cmd = CMD_PREFIX + [ CMAKE, "--build", BUILD_DIR, "--target", - "install", + target, "--config", "Release", ] + args.cmake_args else: - full_cmd = CMD_PREFIX + [CMAKE, SRC_DIR] + CMAKE_DEFINE_ARGS + args.cmake_args + ap.error("unknown invocation mode: %s" % (args.mode,)) cmd_str = " ".join(full_cmd) print("Running: %r" % (cmd_str,))