[DEV] update lutiun to support corectly multiple build model

This commit is contained in:
Edouard DUPIN 2022-01-12 00:04:08 +01:00
parent 9dc5218775
commit 64d016880e
19 changed files with 2203 additions and 1936 deletions

View File

@ -10,6 +10,18 @@ encoding//lutin/multiprocess.py=utf-8
encoding//lutin/system.py=utf-8
encoding//lutin/target.py=utf-8
encoding//lutin/tools.py=utf-8
encoding//lutin/z_builder/__init__.py=utf-8
encoding//lutin/z_builder/lutinBuilder_binary.py=utf-8
encoding//lutin/z_builder/lutinBuilder_c++.py=utf-8
encoding//lutin/z_builder/lutinBuilder_c.py=utf-8
encoding//lutin/z_builder/lutinBuilder_jar.py=utf-8
encoding//lutin/z_builder/lutinBuilder_java.py=utf-8
encoding//lutin/z_builder/lutinBuilder_javah.py=utf-8
encoding//lutin/z_builder/lutinBuilder_libraryDynamic.py=utf-8
encoding//lutin/z_builder/lutinBuilder_libraryStatic.py=utf-8
encoding//lutin/z_builder/lutinBuilder_m.py=utf-8
encoding//lutin/z_builder/lutinBuilder_mm.py=utf-8
encoding//lutin/z_builder/lutinBuilder_s.py=utf-8
encoding//lutin/z_system/lutinSystem_Android_c.py=utf-8
encoding//lutin/z_system/lutinSystem_Android_cxx.py=utf-8
encoding//lutin/z_system/lutinSystem_Android_m.py=utf-8
@ -19,10 +31,12 @@ encoding//lutin/z_system/lutinSystem_Linux_alsa.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_c.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_cxx.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_egl.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_khr.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_m.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_mysql.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_opengl.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_pthread.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_rt.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_z.py=utf-8
encoding//lutin/z_system/lutinSystem_MacOs_Cocoa.py=utf-8
encoding//lutin/z_system/lutinSystem_Windows_ole.py=utf-8
@ -35,3 +49,4 @@ encoding//lutin/z_target/lutinTarget_Debian.py=utf-8
encoding//lutin/z_target/lutinTarget_IOs.py=utf-8
encoding//lutin/z_target/lutinTarget_MacOs.py=utf-8
encoding//lutin/z_target/lutinTarget_Windows.py=utf-8
encoding//lutin/zip.py=utf-8

View File

@ -62,9 +62,10 @@ def import_path(path_list):
debug.verbose("BUILDER: Integrate: '" + builder_name + "' from '" + elem + "'")
the_builder = __import__(base_file_name)
builder_list.append({"name":builder_name,
"order":the_builder.get_order(),
"element":the_builder
})
debug.debug('BUILDER: type=' + the_builder.get_type() + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
debug.debug('BUILDER: type=' + the_builder.get_type() + " order=" + str(the_builder.get_order()) + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
debug.verbose("List of BUILDER: ")
for elem in builder_list:
debug.verbose(" " + str(elem["name"]))
@ -81,8 +82,8 @@ def init():
element["element"].init()
##
## @brief Get a builder tool with specifiying the input type (like cpp, S ...)
## @param[in] input_type (string) extention file that can be compile
## @brief Get a builder tool with specifying the input type (like cpp, S ...)
## @param[in] input_type (string) extension file that can be compile
##
def get_builder(input_type):
global builder_list
@ -93,10 +94,59 @@ def get_builder(input_type):
# we can not find the builder ...
debug.error("Can not find builder for type : '" + str(input_type) + "'")
raise ValueError('type error :' + str(input_type))
##
## @brief Get a builder tool with his name
## @param[in] name (string) name of the builder
##
def get_builder_named(name):
global builder_list
for element in builder_list:
if element["name"] == name:
return element["element"]
# we can not find the builder ...
debug.error("Can not find builder for type : '" + str(input_type) + "'")
raise ValueError('type error :' + str(input_type))
##
## @brief Get a builder tool with specifiying the output type (like .exe, .jar ...)
## @param[in] input_type (string) extention file that can be generated
## @brief get all the builder with extension to detect automaticly mode to compile
## @return a map with the key name of the builder, and a table of extension files
##
def get_full_builder_extention():
global builder_list
out = {};
for element in builder_list:
if element["element"] != None:
out[element["name"]] = element["element"].get_input_type();
return out;
##
## @brief get all the builder in the common order build
## @return a list with the ordered builder names
##
def get_ordered_builder_list():
global builder_list
table = {};
for element in builder_list:
table[element["order"]] = element["name"];
out = []
for key in sorted(table.keys()):
out.append(table[key]);
debug.extreme_verbose("builder ordered=" + str(table));
debug.extreme_verbose(" ==> " + str(out));
return out;
def find_builder_with_input_extention(extension):
extention_map = get_full_builder_extention();
for builder_name in get_ordered_builder_list():
debug.extreme_verbose("builder_name: " + str(extension) + " in " + str(extention_map[builder_name]));
if extension in extention_map[builder_name]:
return builder_name;
debug.warning("does not find the builder: for extension: " + str(extension))
return "?";
##
## @brief Get a builder tool with specifying the output type (like .exe, .jar ...)
## @param[in] input_type (string) extension file that can be generated
##
def get_builder_with_output(output_type):
global builder_list

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,8 @@ list_of_property_module=[
"version",
"version-id",
"code-quality",
"header-install-mode"
"header-install-mode",
"package" # package is for specifie some right in LUTIN
];
list_of_element_ignored=[
@ -76,7 +77,8 @@ list_of_element_availlable=[
"target",
"arch",
"bus-size", # todo
"sanity-compilation" # todo "isolate", "intricate", "*" permit to specify element to copy for the isolation mode. intricate is for current mode where everything is mixed together ...
"sanity-compilation", # todo "isolate", "intricate", "*" permit to specify element to copy for the isolation mode. intricate is for current mode where everything is mixed together ...
"compilator"
];
"""
@ -442,10 +444,8 @@ def parse_node_generic(target, path, json_path, my_module, data, first = False )
elif type(data["source"]) == list:
my_module.add_src_file(data["source"]);
elif type(data["source"]) == dict:
if "list" in data["source"].keys():
my_module.add_src_file(data["source"]["list"]);
else:
debug.error("missing 'list' in node 'source:{}'");
for builder_key in data["source"].keys():
my_module.add_src_file_type(data["source"][builder_key], builder_key);
else:
debug.error("'" + json_path + "'Wrong type for node 'source' [] or {} or string");
@ -477,10 +477,8 @@ def parse_node_generic(target, path, json_path, my_module, data, first = False )
else:
debug.error("headers does not manage other than string, list and object");
elif type(data["header"]) == dict:
if "list" in data["header"].keys():
my_module.add_header_file(data["header"]["list"]);
else:
debug.error("missing 'list' in node 'header:{}'");
for builder_key in data["header"].keys():
my_module.add_header_file(data["header"][builder_key], builder_key);
else:
debug.error("Wrong type for node 'headers' [] or {}");

View File

@ -310,6 +310,17 @@ def filter_extention(list_files, extentions, invert=False):
out.append(file)
return out
def filter_map(input_data, extentions, invert=False):
out = {}
for key in input_data.keys():
if invert:
if key not in extentions:
out[key] = input_data[key];
else:
if key in extentions:
out[key] = input_data[key];
return out
def move_if_needed(src, dst):
if not os.path.isfile(src):

View File

@ -31,6 +31,12 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 1100
##
## @brief Get builder input file type

View File

@ -40,6 +40,13 @@ def get_type():
def get_input_type():
return ["cpp", "CPP", "cxx", "CXX", "xx", "XX", "CC", "cc"]
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 600
##
## @brief Get builder output file type
## @return List of extention supported
@ -152,11 +159,16 @@ def get_version_compilation_flags(flags, dependency_flags):
is_gnu = default_version_gnu
version = max(version_local, dependency_version)
if version == 2020:
if version == 2023:
if is_gnu == True:
out = ["-std=gnu++2a", "-D__CPP_VERSION__=2020"]
out = ["-std=gnu++23", "-D__CPP_VERSION__=2023"]
else:
out = ["-std=c++2a", "-D__CPP_VERSION__=2020"]
out = ["-std=c++23", "-D__CPP_VERSION__=2023"]
elif version == 2020:
if is_gnu == True:
out = ["-std=gnu++20", "-D__CPP_VERSION__=2020"]
else:
out = ["-std=c++20", "-D__CPP_VERSION__=2020"]
elif version == 2017:
if is_gnu == True:
out = ["-std=gnu++17", "-D__CPP_VERSION__=2017"]

View File

@ -34,6 +34,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 400
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -31,6 +31,13 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 1200
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -29,6 +29,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 800
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -29,6 +29,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 100
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -31,6 +31,13 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 900
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -31,6 +31,13 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 1000
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -35,6 +35,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 500
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -35,6 +35,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 700
##
## @brief Get builder input file type
## @return List of extention supported

View File

@ -29,24 +29,31 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 300
##
## @brief Get builder input file type
## @return List of extention supported
## @return List of extension supported
##
def get_input_type():
return ["s", "S"]
##
## @brief Get builder output file type
## @return List of extention supported
## @return List of extension supported
##
def get_output_type():
return ["o"]
##
## @brief Get builder support multi-threading or not
## @return True Multithreading supported
## @return False Multithreading NOT supported
## @return True Multi-threading supported
## @return False Multi-threading NOT supported
##
def get_support_multithreading():
return True

View File

@ -0,0 +1,35 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.set_help("python numpy library")
# check if the library exist:
for version in ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]:
if os.path.isdir("/usr/lib/python" + version + "/site-packages/numpy/core/include"):
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "python" + version);
if env.get_isolate_system() == True:
self.add_header_file(self, "/usr/lib/python" + version + "/site-packages/numpy/core/include/*", clip_path="/usr/lib/python" + version + "/site-packages/numpy/core/include/", recursive=True);
else:
self.add_path("/usr/lib/python" + version + "/site-packages/numpy/core/include/");
return;

View File

@ -0,0 +1,35 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.set_help("Python3 library \n Can be install with the package:\n - zlib1g-dev")
# check if the library exist:
for version in ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]:
if os.path.isdir("/usr/include/python" + version):
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "python" + version);
if env.get_isolate_system() == True:
self.add_header_file(self, "/usr/include/python" + version + "/*", clip_path="/usr/include/", recursive=True);
else:
self.add_path("/usr/include/python" + version + "/");
return;

View File

@ -0,0 +1,38 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.set_help("RT : rt access to the shared momory interface")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "rt")
self.add_depend([
'c'
])
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sys/mman.h",
"/usr/include/sys/stat.h"
],
clip_path="/usr/include",
recursive=False)