[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:
|
||||
my_module.add_module_depend('c')
|
||||
my_module.add_depend('c')
|
||||
# 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:
|
||||
my_module.add_module_depend('m')
|
||||
my_module.add_depend('m')
|
||||
# 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
|
||||
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
|
||||
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"))
|
||||
|
||||
# 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:
|
||||
my_module.add_module_depend('cxx')
|
||||
my_module.add_depend('cxx')
|
||||
# add dependency of the generic math library:
|
||||
my_module.add_module_depend('m')
|
||||
my_module.add_depend('m')
|
||||
# or other user lib:
|
||||
my_module.add_module_depend([
|
||||
my_module.add_depend([
|
||||
'lib-name1',
|
||||
'lib-name2'
|
||||
])
|
||||
|
||||
# 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
|
||||
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:
|
||||
my_module.add_flag('link-lib', "pthread", export=True)
|
||||
my_module.add_flag('c++', "-DHELLO_FLAG=\"kljlkj\"", export=True)
|
||||
# internal flags:
|
||||
my_module.add_flags('c', "-DMODE_RELEASE")
|
||||
my_module.add_flag('c', "-DMODE_RELEASE")
|
||||
|
||||
if target.get_mode() == "release":
|
||||
pass
|
||||
|
@ -521,17 +521,14 @@ class Module:
|
||||
list_sub_file_needed_to_build = []
|
||||
self._sub_heritage_list = heritage.HeritageList()
|
||||
# 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) + "'")
|
||||
inherit_list, isBuilt = target.build(dep, True)
|
||||
if isBuilt == True:
|
||||
self._local_heritage.add_depends(dep);
|
||||
# TODO : Add optionnal Flags ...
|
||||
# ==> do it really better ...
|
||||
if export == False:
|
||||
self.add_flag(option[0], option[1]);
|
||||
else:
|
||||
self.add_flag(option[0], option[1], export=True);
|
||||
self.add_flag(option[0], option[1], export=export);
|
||||
self.add_src_file(src_file)
|
||||
self.add_header_file(header_file)
|
||||
# add at the heritage list :
|
||||
self._sub_heritage_list.add_heritage_list(inherit_list)
|
||||
for dep in self._depends:
|
||||
@ -951,10 +948,12 @@ class Module:
|
||||
## @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] 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
|
||||
##
|
||||
def add_optionnal_depend(self, module_name, compilation_flags=["", ""], export=False):
|
||||
tools.list_append_and_check(self._depends_optionnal, [module_name, compilation_flags, export], True)
|
||||
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, src_file, header_file], True)
|
||||
|
||||
## @brief deprecated ...
|
||||
## @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:
|
||||
self.add_flag("c", "-m32")
|
||||
|
||||
self.add_flag("c", "-fpic")
|
||||
self.add_flag("c", "-fPIC")
|
||||
|
||||
self.pkg_path_data = "share"
|
||||
self.pkg_path_bin = "bin"
|
||||
|
Loading…
x
Reference in New Issue
Block a user