Base of the module file:
To create a new module you will use a generic naming:
Replace your module-name
with the delivery you want. The name can contain [a-zA-Z0-9-_] values.
In the module name you must define some values:
3 import lutin.tools
as tools
21 return "Ewol tool kit" 45 def get_compagny_type():
50 def get_compagny_name():
51 return "hello-compagny" 56 return [
"Mr NAME SurName <my-email@group.com>"]
68 def configure(target, my_module):
Thes it is simple to specify build for:
Create a new Module (LIBRARY):
What to change:
By default the library is compile in shared and static. The binary select the mode it prefer...
You can force the library to be compile as a dll/so: LIBRARY_DYNAMIC
or a basic include lib: .a LIBRARY_STATIC
Create a new Module (BINARY):
Generic Binary:
What to change:
The Binay is compile by default target mode (note that the IOs target generate a single .so with all the library inside)
You can force the Binary to be use dynamic library when possible: BINARY_SHARED
or create a single binary with no .so depenency: BINARY_STAND_ALONE
Create a new Module (TEST-BINARY / TOOL-BINARY):
Two binary are really usefull in developpement, the tools and the test-unit, This is the reason why we specify for this 2 cases.
Add the subElement description:
or:
Create a new Module (DATA):
This pode permit to only copy data and no dependency with compilling system
What to change:
Module internal specifications:
Add file to compile:
This is simple: (you just need to specify all the file to compile)
1 def configure(target, my_module):
5 my_module.add_src_file([
6 'module-name/file1.cpp',
7 'module-name/file2.cpp',
Include directory & install header:
A big point to understand is that your library will be used by an other module, then it need to use headers.
The developper must isolate the external include and internal include, then lutin "install" the header and add the "install" header path to build the local library. This permit to check error inclusion directly in developpement and separate the #include "XXX.h"
and the #include <lib-xxx/XXX.h>
Add file to external include:
1 def configure(target, my_module):
4 my_module.add_header_file([
You can add a path to your local include:
1 def configure(target, my_module):
4 my_module.add_path(os.path.join(tools.get_current_path(__file__),
"lib-name"))
Add Sub-dependency:
All library need to add at minimum of a simple library (C lib) and other if needed. To do it jus call:
1 def configure(target, my_module):
5 my_module.add_depend(
'c')
7 my_module.add_depend(
'cxx')
9 my_module.add_depend(
'm')
11 my_module.add_depend(
'lib-name')
The system can have optinnal sub-library, then if you just want to add an optionnal dependency:
1 def configure(target, my_module):
5 my_module.add_optionnal_depend(
'z', [
"c++",
"-DLIB_NAME_BUILD_ZLIB"])
8 my_module.add_optionnal_depend(
'z', [
"c++",
"-DLIB_NAME_BUILD_ZLIB"], export=
True)
Compilation adn link flags/libs:
It is possible to define local and external flags (external are set internal too):
1 def configure(target, my_module):
4 my_module.add_flag(
'link-lib',
"pthread", export=
True)
5 my_module.add_flag(
'c++',
"-DHELLO_FLAG=\"kljlkj\"", export=
True)
7 my_module.add_flag(
'c',
"-DMODE_RELEASE")
build mode (release/debug):
To add somes element dependent of the build mode:
1 def configure(target, my_module):
4 if target.get_mode() ==
"release":
build type target:
To add somes element dependent of the target type:
1 def configure(target, my_module):
4 if "Windows" in target.get_type():
6 elif "MacOs" in target.get_type():
8 elif "IOs" in target.get_type():
10 elif "Linux" in target.get_type():
12 elif "Android" in target.get_type():
The target get_type return a list of type that represent the hiararchy dependency, a simple example:
A "Debian" herited of a "Linux" then it will return ["Linux", "Debian"]
Add some data in the install path (share path):
You can install a simple file:
1 def configure(target, my_module):
5 my_module.copy_path(
'data/icon.svg')
Copy multiple files (change path)
1 def configure(target, my_module):
4 my_module.copy_path(
'data/*',
'destinationPath')
display some debug to help writing code:
5 debug.error(
"comment that stop the build")
6 debug.warning(
"comment that print a simple warning")
7 debug.info(
"comment that print a simple information")
8 debug.debug(
"comment that print a simple debug")
9 debug.verbose(
"comment that print a simple verbose")
A Full template:
Create the file:
With:
3 import lutin.tools
as tools
23 return "Descriptiuon of the PROGRAMM" 47 def get_compagny_type():
52 def get_compagny_name():
53 return "hello-compagny" 58 return [
"Mr NAME SurName <my-email@group.com>"]
72 def configure(target, my_module):
75 my_module.add_src_file([
76 'module-name/file1.cpp',
77 'module-name/file2.cpp',
81 my_module.add_header_file([
82 'module-name/file1.h',
86 my_module.add_path(os.path.join(tools.get_current_path(__file__),
"lib-name"))
89 my_module.add_depend(
'c')
91 my_module.add_depend(
'cxx')
93 my_module.add_depend(
'm')
95 my_module.add_depend([
101 my_module.add_optionnal_depend(
'z', [
"c++",
"-DLIB_NAME_BUILD_ZLIB"])
104 my_module.add_optionnal_depend(
'z', [
"c++",
"-DLIB_NAME_BUILD_ZLIB"], export=
True)
107 my_module.add_flag(
'link-lib',
"pthread", export=
True)
108 my_module.add_flag(
'c++',
"-DHELLO_FLAG=\"kljlkj\"", export=
True)
110 my_module.add_flag(
'c',
"-DMODE_RELEASE")
112 if target.get_mode() ==
"release":
117 if "Windows" in target.get_type():
119 elif "MacOs" in target.get_type():
121 elif "IOs" in target.get_type():
123 elif "Linux" in target.get_type():
125 elif "Android" in target.get_type():
129 my_module.copy_path(
'data/icon.svg')
131 my_module.copy_path(
'data/*',
'destinationPath')
Index: