From 89378d039dceec57d735ef9c7ea021f2d7a05792 Mon Sep 17 00:00:00 2001 From: Stéphane Cerveau Date: Mon, 18 May 2020 18:20:10 +0200 Subject: 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: --- cerbero/build/build.py | 14 ++++++++------ cerbero/build/recipe.py | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cerbero/build/build.py b/cerbero/build/build.py index 59a14027..34461181 100644 --- a/cerbero/build/build.py +++ b/cerbero/build/build.py @@ -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 = \ ''' diff --git a/cerbero/build/recipe.py b/cerbero/build/recipe.py index d4c4125f..3dfa8d76 100644 --- a/cerbero/build/recipe.py +++ b/cerbero/build/recipe.py @@ -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: -- cgit v1.2.3