[DEV] create an isolation in the include file in Linux...
now libc header is install in a specific directory lib c++ header is install in a specific directory idem for pthread, X11, openGL, m, ...
This commit is contained in:
parent
8fa25bb8ec
commit
3804de2078
@ -500,7 +500,7 @@ class Module:
|
|||||||
dst_path = os.path.join(include_path, file["multi-dst"])
|
dst_path = os.path.join(include_path, file["multi-dst"])
|
||||||
tools.copy_anything(src_path,
|
tools.copy_anything(src_path,
|
||||||
dst_path,
|
dst_path,
|
||||||
recursive=False,
|
recursive=file["recursive"],
|
||||||
force_identical=True,
|
force_identical=True,
|
||||||
in_list=copy_list)
|
in_list=copy_list)
|
||||||
else:
|
else:
|
||||||
@ -854,23 +854,99 @@ class Module:
|
|||||||
|
|
||||||
def add_src_file(self, list):
|
def add_src_file(self, list):
|
||||||
tools.list_append_to(self.src, list, True)
|
tools.list_append_to(self.src, list, True)
|
||||||
|
##
|
||||||
def add_header_file(self, list, destination_path=None):
|
## @brief An an header file in the install directory
|
||||||
|
## @param[in] list List of element that is needed to install (can be a list or a simple string)
|
||||||
|
## @param[in,optional] destination_path Path to install the files (remove all the path of the file)
|
||||||
|
## @param[in,optional] clip_path Remove a part of the path set in the list and install data in generic include path
|
||||||
|
## @param[in,optional] recursive when use regexp in file list ==> we can add recursive property
|
||||||
|
##
|
||||||
|
## @code
|
||||||
|
## my_module.add_header_file([
|
||||||
|
## 'include/ewol/widget.h',
|
||||||
|
## 'include/ewol/context/context.h',
|
||||||
|
## ])
|
||||||
|
## @endcode
|
||||||
|
## Here the user need to acces to the file wrote: #include <include/ewol/cotext/context.h>
|
||||||
|
##
|
||||||
|
## We can simplify it:
|
||||||
|
## @code
|
||||||
|
## my_module.add_header_file([
|
||||||
|
## 'include/ewol/widget.h',
|
||||||
|
## 'include/ewol/context/context.h',
|
||||||
|
## ],
|
||||||
|
## destination_path='ewol')
|
||||||
|
## @endcode
|
||||||
|
## Here the user need to acces to the file wrote: #include <ewol/context.h> ==> the internal path has been removed
|
||||||
|
##
|
||||||
|
## An other way is:
|
||||||
|
## @code
|
||||||
|
## my_module.add_header_file([
|
||||||
|
## 'include/ewol/widget.h',
|
||||||
|
## 'include/ewol/context/context.h',
|
||||||
|
## ],
|
||||||
|
## clip_path='include')
|
||||||
|
## @endcode
|
||||||
|
## Here the user need to acces to the file wrote: #include <ewol/context/context.h> ==> it just remove the include data
|
||||||
|
##
|
||||||
|
## With a copy all methode:
|
||||||
|
## @code
|
||||||
|
## my_module.add_header_file(
|
||||||
|
## 'include/*.h',
|
||||||
|
## recursive=True)
|
||||||
|
## @endcode
|
||||||
|
## Here the user need to acces to the file wrote: #include <ewol/context/context.h> ==> it just remove the include data
|
||||||
|
##
|
||||||
|
def add_header_file(self, list, destination_path=None, clip_path=None, recursive=False):
|
||||||
if destination_path != None:
|
if destination_path != None:
|
||||||
debug.verbose("Change destination PATH: '" + str(destination_path) + "'")
|
debug.verbose("Change destination PATH: '" + str(destination_path) + "'")
|
||||||
new_list = []
|
new_list = []
|
||||||
for elem in list:
|
for elem in list:
|
||||||
if destination_path != None:
|
|
||||||
base = os.path.basename(elem)
|
base = os.path.basename(elem)
|
||||||
if '*' in base or '[' in base or '(' in base:
|
if destination_path != None:
|
||||||
|
if clip_path != None:
|
||||||
|
debug.error("can not use 'destination_path' and 'clip_path' at the same time ...");
|
||||||
|
if '*' in base \
|
||||||
|
or '[' in base \
|
||||||
|
or '(' in base:
|
||||||
new_list.append({"src":elem,
|
new_list.append({"src":elem,
|
||||||
"multi-dst":destination_path})
|
"multi-dst":destination_path,
|
||||||
|
"recursive":recursive})
|
||||||
else:
|
else:
|
||||||
new_list.append({"src":elem,
|
new_list.append({"src":elem,
|
||||||
"dst":os.path.join(destination_path, base)})
|
"dst":os.path.join(destination_path, base),
|
||||||
|
"recursive":recursive})
|
||||||
|
else:
|
||||||
|
if clip_path == None:
|
||||||
|
if '*' in base \
|
||||||
|
or '[' in base \
|
||||||
|
or '(' in base:
|
||||||
|
new_list.append({"src":elem,
|
||||||
|
"multi-dst":"",
|
||||||
|
"recursive":recursive})
|
||||||
else:
|
else:
|
||||||
new_list.append({"src":elem,
|
new_list.append({"src":elem,
|
||||||
"dst":elem})
|
"dst":elem,
|
||||||
|
"recursive":recursive})
|
||||||
|
else:
|
||||||
|
if len(clip_path)>len(elem):
|
||||||
|
debug.error("can not clip a path with not the same name: '" + clip_path + "' != '" + elem + "' (size too small)")
|
||||||
|
if clip_path != elem[:len(clip_path)]:
|
||||||
|
debug.error("can not clip a path with not the same name: '" + clip_path + "' != '" + elem[:len(clip_path)] + "'")
|
||||||
|
out_elem = elem[len(clip_path):]
|
||||||
|
while len(out_elem) > 0 \
|
||||||
|
and out_elem[0] == "/":
|
||||||
|
out_elem = out_elem[1:]
|
||||||
|
if '*' in base \
|
||||||
|
or '[' in base \
|
||||||
|
or '(' in base:
|
||||||
|
new_list.append({"src":elem,
|
||||||
|
"multi-dst":"",
|
||||||
|
"recursive":recursive})
|
||||||
|
else:
|
||||||
|
new_list.append({"src":elem,
|
||||||
|
"dst":out_elem,
|
||||||
|
"recursive":recursive})
|
||||||
tools.list_append_to(self.header, new_list, True)
|
tools.list_append_to(self.header, new_list, True)
|
||||||
|
|
||||||
def add_export_path(self, list, type='c'):
|
def add_export_path(self, list, type='c'):
|
||||||
|
@ -28,6 +28,7 @@ class System:
|
|||||||
self.export_src=[]
|
self.export_src=[]
|
||||||
self.export_path=[]
|
self.export_path=[]
|
||||||
self.action_on_state={}
|
self.action_on_state={}
|
||||||
|
self.headers=[]
|
||||||
|
|
||||||
def add_export_sources(self, list):
|
def add_export_sources(self, list):
|
||||||
tools.list_append_to(self.export_src, list)
|
tools.list_append_to(self.export_src, list)
|
||||||
@ -47,7 +48,13 @@ class System:
|
|||||||
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])
|
||||||
|
def add_header_file(self, list, destination_path=None, clip_path=None, recursive=False):
|
||||||
|
self.headers.append({
|
||||||
|
"list":list,
|
||||||
|
"dst":destination_path,
|
||||||
|
"clip":clip_path,
|
||||||
|
"recursive":recursive
|
||||||
|
})
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "{lutin.System}"
|
return "{lutin.System}"
|
||||||
|
|
||||||
@ -69,7 +76,12 @@ def create_module_from_system(target, dict):
|
|||||||
for elem in dict["system"].action_on_state:
|
for elem in dict["system"].action_on_state:
|
||||||
level, name, action = dict["system"].action_on_state[elem]
|
level, name, action = dict["system"].action_on_state[elem]
|
||||||
target.add_action(elem, level, name, action)
|
target.add_action(elem, level, name, action)
|
||||||
|
for elem in dict["system"].headers:
|
||||||
|
myModule.add_header_file(
|
||||||
|
elem["list"],
|
||||||
|
destination_path=elem["dst"],
|
||||||
|
clip_path=elem["clip"],
|
||||||
|
recursive=elem["recursive"])
|
||||||
return myModule
|
return myModule
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ class Target:
|
|||||||
'-D__TARGET_ADDR__' + self.select_bus + 'BITS',
|
'-D__TARGET_ADDR__' + self.select_bus + 'BITS',
|
||||||
'-D_REENTRANT'
|
'-D_REENTRANT'
|
||||||
])
|
])
|
||||||
|
self.add_flag("c", "-nodefaultlibs")
|
||||||
self.add_flag("c++", "-nostdlib")
|
self.add_flag("c++", "-nostdlib")
|
||||||
self.add_flag("ar", 'rcs')
|
self.add_flag("ar", 'rcs')
|
||||||
|
|
||||||
|
33
lutin/z_system/lutinSystem_Linux_X11.py
Normal file
33
lutin/z_system/lutinSystem_Linux_X11.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
|
from lutin import debug
|
||||||
|
from lutin import system
|
||||||
|
from lutin import tools
|
||||||
|
import os
|
||||||
|
|
||||||
|
class System(system.System):
|
||||||
|
def __init__(self, target):
|
||||||
|
system.System.__init__(self)
|
||||||
|
# create some HELP:
|
||||||
|
self.help = "X11: Basic interface of Linux Graphic interface"
|
||||||
|
self.valid = True
|
||||||
|
# no check needed ==> just add this:
|
||||||
|
self.add_module_depend(['c'])
|
||||||
|
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/X11/*"
|
||||||
|
],
|
||||||
|
destination_path="X11",
|
||||||
|
recursive=True)
|
||||||
|
|
||||||
|
self.add_export_flag('link-lib', 'X11')
|
||||||
|
|
||||||
|
|
95
lutin/z_system/lutinSystem_Linux_c.py
Normal file
95
lutin/z_system/lutinSystem_Linux_c.py
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
|
from lutin import debug
|
||||||
|
from lutin import system
|
||||||
|
from lutin import tools
|
||||||
|
import os
|
||||||
|
|
||||||
|
class System(system.System):
|
||||||
|
def __init__(self, target):
|
||||||
|
system.System.__init__(self)
|
||||||
|
# create some HELP:
|
||||||
|
self.help = "C: Generic C library"
|
||||||
|
self.valid = True
|
||||||
|
# no check needed ==> just add this:
|
||||||
|
#self.add_export_flag("c", "-D__STDCPP_GNU__")
|
||||||
|
#self.add_export_flag("c++", "-nodefaultlibs")
|
||||||
|
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/unistd*",
|
||||||
|
"/usr/include/assert.h*",
|
||||||
|
"/usr/include/ctype.h*",
|
||||||
|
"/usr/include/errno.h*",
|
||||||
|
"/usr/include/execinfo.h*",
|
||||||
|
"/usr/include/fenv.h*",
|
||||||
|
"/usr/include/float.h*",
|
||||||
|
"/usr/include/inttypes.h*",
|
||||||
|
"/usr/include/iso646.h*",
|
||||||
|
"/usr/include/limits.h*",
|
||||||
|
"/usr/include/locale.h*",
|
||||||
|
"/usr/include/setjmp.h*",
|
||||||
|
"/usr/include/signal.h*",
|
||||||
|
"/usr/include/string.h*",
|
||||||
|
"/usr/include/std*",
|
||||||
|
"/usr/include/tgmath.h*",
|
||||||
|
"/usr/include/time.h*",
|
||||||
|
"/usr/include/uchar.h*",
|
||||||
|
"/usr/include/wchar.h*",
|
||||||
|
"/usr/include/wctype.h*",
|
||||||
|
"/usr/include/features.h*",
|
||||||
|
"/usr/include/xlocale.h*",
|
||||||
|
"/usr/include/endian.h*",
|
||||||
|
"/usr/include/alloca.h*",
|
||||||
|
"/usr/include/libio.h*",
|
||||||
|
"/usr/include/_G_config.h*",
|
||||||
|
"/usr/include/fcntl.h*",
|
||||||
|
"/usr/include/utime.h*",
|
||||||
|
"/usr/include/dlfcn.h*",
|
||||||
|
"/usr/include/libintl.h*",
|
||||||
|
"/usr/include/getopt.h*",
|
||||||
|
"/usr/include/dirent.h*",
|
||||||
|
"/usr/include/setjmp.h*",
|
||||||
|
],
|
||||||
|
recursive=False)
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/sys/*",
|
||||||
|
],
|
||||||
|
destination_path="sys",
|
||||||
|
recursive=False)
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/bits/*",
|
||||||
|
],
|
||||||
|
destination_path="bits",
|
||||||
|
recursive=False)
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/gnu/*",
|
||||||
|
],
|
||||||
|
destination_path="gnu",
|
||||||
|
recursive=False)
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/linux/*",
|
||||||
|
],
|
||||||
|
destination_path="linux",
|
||||||
|
recursive=False)
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/asm/*",
|
||||||
|
],
|
||||||
|
destination_path="asm",
|
||||||
|
recursive=False)
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/asm-generic/*",
|
||||||
|
],
|
||||||
|
destination_path="asm-generic",
|
||||||
|
recursive=False)
|
||||||
|
self.add_export_flag("link-bin", "/usr/lib/crti.o")
|
||||||
|
self.add_export_flag("link-bin", "/usr/lib/crt1.o")
|
||||||
|
|
||||||
|
|
@ -20,8 +20,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_module_depend(['c'])
|
||||||
self.add_export_flag("c++", "-D__STDCPP_GNU__")
|
self.add_export_flag("c++", "-D__STDCPP_GNU__")
|
||||||
self.add_export_flag("c++-remove", "-nostdlib")
|
#self.add_export_flag("c++-remove", "-nostdlib")
|
||||||
self.add_export_flag("need-libstdc++", True)
|
#self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/c++/6.1.1/*"
|
||||||
|
],
|
||||||
|
recursive=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,5 +22,11 @@ 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", "m")
|
self.add_export_flag("link-lib", "m")
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/math.h"
|
||||||
|
],
|
||||||
|
clip_path="/usr/include",
|
||||||
|
recursive=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
53
lutin/z_system/lutinSystem_Linux_opengl.py
Normal file
53
lutin/z_system/lutinSystem_Linux_opengl.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
|
from lutin import debug
|
||||||
|
from lutin import system
|
||||||
|
from lutin import tools
|
||||||
|
import os
|
||||||
|
|
||||||
|
class System(system.System):
|
||||||
|
def __init__(self, target):
|
||||||
|
system.System.__init__(self)
|
||||||
|
# create some HELP:
|
||||||
|
self.help = "OpenGL: Generic graphic library"
|
||||||
|
self.valid = True
|
||||||
|
# no check needed ==> just add this:
|
||||||
|
self.add_module_depend([
|
||||||
|
'c',
|
||||||
|
'X11'
|
||||||
|
])
|
||||||
|
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/GL/*"
|
||||||
|
],
|
||||||
|
destination_path="GL",
|
||||||
|
recursive=True)
|
||||||
|
|
||||||
|
self.add_export_flag('link-lib', 'GL')
|
||||||
|
"""
|
||||||
|
if target.name=="Linux":
|
||||||
|
|
||||||
|
elif target.name=="Android":
|
||||||
|
my_module.add_export_flag('link-lib', "GLESv2")
|
||||||
|
elif target.name=="Windows":
|
||||||
|
my_module.add_module_depend([
|
||||||
|
"glew"
|
||||||
|
])
|
||||||
|
elif target.name=="MacOs":
|
||||||
|
my_module.add_export_flag('link', [
|
||||||
|
"-framework OpenGL"])
|
||||||
|
elif target.name=="IOs":
|
||||||
|
my_module.add_export_flag('link', [
|
||||||
|
"-framework OpenGLES"
|
||||||
|
])
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
34
lutin/z_system/lutinSystem_Linux_pthread.py
Normal file
34
lutin/z_system/lutinSystem_Linux_pthread.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
|
from lutin import debug
|
||||||
|
from lutin import system
|
||||||
|
from lutin import tools
|
||||||
|
import os
|
||||||
|
|
||||||
|
class System(system.System):
|
||||||
|
def __init__(self, target):
|
||||||
|
system.System.__init__(self)
|
||||||
|
# create some HELP:
|
||||||
|
self.help="pthread : Generic multithreading system\n Can be install with the package:\n - pthread-dev"
|
||||||
|
# check if the library exist:
|
||||||
|
if not os.path.isfile("/usr/include/pthread.h"):
|
||||||
|
# we did not find the library reqiested (just return) (automaticly set at false)
|
||||||
|
return;
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "pthread")
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/sched.h",
|
||||||
|
"/usr/include/pthread.h"
|
||||||
|
],
|
||||||
|
clip_path="/usr/include/")
|
||||||
|
|
||||||
|
|
@ -42,6 +42,9 @@ class Target(target.Target):
|
|||||||
self.pkg_path_lib = "lib"
|
self.pkg_path_lib = "lib"
|
||||||
self.pkg_path_license = "license"
|
self.pkg_path_license = "license"
|
||||||
|
|
||||||
|
self.sysroot = "--sysroot=/aDirectoryThatDoesNotExist/"
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
.local/application
|
.local/application
|
||||||
*--> applName -> applName.app/bin/applName
|
*--> applName -> applName.app/bin/applName
|
||||||
|
Loading…
x
Reference in New Issue
Block a user