Commit 7be9cf6a authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

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
parent 48407345
...@@ -332,7 +332,7 @@ class FBCodeBuilder(object): ...@@ -332,7 +332,7 @@ class FBCodeBuilder(object):
self.run(ShellQuoted('autoreconf -ivf')), self.run(ShellQuoted('autoreconf -ivf')),
] + self.configure() + self.make_and_install()) ] + self.configure() + self.make_and_install())
def cmake_configure(self, name): def cmake_configure(self, name, cmake_path='..'):
cmake_defines = { cmake_defines = {
'BUILD_SHARED_LIBS': 'ON', 'BUILD_SHARED_LIBS': 'ON',
'CMAKE_INSTALL_PREFIX': self.option('prefix'), 'CMAKE_INSTALL_PREFIX': self.option('prefix'),
...@@ -344,19 +344,22 @@ class FBCodeBuilder(object): ...@@ -344,19 +344,22 @@ class FBCodeBuilder(object):
self.run(ShellQuoted( self.run(ShellQuoted(
'CXXFLAGS="$CXXFLAGS -fPIC -isystem "{p}"/include" ' 'CXXFLAGS="$CXXFLAGS -fPIC -isystem "{p}"/include" '
'CFLAGS="$CFLAGS -fPIC -isystem "{p}"/include" ' 'CFLAGS="$CFLAGS -fPIC -isystem "{p}"/include" '
'cmake {args} ..' 'cmake {args} {cmake_path}'
).format( ).format(
p=self.option('prefix'), p=self.option('prefix'),
args=shell_join(' ', ( args=shell_join(' ', (
ShellQuoted('-D{k}={v}').format(k=k, v=v) ShellQuoted('-D{k}={v}').format(k=k, v=v)
for k, v in cmake_defines.items() for k, v in cmake_defines.items()
)), )),
cmake_path=cmake_path,
)), )),
] ]
def cmake_install(self, name): def cmake_install(self, name, cmake_path='..'):
return self.step('Build and install {0}'.format(name), return self.step(
self.cmake_configure(name) + self.make_and_install()) '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): def fb_github_autoconf_install(self, project_and_path):
return [ return [
...@@ -364,8 +367,8 @@ class FBCodeBuilder(object): ...@@ -364,8 +367,8 @@ class FBCodeBuilder(object):
self.autoconf_install(project_and_path), 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 [ return [
self.fb_github_project_workdir(project_and_path), self.fb_github_project_workdir(project_and_path),
self.cmake_install(project_and_path), self.cmake_install(project_and_path, cmake_path),
] ]
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