def _libcxx_flags(self, compiler, libcxx): lib_flags = [] if libcxx: if conan_version >= Version("1.26"): stdlib_define = libcxx_define(self._settings) cxxf = libcxx_flag(self._settings) else: stdlib_define = libcxx_define(compiler=compiler, libcxx=libcxx) cxxf = libcxx_flag(compiler=compiler, libcxx=libcxx) lib_flags.extend(format_defines([stdlib_define])) if cxxf: lib_flags.append(cxxf) return lib_flags
def __init__(self, conanfile): self._conanfile = conanfile self._build_type = conanfile.settings.get_safe("build_type") self._compiler = conanfile.settings.get_safe("compiler") self._compiler_version = conanfile.settings.get_safe( "compiler.version") self._compiler_runtime = conanfile.settings.get_safe( "compiler.runtime") self._shared = self._conanfile.options.get_safe("shared") self._fpic = self._deduce_fpic() self._libcxx_flag = libcxx_flag(conanfile.settings) self._cppstd_flag = cppstd_flag(conanfile.settings) self._skip_rpath = True if self._conanfile.settings.get_safe( "os") == "Macos" else False self._arch_flag = architecture_flag(self._conanfile.settings) self._build_type_flags = build_type_flags(self._conanfile.settings) self._os_host = conanfile.settings.get_safe("os") self._arch_host = conanfile.settings.get_safe("arch") self._os_target, self._arch_target = get_target_os_arch(conanfile) self._arch_build, self._os_build = self._get_build_os_arch() self._trip_build, self._trip_host, self._trip_target = self._get_host_build_target_flags( ) self._build_type_define = build_type_define( build_type=self._build_type) self._glibcxx_define = libcxx_define(self._conanfile.settings) self.variables = {} self.preprocessor_definitions = {}
def _libcxx_flags(self, compiler, libcxx): lib_flags = [] if libcxx: stdlib_define = libcxx_define(compiler=compiler, libcxx=libcxx) lib_flags.extend(format_defines([stdlib_define])) cxxf = libcxx_flag(compiler=compiler, libcxx=libcxx) if cxxf: lib_flags.append(cxxf) return lib_flags
def _libcxx_flags(self): libcxx = self._settings.get_safe("compiler.libcxx") lib_flags = [] if libcxx: stdlib_define = libcxx_define(self._settings) lib_flags.extend(format_defines([stdlib_define])) cxxf = libcxx_flag(self._settings) if cxxf: lib_flags.append(cxxf) return lib_flags
def _libcxx_flags(self): libcxx = self.conanfile.settings.get_safe("compiler.libcxx") compiler = self.conanfile.settings.get_safe("compiler") lib_flags = [] if libcxx: stdlib_define = libcxx_define(compiler=compiler, libcxx=libcxx) lib_flags.extend(format_defines([stdlib_define])) cxxf = libcxx_flag(compiler=compiler, libcxx=libcxx) if cxxf: lib_flags.append(cxxf) return lib_flags
def test_libcxx_flags(self): arch_define = libcxx_define(compiler='gcc', libcxx='libstdc++') self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=0') arch_define = libcxx_define(compiler='gcc', libcxx='libstdc++11') self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=1') arch_flags = libcxx_flag(compiler='clang', libcxx='libc++') self.assertEquals(arch_flags, '-stdlib=libc++') arch_flags = libcxx_flag(compiler='clang', libcxx='libstdc++') self.assertEquals(arch_flags, '-stdlib=libstdc++') arch_define = libcxx_define(compiler='clang', libcxx='libstdc++') self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=0') arch_flags = libcxx_flag(compiler='clang', libcxx='libstdc++') self.assertEquals(arch_flags, '-stdlib=libstdc++') arch_define = libcxx_define(compiler='clang', libcxx='libstdc++') self.assertEquals(arch_define, '_GLIBCXX_USE_CXX11_ABI=0') arch_flags = libcxx_flag(compiler='apple-clang', libcxx='libc++') self.assertEquals(arch_flags, '-stdlib=libc++') arch_flags = libcxx_flag(compiler='Visual Studio', libcxx=None) self.assertEquals(arch_flags, "") arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libCstd') self.assertEquals(arch_flags, '-library=Cstd') arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libstdcxx') self.assertEquals(arch_flags, '-library=stdcxx4') arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libstlport') self.assertEquals(arch_flags, '-library=stlport4') arch_flags = libcxx_flag(compiler='sun-cc', libcxx='libstdc++') self.assertEquals(arch_flags, '-library=stdcpp')
def _configure_cxx_flags(self): ret = copy.copy(self._deps_cpp_info.cxxflags) cxxf = libcxx_flag(compiler=self._compiler, libcxx=self._libcxx) if cxxf: ret.append(cxxf) return ret
def test_libcxx_flags_qnx(self, libcxx): settings = MockSettings({"compiler": "qcc", "compiler.libcxx": libcxx}) arch_flags = libcxx_flag(settings) self.assertEqual(arch_flags, '-Y _%s' % libcxx)
def test_libcxx_flags(self, compiler, libcxx, flag): settings = MockSettings({"compiler": compiler, "compiler.libcxx": libcxx}) self.assertEqual(libcxx_flag(settings), flag)
def _configure_cxx_flags(self): ret = copy.copy(self._deps_cpp_info.cxxflags) cxxf = libcxx_flag(self._conanfile.settings) if cxxf: ret.append(cxxf) return ret
def _configure_cxx_flags(self): ret = copy.copy(self._deps_cpp_info.cppflags) cxxf = libcxx_flag(compiler=self._compiler, libcxx=self._libcxx) if cxxf: ret.append(cxxf) return ret
def test_libcxx_flags_qnx(self, libcxx): arch_flags = libcxx_flag(compiler='qcc', libcxx=libcxx) self.assertEqual(arch_flags, '-Y _%s' % libcxx)
def test_libcxx_flags(self, compiler, libcxx, flag): self.assertEqual(libcxx_flag(compiler=compiler, libcxx=libcxx), flag)