[DEV] rework the build of java file for android

This commit is contained in:
Edouard DUPIN 2015-06-18 21:06:06 +02:00
parent 2e2143ebcf
commit 7e41e6f393
13 changed files with 353 additions and 205 deletions

View File

@ -39,44 +39,54 @@ def get_print_pretty_mode():
global printPrettyMode global printPrettyMode
return printPrettyMode return printPrettyMode
def end_with(name, list):
for appl in list:
if name[len(name)-len(appl):] == appl:
return True
return False
def print_pretty(myString, force=False): def print_pretty(myString, force=False):
global printPrettyMode global printPrettyMode
if printPrettyMode == True \ if printPrettyMode == True \
or force == True: or force == True:
if myString[len(myString)-1]==' ' : if myString[len(myString)-1] == ' ':
tmpcmdLine = myString[:len(myString)-1] tmpcmdLine = myString[:len(myString)-1]
else : else:
tmpcmdLine = myString tmpcmdLine = myString
cmdApplication = tmpcmdLine.split(' ')[0]
tmpcmdLine = tmpcmdLine.replace(' ', '\n\t') tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t') tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t') tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t') tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
baseElementList = ["-o", baseElementList = []
if end_with(cmdApplication, ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]) == True:
baseElementList = [
"-o",
"-D", "-D",
"-I", "-I",
"-L", "-L",
"g++",
"gcc",
"clang",
"clang++",
"ar",
"ld",
"ranlib",
"-framework", "-framework",
"-isysroot", "-isysroot",
"-arch", "-arch",
"-keystore", "-keystore",
"-sigalg", "-sigalg",
"-digestalg", "-digestalg"]
"<", elif end_with(cmdApplication, ["javac"]) == True:
"<<", baseElementList = [
">", "-d",
">>"] "-D",
"-classpath",
"-sourcepath"
]
elif end_with(cmdApplication, ["jar"]) == True:
baseElementList = [
"cf"
]
for element in baseElementList: for element in baseElementList:
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ') tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
baseElementList = ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"] for element in ["<", "<<", ">", ">>"]:
for element in baseElementList: tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
tmpcmdLine = tmpcmdLine.replace('/'+element+' ', '/'+element+'\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t', ' \\\n\t') tmpcmdLine = tmpcmdLine.replace('\n\t', ' \\\n\t')
return tmpcmdLine return tmpcmdLine

View File

@ -29,7 +29,7 @@ class HeritageList:
self.flags={} self.flags={}
# sources list: # sources list:
self.src=[] self.src=[]
self.path=[] self.path={}
self.listHeritage=[] self.listHeritage=[]
if heritage != None: if heritage != None:
@ -61,7 +61,7 @@ class HeritageList:
self.flags={} self.flags={}
# sources list: # sources list:
self.src=[] self.src=[]
self.path=[] self.path={}
# reorder heritage list : # reorder heritage list :
listHeritage = self.listHeritage listHeritage = self.listHeritage
self.listHeritage = [] self.listHeritage = []
@ -99,7 +99,12 @@ class HeritageList:
self.flags[flags] = value self.flags[flags] = value
else: else:
append_to_list(self.flags[flags], value) append_to_list(self.flags[flags], value)
append_to_list(self.path, element.path) for ppp in element.path:
value = element.path[ppp]
if ppp not in self.path:
self.path[ppp] = value
else:
append_to_list(self.path[ppp], value)
append_to_list(self.src, element.src) append_to_list(self.src, element.src)
if "c-version" in element.flags: if "c-version" in element.flags:
ver = element.flags["c-version"] ver = element.flags["c-version"]
@ -124,7 +129,7 @@ class heritage:
self.flags={} self.flags={}
# sources list: # sources list:
self.src=[] self.src=[]
self.path=[] self.path={}
# update is set at true when data are newly created ==> force upper element to update # update is set at true when data are newly created ==> force upper element to update
self.hasBeenUpdated=False self.hasBeenUpdated=False
@ -143,6 +148,8 @@ class heritage:
append_to_list(self.path, list) append_to_list(self.path, list)
def add_sources(self, list): def add_sources(self, list):
if type(list) == type(None):
debug.error("try add element none in a list ...")
append_to_list(self.src, list) append_to_list(self.src, list)
def need_update(self, list): def need_update(self, list):

View File

@ -47,8 +47,8 @@ class Module:
# Documentation list: # Documentation list:
self.documentation = None self.documentation = None
# export PATH # export PATH
self.path = {"export":[], self.path = {"export":{},
"local":[] "local":{}
} }
self.flags = {"export":{}, self.flags = {"export":{},
"local":{} "local":{}
@ -242,7 +242,6 @@ class Module:
list_sub_file_needed_to_build.append(resFile) list_sub_file_needed_to_build.append(resFile)
except ValueError: except ValueError:
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'") debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'")
# when multiprocess availlable, we need to synchronize here ... # when multiprocess availlable, we need to synchronize here ...
multiprocess.pool_synchrosize() multiprocess.pool_synchrosize()
@ -252,7 +251,9 @@ class Module:
elif self.type=='LIBRARY': elif self.type=='LIBRARY':
try: try:
tmp_builder = builder.get_builder_with_output("a"); tmp_builder = builder.get_builder_with_output("a");
resFile = tmp_builder.link(list_sub_file_needed_to_build, list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
if len(list_file) > 0:
resFile = tmp_builder.link(list_file,
package_name, package_name,
target, target,
self.sub_heritage_list, self.sub_heritage_list,
@ -261,6 +262,19 @@ class Module:
self.local_heritage.add_sources(resFile) self.local_heritage.add_sources(resFile)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.a'") debug.error(" UN-SUPPORTED link format: '.a'")
try:
tmp_builder = builder.get_builder_with_output("jar");
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
if len(list_file) > 0:
resFile = tmp_builder.link(list_file,
package_name,
target,
self.sub_heritage_list,
name = self.name,
basic_folder = self.origin_folder)
self.local_heritage.add_sources(resFile)
except ValueError:
debug.error(" UN-SUPPORTED link format: '.jat'")
elif self.type=='BINARY': elif self.type=='BINARY':
try: try:
tmp_builder = builder.get_builder_with_output("bin"); tmp_builder = builder.get_builder_with_output("bin");
@ -278,10 +292,12 @@ class Module:
target.copy_to_staging(self.name) target.copy_to_staging(self.name)
elif self.type=="PACKAGE": elif self.type=="PACKAGE":
if target.name=="Android": if target.name=="Android":
# special case for android wrapper : # special case for android wrapper:
try: try:
tmp_builder = builder.get_builder_with_output("so"); tmp_builder = builder.get_builder_with_output("so");
resFile = tmp_builder.link(list_sub_file_needed_to_build, list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
debug.info("plopppp " + str(list_file))
resFile = tmp_builder.link(list_file,
package_name, package_name,
target, target,
self.sub_heritage_list, self.sub_heritage_list,
@ -380,11 +396,11 @@ class Module:
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False): def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True) self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
def add_export_path(self, list): def add_export_path(self, list, type='c'):
self.append_to_internalList(self.path["export"], list) self.append_to_internalList2(self.path["export"], type, list)
def add_path(self, list): def add_path(self, list, type='c'):
self.append_to_internalList(self.path["local"], list) self.append_to_internalList2(self.path["local"], type, list)
def add_export_flag(self, type, list): def add_export_flag(self, type, list):
self.append_to_internalList2(self.flags["export"], type, list) self.append_to_internalList2(self.flags["export"], type, list)
@ -452,17 +468,25 @@ class Module:
self.print_list('depends',self.depends) self.print_list('depends',self.depends)
self.print_list('depends_optionnal', self.depends_optionnal) self.print_list('depends_optionnal', self.depends_optionnal)
for element,value in self.flags["local"]: for element in self.flags["local"]:
value = self.flags["local"][element]
self.print_list('flags ' + element, value) self.print_list('flags ' + element, value)
for element,value in self.flags["export"]: for element in self.flags["export"]:
value = self.flags["export"][element]
self.print_list('flags export ' + element, value) self.print_list('flags export ' + 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('folders',self.folders) self.print_list('folders',self.folders)
self.print_list('export path',self.path["export"]) for element in self.path["local"]:
self.print_list('local path',self.path["local"]) value = self.path["local"][element]
self.print_list('local path ' + element, value)
for element in self.path["export"]:
value = self.path["export"][element]
self.print_list('export path ' + element, value)
def pkg_set(self, variable, value): def pkg_set(self, variable, value):
if "COMPAGNY_TYPE" == variable: if "COMPAGNY_TYPE" == variable:

View File

@ -137,6 +137,8 @@ class Target:
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 + "'");
self.java = "javac"
self.jar = "jar"
self.ar = self.cross + "ar" self.ar = self.cross + "ar"
self.ranlib = self.cross + "ranlib" self.ranlib = self.cross + "ranlib"
if self.config["compilator"] == "clang": if self.config["compilator"] == "clang":
@ -206,13 +208,32 @@ class Target:
self.folder_ewol = folder self.folder_ewol = folder
def file_generate_object(self,binaryName,moduleName,basePath,file): def get_full_name_source(self, basePath, file):
list=[] return basePath + "/" + file
list.append(basePath + "/" + file)
list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_obj) def get_full_name_cmd(self, moduleName, basePath, file):
list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_dependence) return self.get_build_folder(moduleName) + "/" + file + self.suffix_cmdLine
list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_cmdLine)
return list def get_full_name_destination(self, moduleName, basePath, file, suffix, remove_suffix=False):
# special patch for java file:
if file[-4:] == "java":
for elem in ["org/", "com/"]:
pos = file.find(elem);
if pos > 0:
file = file[pos:]
if remove_suffix == True:
file = file[:file.rfind(".")] + '.'
else:
file += "."
if len(suffix) >= 1:
suffix = suffix[0]
else:
suffix = ""
return self.get_build_folder(moduleName) + "/" + file + suffix
def get_full_dependency(self, moduleName, basePath, file):
return self.get_build_folder(moduleName) + "/" + file + self.suffix_dependence
""" """
return a list of 3 elements : return a list of 3 elements :
0 : sources files (can be a list) 0 : sources files (can be a list)
@ -225,17 +246,22 @@ class Target:
list.append(file) list.append(file)
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary) list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence) list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_cmdLine) list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_cmdLine)
elif (type=="lib-shared"): elif (type=="lib-shared"):
list.append(file) list.append(file)
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic) list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence) list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_cmdLine) list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_cmdLine)
elif (type=="lib-static"): elif (type=="lib-static"):
list.append(file) list.append(file)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static) list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence) list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_cmdLine) list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_cmdLine)
elif (type=="jar"):
list.append(file)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar")
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_dependence)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_cmdLine)
elif (type=="image"): elif (type=="image"):
list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmdLine) list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmdLine)
else: else:

View File

@ -144,3 +144,15 @@ def copy_anything_target(target, src, dst):
newDst += "/" newDst += "/"
debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" ) debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile) target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)
def filter_extention(list_files, extentions):
out = []
for ext in extentions:
for file in list_files:
if file[-len(ext):] == ext:
out.append(file)
return out

View File

@ -41,7 +41,10 @@ def get_output_type():
## @brief Commands for running gcc to compile a C file in object file. ## @brief Commands for running gcc to compile a C file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_folder):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder,file) file_src = target.get_full_name_source(basic_folder, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
@ -50,16 +53,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
target.arch, target.arch,
target.sysroot, target.sysroot,
target.global_include_cc] target.global_include_cc]
for view in ["export", "local"]:
try: try:
cmd.append(tools.add_prefix("-I", path["export"])) cmd.append(tools.add_prefix("-I", path[view]["c"]))
except: except:
pass pass
try: try:
cmd.append(tools.add_prefix("-I", path["local"])) cmd.append(tools.add_prefix("-I", depancy.path["c"]))
except:
pass
try:
cmd.append(tools.add_prefix("-I", depancy.path))
except: except:
pass pass
try: try:
@ -74,12 +74,9 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
cmd.append(depancy.flags["c"]) cmd.append(depancy.flags["c"])
except: except:
pass pass
for view in ["local", "export"]:
try: try:
cmd.append(flags["local"]["c"]) cmd.append(flags[view]["c"])
except:
pass
try:
cmd.append(flags["export"]["c"])
except: except:
pass pass
cmd.append("-c") cmd.append("-c")

View File

@ -40,7 +40,10 @@ def get_output_type():
## @brief Commands for running gcc to compile a C++ file in object file. ## @brief Commands for running gcc to compile a C++ file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_folder):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file) file_src = target.get_full_name_source(basic_folder, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
@ -50,16 +53,15 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
target.sysroot, target.sysroot,
target.global_include_cc target.global_include_cc
] ]
for view in ["export", "local"]:
for type in ["c", "c++"]:
try: try:
cmd.append(tools.add_prefix("-I",path["export"])) cmd.append(tools.add_prefix("-I",path[view][type]))
except: except:
pass pass
for type in ["c", "c++"]:
try: try:
cmd.append(tools.add_prefix("-I",path["local"])) cmd.append(tools.add_prefix("-I",depancy.path[type]))
except:
pass
try:
cmd.append(tools.add_prefix("-I",depancy.path))
except: except:
pass pass
try: try:
@ -74,28 +76,15 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
cmd.append(target.global_flags_xx) cmd.append(target.global_flags_xx)
except: except:
pass pass
for type in ["c", "c++"]:
try: try:
cmd.append(depancy.flags["c"]) cmd.append(depancy.flags[type])
except: except:
pass pass
for view in ["local", "export"]:
for type in ["c", "c++"]:
try: try:
cmd.append(depancy.flags["c++"]) cmd.append(flags[view][type])
except:
pass
try:
cmd.append(flags["local"]["c"])
except:
pass
try:
cmd.append(flags["local"]["c++"])
except:
pass
try:
cmd.append(flags["export"]["c"])
except:
pass
try:
cmd.append(flags["export"]["c++"])
except: except:
pass pass
cmd.append(["-c", "-MMD", "-MP"]) cmd.append(["-c", "-MMD", "-MP"])

View File

@ -0,0 +1,67 @@
##
## Dynamic library builder
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from lutin import depend
from lutin import env
import os
##
## Initialize the builder, if needed ... to get dependency between builder (for example)
##
def init():
pass
##
## Get the current builder type.
## Return the type of builder
##
def get_type():
return "linker"
##
## @brief Get builder input file type
## @return List of extention supported
##
def get_input_type():
return ["class"]
##
## @brief Get builder output file type
## @return List of extention supported
##
def get_output_type():
return ["jar"]
##
## @brief Commands for running gcc to link a shared library.
##
def link(file, binary, target, depancy, name, basic_folder):
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "jar")
#create command Line
cmd = [
target.jar,
"cf", file_dst
]
try:
cmd.append(file_src)
except:
pass
cmdLine=tools.list_to_str(cmd)
"""
# check the dependency for this file :
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False:
return tmpList[1]
"""
tools.create_directory_of_file(file_dst)
debug.print_element("jar", name, "==>", file_dst)
multiprocess.run_command(cmdLine)
# write cmd line only after to prevent errors ...
multiprocess.store_command(cmdLine, file_cmd)
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
return file_dst

View File

@ -32,3 +32,52 @@ def get_input_type():
## ##
def get_output_type(): def get_output_type():
return ["class"] return ["class"]
##
## @brief Commands for running gcc to compile a C++ file in object file.
##
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
file_src = target.get_full_name_source(basic_folder, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type(), remove_suffix=True)
file_depend = target.get_full_dependency(name, basic_folder, file)
# create the command line befor requesting start:
cmd = [
target.java,
"-d", target.get_build_folder(name)
]
# add source dependency:
list_sources_path = []
for view in ["export", "local"]:
try:
list = path[view]["java"]
for elem in list:
list_sources_path.append(elem)
except:
pass
if len(list_sources_path) > 0:
cmd.append("-sourcepath")
out = ""
for elem in list_sources_path:
if len(out) > 0:
out += ":"
out += elem
cmd.append(out)
# dependency : + "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
cmd.append("-classpath " + target.folder_sdk + "/platforms/android-" + str(target.boardId) + "/android.jar")
cmd.append(file_src)
# Create cmd line
cmdLine=tools.list_to_str(cmd)
# check the dependency for this file :
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
return file_dst
tools.create_directory_of_file(file_dst)
comment = ["java", name, "<==", file]
#process element
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
return file_dst

View File

@ -26,7 +26,7 @@ def get_type():
## @return List of extention supported ## @return List of extention supported
## ##
def get_input_type(): def get_input_type():
return ["o"] return ["o", "a"]
## ##
## @brief Get builder output file type ## @brief Get builder output file type
@ -59,7 +59,8 @@ def link(file, binary, target, depancy, name, basic_folder):
except: except:
pass pass
try: try:
cmd.append(depancy.src) # keep only compilated files ...
cmd.append(tools.filter_extention(depancy.src, get_input_type()))
except: except:
pass pass
try: try:

View File

@ -26,7 +26,7 @@ def get_type():
## @return List of extention supported ## @return List of extention supported
## ##
def get_input_type(): def get_input_type():
return ["o"] return ["o", "a"]
## ##
## @brief Get builder output file type ## @brief Get builder output file type

View File

@ -42,7 +42,10 @@ def get_output_type():
## @brief Commands for running gcc to compile a m file in object file. ## @brief Commands for running gcc to compile a m file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_folder):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file) file_src = target.get_full_name_source(basic_folder, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
target.cc, target.cc,
@ -50,16 +53,15 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
target.arch, target.arch,
target.sysroot, target.sysroot,
target.global_include_cc] target.global_include_cc]
for view in ["export", "local"]:
for type in ["c", "m"]:
try: try:
cmd.append(tools.add_prefix("-I",path["export"])) cmd.append(tools.add_prefix("-I",path[view][type]))
except: except:
pass pass
for type in ["c", "m"]:
try: try:
cmd.append(tools.add_prefix("-I",path["local"])) cmd.append(tools.add_prefix("-I",depancy.path[type]))
except:
pass
try:
cmd.append(tools.add_prefix("-I",depancy.path))
except: except:
pass pass
try: try:
@ -74,28 +76,15 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
cmd.append(target.global_flags_m) cmd.append(target.global_flags_m)
except: except:
pass pass
for type in ["c", "m"]:
try: try:
cmd.append(depancy.flags["c"]) cmd.append(depancy.flags[type])
except: except:
pass pass
for view in ["local", "export"]:
for type in ["c", "m"]:
try: try:
cmd.append(depancy.flags["m"]) cmd.append(flags[view][type])
except:
pass
try:
cmd.append(flags["local"]["c"])
except:
pass
try:
cmd.append(flags["local"]["m"])
except:
pass
try:
cmd.append(flags["export"]["c"])
except:
pass
try:
cmd.append(flags["export"]["m"])
except: except:
pass pass
cmd.append("-c -MMD -MP") cmd.append("-c -MMD -MP")

View File

@ -42,7 +42,10 @@ def get_output_type():
## @brief Commands for running gcc to compile a m++ file in object file. ## @brief Commands for running gcc to compile a m++ file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_folder):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file) file_src = target.get_full_name_source(basic_folder, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
target.xx, target.xx,
@ -50,16 +53,15 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
target.arch, target.arch,
target.sysroot, target.sysroot,
target.global_include_cc] target.global_include_cc]
for view in ["export", "local"]:
for type in ["c", "c++", "m", "mm"]:
try: try:
cmd.append(tools.add_prefix("-I",path["export"])) cmd.append(tools.add_prefix("-I",path[view][type]))
except: except:
pass pass
for type in ["c", "c++", "m", "mm"]:
try: try:
cmd.append(tools.add_prefix("-I",path["local"])) cmd.append(tools.add_prefix("-I",depancy.path[type]))
except:
pass
try:
cmd.append(tools.add_prefix("-I",depancy.path))
except: except:
pass pass
try: try:
@ -74,40 +76,15 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
cmd.append(target.global_flags_mm) cmd.append(target.global_flags_mm)
except: except:
pass pass
for type in ["c", "c++", "m", "mm"]:
try: try:
cmd.append(depancy.flags["c"]) cmd.append(depancy.flags[type])
except: except:
pass pass
for view in ["export", "local"]:
for type in ["c", "c++", "m", "mm"]:
try: try:
cmd.append(depancy.flags["c++"]) cmd.append(flags[view][type])
except:
pass
try:
cmd.append(depancy.flags["mm"])
except:
pass
try:
cmd.append(flags["local"]["c"])
except:
pass
try:
cmd.append(flags["local"]["c++"])
except:
pass
try:
cmd.append(flags["local"]["mm"])
except:
pass
try:
cmd.append(flags["export"]["c"])
except:
pass
try:
cmd.append(flags["export"]["c++"])
except:
pass
try:
cmd.append(flags["export"]["mm"])
except: except:
pass pass
cmd.append("-c -MMD -MP") cmd.append("-c -MMD -MP")