Commit 2d520bfd authored by Stéphane Cerveau's avatar Stéphane Cerveau 🤸🏻 Committed by GStreamer Marge Bot
Browse files

build: fix the cmake template

In order to support a different build folder from
a src folder where srcdir is not the root of the package
folder, we need to to differentiate these 3 variables.

-H will use make_dir(where cmakelist.txt is)
-B will use build_dir where the build will be performed.
make_dir after build_dir after configure because the Makefile
is actually in the build_dir.

Part-of: <!488>
parent 581c9c58
......@@ -405,12 +405,11 @@ class MakefilesBase (Build, ModifyEnvBase):
if not self.using_msvc():
self.setup_buildtype_env_ops()
self.config_src_dir = os.path.abspath(os.path.join(self.build_dir,
self.srcdir))
if self.requires_non_src_build:
self.make_dir = os.path.join (self.config_src_dir, "cerbero-build-dir")
else:
self.make_dir = self.config_src_dir
self.make_dir = os.path.abspath(os.path.join(self.config_src_dir,
self.srcdir))
self.make = self.make or ['make', 'V=1']
self.make_install = self.make_install or ['make', 'install']
......@@ -618,8 +617,8 @@ class CMake (MakefilesBase):
config_sh_needs_shell = False
config_sh = 'cmake'
configure_tpl = '%(config-sh)s -DCMAKE_INSTALL_PREFIX=%(prefix)s ' \
'-H%(build_dir)s ' \
'-B%(make_dir)s ' \
'-H%(make_dir)s ' \
'-B%(build_dir)s ' \
'-DCMAKE_LIBRARY_OUTPUT_PATH=%(libdir)s ' \
'-DCMAKE_INSTALL_LIBDIR=lib ' \
'-DCMAKE_INSTALL_BINDIR=bin ' \
......@@ -630,7 +629,8 @@ class CMake (MakefilesBase):
def __init__(self):
MakefilesBase.__init__(self)
self.make_dir = os.path.join(self.build_dir, '_builddir')
self.build_dir = os.path.join(self.build_dir, '_builddir')
@modify_environment
async def configure(self):
......@@ -679,6 +679,8 @@ class CMake (MakefilesBase):
shutil.rmtree(cmake_files)
self.make += ['VERBOSE=1']
await MakefilesBase.configure(self)
# as build_dir is different from source dir, makefile location will be in build_dir.
self.make_dir = self.build_dir
MESON_FILE_TPL = \
'''
......
......@@ -258,8 +258,8 @@ SOFTWARE LICENSE COMPLIANCE.\n\n'''
self.repo_dir = os.path.join(self.config.local_sources,
self.package_name)
self.repo_dir = os.path.abspath(self.repo_dir)
self.build_dir = os.path.join(self.config.sources, self.package_name)
self.build_dir = os.path.abspath(self.build_dir)
self.build_dir = os.path.abspath(os.path.join(self.config.sources, self.package_name))
self.config_src_dir = self.build_dir
self.deps = self.deps or []
if self.config.prefix_is_build_tools():
if self.btype == build.BuildType.MESON:
......
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