[DEV/DOC] correct template of module, add API of set file with dependency availlable
This commit is contained in:
parent
1c76227b27
commit
62d084b351
@ -218,13 +218,13 @@ def create(target, module_name):
|
|||||||
...
|
...
|
||||||
|
|
||||||
# add dependency of the generic C library:
|
# add dependency of the generic C library:
|
||||||
my_module.add_module_depend('c')
|
my_module.add_depend('c')
|
||||||
# add dependency of the generic C++ library:
|
# add dependency of the generic C++ library:
|
||||||
my_module.add_module_depend('cxx')
|
my_module.add_depend('cxx')
|
||||||
# add dependency of the generic math library:
|
# add dependency of the generic math library:
|
||||||
my_module.add_module_depend('m')
|
my_module.add_depend('m')
|
||||||
# or other user lib:
|
# or other user lib:
|
||||||
my_module.add_module_depend('lib-name')
|
my_module.add_depend('lib-name')
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
@ -235,10 +235,10 @@ def create(target, module_name):
|
|||||||
...
|
...
|
||||||
|
|
||||||
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
|
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
|
||||||
my_module.add_optionnal_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
|
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
|
||||||
|
|
||||||
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is exported in external upper build
|
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is exported in external upper build
|
||||||
my_module.add_optionnal_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
|
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
@ -441,28 +441,28 @@ def create(target, module_name):
|
|||||||
my_module.add_path(os.path.join(tools.get_current_path(__file__), "lib-name"))
|
my_module.add_path(os.path.join(tools.get_current_path(__file__), "lib-name"))
|
||||||
|
|
||||||
# add dependency of the generic C library:
|
# add dependency of the generic C library:
|
||||||
my_module.add_module_depend('c')
|
my_module.add_depend('c')
|
||||||
# add dependency of the generic C++ library:
|
# add dependency of the generic C++ library:
|
||||||
my_module.add_module_depend('cxx')
|
my_module.add_depend('cxx')
|
||||||
# add dependency of the generic math library:
|
# add dependency of the generic math library:
|
||||||
my_module.add_module_depend('m')
|
my_module.add_depend('m')
|
||||||
# or other user lib:
|
# or other user lib:
|
||||||
my_module.add_module_depend([
|
my_module.add_depend([
|
||||||
'lib-name1',
|
'lib-name1',
|
||||||
'lib-name2'
|
'lib-name2'
|
||||||
])
|
])
|
||||||
|
|
||||||
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
|
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
|
||||||
my_module.add_optionnal_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
|
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
|
||||||
|
|
||||||
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is exported in external upper build
|
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is exported in external upper build
|
||||||
my_module.add_optionnal_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
|
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
|
||||||
|
|
||||||
# external flags:
|
# external flags:
|
||||||
my_module.add_flag('link-lib', "pthread", export=True)
|
my_module.add_flag('link-lib', "pthread", export=True)
|
||||||
my_module.add_flag('c++', "-DHELLO_FLAG=\"kljlkj\"", export=True)
|
my_module.add_flag('c++', "-DHELLO_FLAG=\"kljlkj\"", export=True)
|
||||||
# internal flags:
|
# internal flags:
|
||||||
my_module.add_flags('c', "-DMODE_RELEASE")
|
my_module.add_flag('c', "-DMODE_RELEASE")
|
||||||
|
|
||||||
if target.get_mode() == "release":
|
if target.get_mode() == "release":
|
||||||
pass
|
pass
|
||||||
|
@ -521,17 +521,14 @@ class Module:
|
|||||||
list_sub_file_needed_to_build = []
|
list_sub_file_needed_to_build = []
|
||||||
self._sub_heritage_list = heritage.HeritageList()
|
self._sub_heritage_list = heritage.HeritageList()
|
||||||
# optionnal dependency :
|
# optionnal dependency :
|
||||||
for dep, option, export in self._depends_optionnal:
|
for dep, option, export, src_file, header_file 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, 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 ...
|
self.add_flag(option[0], option[1], export=export);
|
||||||
# ==> do it really better ...
|
self.add_src_file(src_file)
|
||||||
if export == False:
|
self.add_header_file(header_file)
|
||||||
self.add_flag(option[0], option[1]);
|
|
||||||
else:
|
|
||||||
self.add_flag(option[0], option[1], export=True);
|
|
||||||
# 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)
|
||||||
for dep in self._depends:
|
for dep in self._depends:
|
||||||
@ -951,10 +948,12 @@ class Module:
|
|||||||
## @param[in] module_name (string) Name of the optionnal dependency
|
## @param[in] module_name (string) Name of the optionnal dependency
|
||||||
## @param[in] compilation_flags ([string,string]) flag to add if dependency if find.
|
## @param[in] compilation_flags ([string,string]) flag to add if dependency if find.
|
||||||
## @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.
|
||||||
|
## @param[in] src_file ([string,...]) File to compile if the dependecy if found.
|
||||||
|
## @param[in] header_file ([string,...]) File to add in header if the dependecy if found.
|
||||||
## @return None
|
## @return None
|
||||||
##
|
##
|
||||||
def add_optionnal_depend(self, module_name, compilation_flags=["", ""], export=False):
|
def add_optionnal_depend(self, module_name, compilation_flags=["", ""], export=False, src_file=[], header_file=[]):
|
||||||
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, src_file, header_file], True)
|
||||||
|
|
||||||
## @brief deprecated ...
|
## @brief deprecated ...
|
||||||
## @return None
|
## @return None
|
||||||
|
42
lutin/z_system/lutinSystem_Linux_va.py
Normal file
42
lutin/z_system/lutinSystem_Linux_va.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/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
|
||||||
|
from lutin import env
|
||||||
|
import os
|
||||||
|
|
||||||
|
class System(system.System):
|
||||||
|
def __init__(self, target):
|
||||||
|
system.System.__init__(self)
|
||||||
|
# create some HELP:
|
||||||
|
self.set_help("va : Video Acceleration")
|
||||||
|
# check if the library exist:
|
||||||
|
if not os.path.isfile("/usr/include/va/va.h"):
|
||||||
|
# we did not find the library reqiested (just return) (automaticly set at false)
|
||||||
|
return;
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.set_valid(True)
|
||||||
|
self.add_depend([
|
||||||
|
'X11'
|
||||||
|
])
|
||||||
|
self.add_flag("link-lib", ["va", "va-drm", "va-x11"])
|
||||||
|
if env.get_isolate_system() == True:
|
||||||
|
#self.add_flag("link-lib", "xns")
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/va/*"
|
||||||
|
],
|
||||||
|
destination_path="va",
|
||||||
|
recursive=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
41
lutin/z_system/lutinSystem_Linux_vdpau.py
Normal file
41
lutin/z_system/lutinSystem_Linux_vdpau.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/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
|
||||||
|
from lutin import env
|
||||||
|
import os
|
||||||
|
|
||||||
|
class System(system.System):
|
||||||
|
def __init__(self, target):
|
||||||
|
system.System.__init__(self)
|
||||||
|
# create some HELP:
|
||||||
|
self.set_help("vdpau : Video decaudatge hardware Acceleration")
|
||||||
|
# check if the library exist:
|
||||||
|
if not os.path.isfile("/usr/include/vdpau/vdpau.h"):
|
||||||
|
# we did not find the library reqiested (just return) (automaticly set at false)
|
||||||
|
return;
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.set_valid(True)
|
||||||
|
self.add_flag("link-lib", "vdpau")
|
||||||
|
self.add_depend([
|
||||||
|
'X11'
|
||||||
|
])
|
||||||
|
if env.get_isolate_system() == True:
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/vdpau/*"
|
||||||
|
],
|
||||||
|
destination_path="vdpau",
|
||||||
|
recursive=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ class Target(target.Target):
|
|||||||
if host.BUS_SIZE != 32:
|
if host.BUS_SIZE != 32:
|
||||||
self.add_flag("c", "-m32")
|
self.add_flag("c", "-m32")
|
||||||
|
|
||||||
self.add_flag("c", "-fpic")
|
self.add_flag("c", "-fPIC")
|
||||||
|
|
||||||
self.pkg_path_data = "share"
|
self.pkg_path_data = "share"
|
||||||
self.pkg_path_bin = "bin"
|
self.pkg_path_bin = "bin"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user