Add the SW prefix to cmake when building headless

This commit is contained in:
Kovid Goyal 2021-11-27 20:58:58 +05:30
parent 5a8c73abe3
commit 17d9cd0b6a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -458,7 +458,7 @@ class Build(Command):
from setup.parallel_build import cpu_count from setup.parallel_build import cpu_count
if iswindows or ishaiku: if iswindows or ishaiku:
return # Dont have headless operation on these platforms return # Dont have headless operation on these platforms
from setup.build_environment import CMAKE from setup.build_environment import CMAKE, sw
self.info('\n####### Building headless QPA plugin', '#'*7) self.info('\n####### Building headless QPA plugin', '#'*7)
a = absolutize a = absolutize
headers = a([ headers = a([
@ -480,11 +480,14 @@ class Build(Command):
bdir = self.j(self.build_dir, 'headless') bdir = self.j(self.build_dir, 'headless')
if os.path.exists(bdir): if os.path.exists(bdir):
shutil.rmtree(bdir) shutil.rmtree(bdir)
cmd = [CMAKE]
if sw and os.path.exists(os.path.join(sw, 'qt')):
cmd += ['-DCMAKE_SYSTEM_PREFIX_PATH=' + os.path.join(sw, 'qt').replace(os.sep, '/')]
os.makedirs(bdir) os.makedirs(bdir)
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(bdir) os.chdir(bdir)
try: try:
self.check_call([CMAKE, '-S', os.path.dirname(sources[0])]) self.check_call(cmd + ['-S', os.path.dirname(sources[0])])
self.check_call([self.env.make] + ['-j%d'%(cpu_count or 1)]) self.check_call([self.env.make] + ['-j%d'%(cpu_count or 1)])
finally: finally:
os.chdir(cwd) os.chdir(cwd)