def _get_dirs(self, source_folder, build_folder, source_dir, build_dir, cache_build_folder): if (source_folder or build_folder) and (source_dir or build_dir): raise ConanException("Use 'build_folder'/'source_folder'") if source_dir or build_dir: # OLD MODE build_ret = build_dir or self.build_dir or self._conanfile.build_folder source_ret = source_dir or self._conanfile.source_folder else: build_ret = get_abs_path(build_folder, self._conanfile.build_folder) source_ret = get_abs_path(source_folder, self._conanfile.source_folder) if self._conanfile.in_local_cache and cache_build_folder: build_ret = get_abs_path(cache_build_folder, self._conanfile.build_folder) return source_ret, build_ret
def _configure(self, args=None, defs=None, source_dir=None, build_dir=None, source_folder=None, build_folder=None, cache_build_folder=None, pkg_config_paths=None): # TODO: Deprecate source_dir and build_dir in favor of xxx_folder if not self._conanfile.should_configure: return args = args or [] defs = defs or {} source_dir, self.build_dir = self._get_dirs(source_folder, build_folder, source_dir, build_dir, cache_build_folder) mkdir(self.build_dir) arg_list = join_arguments([ self.command_line, args_to_string(args), defs_to_string(defs), args_to_string([source_dir]) ]) if pkg_config_paths: pkg_env = { "PKG_CONFIG_PATH": os.pathsep.join( get_abs_path(f, self._conanfile.install_folder) for f in pkg_config_paths) } else: # If we are using pkg_config generator automate the pcs location, otherwise it could # read wrong files set_env = "pkg_config" in self._conanfile.generators \ and "PKG_CONFIG_PATH" not in os.environ pkg_env = { "PKG_CONFIG_PATH": self._conanfile.install_folder } if set_env else {} with tools.environment_append(pkg_env): compiler = self._settings.get_safe("compiler") command = "cd %s && cmake %s" % (args_to_string([self.build_dir ]), arg_list) if compiler == 'emcc': self._conanfile.output.warn('Used hacked CMake in emcc build') command = "cd %s && emcmake cmake %s" % (args_to_string( [self.build_dir]), arg_list) if platform.system( ) == "Windows" and self.generator == "MinGW Makefiles": with tools.remove_from_path("sh"): self._conanfile.run(command) else: self._conanfile.run(command)
def configure(self, args=None, defs=None, source_dir=None, build_dir=None, pkg_config_paths=None, cache_build_folder=None, build_folder=None, source_folder=None): if not self._conanfile.should_configure: return args = args or [] defs = defs or {} # overwrite default values with user's inputs self.options.update(defs) source_dir, self.build_dir = self._get_dirs(source_folder, build_folder, source_dir, build_dir, cache_build_folder) if pkg_config_paths: pc_paths = os.pathsep.join( get_abs_path(f, self._conanfile.install_folder) for f in pkg_config_paths) else: pc_paths = self._conanfile.install_folder mkdir(self.build_dir) bt = { "RelWithDebInfo": "debugoptimized", "MinSizeRel": "release", "Debug": "debug", "Release": "release" }.get(str(self.build_type), "") build_type = "--buildtype=%s" % bt arg_list = join_arguments([ "--backend=%s" % self.backend, self.flags, args_to_string(args), build_type ]) command = 'meson "%s" "%s" %s' % (source_dir, self.build_dir, arg_list) command = self._append_vs_if_needed(command) with tools.environment_append({"PKG_CONFIG_PATH": pc_paths}): self._conanfile.run(command)
def configure(self, configure_dir=None, args=None, build=None, host=None, target=None, pkg_config_paths=None, vars=None, use_default_install_dirs=True): """ :param pkg_config_paths: Optional paths to locate the *.pc files :param configure_dir: Absolute or relative path to the configure script :param args: Optional arguments to pass to configure. :param build: In which system the program will be built. "False" skips the --build flag :param host: In which system the generated program will run. "False" skips the --host flag :param target: This option is only used to build a cross-compiling toolchain. "False" skips the --target flag When the tool chain generates executable program, in which target system the program will run. http://jingfenghanmax.blogspot.com.es/2010/09/configure-with-host-target-and-build.html https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html :param use_default_install_dirs: Use or not the defaulted installation dirs """ if not self._conanfile.should_configure: return if configure_dir: configure_dir = configure_dir.rstrip("/") else: configure_dir = "." triplet_args = [] if build is not False: # Skipped by user if build or self.build: # User specified value or automatic triplet_args.append("--build=%s" % (build or self.build)) if host is not False: # Skipped by user if host or self.host: # User specified value or automatic triplet_args.append("--host=%s" % (host or self.host)) if target is not False: # Skipped by user if target or self.target: # User specified value or automatic triplet_args.append("--target=%s" % (target or self.target)) if pkg_config_paths: pkg_env = { "PKG_CONFIG_PATH": [ os.pathsep.join( get_abs_path(f, self._conanfile.install_folder) for f in pkg_config_paths) ] } else: # If we are using pkg_config generator automate the pcs location, otherwise it could # read wrong files pkg_env = {"PKG_CONFIG_PATH": [self._conanfile.install_folder]} \ if "pkg_config" in self._conanfile.generators else {} configure_dir = self._adjust_path(configure_dir) if self._conanfile.package_folder is not None: if not args: args = [ "--prefix=%s" % self._conanfile.package_folder.replace("\\", "/") ] elif not self._is_flag_in_args("prefix", args): args.append("--prefix=%s" % self._conanfile.package_folder.replace("\\", "/")) all_flags = [ "bindir", "sbindir", "libexecdir", "libdir", "includedir", "oldincludedir", "datarootdir" ] help_output = self._configure_help_output(configure_dir) available_flags = [ flag for flag in all_flags if "--%s" % flag in help_output ] if use_default_install_dirs: for varname in ["bindir", "sbindir", "libexecdir"]: if self._valid_configure_flag(varname, args, available_flags): args.append("--%s=${prefix}/%s" % (varname, DEFAULT_BIN)) if self._valid_configure_flag("libdir", args, available_flags): args.append("--libdir=${prefix}/%s" % DEFAULT_LIB) for varname in ["includedir", "oldincludedir"]: if self._valid_configure_flag(varname, args, available_flags): args.append("--%s=${prefix}/%s" % (varname, DEFAULT_INCLUDE)) if self._valid_configure_flag("datarootdir", args, available_flags): args.append("--datarootdir=${prefix}/%s" % DEFAULT_SHARE) with environment_append(pkg_env): with environment_append(vars or self.vars): command = '%s/configure %s %s' % (configure_dir, args_to_string(args), " ".join(triplet_args)) self._conanfile.output.info("Calling:\n > %s" % command) self._conanfile.run(command, win_bash=self._win_bash, subsystem=self.subsystem)
def configure(self, configure_dir=None, args=None, build=None, host=None, target=None, pkg_config_paths=None, vars=None): """ :param pkg_config_paths: Optional paths to locate the *.pc files :param configure_dir: Absolute or relative path to the configure script :param args: Optional arguments to pass to configure. :param build: In which system the program will be built. "False" skips the --build flag :param host: In which system the generated program will run. "False" skips the --host flag :param target: This option is only used to build a cross-compiling toolchain. "False" skips the --target flag When the tool chain generates executable program, in which target system the program will run. :return: None http://jingfenghanmax.blogspot.com.es/2010/09/configure-with-host-target-and-build.html https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html """ if not self._conanfile.should_configure: return if configure_dir: configure_dir = configure_dir.rstrip("/") else: configure_dir = "." triplet_args = [] if build is not False: # Skipped by user if build or self.build: # User specified value or automatic triplet_args.append("--build=%s" % (build or self.build)) if host is not False: # Skipped by user if host or self.host: # User specified value or automatic triplet_args.append("--host=%s" % (host or self.host)) if target is not False: # Skipped by user if target or self.target: # User specified value or automatic triplet_args.append("--target=%s" % (target or self.target)) if pkg_config_paths: pkg_env = {"PKG_CONFIG_PATH": os.pathsep.join(get_abs_path(f, self._conanfile.install_folder) for f in pkg_config_paths)} else: # If we are using pkg_config generator automate the pcs location, otherwise it could # read wrong files pkg_env = {"PKG_CONFIG_PATH": self._conanfile.install_folder} \ if "pkg_config" in self._conanfile.generators else {} if self._conanfile.package_folder is not None: if not args: args = ["--prefix=%s" % self._conanfile.package_folder.replace("\\", "/")] elif not any(["--prefix=" in arg for arg in args]): args.append("--prefix=%s" % self._conanfile.package_folder.replace("\\", "/")) with environment_append(pkg_env): with environment_append(vars or self.vars): configure_dir = self._adjust_path(configure_dir) command = '%s/configure %s %s' % (configure_dir, args_to_string(args), " ".join(triplet_args)) self._conanfile.output.info("Calling:\n > %s" % command) self._conanfile.run(command, win_bash=self._win_bash, subsystem=self.subsystem)