[DEV] Add C++ 17 and better support for Android platform
This commit is contained in:
parent
663188773d
commit
54fddc82b5
@ -46,7 +46,7 @@ def enable_color():
|
|||||||
global color_yellow
|
global color_yellow
|
||||||
color_yellow = "\033[33m"
|
color_yellow = "\033[33m"
|
||||||
global color_blue
|
global color_blue
|
||||||
color_blue = "\033[34m"
|
color_blue = "\033[01;34m"
|
||||||
global color_purple
|
global color_purple
|
||||||
color_purple = "\033[35m"
|
color_purple = "\033[35m"
|
||||||
global color_cyan
|
global color_cyan
|
||||||
|
@ -689,7 +689,7 @@ class Module:
|
|||||||
self.append_to_internal_list2(self.flags["local"], type, list)
|
self.append_to_internal_list2(self.flags["local"], type, list)
|
||||||
|
|
||||||
def compile_version_XX(self, version, same_as_api=True, gnu=False):
|
def compile_version_XX(self, version, same_as_api=True, gnu=False):
|
||||||
cpp_version_list = [1999, 2003, 2011, 2014]
|
cpp_version_list = [1999, 2003, 2011, 2014, 2017]
|
||||||
if version not in cpp_version_list:
|
if version not in cpp_version_list:
|
||||||
debug.error("can not select CPP version : " + str(version) + " not in " + str(cpp_version_list))
|
debug.error("can not select CPP version : " + str(version) + " not in " + str(cpp_version_list))
|
||||||
# select API version:
|
# select API version:
|
||||||
@ -740,11 +740,15 @@ class Module:
|
|||||||
def copy_path(self, source, destination=''):
|
def copy_path(self, source, destination=''):
|
||||||
self.paths.append([source, destination])
|
self.paths.append([source, destination])
|
||||||
|
|
||||||
def print_list(self, description, list):
|
def print_list(self, description, input_list):
|
||||||
if len(list) > 0:
|
if type(input_list) == list:
|
||||||
|
if len(input_list) > 0:
|
||||||
|
print(' ' + str(description))
|
||||||
|
for elem in input_list:
|
||||||
|
print(' ' + str(elem))
|
||||||
|
else:
|
||||||
print(' ' + str(description))
|
print(' ' + str(description))
|
||||||
for elem in list:
|
print(' ' + str(input_list))
|
||||||
print(' ' + str(elem))
|
|
||||||
|
|
||||||
def display(self, target):
|
def display(self, target):
|
||||||
print('-----------------------------------------------')
|
print('-----------------------------------------------')
|
||||||
@ -759,22 +763,22 @@ class Module:
|
|||||||
|
|
||||||
for element in self.flags["local"]:
|
for element in self.flags["local"]:
|
||||||
value = self.flags["local"][element]
|
value = self.flags["local"][element]
|
||||||
self.print_list('flags ' + element, value)
|
self.print_list('flags "' + str(element) + '"', value)
|
||||||
|
|
||||||
for element in self.flags["export"]:
|
for element in self.flags["export"]:
|
||||||
value = self.flags["export"][element]
|
value = self.flags["export"][element]
|
||||||
self.print_list('flags export ' + element, value)
|
self.print_list('flags export "' + str(element) + '"', value)
|
||||||
|
|
||||||
self.print_list('src',self.src)
|
self.print_list('src',self.src)
|
||||||
self.print_list('files',self.files)
|
self.print_list('files',self.files)
|
||||||
self.print_list('paths',self.paths)
|
self.print_list('paths',self.paths)
|
||||||
for element in self.path["local"]:
|
for element in self.path["local"]:
|
||||||
value = self.path["local"][element]
|
value = self.path["local"][element]
|
||||||
self.print_list('local path ' + element, value)
|
self.print_list('local path ' + str(element), value)
|
||||||
|
|
||||||
for element in self.path["export"]:
|
for element in self.path["export"]:
|
||||||
value = self.path["export"][element]
|
value = self.path["export"][element]
|
||||||
self.print_list('export path ' + element, value)
|
self.print_list('export path ' + str(element), value)
|
||||||
|
|
||||||
|
|
||||||
def pkg_set(self, variable, value):
|
def pkg_set(self, variable, value):
|
||||||
|
@ -115,8 +115,13 @@ def get_version_compilation_flags(flags, dependency_flags):
|
|||||||
is_gnu = default_version_gnu
|
is_gnu = default_version_gnu
|
||||||
|
|
||||||
version = max(version_local, dependency_version)
|
version = max(version_local, dependency_version)
|
||||||
|
if version == 2017:
|
||||||
|
debug.error("not supported flags for X17 ...");
|
||||||
|
if is_gnu == True:
|
||||||
|
out = ["-std=gnu++17", "-D__CPP_VERSION__=2017"]
|
||||||
|
else:
|
||||||
|
out = ["-std=c++17", "-D__CPP_VERSION__=2017"]
|
||||||
if version == 2014:
|
if version == 2014:
|
||||||
debug.error("not supported flags for X14 ...");
|
|
||||||
if is_gnu == True:
|
if is_gnu == True:
|
||||||
out = ["-std=gnu++14", "-D__CPP_VERSION__=2014"]
|
out = ["-std=gnu++14", "-D__CPP_VERSION__=2014"]
|
||||||
else:
|
else:
|
||||||
|
@ -91,7 +91,8 @@ def link(file, binary, target, depancy, name, basic_path, static=False):
|
|||||||
lib_name = elem[len(lib_path)+len(target.prefix_lib)+1:-len(target.suffix_lib_dynamic)]
|
lib_name = elem[len(lib_path)+len(target.prefix_lib)+1:-len(target.suffix_lib_dynamic)]
|
||||||
cmd.append("-L" + lib_path)
|
cmd.append("-L" + lib_path)
|
||||||
cmd.append("-l" + lib_name)
|
cmd.append("-l" + lib_name)
|
||||||
if target.name != "MacOs":
|
if target != "MacOs" \
|
||||||
|
and target.name != "Android":
|
||||||
if len(list_dynamic) > 0:
|
if len(list_dynamic) > 0:
|
||||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||||
except:
|
except:
|
||||||
|
@ -214,7 +214,29 @@ class Target(target.Target):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
#The package generated depend of the type of the element:
|
||||||
|
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||||
|
module = self.get_module(end_point_module_name)
|
||||||
|
if module == None:
|
||||||
|
debug.error("can not create package ... ");
|
||||||
|
if module.get_type() == 'PREBUILD':
|
||||||
|
#nothing to do ...
|
||||||
|
return
|
||||||
|
if module.get_type() == 'LIBRARY' \
|
||||||
|
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||||
|
or module.get_type() == 'LIBRARY_STATIC':
|
||||||
|
debug.info("Can not create package for library");
|
||||||
|
return
|
||||||
|
if module.get_type() == 'BINARY' \
|
||||||
|
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||||
|
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||||
|
if module.get_type() == 'BINARY_SHARED':
|
||||||
|
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||||
|
if module.get_type() == 'PACKAGE':
|
||||||
|
debug.info("Can not create package for package");
|
||||||
|
return
|
||||||
|
|
||||||
|
def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Generate package '" + pkg_name + "'")
|
debug.info("Generate package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
@ -223,8 +245,6 @@ class Target(target.Target):
|
|||||||
target_outpath = self.get_staging_path(pkg_name)
|
target_outpath = self.get_staging_path(pkg_name)
|
||||||
tools.create_directory_of_file(target_outpath)
|
tools.create_directory_of_file(target_outpath)
|
||||||
|
|
||||||
# TODO : Remove :
|
|
||||||
static = True
|
|
||||||
## Create share datas
|
## Create share datas
|
||||||
if static == True:
|
if static == True:
|
||||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
|
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user