mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-05 19:55:47 +03:00
getdeps: honor INSTALL_DIR correctly in the generated run_cmake.py script
Summary: This cleans up how the `CMAKE_ENV` and `CMAKE_DEFINE_ARGS` variables are written in the generated `run_cmake.py` script that we emit for CMake-based projects. We now emit each entry in these variables on separate lines, just to improve readability. (Both of these variables tend to have a number of entries and are very long if emitted on a single line.) This also replaces the `-DCMAKE_INSTALL_PREFIX` entry in `CMAKE_DEFINE_ARGS` to have it correctly honor the `INSTALL_DIR` variable defined in `run_cmake.py`. This makes `run_cmake.py` still do the right thing if someone manually edits it to change the `INSTALL_DIR` value. Reviewed By: wez Differential Revision: D16778006 fbshipit-source-id: fee5d25748b87b5d9c57ee2edf8de5e586e872ee
This commit is contained in:
committed by
Facebook Github Bot
parent
a412d9a8a0
commit
4a19af7b54
@@ -203,12 +203,12 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
CMAKE = {cmake!r}
|
CMAKE = {cmake!r}
|
||||||
CMAKE_ENV = {env!r}
|
|
||||||
CMAKE_DEFINE_ARGS = {define_args!r}
|
|
||||||
SRC_DIR = {src_dir!r}
|
SRC_DIR = {src_dir!r}
|
||||||
BUILD_DIR = {build_dir!r}
|
BUILD_DIR = {build_dir!r}
|
||||||
INSTALL_DIR = {install_dir!r}
|
INSTALL_DIR = {install_dir!r}
|
||||||
CMD_PREFIX = {cmd_prefix!r}
|
CMD_PREFIX = {cmd_prefix!r}
|
||||||
|
CMAKE_ENV = {env_str}
|
||||||
|
CMAKE_DEFINE_ARGS = {define_args_str}
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -278,6 +278,23 @@ if __name__ == "__main__":
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def _write_build_script(self, **kwargs):
|
def _write_build_script(self, **kwargs):
|
||||||
|
env_lines = [" {!r}: {!r},".format(k, v) for k, v in kwargs["env"].items()]
|
||||||
|
kwargs["env_str"] = "\n".join(["{"] + env_lines + ["}"])
|
||||||
|
|
||||||
|
define_arg_lines = ["["]
|
||||||
|
for arg in kwargs["define_args"]:
|
||||||
|
# Replace the CMAKE_INSTALL_PREFIX argument to use the INSTALL_DIR
|
||||||
|
# variable that we define in the MANUAL_BUILD_SCRIPT code.
|
||||||
|
if arg.startswith("-DCMAKE_INSTALL_PREFIX="):
|
||||||
|
value = " {!r}.format(INSTALL_DIR),".format(
|
||||||
|
"-DCMAKE_INSTALL_PREFIX={}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
value = " {!r},".format(arg)
|
||||||
|
define_arg_lines.append(value)
|
||||||
|
define_arg_lines.append("]")
|
||||||
|
kwargs["define_args_str"] = "\n".join(define_arg_lines)
|
||||||
|
|
||||||
# In order to make it easier for developers to manually run builds for
|
# In order to make it easier for developers to manually run builds for
|
||||||
# CMake-based projects, write out some build scripts that can be used to invoke
|
# CMake-based projects, write out some build scripts that can be used to invoke
|
||||||
# CMake manually.
|
# CMake manually.
|
||||||
|
Reference in New Issue
Block a user