Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds new architectures: ppc32, armv8_32 and armv8.3 #4195

Merged
merged 13 commits into from Jan 10, 2019
6 changes: 3 additions & 3 deletions conans/client/conf/__init__.py
Expand Up @@ -14,12 +14,12 @@
default_settings_yml = """
# Only for cross building, 'os_build/arch_build' is the system that runs Conan
os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS]
arch_build: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k]
arch_build: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr]

# Only for building cross compilation tools, 'os_target/arch_target' is the system for
# which the tools generate code
os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, Arduino]
arch_target: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k]
arch_target: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr]

# Rest of the settings are "host" settings:
# - For native building/cross building: Where the library/program will run.
Expand All @@ -44,7 +44,7 @@
SunOS:
Arduino:
board: ANY
arch: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k]
arch: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr]
compiler:
sun-cc:
version: ["5.10", "5.11", "5.12", "5.13", "5.14"]
Expand Down
113 changes: 56 additions & 57 deletions conans/client/generators/b2.py
Expand Up @@ -14,18 +14,20 @@


class B2Generator(Generator):
_b2_variation_key = None
danimtb marked this conversation as resolved.
Show resolved Hide resolved
_b2_variation_id = None

@property
def filename(self):
pass # in this case, filename defined in return value of content method

@property
def content(self):
'''
"""
Generates two content files: conanbuildinfo.jam and conanbuildinfo-ID.jam which
the former defines sub-projects for each package and loads the other files and
the latter define variables and targets for the packages.
'''
"""
result = {
'conanbuildinfo.jam': None,
self.conanbuildinfo_variation_jam: None
Expand Down Expand Up @@ -56,7 +58,7 @@ def content(self):
cbiv = [self.conanbuildinfo_header_text]
# The first, 1, set of variables are collective in that they have the info for all
# of the packages combined, 1a.
cbiv += ["# global" ]
cbiv += ["# global"]
cbiv += self.b2_constants_for_dep('conan', self.deps_build_info)
# Now the constants for individual packages, 1b.
for dep_name, dep_cpp_info in self.deps_build_info.dependencies:
Expand All @@ -72,22 +74,22 @@ def content(self):
return result

def b2_project_for_dep(self, name, info):
'''
"""
Generates a sub-project definition to match the package. Which is used later
to define targets for the package libs.
'''
"""
if not info:
return []
name = name.lower()
# Create a b2 project for the package dependency.
return [self.conanbuildinfo_project_template.format(name=name)]

def b2_constants_for_dep(self, name, info, user=None):
'''
"""
Generates a list of constant variable definitions for the information in the
CppInfo conan data given for the package. If user variables map is also given
those are also generated following the package variables.
'''
"""
if not info:
return []
name = name.lower()
Expand Down Expand Up @@ -119,10 +121,10 @@ def b2_constants_for_dep(self, name, info, user=None):
return result

def b2_targets_for_dep(self, name, info):
'''
"""
Generates individual targets for the libraries in a package and a single "libs"
collective alias target that refers to them.
'''
"""
if not info:
return []
name = name.lower()
Expand All @@ -140,10 +142,10 @@ def b2_targets_for_dep(self, name, info):
return result

def b2_constant(self, name, var, val, is_paths=False):
'''
"""
Generates a constant definition for the given variable and value(s). If is_path
is True the value(s) are reformated to be acceptable to b2.
'''
is True the value(s) are reformatted to be acceptable to b2.
"""
if not val:
return []
if is_paths:
Expand All @@ -158,46 +160,43 @@ def b2_constant(self, name, var, val, is_paths=False):
name=name, var=var, variation=self.b2_variation_id, value="\n".join(value)
)]

def b2_path(self, p):
'''
Adjust a ragular path to the form b2 can use in source code.
'''
return p.replace('\\', '/')

def b2_features(self, m):
'''
Generated a b2 requirements list, i.e. <name>value list, from the given
map of key-values.
'''
@staticmethod
def b2_path(path):
"""
Adjust a regular path to the form b2 can use in source code.
"""
return path.replace('\\', '/')

@staticmethod
def b2_features(variations):
"""
Generated a b2 requirements list, i.e. <name>value list, from the given 'variations' dict.
"""
result = []
for k, v in sorted(m.items()):
for k, v in sorted(variations.items()):
if v:
result += ['<%s>%s' % (k, v)]
return result

@property
def conanbuildinfo_variation_jam(self):
return 'conanbuildinfo-%s.jam'%(self.b2_variation_key)

_b2_variation_key = None
return 'conanbuildinfo-%s.jam' % self.b2_variation_key

@property
def b2_variation_key(self):
'''
"""
A hashed key of the variation to use a UID for the variation.
'''
"""
if not self._b2_variation_key:
self._b2_variation_key = md5(self.b2_variation_id.encode('utf-8')).hexdigest()
return self._b2_variation_key

_b2_variation_id = None

@property
def b2_variation_id(self):
'''
"""
A compact single comma separated list of the variation where only the values
of the b2 variation are included in sorted by feature name order.
'''
"""
if not self._b2_variation_id:
vid = []
for k in sorted(self.b2_variation.keys()):
Expand All @@ -208,10 +207,10 @@ def b2_variation_id(self):

@property
def b2_variation(self):
'''
"""
Returns a map of b2 features & values as translated from conan settings that
can affect the link compatibility of libraries.
'''
"""
if not getattr(self, "_b2_variation_key", None):
self._b2_variation = {}
self._b2_variation['toolset'] = {
Expand All @@ -223,25 +222,25 @@ def b2_variation(self):
}.get(self.conanfile.settings.get_safe('compiler'))+'-'+self.b2_toolset_version
self._b2_variation['architecture'] = {
'x86': 'x86', 'x86_64': 'x86',
'ppc64le': 'power', 'ppc64': 'power',
'armv6': 'arm', 'armv7': 'arm', 'armv7hf': 'arm', 'armv8': 'arm',
'armv7s': 'arm', 'armv7k': 'arm',
'ppc64le': 'power', 'ppc64': 'power', 'ppc32': 'power',
'armv6': 'arm', 'armv7': 'arm', 'armv7hf': 'arm', 'armv7s': 'arm', 'armv7k': 'arm',
'armv8': 'arm', 'armv8_32': 'arm', 'armv8.3': 'arm',
'sparc': 'sparc', 'sparcv9': 'sparc',
'mips': 'mips1', 'mips64': 'mips64',
}.get(self.conanfile.settings.get_safe('arch'))
self._b2_variation['instruction-set'] = {
'armv6': 'armv6', 'armv7': 'armv7', 'armv7hf': None, 'armv7k': None,
'armv7s': 'armv7s', 'armv8': None, 'avr': None,
'armv7s': 'armv7s', 'armv8': None, 'armv8_32': None, 'armv8.3': None, 'avr': None,
'mips': None, 'mips64': None,
'ppc64le': None, 'ppc64': 'powerpc64',
'ppc64le': None, 'ppc64': 'powerpc64', 'ppc32': None,
'sparc': None, 'sparcv9': 'v9',
'x86': None, 'x86_64': None,
}.get(self.conanfile.settings.get_safe('arch'))
self._b2_variation['address-model'] = {
danimtb marked this conversation as resolved.
Show resolved Hide resolved
'x86': '32', 'x86_64': '64',
'ppc64le': '64', 'ppc64': '64',
'armv6': '32', 'armv7': '32', 'armv7hf': '32', 'armv8': '64',
'armv7s': '32', 'armv7k': '32',
'armv6': '32', 'armv7': '32', 'armv7s': '32', 'armv7k': '32', 'armv7hf': '32',
'armv8': '64', 'armv8_32': '32', 'armv8.3': "64",
'sparc': '32', 'sparcv9': '64',
'mips': '32', 'mips64': '64',
}.get(self.conanfile.settings.get_safe('arch'))
Expand Down Expand Up @@ -280,7 +279,7 @@ def b2_variation(self):
'2c': None, 'gnu2c': 'gnu',
}.get(self.conanfile.settings.get_safe('cppstd'))
return self._b2_variation

@property
def b2_toolset_version(self):
if self.conanfile.settings.compiler == 'Visual Studio':
Expand All @@ -290,14 +289,14 @@ def b2_toolset_version(self):
return str(self.conanfile.settings.compiler.version)+'.0'
return str(self.conanfile.settings.compiler.version)

conanbuildinfo_header_text = '''\
conanbuildinfo_header_text = """\
#|
B2 definitions for Conan packages. This is a generated file.
Edit the corresponding conanfile.txt instead.
|#
'''
"""

conanbuildinfo_prefix_text = '''\
conanbuildinfo_prefix_text = """\
import path ;
import project ;
import modules ;
Expand Down Expand Up @@ -375,45 +374,45 @@ def b2_toolset_version(self):
call-in-project : include-conanbuildinfo $(__cbi__) ;
}
}
'''
"""

conanbuildinfo_project_template = '''\
conanbuildinfo_project_template = """\
# {name}
project-define {name} ;
'''
"""

conanbuildinfo_postfix_text = '''\
conanbuildinfo_postfix_text = """\
{
local __define_targets__ = yes ;
for local __cbi__ in $(__conanbuildinfo__)
{
call-in-project : include-conanbuildinfo $(__cbi__) ;
}
}
'''
"""

conanbuildinfo_variation_constant_template = '''\
conanbuildinfo_variation_constant_template = """\
constant-if {var}({name},{variation}) :
{value}
;
'''
"""

conanbuildinfo_variation_lib_template = '''\
conanbuildinfo_variation_lib_template = """\
if $(__define_targets__) {{
call-in-project $({name}-mod) : lib {lib}
:
: <name>{lib} <search>$(libdirs({name},{variation})) $(requirements({name},{variation}))
:
: $(usage-requirements({name},{variation})) ;
call-in-project $({name}-mod) : explicit {lib} ; }}
'''
"""

conanbuildinfo_variation_alias_template = '''\
conanbuildinfo_variation_alias_template = """\
if $(__define_targets__) {{
call-in-project $({name}-mod) : alias libs
: {libs}
: $(requirements({name},{variation}))
:
: $(usage-requirements({name},{variation})) ;
call-in-project $({name}-mod) : explicit libs ; }}
'''
"""
18 changes: 10 additions & 8 deletions conans/client/migrations.py
Expand Up @@ -43,16 +43,16 @@ def _make_migrations(self, old_version):
# VERSION 0.1
if old_version is None:
return
if old_version < Version("1.9.0"):
if old_version < Version("1.12.0"):
old_settings = """
# Only for cross building, 'os_build/arch_build' is the system that runs Conan
os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS]
arch_build: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k]
arch_build: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr]

# Only for building cross compilation tools, 'os_target/arch_target' is the system for
# which the tools generate code
os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, Arduino]
arch_target: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k]
arch_target: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr]

# Rest of the settings are "host" settings:
# - For native building/cross building: Where the library/program will run.
Expand All @@ -77,7 +77,7 @@ def _make_migrations(self, old_version):
SunOS:
Arduino:
board: ANY
arch: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k]
arch: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr]
compiler:
sun-cc:
version: ["5.10", "5.11", "5.12", "5.13", "5.14"]
Expand All @@ -88,19 +88,21 @@ def _make_migrations(self, old_version):
"5", "5.1", "5.2", "5.3", "5.4", "5.5",
"6", "6.1", "6.2", "6.3", "6.4",
"7", "7.1", "7.2", "7.3",
"8", "8.1"]
"8", "8.1", "8.2"]
libcxx: [libstdc++, libstdc++11]
threads: [None, posix, win32] # Windows MinGW
exception: [None, dwarf2, sjlj, seh] # Windows MinGW
Visual Studio:
runtime: [MD, MT, MTd, MDd]
version: ["8", "9", "10", "11", "12", "14", "15"]
toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp,
v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp,
LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp,
v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp,
LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp,
LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2]
clang:
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", "5.0", "6.0", "7.0"]
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
"5.0", "6.0", "7.0",
"8"]
libcxx: [libstdc++, libstdc++11, libc++]
apple-clang:
version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0"]
Expand Down