def build(self): cmake = CMake(self) cmake.verbose = True if self.settings.compiler == "Visual Studio": cmake.definitions["CONAN_CXX_FLAGS"] += " /W4 /WX /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS" +\ " /D_WIN32_WINNT=0x0A00" +\ " /DBOOST_ASIO_STANDALONE" elif self.settings.compiler == "gcc": cmake.definitions[ "CONAN_CXX_FLAGS"] += " -Wall -Wextra -Werror -DBOOST_ASIO_STANDALONE" elif self.settings.compiler == "clang": cmake.definitions[ "CONAN_CXX_FLAGS"] += " -Wall -Wextra -Werror -Wglobal-constructors -DBOOST_ASIO_STANDALONE" if not self.settings.os == "Windows": cmake.definitions["CONAN_CXX_FLAGS"] += " -pthread" if self.options.clang_tidy: # If testing with clang_tidy, removing the CONAN_LIBCXX flag so that we do not get a # clang-tidy warning/error from _GLIBCXX_USE_CXX11_ABI being defined del cmake.definitions["CONAN_LIBCXX"] path_clang_tidy = tools.which( tools.get_env("CLANG_TIDY", "clang-tidy")) if path_clang_tidy: cmake.definitions["CLANG_TIDY_COMMAND"] = path_clang_tidy cmake.configure() cmake.build() if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug": self.output.warn("Skipping tests in Visual Studio/Debug build. " "Error testing will fail with checked iterators") else: with tools.environment_append({"CTEST_OUTPUT_ON_FAILURE": "1"}): cmake.test()
def test_which_positive(self): tmp_dir = temp_folder() fullname = os.path.join(tmp_dir, 'example.sh') self._touch(fullname) self._add_executable_bit(fullname) with tools.environment_append({'PATH': tmp_dir}): self.assertEqual(tools.which('example.sh'), fullname)
def build_requirements(self): if not tools.which("7zr"): self.build_requires("lzma_sdk/9.20") if tools.os_info.is_windows and "make" not in os.environ.get( "CONAN_MAKE_PROGRAM", ""): self.build_requires("make/4.2.1")
def test(self): if not tools.cross_building(self.settings): self.run(os.path.join("bin", "test_package"), run_environment=True) pkg_config = tools.get_env("PKG_CONFIG") self.output.info( "Read environment variable PKG_CONFIG='{}'".format(pkg_config)) if not pkg_config or not pkg_config.startswith( self.deps_cpp_info["pkgconf"].rootpath.replace("\\", "/")): raise ConanException("PKG_CONFIG variable incorrect") pkgconf_path = tools.which("pkgconf").replace("\\", "/") self.output.info("Found pkgconf at '{}'".format(pkgconf_path)) if not pkgconf_path or not pkgconf_path.startswith( self.deps_cpp_info["pkgconf"].rootpath.replace("\\", "/")): raise ConanException("pkgconf executable not found") with tools.environment_append( {"PKG_CONFIG_PATH": self.source_folder}): self.run("{} libexample1 --libs".format( os.environ["PKG_CONFIG"]), run_environment=True) self.run("{} libexample1 --cflags".format( os.environ["PKG_CONFIG"]), run_environment=True)
def _check_python_version(self): """depot_tools requires python >= 2.7.5 or >= 3.8 for python 3 support.""" python_exe = tools.which("python") if not python_exe: msg = ("Python must be available in PATH " "in order to build v8") raise ConanInvalidConfiguration(msg) # In any case, check its actual version for compatibility from six import StringIO # Python 2 and 3 compatible version_buf = StringIO() cmd_v = "{} --version".format(python_exe) self.run(cmd_v, output=version_buf) p = re.compile(r'Python (\d+\.\d+\.\d+)') verstr = p.match(version_buf.getvalue().strip()).group(1) if verstr.endswith('+'): verstr = verstr[:-1] version = tools.Version(verstr) # >= 2.7.5 & < 3 py2_min = "2.7.5" py2_max = "3.0.0" py3_min = "3.8.0" if (version >= py2_min) and (version < py2_max): msg = ("Found valid Python 2 required for v8:" " version={}, path={}".format( version_buf.getvalue().strip(), python_exe)) self.output.success(msg) elif version >= py3_min: msg = ("Found valid Python 3 required for v8:" " version={}, path={}".format( version_buf.getvalue().strip(), python_exe)) self.output.success(msg) else: msg = ("Found Python in path, but with invalid version {}" " (v8 requires >= {} and < " "{} or >= {})".format(verstr, py2_min, py2_max, py3_min)) raise ConanInvalidConfiguration(msg)
def _create_linux_arguments(self): with tools.chdir(self._webrtc_source): self.run( "./build/linux/sysroot_scripts/install-sysroot.py --arch=amd64" ) if self.settings.arch == "armv8": self.run( "./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64" ) if self.settings.arch == "armv7": self.run( "./build/linux/sysroot_scripts/install-sysroot.py --arch=arm" ) args = "" args += "use_rtti=true " if self.settings.arch != "armv8" and self.settings.arch != "armv7": args += "use_sysroot=false " # compiler = self.settings.compiler # if compiler == "gcc": # args += "is_clang=false use_gold=false use_lld=false " # else: # self.output.error("the compiler '%s' is not tested" % (compiler)) if tools.which('ccache'): args += 'cc_wrapper=\\"ccache\\" ' if self.settings.arch == "armv8": args += 'target_cpu=\\"arm64\\" ' if self.settings.arch == "armv7": args += 'target_cpu=\\"arm\\" ' if self._is_release_with_debug_information(): # '2' results in a ~450mb static library # args += 'symbol_level=2 ' args += 'symbol_level=1 ' return args
def build_requirements(self): # useful for example for conditional build_requires if tools.os_info.is_windows: if not self._win_bash: self.build_requires("strawberryperl/5.30.0.1") if not self.options.no_asm and not tools.which("nasm"): self.build_requires("nasm/2.14")
def build_requirements(self): if tools.os_info.is_windows and self.settings.compiler == "Visual Studio": self.build_requires("jom_installer/1.1.2@bincrafters/stable") if self.settings.os == 'Linux': if not tools.which('pkg-config'): self.build_requires( 'pkg-config_installer/0.29.2@bincrafters/stable')
def requirements(self): if self.options.iconv: self.requires.add("libiconv/1.16") if self.settings.os == "Linux" and tools.os_info.is_linux: self.requires.add("libdrm/2.4.100@bincrafters/stable") if not tools.which('pkg-config'): self.requires.add("pkg-config_installer/0.29.2@bincrafters/stable") if self.options.alsa: self.requires.add("libalsa/1.1.9") if self.options.x11: self.requires.add("libx11/1.6.8@bincrafters/stable") self.requires.add("libxext/1.3.4@bincrafters/stable") if self.options.xcursor: self.requires.add("libxcursor/1.2.0@bincrafters/stable") if self.options.xinerama: self.requires.add("libxinerama/1.1.4@bincrafters/stable") if self.options.xinput: self.requires.add("libxi/1.7.10@bincrafters/stable") if self.options.xrandr: self.requires.add("libxrandr/1.5.2@bincrafters/stable") if self.options.xscrnsaver: self.requires.add("libxscrnsaver/1.2.3@bincrafters/stable") if self.options.xvm: self.requires.add("libxxf86vm/1.1.4@bincrafters/stable") if self.options.wayland: self.requires.add("xkbcommon/0.9.1@bincrafters/stable") if self.options.pulse: self.requires("pulseaudio/13.0@bincrafters/stable") self.requires("opengl/virtual@bincrafters/stable")
def _get_boostrap_toolset(self): if self._is_msvc: comp_ver = self.settings.compiler.version if Version(str(comp_ver)) >= "16": return "vc142" elif Version(str(comp_ver)) >= "15": return "vc141" else: return "vc%s" % comp_ver if tools.os_info.is_windows: return "gcc" if self.settings.compiler == "gcc" else "" if tools.os_info.is_macos: return "clang" with_toolset = { "apple-clang": "clang" }.get(str(self.settings.compiler), str(self.settings.compiler)) # fallback for the case when no unversioned gcc/clang is available if with_toolset in ["gcc", "clang"]: # check for C++ compiler, as b2 uses only C++ one, which may not be installed alongside C compiler compiler = "g++" if with_toolset == "gcc" else "clang++" if not tools.which(compiler): with_toolset = "cxx" if Version(str( self.version)) >= "1.71" else "cc" return with_toolset
def get_toolset_version_and_exe(self): compiler_version = str(self.settings.compiler.version) compiler = str(self.settings.compiler) if self.settings.compiler == "Visual Studio": cversion = self.settings.compiler.version _msvc_version = "14.1" if cversion == "15" else "%s.0" % cversion return "msvc", _msvc_version, "" elif not self.settings.os == "Windows" and compiler == "gcc" and compiler_version[ 0] >= "5": # For GCC >= v5 we only need the major otherwise Boost doesn't find the compiler # The NOT windows check is necessary to exclude MinGW: if not tools.which("g++-%s" % compiler_version[0]): # In fedora 24, 25 the gcc is 6, but there is no g++-6 and the detection is 6.3.1 # so b2 fails because 6 != 6.3.1. Specify the exe to avoid the smart detection executable = "g++" else: executable = "" return compiler, compiler_version[0], executable elif str(self.settings.compiler) in ["clang", "gcc"]: # For GCC < v5 and Clang we need to provide the entire version string return compiler, compiler_version, "" elif self.settings.compiler == "apple-clang": return "clang", compiler_version, "" elif self.settings.compiler == "sun-cc": return "sunpro", compiler_version, "" else: return compiler, compiler_version, ""
def system_requirements(self): if tools.which("gfortran") is not None: # Prefere local install return installer = SystemPackageTool() if tools.os_info.is_linux: if tools.os_info.with_zypper or tools.os_info.with_pacman: installer.install("gcc-fortran") elif tools.os_info.with_yum: installer.install("gcc-gfortran") else: installer.install("gfortran") versionfloat = Version(self.settings.compiler.version.value) if self.settings.compiler == "gcc": if versionfloat < "5.0": installer.install( "libgfortran-{}-dev".format(versionfloat)) else: installer.install("libgfortran-{}-dev".format( int(versionfloat))) if tools.os_info.is_macos and Version( self.settings.compiler.version.value) > "7.3": try: installer.install("gcc", update=True, force=True) except Exception: self.output.warn( "brew install gcc failed. Tying to fix it with 'brew link'" ) self.run("brew link --overwrite gcc")
def build_requirements(self): if self._meson_required: self.build_requires("meson/0.53.0") if not tools.which("pkg-config"): self.build_requires("pkg-config_installer/0.29.2@bincrafters/stable") self.build_requires("bison_installer/3.3.2@bincrafters/stable") self.build_requires("flex_installer/2.6.4@bincrafters/stable")
def _get_toolset_version_and_exe(self): compiler_version = str(self.settings.compiler.version) compiler = str(self.settings.compiler) if self._is_msvc: cversion = self.settings.compiler.version if Version(str(cversion)) >= "16": _msvc_version = "14.2" elif Version(str(cversion)) >= "15": _msvc_version = "14.1" else: _msvc_version = "%s.0" % cversion return "msvc", _msvc_version, "" elif self.settings.os == "Windows" and self.settings.compiler == "clang": return "clang-win", compiler_version, "" elif self.settings.os == "Emscripten" and self.settings.compiler == "clang": return "emscripten", compiler_version, self._cxx elif self.settings.compiler == "gcc" and tools.is_apple_os( self.settings.os): return "darwin", compiler_version, self._cxx elif compiler == "gcc" and compiler_version[0] >= "5": # For GCC >= v5 we only need the major otherwise Boost doesn't find the compiler # The NOT windows check is necessary to exclude MinGW: if not tools.which("g++-%s" % compiler_version[0]): # In fedora 24, 25 the gcc is 6, but there is no g++-6 and the detection is 6.3.1 # so b2 fails because 6 != 6.3.1. Specify the exe to avoid the smart detection executable = tools.which("g++") or "" else: executable = "" return compiler, compiler_version[0], executable elif self.settings.compiler == "apple-clang": return "clang-darwin", compiler_version, self._cxx elif self.settings.os == "Android" and self.settings.compiler == "clang": return "clang-linux", compiler_version, self._cxx elif str(self.settings.compiler) in ["clang", "gcc"]: # For GCC < v5 and Clang we need to provide the entire version string return compiler, compiler_version, "" elif self.settings.compiler == "sun-cc": return "sunpro", compiler_version, "" elif self.settings.compiler == "intel": toolset = { "Macos": "intel-darwin", "Windows": "intel-win", "Linux": "intel-linux" }.get(str(self.settings.os)) return toolset, compiler_version, "" else: return compiler, compiler_version, ""
def __init__(self, executable, settings): self._executable = tools.which(str(executable)) self._os = settings.os if not self._executable: raise errors.ConanInvalidConfiguration( "Python executable cannot be found: {!s}".format( self._executable))
def build_requirements(self): self.build_requires("yasm/1.3.0") if tools.os_info.is_windows: if "CONAN_BASH_PATH" not in os.environ: self.build_requires("msys2/20190524") if self.settings.os == 'Linux': if not tools.which('pkg-config'): self.build_requires('pkg-config_installer/0.29.2@bincrafters/stable')
def test_which_not_dir(self): tmp_dir = temp_folder() dev_dir = os.path.join(tmp_dir, "Dev") dev_git_dir = os.path.join(dev_dir, "Git") mkdir(dev_git_dir) with tools.environment_append({'PATH': dev_dir}): self.assertEqual(dev_dir, tools.get_env("PATH")) self.assertIsNone(tools.which('git'))
def build_requirements(self): if self._settings_build.os == "Windows": if not self._win_bash: self.build_requires("strawberryperl/5.30.0.1") if not self.options.no_asm and not tools.which("nasm"): self.build_requires("nasm/2.15.05") if self._win_bash and not tools.get_env("CONAN_BASH_PATH"): self.build_requires("msys2/cci.latest")
def test_which_positive(self): tmp_dir = temp_folder() ext = ".sh" if platform.system() != "Windows" else ".bat" fullname = os.path.join(tmp_dir, 'example%s' % ext) self._touch(fullname) self._add_executable_bit(fullname) with tools.environment_append({'PATH': tmp_dir}): self.assertEqual(tools.which('example').lower(), fullname.lower())
def build_requirements(self): self.build_requires("yasm/1.3.0") if tools.os_info.is_windows: if "CONAN_BASH_PATH" not in os.environ: self.build_requires("msys2/20200517") if self.settings.os == "Linux": if not tools.which("pkg-config"): self.build_requires("pkgconf/1.7.3")
def build_requirements(self): # if self.settings.os == "Windows": # # will not compile with less than visual studio 2019 # self.build_requires("qt/5.15.0@bincrafters/stable") if not tools.which('meson'): self.build_requires("meson/0.56.0") if os_info.is_macos: # maybe even for windows, instead of the pkgconfig-lite "hack" self.build_requires("pkgconf/1.7.3")
def build_requirements(self): self.build_requires("yasm/1.3.0") if tools.os_info.is_windows: if "CONAN_BASH_PATH" not in os.environ: self.build_requires("msys2/20190524") if self.settings.os == 'Linux': if not tools.which('pkg-config'): self.build_requires('pkgconf/1.7.3')
def build(self): def add_flag(name, value): if name in os.environ: os.environ[name] += ' ' + value else: os.environ[name] = value extra = "" if self.settings.os == "Windows" or self.options.shared else "extra_inc=big_iron.inc" arch = "ia32" if self.settings.arch == "x86" else "intel64" if self.settings.compiler in ['gcc', 'clang', 'apple-clang']: if str(self.settings.compiler.libcxx) in [ 'libstdc++', 'libstdc++11' ]: extra += " stdlib=libstdc++" elif str(self.settings.compiler.libcxx) == 'libc++': extra += " stdlib=libc++" extra += " compiler=gcc" if self.settings.compiler == 'gcc' else " compiler=clang" make = tools.get_env( "CONAN_MAKE_PROGRAM", tools.which("make") or tools.which('mingw32-make')) if not make: raise Exception("This package needs 'make' in the path to build") def _make(): with tools.chdir(self._source_subfolder): # intentionally not using AutoToolsBuildEnvironment for now - it's broken for clang-cl if self.is_clanglc: add_flag('CFLAGS', '-mrtm') add_flag('CXXFLAGS', '-mrtm') if self.is_msvc: # intentionally not using vcvars for clang-cl yet with tools.vcvars(self.settings): self.run("%s arch=%s %s" % (make, arch, extra)) elif self.is_mingw: self.run("%s arch=%s compiler=gcc %s" % (make, arch, extra)) else: self.run("%s arch=%s %s" % (make, arch, extra)) _make() if self.options.preview: extra += " tbb_cpf=1" _make()
def create_user_config_jam(self, folder): """To help locating the zlib and bzip2 deps""" self.output.warn("Patching user-config.jam") compiler_command = os.environ.get('CXX', None) contents = "" if self.zip_bzip2_requires_needed: contents = "\nusing zlib : 1.2.11 : <include>%s <search>%s ;" % ( self.deps_cpp_info["zlib"].include_paths[0].replace('\\', '/'), self.deps_cpp_info["zlib"].lib_paths[0].replace('\\', '/')) if self.settings.os == "Linux" or self.settings.os == "Macos": contents += "\nusing bzip2 : 1.0.6 : <include>%s <search>%s ;" % ( self.deps_cpp_info["bzip2"].include_paths[0].replace( '\\', '/'), self.deps_cpp_info["bzip2"].lib_paths[0].replace( '\\', '/')) toolset, version, exe = self.get_toolset_version_and_exe() exe = compiler_command or exe # Prioritize CXX # Specify here the toolset with the binary if present if don't empty parameter : : contents += '\nusing "%s" : "%s" : ' % (toolset, version) contents += ' "%s"' % exe.replace("\\", "/") contents += " : \n" if "AR" in os.environ: contents += '<archiver>"%s" ' % tools.which( os.environ["AR"]).replace("\\", "/") if "RANLIB" in os.environ: contents += '<ranlib>"%s" ' % tools.which( os.environ["RANLIB"]).replace("\\", "/") if "CXXFLAGS" in os.environ: contents += '<cxxflags>"%s" ' % os.environ["CXXFLAGS"] if "CFLAGS" in os.environ: contents += '<cflags>"%s" ' % os.environ["CFLAGS"] if "LDFLAGS" in os.environ: contents += '<ldflags>"%s" ' % os.environ["LDFLAGS"] if "ASFLAGS" in os.environ: contents += '<asmflags>"%s" ' % os.environ["ASFLAGS"] contents += " ;" self.output.warn(contents) filename = "%s/user-config.jam" % folder tools.save(filename, contents)
def __init__(self, conanfile, generator=None, cmake_system_name=True, parallel=True, build_type=None, toolset=None, make_program=None, set_cmake_flags=False): """ :param settings_or_conanfile: Conanfile instance (or settings for retro compatibility) :param generator: Generator name to use or none to autodetect :param cmake_system_name: False to not use CMAKE_SYSTEM_NAME variable, True for auto-detect or directly a string with the system name :param parallel: Try to build with multiple cores if available :param build_type: Overrides default build type comming from settings :param toolset: Toolset name to use (such as llvm-vs2014) or none for default one, applies only to certain generators (e.g. Visual Studio) :param set_cmake_flags: whether or not to set CMake flags like CMAKE_CXX_FLAGS, CMAKE_C_FLAGS, etc. it's vital to set for certain projects (e.g. using CMAKE_SIZEOF_VOID_P or CMAKE_LIBRARY_ARCHITECTURE) """ if not isinstance(conanfile, ConanFile): raise ConanException("First argument of CMake() has to be ConanFile. Use CMake(self)") self._settings = conanfile.settings self._conanfile = conanfile self._os = self._settings.get_safe("os") self._os_build, _, self._os_host, _ = get_cross_building_settings(self._settings) self._compiler = self._settings.get_safe("compiler") self._compiler_version = self._settings.get_safe("compiler.version") self._arch = self._settings.get_safe("arch") os_ver_str = "os.api_level" if self._os == "Android" else "os.version" self._op_system_version = self._settings.get_safe(os_ver_str) self._libcxx = self._settings.get_safe("compiler.libcxx") self._runtime = self._settings.get_safe("compiler.runtime") self._build_type = self._settings.get_safe("build_type") self._cppstd = self._settings.get_safe("cppstd") self.generator = generator or self._generator() self.toolset = self._toolset(toolset) self.build_dir = None self._cmake_system_name = _get_env_cmake_system_name() if self._cmake_system_name is None: # Not overwritten using environment self._cmake_system_name = cmake_system_name self.parallel = parallel self._set_cmake_flags = set_cmake_flags self.definitions = self._get_cmake_definitions() if build_type and build_type != self._build_type: # Call the setter to warn and update the definitions if needed self.build_type = build_type make_program = os.getenv("CONAN_MAKE_PROGRAM") or make_program if make_program: if not tools.which(make_program): self._conanfile.output.warn("The specified make program '%s' cannot be found" "and will be ignored" % make_program) else: self._conanfile.output.info("Using '%s' as CMAKE_MAKE_PROGRAM" % make_program) self.definitions["CMAKE_MAKE_PROGRAM"] = make_program
def build_requirements(self): if tools.os_info.is_windows: if not self._win_bash: self.build_requires("strawberryperl/5.30.0.1") if not self.options.no_asm and not tools.which("nasm"): self.build_requires("nasm/2.14") if self._win_bash: if "CONAN_BASH_PATH" not in os.environ: self.build_requires("msys2/20200517")
def build_requirements(self): self.build_requires("meson/0.54.2") if not tools.which("pkg-config"): self.build_requires("pkgconf/1.7.3") if self.settings.os == 'Windows': self.build_requires("winflexbison/2.5.22") else: self.build_requires("bison/3.5.3") self.build_requires("flex/2.6.4")
def test_which_non_executable(self): if platform.system() == "Windows": """on Windows we always have executable permissions by default""" return tmp_dir = temp_folder() fullname = os.path.join(tmp_dir, 'example.sh') self._touch(fullname) with tools.environment_append({'PATH': tmp_dir}): self.assertIsNone(tools.which('example.sh'))
def _set_compiler_path(self): gcc_path = tools.which("gcc") tools.replace_in_file( os.path.join(EPICS_BASE_DIR, "configure", "CONFIG.gnuCommon"), "CC = $(GNU_BIN)/$(CMPLR_PREFIX)gcc$(CMPLR_SUFFIX)", "CC = {}".format(gcc_path) ) gcc_path = tools.which("g++") tools.replace_in_file( os.path.join(EPICS_BASE_DIR, "configure", "CONFIG.gnuCommon"), "CCC = $(GNU_BIN)/$(CMPLR_PREFIX)g++$(CMPLR_SUFFIX)", "CCC = {}".format(gcc_path) ) tools.replace_in_file( os.path.join(EPICS_BASE_DIR, "configure", "CONFIG.gnuCommon"), "OPT_CXXFLAGS_YES = -O3", "OPT_CXXFLAGS_YES = -O3 -std=c++11" )
def build_requirements(self): if tools.os_info.is_windows: if not self._win_bash: self.build_requires("strawberryperl/5.30.0.1") if not self.options.no_asm and not tools.which("nasm"): self.build_requires("nasm/2.14") if self._win_bash: if "CONAN_BASH_PATH" not in os.environ and tools.os_info.detect_windows_subsystem() != 'msys2': self.build_requires("msys2/20190524")
def __init__(self, conanfile, generator=None, cmake_system_name=True, parallel=True, build_type=None, toolset=None, make_program=None, set_cmake_flags=False): """ :param settings_or_conanfile: Conanfile instance (or settings for retro compatibility) :param generator: Generator name to use or none to autodetect :param cmake_system_name: False to not use CMAKE_SYSTEM_NAME variable, True for auto-detect or directly a string with the system name :param parallel: Try to build with multiple cores if available :param build_type: Overrides default build type comming from settings :param toolset: Toolset name to use (such as llvm-vs2014) or none for default one, applies only to certain generators (e.g. Visual Studio) :param set_cmake_flags: whether or not to set CMake flags like CMAKE_CXX_FLAGS, CMAKE_C_FLAGS, etc. it's vital to set for certain projects (e.g. using CMAKE_SIZEOF_VOID_P or CMAKE_LIBRARY_ARCHITECTURE) """ if not isinstance(conanfile, ConanFile): raise ConanException("First argument of CMake() has to be ConanFile. Use CMake(self)") self._settings = conanfile.settings self._conanfile = conanfile self._os = self._settings.get_safe("os") self._os_build, _, self._os_host, _ = get_cross_building_settings(self._settings) self._compiler = self._settings.get_safe("compiler") self._compiler_version = self._settings.get_safe("compiler.version") self._arch = self._settings.get_safe("arch") self._op_system_version = self._settings.get_safe("os.version") self._libcxx = self._settings.get_safe("compiler.libcxx") self._runtime = self._settings.get_safe("compiler.runtime") self._build_type = self._settings.get_safe("build_type") self._cppstd = self._settings.get_safe("cppstd") self.generator = generator or self._generator() self.toolset = self._toolset(toolset) self.build_dir = None self._cmake_system_name = _get_env_cmake_system_name() if self._cmake_system_name is None: # Not overwritten using environment self._cmake_system_name = cmake_system_name self.parallel = parallel self._set_cmake_flags = set_cmake_flags self.definitions = self._get_cmake_definitions() if build_type and build_type != self._build_type: # Call the setter to warn and update the definitions if needed self.build_type = build_type make_program = os.getenv("CONAN_MAKE_PROGRAM") or make_program if make_program: if not tools.which(make_program): self._conanfile.output.warn("The specified make program '%s' cannot be found" "and will be ignored" % make_program) else: self._conanfile.output.info("Using '%s' as CMAKE_MAKE_PROGRAM" % make_program) self.definitions["CMAKE_MAKE_PROGRAM"] = make_program
def test_which_negative(self): tmp_dir = temp_folder() with tools.environment_append({'PATH': tmp_dir}): self.assertIsNone(tools.which('example.sh'))