From a277c46e5900b631d68bbb9af0addee9b532e96c Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Tue, 10 Apr 2018 12:15:52 -0700 Subject: [PATCH] allow specifying the directory containing CMakeLists.txt Summary: Update `cmake_configure()`, `cmake_install()`, and `fb_github_cmake_install()` to support specifying the directory where CMakeLists.txt is found, relative to the directory where the build is being performed. Previously these functions where hardcoded to assume that CMakeLists.txt was always found at '..' Reviewed By: snarkmaster Differential Revision: D7540689 fbshipit-source-id: efd3d044345fadc0346e436c01d0a247e1b6fd70 --- build/fbcode_builder/fbcode_builder.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/build/fbcode_builder/fbcode_builder.py b/build/fbcode_builder/fbcode_builder.py index f86741969..e54bc7d16 100644 --- a/build/fbcode_builder/fbcode_builder.py +++ b/build/fbcode_builder/fbcode_builder.py @@ -332,7 +332,7 @@ class FBCodeBuilder(object): self.run(ShellQuoted('autoreconf -ivf')), ] + self.configure() + self.make_and_install()) - def cmake_configure(self, name): + def cmake_configure(self, name, cmake_path='..'): cmake_defines = { 'BUILD_SHARED_LIBS': 'ON', 'CMAKE_INSTALL_PREFIX': self.option('prefix'), @@ -344,19 +344,22 @@ class FBCodeBuilder(object): self.run(ShellQuoted( 'CXXFLAGS="$CXXFLAGS -fPIC -isystem "{p}"/include" ' 'CFLAGS="$CFLAGS -fPIC -isystem "{p}"/include" ' - 'cmake {args} ..' + 'cmake {args} {cmake_path}' ).format( p=self.option('prefix'), args=shell_join(' ', ( ShellQuoted('-D{k}={v}').format(k=k, v=v) for k, v in cmake_defines.items() )), + cmake_path=cmake_path, )), ] - def cmake_install(self, name): - return self.step('Build and install {0}'.format(name), - self.cmake_configure(name) + self.make_and_install()) + def cmake_install(self, name, cmake_path='..'): + return self.step( + 'Build and install {0}'.format(name), + self.cmake_configure(name, cmake_path) + self.make_and_install() + ) def fb_github_autoconf_install(self, project_and_path): return [ @@ -364,8 +367,8 @@ class FBCodeBuilder(object): self.autoconf_install(project_and_path), ] - def fb_github_cmake_install(self, project_and_path): + def fb_github_cmake_install(self, project_and_path, cmake_path='..'): return [ self.fb_github_project_workdir(project_and_path), - self.cmake_install(project_and_path), + self.cmake_install(project_and_path, cmake_path), ]