[API/DOC] change API to have a good coherency

This commit is contained in:
Edouard DUPIN 2016-09-07 22:17:41 +02:00
parent 2ebe27a5a4
commit 40d2e8eac1
39 changed files with 571 additions and 394 deletions

View File

@ -39,12 +39,21 @@ class Module:
## @param[in] self (handle) Class handle ## @param[in] self (handle) Class handle
## @param[in] file (string) Plugin file name (use __file__ to get it) ## @param[in] file (string) Plugin file name (use __file__ to get it)
## @param[in] module_name (string) Name of the module ## @param[in] module_name (string) Name of the module
## @param[in] moduleType (string) Type of the module ## @param[in] module_type (string) Type of the module:
## - BINARY
## - BINARY_SHARED
## - BINARY_STAND_ALONE
## - LIBRARY
## - LIBRARY_DYNAMIC
## - LIBRARY_STATIC
## - PACKAGE
## - PREBUILD
## - DATA
## @return None ## @return None
## ##
def __init__(self, file, module_name, moduleType): def __init__(self, file, module_name, module_type):
## Remove all variable to prevent error of multiple deffinition of the module ... ## Remove all variable to prevent error of multiple deffinition of the module ...
debug.verbose("Create a new module : '" + module_name + "' TYPE=" + moduleType) debug.verbose("Create a new module : '" + module_name + "' TYPE=" + module_type)
self._origin_file='' self._origin_file=''
self._origin_path='' self._origin_path=''
# type of the module: # type of the module:
@ -78,19 +87,19 @@ class Module:
# The module has been already build ... # The module has been already build ...
self._isbuild = False self._isbuild = False
## end of basic INIT ... ## end of basic INIT ...
if moduleType == 'BINARY' \ if module_type == 'BINARY' \
or moduleType == 'BINARY_SHARED' \ or module_type == 'BINARY_SHARED' \
or moduleType == 'BINARY_STAND_ALONE' \ or module_type == 'BINARY_STAND_ALONE' \
or moduleType == 'LIBRARY' \ or module_type == 'LIBRARY' \
or moduleType == 'LIBRARY_DYNAMIC' \ or module_type == 'LIBRARY_DYNAMIC' \
or moduleType == 'LIBRARY_STATIC' \ or module_type == 'LIBRARY_STATIC' \
or moduleType == 'PACKAGE' \ or module_type == 'PACKAGE' \
or moduleType == 'PREBUILD' \ or module_type == 'PREBUILD' \
or moduleType == 'DATA': or module_type == 'DATA':
self._type=moduleType self._type=module_type
else : else :
debug.error('for module "%s"' %module_name) debug.error('for module "%s"' %module_name)
debug.error(' ==> error : "%s" ' %moduleType) debug.error(' ==> error : "%s" ' %module_type)
raise 'Input value error' raise 'Input value error'
self._origin_file = file; self._origin_file = file;
self._origin_path = tools.get_current_path(self._origin_file) self._origin_path = tools.get_current_path(self._origin_file)
@ -184,7 +193,7 @@ class Module:
## @param[in] self (handle) Class handle ## @param[in] self (handle) Class handle
## @return None ## @return None
## ##
def add_extra_compile_flags(self): def add_extra_flags(self):
self.add_flag('c', [ self.add_flag('c', [
"-Wall", "-Wall",
"-Wsign-compare", "-Wsign-compare",
@ -514,7 +523,7 @@ class Module:
# optionnal dependency : # optionnal dependency :
for dep, option, export in self._depends_optionnal: for dep, option, export in self._depends_optionnal:
debug.verbose("try find optionnal dependency: '" + str(dep) + "'") debug.verbose("try find optionnal dependency: '" + str(dep) + "'")
inherit_list, isBuilt = target.build(dep, package_name, True) inherit_list, isBuilt = target.build(dep, True)
if isBuilt == True: if isBuilt == True:
self._local_heritage.add_depends(dep); self._local_heritage.add_depends(dep);
# TODO : Add optionnal Flags ... # TODO : Add optionnal Flags ...
@ -527,7 +536,7 @@ class Module:
self._sub_heritage_list.add_heritage_list(inherit_list) self._sub_heritage_list.add_heritage_list(inherit_list)
for dep in self._depends: for dep in self._depends:
debug.debug("module: '" + str(self._name) + "' request: '" + dep + "'") debug.debug("module: '" + str(self._name) + "' request: '" + dep + "'")
inherit_list = target.build(dep, package_name, False) inherit_list = target.build(dep, False)
# add at the heritage list : # add at the heritage list :
self._sub_heritage_list.add_heritage_list(inherit_list) self._sub_heritage_list.add_heritage_list(inherit_list)
# do sub library action for automatic generating ... # do sub library action for automatic generating ...
@ -927,9 +936,15 @@ class Module:
## @param[in] list ([string,...] or string) Name(s) of the modules dependency ## @param[in] list ([string,...] or string) Name(s) of the modules dependency
## @return None ## @return None
## ##
def add_module_depend(self, list): def add_depend(self, list):
tools.list_append_to(self._depends, list, True) tools.list_append_to(self._depends, list, True)
## @brief deprecated ...
## @return None
def add_module_depend(self, list):
debug.warning("[" + self._name + "] add_module_depend is deprecated ==> use add_depend(...)")
self.add_depend(list)
## ##
## @brief Add an optionnal dependency on this module ## @brief Add an optionnal dependency on this module
## @param[in] self (handle) Class handle ## @param[in] self (handle) Class handle
@ -938,9 +953,15 @@ class Module:
## @param[in] export (bool) export the flat that has been requested to add if module is present. ## @param[in] export (bool) export the flat that has been requested to add if module is present.
## @return None ## @return None
## ##
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False): def add_optionnal_depend(self, module_name, compilation_flags=["", ""], export=False):
tools.list_append_and_check(self._depends_optionnal, [module_name, compilation_flags, export], True) tools.list_append_and_check(self._depends_optionnal, [module_name, compilation_flags, export], True)
## @brief deprecated ...
## @return None
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
debug.warning("[" + self._name + "] add_optionnal_module_depend is deprecated ==> use add_optionnal_depend(...)")
self.add_optionnal_depend(module_name, compilation_flags, export)
## ##
## @brief Add a path to include when build ## @brief Add a path to include when build
## @param[in] self (handle) Class handle ## @param[in] self (handle) Class handle
@ -961,7 +982,6 @@ class Module:
debug.warning("[" + self._name + "] add_export_path is deprecated ==> use add_path(xxx, yyy, export=True)") debug.warning("[" + self._name + "] add_export_path is deprecated ==> use add_path(xxx, yyy, export=True)")
self.add_path(list, type, export=True) self.add_path(list, type, export=True)
## ##
## @brief Add compilation flags ## @brief Add compilation flags
## @param[in] self (handle) Class handle ## @param[in] self (handle) Class handle
@ -979,13 +999,13 @@ class Module:
## @brief deprecated ... ## @brief deprecated ...
## @return None ## @return None
def add_export_flag(self, type, list): def add_export_flag(self, type, list):
debug.warning("[" + self._name + "] Add_export_flag is deprecated ==> use add_flag(xxx, yyy, export=True)") debug.warning("[" + self._name + "] add_export_flag is deprecated ==> use add_flag(xxx, yyy, export=True)")
self.add_flag(type, list, export=True) self.add_flag(type, list, export=True)
## @brief deprecated ... ## @brief deprecated ...
## @return None ## @return None
def compile_flags(self, type, list): def compile_flags(self, type, list):
debug.warning("[" + self._name + "] Compile_flags is deprecated ==> use add_flag(xxx, yyy)") debug.warning("[" + self._name + "] compile_flags is deprecated ==> use add_flag(xxx, yyy)")
self.add_flag(type, list) self.add_flag(type, list)
## ##
@ -1345,39 +1365,6 @@ class Module:
else: else:
self._package_prop[variable] = [value] self._package_prop[variable] = [value]
##
## @brief Add an external project module
## @param[in] self (handle) Class handle
## @param[in] target (handle) @ref lutin.target.Target handle
## @param[in] projectMng (string) name of the project manager
## @param[in] added_module ([string,...]) Modules to add
## @return None
##
def ext_project_add_module(self, target, projectMng, added_module = []):
if self._name in added_module:
return
added_module.append(self._name)
debug.verbose("add a module to the project generator :" + self._name)
debug.verbose("local path :" + self._origin_path)
projectMng.add_files(self._name, self._origin_path, self._src)
#projectMng.add_data_file(self.origin_path, self.files)
#projectMng.add_data_path(self.origin_path, self.paths)
"""
for depend in self.depends:
target.project_add_module(depend, projectMng, added_module)
"""
##
## @brief Create a project for external build environement
## @param[in] self (handle) Class handle
## @param[in] target (handle) @ref lutin.target.Target handle
## @param[in] projectMng (string) name of the project manager
## @return None
##
def create_project(self, target, projectMng):
projectMng.set_project_name(self._name)
self.ext_project_add_module(target, projectMng)
projectMng.generate_project_file()
__module_list=[] __module_list=[]
__start_module_name="_" __start_module_name="_"

View File

@ -22,40 +22,78 @@ from . import env
## @brief System class represent the pre-build Module that are already install and accessible in the system environment ## @brief System class represent the pre-build Module that are already install and accessible in the system environment
## ##
class System: class System:
##
## @brief Constructor
## @param[in] self (handle) Class handle
## @return None
##
def __init__(self): def __init__(self):
self.valid=False; self._valid=False;
self.help=""; self._help="";
self.export_depends=[] self._export_depends=[]
self.export_flags={} self._export_flags={}
self.export_src=[] self._export_src=[]
self.export_path=[] self._export_path=[]
self.action_on_state={} self._action_on_state={}
self.headers=[] self._headers=[]
self.version=None self._version=None
##
def add_export_sources(self, list): ## @brief Add source element
tools.list_append_to(self.export_src, list) ## @param[in] self (handle) Class handle
## @param[in] list ([string,...]) List of all Files to add. ex: *.a, *.so ...
## @return None
##
def add_sources(self, list):
tools.list_append_to(self._export_src, list)
##
## @brief Add include path of the sources
## @param[in] self (handle) Class handle
## @param[in] list ([string,...]) List of all path to add in the -I include element
## @return None
##
# todo : add other than C ... # todo : add other than C ...
def add_export_path(self, list): def add_path(self, list):
tools.list_append_to(self.export_path, list) tools.list_append_to(self._export_path, list)
def add_module_depend(self, list): ##
tools.list_append_to(self.export_depends, list, True) ## @brief Add a dependency on this module
## @param[in] self (handle) Class handle
## @param[in] list ([string,...] or string) Name(s) of the modules dependency
## @return None
##
def add_depend(self, list):
tools.list_append_to(self._export_depends, list, True)
def add_export_flag(self, type, list): ##
tools.list_append_to_2(self.export_flags, type, list) ## @brief Add compilation flags
## @param[in] self (handle) Class handle
## @param[in] type (string) inclusion group name 'c', 'c++', 'java' ...
## @param[in] list ([string,...] or string) List of path to include
## @return None
##
def add_flag(self, type, list):
tools.list_append_to_2(self._export_flags, type, list)
##
## @brief Set version of the module
## @param[in] self (handle) Class handle
## @param[in] version_list ([int,...]) Ids of the version. ex: [1,2,5] or [0,8,"dev"]
## @return None
##
def set_version(self, version_list): def set_version(self, version_list):
self.version = version_list self._version = version_list
## @copydoc lutin.module.Target.add_action
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None): def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
if name_of_state not in self.action_on_add_src_filestate: if name_of_state not in self._action_on_state:
self.action_on_state[name_of_state] = [[level, name, action]] self._action_on_state[name_of_state] = [[level, name, action]]
else: else:
self.action_on_state[name_of_state].append([level, name, action]) self._action_on_state[name_of_state].append([level, name, action])
## @copydoc lutin.module.Module.add_header_file
def add_header_file(self, list, destination_path=None, clip_path=None, recursive=False): def add_header_file(self, list, destination_path=None, clip_path=None, recursive=False):
self.headers.append({ self._headers.append({
"list":list, "list":list,
"dst":destination_path, "dst":destination_path,
"clip":clip_path, "clip":clip_path,
@ -69,40 +107,55 @@ class System:
def __repr__(self): def __repr__(self):
return "{lutin.System}" return "{lutin.System}"
##
## @brief Configure a module with internal datas
def create_module_from_system(target, dict): ## @param[in] self (handle) Class handle
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD') ## @param[in] target (handle) @ref lutin.module.Target handle
## @param[in] module (handle) @ref lutin.module.Module handle
## @return None
##
def configure_module(self, target, module):
# add element flags to export # add element flags to export
for elem in dict["system"].export_flags: for elem in self._export_flags:
debug.verbose("add element :" + str(elem) + " elems=" + str(dict["system"].export_flags[elem])) debug.verbose("add element :" + str(elem) + " elems=" + str(self._export_flags[elem]))
myModule.add_flag(elem, dict["system"].export_flags[elem], export=True) module.add_flag(elem, self._export_flags[elem], export=True)
# add module dependency # add module dependency
myModule.add_module_depend(dict["system"].export_depends) module.add_depend(self._export_depends)
# add exporting sources # add exporting sources
myModule.add_src_file(dict["system"].export_src) module.add_src_file(self._export_src)
# add export path # add export path
myModule.add_path(dict["system"].export_path, export=True) module.add_path(self._export_path, export=True)
# Export all actions ... # Export all actions ...
for elem in dict["system"].action_on_state: for elem in self._action_on_state:
level, name, action = dict["system"].action_on_state[elem] level, name, action = self._action_on_state[elem]
target.add_action(elem, level, name, action) target.add_action(elem, level, name, action)
for elem in dict["system"].headers: for elem in self._headers:
myModule.add_header_file( module.add_header_file(
elem["list"], elem["list"],
destination_path=elem["dst"], destination_path=elem["dst"],
clip_path=elem["clip"], clip_path=elem["clip"],
recursive=elem["recursive"]) recursive=elem["recursive"])
if dict["system"].version != None: if self._version != None:
myModule.package_prop["VERSION"] = dict["system"].version module.pkg_set("VERSION", self._version);
return myModule
##
## @brief Create a @ref lutin.module.Module for the system list elements
## @param[in] target (handle) @ref lutin.target.Target handle
## @param[in] name (string) Name of the system module
##
def create_module_from_system(target, dict):
my_module = module.Module(dict["path"], dict["name"], 'PREBUILD')
dict["system"].configure_module(target, my_module)
return my_module
# Dictionnaire of Target name # Dictionnaire of Target name
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded] # inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
system_list={} __system_list={}
__start_system_name="System_" __start_system_name="System_"
## ##
@ -110,7 +163,7 @@ __start_system_name="System_"
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster) ## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
## ##
def import_path(path_list): def import_path(path_list):
global system_list global __system_list
global_base = env.get_build_system_base_name() global_base = env.get_build_system_base_name()
debug.debug("SYSTEM: Init with Files list:") debug.debug("SYSTEM: Init with Files list:")
for elem in path_list: for elem in path_list:
@ -129,49 +182,49 @@ def import_path(path_list):
system_name = filename[len(__start_system_name):] system_name = filename[len(__start_system_name):]
system_type, system_name = system_name.split('_') system_type, system_name = system_name.split('_')
debug.verbose("SYSTEM: Integrate: '" + system_type + "':'" + system_name + "' from '" + elem + "'") debug.verbose("SYSTEM: Integrate: '" + system_type + "':'" + system_name + "' from '" + elem + "'")
if system_type in system_list: if system_type in __system_list:
system_list[system_type].append({"name":system_name, __system_list[system_type].append({"name":system_name,
"path":elem, "path":elem,
"system":None, "system":None,
"loaded":False, "loaded":False,
"exist":False, "exist":False,
"module":None}) "module":None})
else: else:
system_list[system_type] = [{"name":system_name, __system_list[system_type] = [{"name":system_name,
"path":elem, "path":elem,
"system":None, "system":None,
"loaded":False, "loaded":False,
"exist":False, "exist":False,
"module":None}] "module":None}]
debug.verbose("New list system: ") debug.verbose("New list system: ")
for elem in system_list: for elem in __system_list:
debug.verbose(" " + str(elem)) debug.verbose(" " + str(elem))
for val in system_list[elem]: for val in __system_list[elem]:
debug.verbose(" " + str(val["name"])) debug.verbose(" " + str(val["name"]))
## ##
## @brief Display all the system binary that can be used ## @brief Display all the system binary that can be used
## ##
def display(): def display():
global system_list global __system_list
for elementName in system_list: for elementName in __system_list:
debug.info("SYSTEM: Integrate system: '" + elementName +"'") debug.info("SYSTEM: Integrate system: '" + elementName +"'")
for data in system_list[elementName]: for data in __system_list[elementName]:
debug.info("SYSTEM: '" + data["name"] +"' in " + data["path"]) debug.info("SYSTEM: '" + data["name"] +"' in " + data["path"])
## ##
## @brief Check if a library is availlable for a specific target ## @brief Check if a system Module is availlable for a specific target
## @param[in] lib_name (string) Name of the Library ## @param[in] lib_name (string) Name of the Library
## @param[in] target_name (string) Name of the target ## @param[in] target_name (string) Name of the target
## @param[in] target (handle) Handle on the @ref Target build engine ## @param[in] target (handle) Handle on the @ref Target build engine
## @return ## @return (bool) find the system lib or not
## ##
def exist(lib_name, target_name, target) : def exist(lib_name, target_name, target) :
global system_list global __system_list
debug.verbose("exist= " + lib_name + " in " + target_name) debug.verbose("exist= " + lib_name + " in " + target_name)
if target_name not in system_list: if target_name not in __system_list:
return False return False
for data in system_list[target_name]: for data in __system_list[target_name]:
if data["name"] == lib_name: if data["name"] == lib_name:
# we find it in the List ==> need to check if it is present in the system : # we find it in the List ==> need to check if it is present in the system :
if data["loaded"] == False: if data["loaded"] == False:
@ -189,11 +242,18 @@ def exist(lib_name, target_name, target) :
return data["exist"] return data["exist"]
return False return False
##
## @brief Load a system Module for a specific target
## @param[in] target (handle) Handle on the @ref Target build engine
## @param[in] lib_name (string) Name of the Library
## @param[in] target_name (string) Name of the target
## @return None
##
def load(target, lib_name, target_name): def load(target, lib_name, target_name):
global system_list global __system_list
if target_name not in system_list: if target_name not in __system_list:
debug.error("you must call this function after checking of the system exist() !1!") debug.error("you must call this function after checking of the system exist() !1!")
for data in system_list[target_name]: for data in __system_list[target_name]:
if data["name"] == lib_name: if data["name"] == lib_name:
if data["exist"] == False: if data["exist"] == False:
debug.error("you must call this function after checking of the system exist() !2!") debug.error("you must call this function after checking of the system exist() !2!")

View File

@ -25,6 +25,12 @@ from . import env
## @brief Target class represent the buyild environement for a specific platform like Linux, or Android .... ## @brief Target class represent the buyild environement for a specific platform like Linux, or Android ....
## ##
class Target: class Target:
##
## @brief contructor
## @param[in] name (string) Name of the target
## @param[in] config (dict) User configuration
## @param[in] arch (string) specific parameter for gcc -arch element
##
def __init__(self, name, config, arch): def __init__(self, name, config, arch):
self.config = config self.config = config
@ -59,21 +65,6 @@ class Target:
# Target global variables. # Target global variables.
############################################################################### ###############################################################################
self.global_include_cc=[] self.global_include_cc=[]
"""
self.global_flags_cc=['-D__TARGET_OS__'+self.name,
'-D__TARGET_ARCH__'+self.select_arch,
'-D__TARGET_ADDR__'+self.select_bus + 'BITS',
'-D_REENTRANT']
self.global_flags_xx=[]
self.global_flags_mm=[]
if self.name == "Windows":
self.global_flags_xx=['-static-libgcc', '-static-libstdc++']
self.global_flags_mm=[]
self.global_flags_m=[]
self.global_flags_ar=['rcs']
self.global_flags_ld=[]
self.global_flags_ld_shared=[]
"""
self.global_flags={} self.global_flags={}
self.global_libs_ld=[] self.global_libs_ld=[]
@ -105,8 +96,10 @@ class Target:
self.add_flag("ar", 'rcs') self.add_flag("ar", 'rcs')
if self.name == "Windows": if self.name == "Windows":
self.add_flag("c++", ['-static-libgcc', '-static-libstdc++']) self.add_flag("c++", [
'-static-libgcc',
'-static-libstdc++'
])
if "debug" == self.config["mode"]: if "debug" == self.config["mode"]:
self.add_flag("c", [ self.add_flag("c", [
"-g", "-g",
@ -141,7 +134,7 @@ class Target:
"--coverage" "--coverage"
]) ])
self.update_path_tree() self._update_path_tree()
self.path_bin="bin" self.path_bin="bin"
self.path_lib="lib" self.path_lib="lib"
self.path_data="share" self.path_data="share"
@ -182,7 +175,8 @@ class Target:
## ##
## @brief Get the type of the target: ["Linux, ...] ## @brief Get the type of the target: ["Linux, ...]
## @return The current target name and other sub name type (ubuntu ...) ## @param[in] self (handle) Class handle
## @return ([string,...]) The current target name and other sub name type (ubuntu ...)
## ##
def get_type(self): def get_type(self):
out = [self.name] out = [self.name]
@ -192,20 +186,40 @@ class Target:
## ##
## @brief Get build mode of the target: ["debug", "release"] ## @brief Get build mode of the target: ["debug", "release"]
## @param[in] self (handle) Class handle
## @return The current target build mode. ## @return The current target build mode.
## ##
def get_mode(self): def get_mode(self):
return self.config["mode"] return self.config["mode"]
##
## @brief Add global target flags
## @param[in] self (handle) Class handle
## @param[in] type (string) inclusion group name 'c', 'c++', 'java' ...
## @param[in] list ([string,...] or string) List of path to include
## @return None
##
def add_flag(self, type, list): def add_flag(self, type, list):
tools.list_append_to_2(self.global_flags, type, list) tools.list_append_to_2(self.global_flags, type, list)
def update_path_tree(self): ##
## @brief Update basic tree path positions on the build tree
## @param[in] self (handle) Class handle
## @return None
##
def _update_path_tree(self):
self.path_out = os.path.join("out", self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"]) self.path_out = os.path.join("out", self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"])
self.path_final = os.path.join("final", self.config["compilator"]) self.path_final = os.path.join("final", self.config["compilator"])
self.path_staging = os.path.join("staging", self.config["compilator"]) self.path_staging = os.path.join("staging", self.config["compilator"])
self.path_build = os.path.join("build", self.config["compilator"]) self.path_build = os.path.join("build", self.config["compilator"])
# TODO: Remove this from here ==> this is a tools
##
## @brief create a string version number with the associated list values
## @param[in] self (handle) Class handle
## @param[in] data ([int|string,...]) version basic number
## @return (string) version number
##
def create_number_from_version_string(self, data): def create_number_from_version_string(self, data):
tmp_data = data.split("-") tmp_data = data.split("-")
if len(tmp_data) > 1: if len(tmp_data) > 1:
@ -225,6 +239,12 @@ class Target:
offset /= 1000 offset /= 1000
return out return out
##
## @brief Configure the cross toolchain
## @param[in] self (handle) Class handle
## @param[in] cross (string) Path of the cross toolchain
## @return None
##
def set_cross_base(self, cross=""): def set_cross_base(self, cross=""):
self.cross = cross self.cross = cross
debug.debug("== Target='" + self.cross + "'"); debug.debug("== Target='" + self.cross + "'");
@ -258,7 +278,7 @@ class Target:
self.nm = self.cross + "nm" self.nm = self.cross + "nm"
self.strip = self.cross + "strip" self.strip = self.cross + "strip"
self.dlltool = self.cross + "dlltool" self.dlltool = self.cross + "dlltool"
self.update_path_tree() self._update_path_tree()
#some static libraries that is sometime needed when not use stdlib ... #some static libraries that is sometime needed when not use stdlib ...
ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libgcc.a"); ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libgcc.a");
@ -270,13 +290,14 @@ class Target:
debug.error("Can not get the g++/clang++ libsupc++.a ...") debug.error("Can not get the g++/clang++ libsupc++.a ...")
self.stdlib_name_libsupc = ret; self.stdlib_name_libsupc = ret;
##
## @brief Get the current build mode
## @param[in] self (handle) Class handle
## @return Build mode value [debug,release]
##
def get_build_mode(self): def get_build_mode(self):
return self.config["mode"] return self.config["mode"]
def clean_module_tree(self):
self.build_tree_done = []
self.list_final_file = []
def get_full_name_source(self, basePath, file): def get_full_name_source(self, basePath, file):
if file[0] == '/': if file[0] == '/':
if tools.os.path.isfile(file): if tools.os.path.isfile(file):
@ -312,120 +333,153 @@ class Target:
def get_full_dependency(self, module_name, basePath, file): def get_full_dependency(self, module_name, basePath, file):
return self.get_build_path_object(module_name) + "/" + file + self.suffix_dependence return self.get_build_path_object(module_name) + "/" + file + self.suffix_dependence
"""
return a list of 3 elements :
0 : sources files (can be a list)
1 : destination file
2 : dependence files module (*.d)
"""
# TODO : Remove this it is urgent ...
def generate_file(self,
binary_name,
module_name,
basePath,
file,
type):
#debug.warning("genrate_file(" + str(binary_name) + "," + str(module_name) + "," + str(basePath) + "," + str(file) + "," + str(type) + ")")
list=[]
if (type=="bin"):
list.append(file)
list.append(self.get_build_file_bin(binary_name))
list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
list.append(self.get_build_file_bin(binary_name) + self.suffix_cmd_line)
list.append(self.get_build_file_bin(binary_name) + self.suffix_warning)
elif (type=="lib-shared"):
list.append(file)
list.append(self.get_build_file_dynamic(module_name))
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_dependence))
list.append(self.get_build_file_dynamic(module_name) + self.suffix_cmd_line)
list.append(self.get_build_file_dynamic(module_name) + self.suffix_warning)
elif (type=="lib-static"):
list.append(file)
list.append(self.get_build_file_static(module_name))
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_dependence))
list.append(self.get_build_file_static(module_name) + self.suffix_cmd_line)
list.append(self.get_build_file_static(module_name) + self.suffix_warning)
elif (type=="jar"):
list.append(file)
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar"))
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_dependence))
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_cmd_line))
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_warning))
elif (type=="image"):
list.append(os.path.join(self.get_build_path(binary_name), "data", file + self.suffix_cmd_line))
else:
debug.error("unknow type : " + type)
return list
## ##
## @brief Get the fianal path ==> contain all the generated packages ## @brief Get the final path ==> contain all the generated packages
## @return The path of the pa ## @param[in] self (handle) Class handle
## @return (string) The path
## ##
def get_final_path(self): def get_final_path(self):
return os.path.join(tools.get_run_path(), self.path_out, self.path_final) return os.path.join(tools.get_run_path(), self.path_out, self.path_final)
def get_staging_path(self, binary_name): ##
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, binary_name) ## @brief Get the staging path ==> all install stangalone package (no dependency file, no object files, no cmdlines files
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_staging_path(self, name):
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, name)
def get_build_path(self, module_name): ##
#debug.warning("A=" + str(tools.get_run_path()) + " " + str(self.path_out) + " " + str(self.path_build) + " " + str(module_name)) ## @brief Get the build path ==> dependency file, object files, cmdlines files, generate files, local install headers ...
return os.path.join(tools.get_run_path(), self.path_out, self.path_build, module_name) ## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_path(self, name):
return os.path.join(tools.get_run_path(), self.path_out, self.path_build, name)
##
## @brief Get the build object path where write .o files
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_path_object(self, name):
return os.path.join(self.get_build_path(name), self.path_object)
##
## @brief Get the build binary path where write .bin, .exe ... files
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_path_bin(self, name):
return os.path.join(self.get_build_path(name), self.path_bin)
##
## @brief Get the shared/static library object path where write .a / .so files
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_path_lib(self, name):
return os.path.join(self.get_build_path(name), self.path_lib)
##
## @brief Get the data path where pre-write the install "data" files
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_path_data(self, name):
return os.path.join(self.get_build_path(name), self.path_data, name)
##
## @brief Get the include path where pre-install "include" headers files
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_path_include(self, name):
return os.path.join(self.get_build_path(name), self.path_include)
##
## @brief Get the path where to generate files when needed (before compiling / installing it)
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_path_temporary_generate(self, name):
return os.path.join(self.get_build_path(name), self.path_temporary_generate)
##
## @brief Get the path filename of the build binary name
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_file_bin(self, name):
return os.path.join(self.get_build_path_bin(name), name + self.suffix_binary)
##
## @brief Get the path filename of the build static library name
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_file_static(self, name):
return os.path.join(self.get_build_path_lib(name), self.prefix_lib + name + self.suffix_lib_static)
##
## @brief Get the path filename of the build shared library name
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_file_dynamic(self, name):
return os.path.join(self.get_build_path_lib(name), self.prefix_lib + name + self.suffix_lib_dynamic)
def get_build_path_object(self, binary_name): ##
return os.path.join(self.get_build_path(binary_name), self.path_object) ## @brief Get the bin path for staging step
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_bin(self, name):
return os.path.join(self.get_staging_path(name), self.path_bin)
def get_build_path_bin(self, binary_name): ##
return os.path.join(self.get_build_path(binary_name), self.path_bin) ## @brief Get the lib path for staging step
## @param[in] self (handle) Class handle
def get_build_path_lib(self, binary_name): ## @param[in] name (string) Name of the package
return os.path.join(self.get_build_path(binary_name), self.path_lib) ## @return (string) The path
##
def get_build_path_data(self, binary_name): def get_staging_path_lib(self, name):
return os.path.join(self.get_build_path(binary_name), self.path_data, binary_name) return os.path.join(self.get_staging_path(name), self.path_lib, name)
def get_build_path_include(self, binary_name):
return os.path.join(self.get_build_path(binary_name), self.path_include)
def get_build_path_temporary_generate(self, binary_name):
return os.path.join(self.get_build_path(binary_name), self.path_temporary_generate)
def get_build_file_bin(self, binary_name):
return os.path.join(self.get_build_path_bin(binary_name), binary_name + self.suffix_binary)
def get_build_file_static(self, binary_name):
return os.path.join(self.get_build_path_lib(binary_name), self.prefix_lib + binary_name + self.suffix_lib_static)
def get_build_file_dynamic(self, binary_name):
return os.path.join(self.get_build_path_lib(binary_name), self.prefix_lib + binary_name + self.suffix_lib_dynamic)
def get_staging_path_bin(self, package_name):
return os.path.join(self.get_staging_path(package_name), self.path_bin)
def get_staging_path_lib(self, package_name):
return os.path.join(self.get_staging_path(package_name), self.path_lib, package_name)
def get_staging_path_data(self, package_name):
return os.path.join(self.get_staging_path(package_name), self.path_data, package_name)
def get_staging_path_include(self, package_name):
return os.path.join(self.get_staging_path(package_name), self.path_include)
"""
def get_staging_file_bin(self, package_name, binary_name):
return os.path.join(self.get_staging_path_bin(package_name), binary_name + self.suffix_binary)
"""
##
## @brief Get the data path for staging step
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_data(self, name):
return os.path.join(self.get_staging_path(name), self.path_data, name)
##
## @brief Get the include path for staging step
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_include(self, name):
return os.path.join(self.get_staging_path(name), self.path_include)
def get_doc_path(self, module_name): def get_doc_path(self, module_name):
return os.path.join(tools.get_run_path(), self.path_out, self.path_doc, module_name) return os.path.join(tools.get_run_path(), self.path_out, self.path_doc, module_name)
def is_module_build(self, my_module): def is_module_build(self, my_module):
for mod in self.build_done: for mod in self.build_done:
if mod == my_module: if mod == my_module:
@ -440,10 +494,22 @@ class Target:
self.build_tree_done.append(my_module) self.build_tree_done.append(my_module)
return False return False
def add_module(self, newModule): ##
debug.debug("Add nodule for Taget : " + newModule.get_name()) ## @brief Add new loaded module
self.module_list.append(newModule) ## @param[in] self (handle) Class handle
## @param[in] new_module (handle) pointer on the module instance
## @return None
##
def add_module(self, new_module):
debug.debug("Add nodule for Taget : " + new_module.get_name())
self.module_list.append(new_module)
##
## @brief Get a module handle that is used in this target
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return (handle|None) @ref lutin.module.Module pointer on the module requested or None
##
def get_module(self, name): def get_module(self, name):
for mod in self.module_list: for mod in self.module_list:
if mod.get_name() == name: if mod.get_name() == name:
@ -451,22 +517,26 @@ class Target:
debug.error("the module '" + str(name) + "'does not exist/already build") debug.error("the module '" + str(name) + "'does not exist/already build")
return None return None
# return inherit packages ... ##
""" ## @brief Build data associated at the module name in a specific package
def build(self, name, packagesName): ## @param[in] self (handle) Class handle
for module in self.module_list: ## @param[in] name (string) Name of the module
if module.name == name: ## @param[in] package_name (string) Name of the package
return module.build(self, packagesName) ## @return None
debug.error("request to build an un-existant module name : '" + name + "'") ##
""" def build_tree(self, name, package_name):
def build_tree(self, name, packagesName):
for mod in self.module_list: for mod in self.module_list:
if mod.get_name() == name: if mod.get_name() == name:
mod.build_tree(self, packagesName) mod.build_tree(self, package_name)
return return
debug.error("request to build tree on un-existant module name : '" + name + "'") debug.error("request to build tree on un-existant module name : '" + name + "'")
##
## @brief Clean a specific module for this target (clean all data in the "out" path)
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @return None
##
def clean(self, name): def clean(self, name):
for mod in self.module_list: for mod in self.module_list:
if mod.get_name() == name: if mod.get_name() == name:
@ -474,6 +544,13 @@ class Target:
return return
debug.error("request to clean an un-existant module name : '" + name + "'") debug.error("request to clean an un-existant module name : '" + name + "'")
##
## @brief Load a specific module if it accessible
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module to load
## @param[in] optionnal (bool) not create an error if the module does not exist.
## @return (bool) module loading status
##
def load_if_needed(self, name, optionnal=False): def load_if_needed(self, name, optionnal=False):
for elem in self.module_list: for elem in self.module_list:
if elem.get_name() == name: if elem.get_name() == name:
@ -491,19 +568,26 @@ class Target:
# we did not find the module ... # we did not find the module ...
return False; return False;
##
## @brief Load all module that are accessible in the worktree
## @param[in] self (handle) Class handle
## @return None
##
def load_all(self): def load_all(self):
listOfAllTheModule = module.list_all_module() listOfAllTheModule = module.list_all_module()
for modName in listOfAllTheModule: for modName in listOfAllTheModule:
self.load_if_needed(modName) self.load_if_needed(modName)
def project_add_module(self, name, projectMng, addedModule): ##
for mod in self.module_list: ## @brief Build action on the target (execute specific actions on the modules...)
if mod.get_name() == name: ## @note Recursive call ...
mod.ext_project_add_module(self, projectMng, addedModule) ## @param[in] self (handle) Class handle
return ## @param[in] name (string) Module to build
## @param[in] optionnal (bool) If the module is not accessible, this is not a probleme ==> optionnal dependency requested
## @param[in] actions ([string,...]) list of action to do. ex: build, gcov, dump, all, clean, install, uninstall, run, log
def build(self, name, packagesName=None, optionnal=False, actions=[]): ## @return (None|Module handle| ...) complicated return ...
##
def build(self, name, optionnal=False, actions=[]):
if len(name.split("?")) != 1\ if len(name.split("?")) != 1\
or len(name.split("@")) != 1: or len(name.split("@")) != 1:
debug.error("need update") debug.error("need update")
@ -635,6 +719,23 @@ class Target:
if len(action_list) == 1: if len(action_list) == 1:
return ret return ret
##
## @brief Add action to do for package specific part when build upper element
## @param[in] name_of_state (string) a state to call action
## - BINARY
## - BINARY_SHARED
## - BINARY_STAND_ALONE
## - LIBRARY
## - LIBRARY_DYNAMIC
## - LIBRARY_STATIC
## - PACKAGE
## - PREBUILD
## - DATA
## @param[in] level (int) Value order to apply action
## @param[in] name (string) Name of the action
## @param[in] action (function handle) Function to call to execure action
## @return None
##
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None): def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
debug.verbose("add action : " + name) debug.verbose("add action : " + name)
if name_of_state not in self.action_on_state: if name_of_state not in self.action_on_state:
@ -868,7 +969,7 @@ class Target:
return result return result
target_list=[] __target_list=[]
__start_target_name="Target_" __start_target_name="Target_"
## ##
@ -876,7 +977,7 @@ __start_target_name="Target_"
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster) ## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
## ##
def import_path(path_list): def import_path(path_list):
global target_list global __target_list
global_base = env.get_build_system_base_name() global_base = env.get_build_system_base_name()
debug.debug("TARGET: Init with Files list:") debug.debug("TARGET: Init with Files list:")
for elem in path_list: for elem in path_list:
@ -894,21 +995,21 @@ def import_path(path_list):
# Remove local patern # Remove local patern
target_name = filename[len(__start_target_name):] target_name = filename[len(__start_target_name):]
debug.verbose("TARGET: Integrate: '" + target_name + "' from '" + elem + "'") debug.verbose("TARGET: Integrate: '" + target_name + "' from '" + elem + "'")
target_list.append([target_name, elem]) __target_list.append([target_name, elem])
debug.verbose("New list TARGET: ") debug.verbose("New list TARGET: ")
for elem in target_list: for elem in __target_list:
debug.verbose(" " + str(elem[0])) debug.verbose(" " + str(elem[0]))
## ##
## @brief ## @brief Load a specific target
## ##
def load_target(name, config): def load_target(name, config):
global target_list global __target_list
debug.debug("load target: " + name) debug.debug("load target: " + name)
if len(target_list) == 0: if len(__target_list) == 0:
debug.error("No target to compile !!!") debug.error("No target to compile !!!")
debug.debug("list target: " + str(target_list)) debug.debug("list target: " + str(__target_list))
for mod in target_list: for mod in __target_list:
if mod[0] == name: if mod[0] == name:
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'") debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
sys.path.append(os.path.dirname(mod[1])) sys.path.append(os.path.dirname(mod[1]))
@ -920,16 +1021,16 @@ def load_target(name, config):
raise KeyError("No entry for : " + name) raise KeyError("No entry for : " + name)
def list_all_target(): def list_all_target():
global target_list global __target_list
tmpListName = [] tmpListName = []
for mod in target_list: for mod in __target_list:
tmpListName.append(mod[0]) tmpListName.append(mod[0])
return tmpListName return tmpListName
def list_all_target_with_desc(): def list_all_target_with_desc():
global target_list global __target_list
tmpList = [] tmpList = []
for mod in target_list: for mod in __target_list:
sys.path.append(os.path.dirname(mod[1])) sys.path.append(os.path.dirname(mod[1]))
theTarget = __import__(env.get_build_system_base_name() + __start_target_name + mod[0]) theTarget = __import__(env.get_build_system_base_name() + __start_target_name + mod[0])
try: try:

View File

@ -58,7 +58,12 @@ def get_support_multithreading():
## @brief Commands for running gcc to link an executable. ## @brief Commands for running gcc to link an executable.
## ##
def link(file, binary, target, depancy, flags, name, basic_path, static = False): def link(file, binary, target, depancy, flags, name, basic_path, static = False):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "bin") file_src = file
file_dst = target.get_build_file_bin(binary)
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
debug.extreme_verbose("list files = " + str(depancy.src)) debug.extreme_verbose("list files = " + str(depancy.src))
list_static = [] list_static = []
list_dynamic = [] list_dynamic = []

View File

@ -57,7 +57,12 @@ def get_support_multithreading():
## @brief Commands for running gcc to link a shared library. ## @brief Commands for running gcc to link a shared library.
## ##
def link(file, binary, target, depancy, flags, name, basic_path): def link(file, binary, target, depancy, flags, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "jar") file_src = file
file_dst = os.path.join(target.get_build_path(name), name + ".jar")
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
#create command Line #create command Line
cmd = [ cmd = [
target.jar, target.jar,

View File

@ -57,7 +57,17 @@ def get_support_multithreading():
## @brief Commands for running gcc to link a shared library. ## @brief Commands for running gcc to link a shared library.
## ##
def link(file, binary, target, depancy, flags, name, basic_path, static=False): def link(file, binary, target, depancy, flags, name, basic_path, static=False):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-shared") file_src = file
file_dst = target.get_build_file_dynamic(name)
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
debug.extreme_verbose("file_dst = " + file_dst)
debug.extreme_verbose("file_depend = " + file_depend)
debug.extreme_verbose("file_cmd = " + file_cmd)
debug.extreme_verbose("file_warning = " + file_warning)
list_static = [] list_static = []
list_dynamic = [] list_dynamic = []
if static == True: if static == True:

View File

@ -57,8 +57,17 @@ def get_support_multithreading():
## @brief Commands for running ar. ## @brief Commands for running ar.
## ##
def link(file, binary, target, depancy, flags, name, basic_path): def link(file, binary, target, depancy, flags, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-static") file_src = file
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS) file_dst = target.get_build_file_static(name)
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
debug.extreme_verbose("file_dst = " + file_dst)
debug.extreme_verbose("file_depend = " + file_depend)
debug.extreme_verbose("file_cmd = " + file_cmd)
debug.extreme_verbose("file_warning = " + file_warning)
cmd = [ cmd = [
target.ar target.ar
] ]

View File

@ -22,7 +22,7 @@ class System(system.System):
# todo : Check if present ... # todo : Check if present ...
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_sources(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar") self.add_sources(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
self.add_action("PACKAGE", 10, "admod-auto-wrapper", tool_generate_main_java_class) self.add_action("PACKAGE", 10, "admod-auto-wrapper", tool_generate_main_java_class)

View File

@ -24,9 +24,9 @@ class System(system.System):
# TODO : Check if the android sdk android.jar is present ... # TODO : Check if the android sdk android.jar is present ...
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_sources(jar_file_path) self.add_sources(jar_file_path)
self.add_export_flag("link-lib", "dl") self.add_flag("link-lib", "dl")
self.add_export_flag("link-lib", "log") self.add_flag("link-lib", "log")
self.add_export_flag("link-lib", "android") self.add_flag("link-lib", "android")

View File

@ -25,53 +25,53 @@ class System(system.System):
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x") debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
self.valid = False self.valid = False
return return
self.add_export_flag("c++", "-D__STDCPP_LLVM__") self.add_flag("c++", "-D__STDCPP_LLVM__")
# llvm is BSD-like licence # llvm is BSD-like licence
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "include")) self.add_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "include"))
if target.type_arch == "armv5": if target.type_arch == "armv5":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "armeabi") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "armeabi")
self.add_export_path( os.path.join(stdCppBasePath, "include")) self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a")) self.add_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
elif target.type_arch == "armv7": elif target.type_arch == "armv7":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libs", "armeabi-v7a") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libs", "armeabi-v7a")
self.add_export_path( os.path.join(stdCppBasePath + "include")) self.add_path( os.path.join(stdCppBasePath + "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libc++_static.a")) self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libc++_static.a"))
elif target.type_arch == "mips": elif target.type_arch == "mips":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "mips") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "mips")
self.add_export_path( os.path.join(stdCppBasePath + "include")) self.add_path( os.path.join(stdCppBasePath + "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath + "libc++_static.a")) self.add_flag("link", os.path.join(stdCppBasePath + "libc++_static.a"))
elif target.type_arch == "x86": elif target.type_arch == "x86":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "x86") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "x86")
self.add_export_path( os.path.join(stdCppBasePath, "include")) self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a")) self.add_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
else: else:
debug.warning("unknow architecture: '" + str(target.arch) + "'"); debug.warning("unknow architecture: '" + str(target.arch) + "'");
else: else:
self.add_export_flag("c++", "-D__STDCPP_GNU__") self.add_flag("c++", "-D__STDCPP_GNU__")
self.add_export_flag("c++-remove","-nostdlib") self.add_flag("c++-remove","-nostdlib")
self.add_export_flag("need-libstdc++", True) self.add_flag("need-libstdc++", True)
# GPL v3 (+ exception link for gcc compilator) # GPL v3 (+ exception link for gcc compilator)
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include")) self.add_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include"))
if target.type_arch == "armv5": if target.type_arch == "armv5":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi")
self.add_export_path( os.path.join(stdCppBasePath, "include")) self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a")) self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a")) self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
elif target.type_arch == "armv7": elif target.type_arch == "armv7":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi-v7a") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi-v7a")
self.add_export_path( os.path.join(stdCppBasePath, "include")) self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a")) self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a")) self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
elif target.type_arch == "mips": elif target.type_arch == "mips":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "mips") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "mips")
self.add_export_path( os.path.join(stdCppBasePath, "include/")) self.add_path( os.path.join(stdCppBasePath, "include/"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a")) self.add_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a")) self.add_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
elif target.type_arch == "x86": elif target.type_arch == "x86":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "x86") stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "x86")
self.add_export_path( os.path.join(stdCppBasePath, "include")) self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a")) self.add_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a")) self.add_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
else: else:
debug.warning("unknow architecture: '" + str(target.arch) + "'"); debug.warning("unknow architecture: '" + str(target.arch) + "'");
debug.warning("plop") debug.warning("plop")

View File

@ -22,6 +22,6 @@ class System(system.System):
# No check ==> on the basic std libs: # No check ==> on the basic std libs:
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m") self.add_flag("link-lib", "m")

View File

@ -21,7 +21,7 @@ class System(system.System):
self.help = "OpenGL: Generic graphic library" self.help = "OpenGL: Generic graphic library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_module_depend([ self.add_depend([
'c', 'c',
]) ])
""" """
@ -31,6 +31,6 @@ class System(system.System):
destination_path="GL", destination_path="GL",
recursive=True) recursive=True)
""" """
self.add_export_flag('link-lib', "GLESv2") self.add_flag('link-lib', "GLESv2")

View File

@ -27,8 +27,8 @@ class System(system.System):
""" """
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
#self.add_export_flag("link-lib", "pthread") #self.add_flag("link-lib", "pthread")
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])

View File

@ -24,6 +24,6 @@ class System(system.System):
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "z") self.add_flag("link-lib", "z")

View File

@ -21,7 +21,7 @@ class System(system.System):
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)" self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link", "-framework CoreAudio") self.add_flag("link", "-framework CoreAudio")
self.add_export_flag("link", "-framework AudioToolbox") self.add_flag("link", "-framework AudioToolbox")

View File

@ -21,8 +21,8 @@ class System(system.System):
self.help = "CXX: Generic C++ library" self.help = "CXX: Generic C++ library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_export_flag("c++", "-D__STDCPP_LLVM__") self.add_flag("c++", "-D__STDCPP_LLVM__")
self.add_export_flag("c++-remove", "-nostdlib") self.add_flag("c++-remove", "-nostdlib")
self.add_export_flag("need-libstdc++", True) self.add_flag("need-libstdc++", True)

View File

@ -22,6 +22,6 @@ class System(system.System):
# No check ==> on the basic std libs: # No check ==> on the basic std libs:
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m") self.add_flag("link-lib", "m")

View File

@ -21,8 +21,8 @@ class System(system.System):
self.help = "X11: Basic interface of Linux Graphic interface" self.help = "X11: Basic interface of Linux Graphic interface"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_module_depend(['c']) self.add_depend(['c'])
self.add_export_flag('link-lib', 'X11') self.add_flag('link-lib', 'X11')
if env.get_isolate_system() == True: if env.get_isolate_system() == True:
self.add_header_file([ self.add_header_file([
"/usr/include/X11/*" "/usr/include/X11/*"

View File

@ -26,9 +26,9 @@ class System(system.System):
return; return;
self.valid = True self.valid = True
if env.get_isolate_system() == False: if env.get_isolate_system() == False:
self.add_export_flag("link-lib", "asound") self.add_flag("link-lib", "asound")
else: else:
self.add_export_flag("link-lib", "asound") self.add_flag("link-lib", "asound")
self.add_header_file([ self.add_header_file([
"/usr/include/alsa/*", "/usr/include/alsa/*",
], ],
@ -39,7 +39,7 @@ class System(system.System):
], ],
destination_path="dssi", destination_path="dssi",
recursive=True) recursive=True)
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])

View File

@ -26,13 +26,13 @@ class System(system.System):
# No check ==> on the basic std libs: # No check ==> on the basic std libs:
self.valid = True self.valid = True
if env.get_isolate_system() == True: if env.get_isolate_system() == True:
#self.add_export_flag("link-lib", "xns") #self.add_flag("link-lib", "xns")
self.add_header_file([ self.add_header_file([
"/usr/include/arpa/*" "/usr/include/arpa/*"
], ],
destination_path="arpa", destination_path="arpa",
recursive=True) recursive=True)
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])

View File

@ -26,7 +26,7 @@ class System(system.System):
self.valid = True self.valid = True
if env.get_isolate_system() == False: if env.get_isolate_system() == False:
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", [ self.add_flag("link-lib", [
"boost_system", "boost_system",
"boost_thread", "boost_thread",
"boost_chrono" "boost_chrono"
@ -37,7 +37,7 @@ class System(system.System):
], ],
destination_path="boost", destination_path="boost",
recursive=True) recursive=True)
self.add_module_depend([ self.add_depend([
'cxx' 'cxx'
]) ])

View File

@ -171,5 +171,5 @@ class System(system.System):
], ],
destination_path="net", destination_path="net",
recursive=True) recursive=True)
self.add_export_flag("link", "-B/usr/lib") self.add_flag("link", "-B/usr/lib")

View File

@ -22,17 +22,17 @@ class System(system.System):
self.help = "CXX: Generic C++ library" self.help = "CXX: Generic C++ library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_module_depend([ self.add_depend([
'c', 'c',
'm', 'm',
'pthread' 'pthread'
]) ])
self.add_export_flag("c++", "-D__STDCPP_GNU__") self.add_flag("c++", "-D__STDCPP_GNU__")
if env.get_isolate_system() == False: if env.get_isolate_system() == False:
self.add_export_flag("c++-remove", "-nostdlib") self.add_flag("c++-remove", "-nostdlib")
self.add_export_flag("need-libstdc++", True) self.add_flag("need-libstdc++", True)
else: else:
self.add_export_flag("link-lib", "stdc++") self.add_flag("link-lib", "stdc++")
compilator_gcc = "g++" compilator_gcc = "g++"
if target.config["compilator-version"] != "": if target.config["compilator-version"] != "":
compilator_gcc = compilator_gcc + "-" + target.config["compilator-version"] compilator_gcc = compilator_gcc + "-" + target.config["compilator-version"]

View File

@ -24,11 +24,11 @@ class System(system.System):
# we did not find the library reqiested (just return) (automaticly set at false) # we did not find the library reqiested (just return) (automaticly set at false)
return; return;
self.valid = True self.valid = True
self.add_module_depend([ self.add_depend([
'uuid', 'uuid',
'c' 'c'
]) ])
self.add_export_flag("link-lib", "jack") self.add_flag("link-lib", "jack")
if env.get_isolate_system() == True: if env.get_isolate_system() == True:
self.add_header_file([ self.add_header_file([
"/usr/include/jack/*", "/usr/include/jack/*",

View File

@ -22,8 +22,8 @@ class System(system.System):
# No check ==> on the basic std libs: # No check ==> on the basic std libs:
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m") self.add_flag("link-lib", "m")
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])
if env.get_isolate_system() == True: if env.get_isolate_system() == True:

View File

@ -21,11 +21,11 @@ class System(system.System):
self.help = "OpenGL: Generic graphic library" self.help = "OpenGL: Generic graphic library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_module_depend([ self.add_depend([
'c', 'c',
'X11' 'X11'
]) ])
self.add_export_flag('link-lib', 'GL') self.add_flag('link-lib', 'GL')
if env.get_isolate_system() == True: if env.get_isolate_system() == True:
self.add_header_file([ self.add_header_file([
"/usr/include/GL/*" "/usr/include/GL/*"
@ -37,16 +37,16 @@ class System(system.System):
if target.name=="Linux": if target.name=="Linux":
elif target.name=="Android": elif target.name=="Android":
my_module.add_export_flag('link-lib', "GLESv2") my_module.add_flag('link-lib', "GLESv2")
elif target.name=="Windows": elif target.name=="Windows":
my_module.add_module_depend([ my_module.add_depend([
"glew" "glew"
]) ])
elif target.name=="MacOs": elif target.name=="MacOs":
my_module.add_export_flag('link', [ my_module.add_flag('link', [
"-framework OpenGL"]) "-framework OpenGL"])
elif target.name=="IOs": elif target.name=="IOs":
my_module.add_export_flag('link', [ my_module.add_flag('link', [
"-framework OpenGLES" "-framework OpenGLES"
]) ])
""" """

View File

@ -26,7 +26,7 @@ class System(system.System):
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "oss") self.add_flag("link-lib", "oss")
""" """

View File

@ -25,8 +25,8 @@ class System(system.System):
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "pthread") self.add_flag("link-lib", "pthread")
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])
if env.get_isolate_system() == True: if env.get_isolate_system() == True:

View File

@ -39,23 +39,23 @@ class System(system.System):
return return
self.set_version([int(version),int(version2)]) self.set_version([int(version),int(version2)])
self.valid = True self.valid = True
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])
if env.get_isolate_system() == False: if env.get_isolate_system() == False:
self.add_export_flag("link-lib", [ self.add_flag("link-lib", [
"pulse-simple", "pulse-simple",
"pulse" "pulse"
]) ])
else: else:
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", [ self.add_flag("link-lib", [
"pulsecommon-" + version + ".0", "pulsecommon-" + version + ".0",
"pulse-mainloop-glib", "pulse-mainloop-glib",
"pulse-simple", "pulse-simple",
"pulse" "pulse"
]) ])
self.add_export_flag("link", "-L/usr/lib/pulseaudio") self.add_flag("link", "-L/usr/lib/pulseaudio")
self.add_header_file([ self.add_header_file([
"/usr/include/pulse/*", "/usr/include/pulse/*",
], ],

View File

@ -21,12 +21,12 @@ class System(system.System):
self.help="rpc : generic RPC library (developed by oracle)" self.help="rpc : generic RPC library (developed by oracle)"
# No check ==> on the basic std libs: # No check ==> on the basic std libs:
self.valid = True self.valid = True
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "rpcsvc") self.add_flag("link-lib", "rpcsvc")
if env.get_isolate_system() == False: if env.get_isolate_system() == True:
self.add_header_file([ self.add_header_file([
"/usr/include/rpc/*" "/usr/include/rpc/*"
], ],

View File

@ -24,12 +24,12 @@ class System(system.System):
# we did not find the library reqiested (just return) (automaticly set at false) # we did not find the library reqiested (just return) (automaticly set at false)
return; return;
self.valid = True self.valid = True
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "uuid") self.add_flag("link-lib", "uuid")
if env.get_isolate_system() == False: if env.get_isolate_system() == True:
self.add_header_file([ self.add_header_file([
"/usr/include/uuid/*", "/usr/include/uuid/*",
], ],

View File

@ -25,12 +25,12 @@ class System(system.System):
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "z") self.add_flag("link-lib", "z")
self.add_module_depend([ self.add_depend([
'c' 'c'
]) ])
if env.get_isolate_system() == False: if env.get_isolate_system() == True:
self.add_header_file([ self.add_header_file([
"/usr/include/zlib.h" "/usr/include/zlib.h"
], ],

View File

@ -21,6 +21,6 @@ class System(system.System):
self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)" self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link", "-framework CoreAudio") self.add_flag("link", "-framework CoreAudio")
self.add_export_flag("link", "-framework CoreFoundation") self.add_flag("link", "-framework CoreFoundation")

View File

@ -21,8 +21,8 @@ class System(system.System):
self.help = "CXX: Generic C++ library" self.help = "CXX: Generic C++ library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_export_flag("c++","-D__STDCPP_LLVM__") self.add_flag("c++","-D__STDCPP_LLVM__")
self.add_export_flag("c++-remove","-nostdlib") self.add_flag("c++-remove","-nostdlib")
self.add_export_flag("need-libstdc++", True) self.add_flag("need-libstdc++", True)

View File

@ -22,6 +22,6 @@ class System(system.System):
# No check ==> on the basic std libs: # No check ==> on the basic std libs:
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m") self.add_flag("link-lib", "m")

View File

@ -21,14 +21,14 @@ class System(system.System):
self.help = "CXX: Generic C++ library" self.help = "CXX: Generic C++ library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_export_flag("c++","-D__STDCPP_GNU__") self.add_flag("c++","-D__STDCPP_GNU__")
self.add_export_flag("c++-remove","-nostdlib") self.add_flag("c++-remove","-nostdlib")
# force static link to prenvent many errors ... # force static link to prenvent many errors ...
self.add_export_flag("link", [ self.add_flag("link", [
"-static-libgcc", "-static-libgcc",
"-static-libstdc++", "-static-libstdc++",
"-static" "-static"
]) ])
self.add_export_flag("need-libstdc++", True) self.add_flag("need-libstdc++", True)

View File

@ -25,7 +25,7 @@ class System(system.System):
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib",[ self.add_flag("link-lib",[
"dsound", "dsound",
"winmm", "winmm",
"ole32" "ole32"

View File

@ -22,6 +22,6 @@ class System(system.System):
# No check ==> on the basic std libs: # No check ==> on the basic std libs:
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m") self.add_flag("link-lib", "m")

View File

@ -353,7 +353,7 @@ class Target(target.Target):
cmdLine += ' ' + self.get_staging_path(pkg_name) cmdLine += ' ' + self.get_staging_path(pkg_name)
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
def createRandomNumber(self, len): def create_random_number(self, len):
out = "" out = ""
for iii in range(0,len): for iii in range(0,len):
out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]) out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"])
@ -378,15 +378,15 @@ class Target(target.Target):
if tools.file_size(simulatorIdFile) < 10: if tools.file_size(simulatorIdFile) < 10:
#create the file: #create the file:
tmpFile = open(simulatorIdFile, 'w') tmpFile = open(simulatorIdFile, 'w')
tmpFile.write(self.createRandomNumber(8)) tmpFile.write(self.create_random_number(8))
tmpFile.write("-") tmpFile.write("-")
tmpFile.write(self.createRandomNumber(4)) tmpFile.write(self.create_random_number(4))
tmpFile.write("-") tmpFile.write("-")
tmpFile.write(self.createRandomNumber(4)) tmpFile.write(self.create_random_number(4))
tmpFile.write("-") tmpFile.write("-")
tmpFile.write(self.createRandomNumber(4)) tmpFile.write(self.create_random_number(4))
tmpFile.write("-") tmpFile.write("-")
tmpFile.write(self.createRandomNumber(12)) tmpFile.write(self.create_random_number(12))
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
simulatorId = tools.file_read_data(simulatorIdFile) simulatorId = tools.file_read_data(simulatorIdFile)