Commit 9876b788 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

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
parent 1bfbd0d8
...@@ -219,10 +219,26 @@ def main(): ...@@ -219,10 +219,26 @@ def main():
help='Any extra arguments after an "--" argument will be passed ' help='Any extra arguments after an "--" argument will be passed '
"directly to CMake." "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( ap.add_argument(
"--build", "--build",
action="store_true", action="store_const",
help="Run the build step rather than the configure step", 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() args = ap.parse_args()
...@@ -232,18 +248,21 @@ def main(): ...@@ -232,18 +248,21 @@ def main():
env = CMAKE_ENV 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 + [ full_cmd = CMD_PREFIX + [
CMAKE, CMAKE,
"--build", "--build",
BUILD_DIR, BUILD_DIR,
"--target", "--target",
"install", target,
"--config", "--config",
"Release", "Release",
] + args.cmake_args ] + args.cmake_args
else: 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) cmd_str = " ".join(full_cmd)
print("Running: %r" % (cmd_str,)) print("Running: %r" % (cmd_str,))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment