[DEV] add ccache
This commit is contained in:
parent
b4bce09b46
commit
3058308f18
13
bin/lutin
13
bin/lutin
@ -38,6 +38,7 @@ myArgs.add("s", "force-strip", desc="Force the stripping of the compile elements
|
||||
myArgs.add("o", "force-optimisation", desc="Force optimisation of the build")
|
||||
myArgs.add("w", "warning", desc="Store warning in a file build file")
|
||||
myArgs.add("i", "isolate-system", desc="Isolate system build (copy header of c and c++ system lib to not include unneeded external libs) EXPERIMENTAL (archlinux)")
|
||||
myArgs.add("K", "ccache", desc="Enable the ccache interface")
|
||||
|
||||
myArgs.add_section("properties", "keep in the sequency of the cible")
|
||||
myArgs.add("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'")
|
||||
@ -216,6 +217,13 @@ def parseGenericArg(argument, active):
|
||||
if active == True:
|
||||
env.set_parse_depth(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.get_option_name()=="ccache":
|
||||
if active == True:
|
||||
if check_boolean(argument.get_arg()) == True:
|
||||
env.set_ccache(True)
|
||||
else:
|
||||
env.set_ccache(False)
|
||||
return True
|
||||
elif argument.get_option_name() == "verbose":
|
||||
if active == True:
|
||||
debug.set_level(int(argument.get_arg()))
|
||||
@ -291,6 +299,11 @@ if os.path.isfile(config_file) == True:
|
||||
debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'")
|
||||
parseGenericArg(arguments.ArgElement("depth", str(data)), True)
|
||||
|
||||
if "get_ccache" in dir(configuration_file):
|
||||
data = configuration_file.get_ccache()
|
||||
debug.debug(" get default config 'get_ccache' val='" + str(data) + "'")
|
||||
parseGenericArg(arguments.ArgElement("ccache", str(data)), True)
|
||||
|
||||
if "get_default_jobs" in dir(configuration_file):
|
||||
data = configuration_file.get_default_jobs()
|
||||
debug.debug(" get default config 'get_default_jobs' val='" + str(data) + "'")
|
||||
|
11
lutin/env.py
11
lutin/env.py
@ -112,6 +112,17 @@ def get_warning_mode():
|
||||
global store_warning
|
||||
return store_warning
|
||||
|
||||
ccache=False
|
||||
def set_ccache(val):
|
||||
global ccache
|
||||
if val == True:
|
||||
ccache = True
|
||||
else:
|
||||
ccache = False
|
||||
|
||||
def get_ccache():
|
||||
global ccache
|
||||
return ccache
|
||||
|
||||
def end_with(name, list):
|
||||
for appl in list:
|
||||
|
@ -83,8 +83,12 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
|
||||
lib_name = elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic
|
||||
if lib_name not in depancy.src['dynamic']:
|
||||
list_static.append(elem)
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
#create comand line:
|
||||
cmd = []
|
||||
cmd = [compilator_ccache]
|
||||
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||
if "need-libstdc++" in depancy.flags \
|
||||
and depancy.flags["need-libstdc++"] == True:
|
||||
|
@ -15,6 +15,7 @@ from lutin import multiprocess
|
||||
from lutin import tools
|
||||
from lutin import debug
|
||||
from lutin import depend
|
||||
from lutin import env
|
||||
|
||||
# C version:
|
||||
default_version = 1989
|
||||
@ -65,8 +66,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
compilator_ccache,
|
||||
target.cc,
|
||||
"-o", file_dst,
|
||||
target.arch,
|
||||
|
@ -15,6 +15,7 @@ from lutin import multiprocess
|
||||
from lutin import tools
|
||||
from lutin import debug
|
||||
from lutin import depend
|
||||
from lutin import env
|
||||
# C++ default version:
|
||||
default_version = 1999
|
||||
default_version_gnu = False
|
||||
@ -64,8 +65,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
compilator_ccache,
|
||||
target.xx,
|
||||
"-o", file_dst,
|
||||
target.arch,
|
||||
|
@ -86,8 +86,12 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
|
||||
lib_name = elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic
|
||||
if lib_name not in depancy.src['dynamic']:
|
||||
list_static.append(elem)
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
#create command Line
|
||||
cmd = []
|
||||
cmd = [compilator_ccache]
|
||||
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||
if "need-libstdc++" in depancy.flags \
|
||||
and depancy.flags["need-libstdc++"] == True:
|
||||
|
@ -68,7 +68,12 @@ def link(file, binary, target, depancy, flags, name, basic_path):
|
||||
debug.extreme_verbose("file_cmd = " + file_cmd)
|
||||
debug.extreme_verbose("file_warning = " + file_warning)
|
||||
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
cmd = [
|
||||
compilator_ccache,
|
||||
target.ar
|
||||
]
|
||||
try:
|
||||
|
@ -16,6 +16,7 @@ from lutin import tools
|
||||
from lutin import builder
|
||||
from lutin import debug
|
||||
from lutin import depend
|
||||
from lutin import env
|
||||
|
||||
local_ref_on_builder_c = None
|
||||
|
||||
@ -65,8 +66,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
compilator_ccache,
|
||||
target.cc,
|
||||
"-o", file_dst ,
|
||||
target.arch,
|
||||
|
@ -16,6 +16,7 @@ from lutin import tools
|
||||
from lutin import builder
|
||||
from lutin import debug
|
||||
from lutin import depend
|
||||
from lutin import env
|
||||
|
||||
local_ref_on_builder_cpp = None
|
||||
|
||||
@ -65,8 +66,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
compilator_ccache,
|
||||
target.xx,
|
||||
"-o", file_dst,
|
||||
target.arch,
|
||||
|
@ -14,6 +14,7 @@
|
||||
from lutin import multiprocess
|
||||
from lutin import tools
|
||||
from lutin import depend
|
||||
from lutin import env
|
||||
|
||||
##
|
||||
## Initialize the builder, if needed ... to get dependency between builder (for example)
|
||||
@ -60,8 +61,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
|
||||
# set ccache interface:
|
||||
compilator_ccache = ""
|
||||
if env.get_ccache() == True:
|
||||
compilator_ccache = "ccache"
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
compilator_ccache,
|
||||
target.cc,
|
||||
"-o", file_dst,
|
||||
target.arch,
|
||||
|
Loading…
Reference in New Issue
Block a user