Fixes to the build script for macOS

- Default the generator to Xcode on macOS
- Fix up how we pass in number of jobs so it works with Xcode
This commit is contained in:
George ElKoura 2019-03-09 11:57:09 -08:00
parent 6ff680f34e
commit 385ae6d012

View File

@ -217,14 +217,30 @@ def RunCMake(context, force, extraArgs = None):
else:
generator = "Visual Studio 14 2015 Win64"
if generator is not None:
generator = '-G "{gen}"'.format(gen=generator)
# On macOS default to Xcode
if generator is None and MacOS():
generator = "Xcode"
multiproc = "-j{procs}"
if Windows():
multiproc = "/M:{procs}"
if generator == "Xcode":
multiproc = "-jobs {procs} -parallelizeTargets"
multiproc = multiproc.format(procs=context.numJobs)
# On MacOS, enable the use of @rpath for relocatable builds.
osx_rpath = None
if MacOS():
osx_rpath = "-DCMAKE_MACOSX_RPATH=ON"
# Format generator appropriately
if generator is not None:
generator = '-G "{gen}"'.format(gen=generator)
with CurrentWorkingDirectory(buildDir):
Run('cmake '
'-DCMAKE_INSTALL_PREFIX="{instDir}" '
@ -239,9 +255,8 @@ def RunCMake(context, force, extraArgs = None):
osx_rpath=(osx_rpath or ""),
generator=(generator or ""),
extraArgs=(" ".join(extraArgs) if extraArgs else "")))
Run("cmake --build . --config Release --target install -- {multiproc}"
.format(multiproc=("/M:{procs}" if Windows() else "-j{procs}")
.format(procs=context.numJobs)))
Run("cmake --build . --config Release --target install -- {jobs}"
.format(jobs=multiproc))
def PatchFile(filename, patches):
"""Applies patches to the specified file. patches is a list of tuples