[DOC] update documentation and add better stanadart API
This commit is contained in:
parent
dc42a8e14b
commit
9fc593fb59
29
README.rst
29
README.rst
@ -14,19 +14,6 @@ Release (master)
|
||||
:target: https://travis-ci.org/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Linux
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=MacOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Mingw
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Android
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=IOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
Developement (dev)
|
||||
------------------
|
||||
@ -35,20 +22,6 @@ Developement (dev)
|
||||
:target: https://travis-ci.org/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Linux
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=MacOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Mingw
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Android
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=IOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
Instructions
|
||||
------------
|
||||
|
||||
@ -70,7 +43,7 @@ http://github.com/HeeroYui/lutin/
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
http://github.io/HeeroYui/lutin/
|
||||
http://github.com/HeeroYui/lutin/tree/master/doc/
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
@ -1,59 +0,0 @@
|
||||
=?= [center]Basic concept[/center] =?=
|
||||
___________________________________________
|
||||
|
||||
Lutin is a compleate builder system. It is designed to answers all the application problems.
|
||||
The library and the distribution problem are partially manage (no real use-case)
|
||||
|
||||
==Technologie==
|
||||
|
||||
Lutin is designed in Python 2.X or 3.X to answers at the multiplatform problesm. On Linux or MacOs, it is really easy to compile with Makefile, cmake, but on Windows it is an other problem.
|
||||
The first version of Lutin has been designed in Makefile, but we need to wait 20 minutes before the first build. In Pytho it is fast as Linux.
|
||||
|
||||
Lutin is not based over an other builder, but request compilation itself.
|
||||
|
||||
==Features==
|
||||
|
||||
Lutin is designed to:
|
||||
:** support many hardware platform (X86/X64/ARM...);
|
||||
:** support many operation system (windows, Ios, Android ...);
|
||||
:** support complex worktree and depedency;
|
||||
:** build only when needed;
|
||||
:** create platform specific packages (application bundle);
|
||||
:**
|
||||
|
||||
|
||||
==global overview==
|
||||
|
||||
Every build system is based on multiple concept depending of their own designed.
|
||||
|
||||
For lutin we can différentiate 4 basics concepts:
|
||||
:** Mudule: Interface to create a part of an application, that contain binary, scipt, datas ...
|
||||
:** Target: methode to creata an application or a library (may be internal: medium level)
|
||||
:** Builder: Methode to transform element in other, for example: compile a cpp in object file, or object files in binary.
|
||||
:** System: Many OS manage basic element contain in the OS, This part permit to find generic module availlable in the system.
|
||||
|
||||
===Module===
|
||||
|
||||
When you use lutin, you migth first create a module, This is the basis of the framework. It permit to describe your "module", all it contain, and the deendency.
|
||||
|
||||
We can separate a module in some part:
|
||||
:** Binary:
|
||||
:: A binary is an end point element.
|
||||
:: It can be transform in a complete standalone bundle, or in an part instalable.
|
||||
:** Library:
|
||||
:: This represent an element that is used by other application
|
||||
:** Package:
|
||||
:: To Be Define.
|
||||
|
||||
|
||||
===Target===
|
||||
|
||||
|
||||
|
||||
===Builder===
|
||||
|
||||
|
||||
===System===
|
||||
|
||||
|
||||
|
73
doc/010_basic_concept.md
Normal file
73
doc/010_basic_concept.md
Normal file
@ -0,0 +1,73 @@
|
||||
Basic concept
|
||||
=============
|
||||
|
||||
Lutin is a compleate builder system. It is designed to answers all the application problems.
|
||||
The library and the distribution problem are partially manage (no real use-case)
|
||||
|
||||
Technologie:
|
||||
------------
|
||||
|
||||
Lutin is designed in Python 2.X or 3.X to answers at the multiplatform problems.
|
||||
On Linux or MacOs, it is really easy to compile with Makefile, cmake, but on Windows it is an other problem.
|
||||
The first version of Lutin has been designed in Makefile, but we need to wait 20 minutes before the first build on Windows. In Python it is fast as Linux.
|
||||
|
||||
Lutin is not based over an other builder, but compile code itself.
|
||||
|
||||
Features:
|
||||
---------
|
||||
|
||||
Lutin is designed to:
|
||||
- support many hardware platform (X86/X64/ARM...);
|
||||
- support many operation system (windows, Ios, Android ...);
|
||||
- support complex worktree and depedency;
|
||||
- build only when needed;
|
||||
- create platform specific packages (application bundle);
|
||||
|
||||
|
||||
global overview:
|
||||
----------------
|
||||
|
||||
Every build system is based on multiple concept depending of their own designed.
|
||||
|
||||
For lutin we can différentiate 4 basics concepts:
|
||||
- Mudule: Interface to create a part of an application, that contain binary, scipt, datas ...
|
||||
- Target: methode to creata an application or a library (may be internal: medium level)
|
||||
- Builder: Methode to transform element in other, for example: compile a cpp in object file, or object files in binary.
|
||||
- System: Many OS manage basic element contain in the OS, This part permit to find generic module availlable in the system.
|
||||
|
||||
Module:
|
||||
-------
|
||||
|
||||
When you use lutin, you migth first create a module, This is the basis of the framework. It permit to describe your "module", all it contain, and the deendency.
|
||||
|
||||
We can separate a module in some part:
|
||||
- Binary:
|
||||
* A binary is an end point element.
|
||||
* It can be transform in a complete standalone bundle, or in an part installable.
|
||||
- Library:
|
||||
* This represent an element that is used by other application
|
||||
|
||||
|
||||
Target:
|
||||
-------
|
||||
|
||||
A target represent the "board" to build the module, we can separate MacOs, IOs, Linux ... and all platform that exist
|
||||
|
||||
You can generate a new one or use satandard that are provided
|
||||
|
||||
|
||||
Builder:
|
||||
--------
|
||||
|
||||
By default lustin manage many methode to build element like cpp, java, asm files ...
|
||||
|
||||
|
||||
System:
|
||||
-------
|
||||
|
||||
This element provide all elements availlable in the Linux distribution.
|
||||
|
||||
|
||||
|
||||
|
||||
[next doc:Generate a delivery](020_Compile_a_module.md)
|
@ -1,79 +1,81 @@
|
||||
=?= [center]Basic concept[/center] =?=
|
||||
___________________________________________
|
||||
How to compile
|
||||
==============
|
||||
|
||||
Lutin permit simply to compile applications and library.
|
||||
|
||||
To simply understand the use, we will use a simple library:
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
git clone http://github.con/atria-soft/etk.git
|
||||
[/code]
|
||||
|
||||
etk is a basic library that have drive the lutin project.
|
||||
```
|
||||
|
||||
|
||||
== compile a module ==
|
||||
compile a module:
|
||||
-----------------
|
||||
|
||||
It is really simple:
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
lutin yourModuleName
|
||||
#example:
|
||||
lutin etk
|
||||
[/code]
|
||||
```
|
||||
|
||||
|
||||
|
||||
== Option working ==
|
||||
Option working:
|
||||
===============
|
||||
|
||||
Lutin have a complex option methodologie. We can consider 3 part of the option:
|
||||
:** Global option
|
||||
:** target option
|
||||
:** modules
|
||||
- global option
|
||||
- target option
|
||||
- modules
|
||||
|
||||
|
||||
Global options:
|
||||
---------------
|
||||
|
||||
|
||||
== Generic options ==
|
||||
|
||||
=== Display help ===
|
||||
Display help:
|
||||
*************
|
||||
|
||||
Availlable everywhere ...
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
lutin -h
|
||||
lutin --help
|
||||
[/code]
|
||||
```
|
||||
|
||||
You can see in this help that it take a litle time to react.
|
||||
The first time you run lutin, it parse all the file in your sub-directory.
|
||||
But the system keep the data in cash, then the next time it is faster.
|
||||
But the system(OS) keep the data in cash, then the next time it is faster.
|
||||
|
||||
At the end of the help you an see an help about the etk librery with the associated help.
|
||||
|
||||
=== Build in color ===
|
||||
Build in color:
|
||||
***************
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
lutin -C
|
||||
lutin --color
|
||||
[/code]
|
||||
```
|
||||
|
||||
=== Display build line in pretty print mode ===
|
||||
Display build line in pretty print mode:
|
||||
****************************************
|
||||
|
||||
when an error apear, the gcc or clang compile line can be really unreadable:
|
||||
[code]
|
||||
```bash
|
||||
g++ -o /home/heero/dev/plop/out/Linux_x86_64/release/build/gcc/etk/obj/etk/Color.cpp.o -I/home/heero/dev/plop/etk -std=c++11 -D__CPP_VERSION__=2011 -D__TARGET_OS__Linux -D__TARGET_ARCH__x86 -D__TARGET_ADDR__64BITS -D_REENTRANT -DNDEBUG -O3 -fpic -D__STDCPP_GNU__ -Wall -Wsign-compare -Wreturn-type -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wno-unused-variable -DMODE_RELEASE -c -MMD -MP /home/heero/dev/plop/etk/etk/Color.cpp
|
||||
[/code]
|
||||
```
|
||||
|
||||
whith this option you can transform this not obvious line in a readable line:
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
lutin -P
|
||||
lutin --pretty
|
||||
[/code]
|
||||
```
|
||||
|
||||
result:
|
||||
[code]
|
||||
```bash
|
||||
g++ \
|
||||
-o /home/XXX/dev/out/Linux_x86_64/release/build/gcc/etk/obj/etk/Color.cpp.o \
|
||||
-I/home/XXX/dev/etk \
|
||||
@ -99,55 +101,101 @@ result:
|
||||
-MMD \
|
||||
-MP \
|
||||
/home/XXX/dev/etk/etk/Color.cpp
|
||||
[/code]
|
||||
```
|
||||
|
||||
=== lutin log ===
|
||||
lutin log:
|
||||
**********
|
||||
|
||||
Lutin have an internal log system. To enable or disable it just select your debug level with the option:
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
lutin -v4
|
||||
lutin --verbose 4
|
||||
[/code]
|
||||
```
|
||||
|
||||
The level availlables are:
|
||||
:** 0: None
|
||||
:** 1: error
|
||||
:** 2: warning (default)
|
||||
:** 3: info
|
||||
:** 4: debug
|
||||
:** 5: verbose
|
||||
:** 6: extreme_verbose
|
||||
- 0: None
|
||||
- 1: error
|
||||
- 2: warning (default)
|
||||
- 3: info
|
||||
- 4: debug
|
||||
- 5: verbose
|
||||
- 6: extreme_verbose
|
||||
|
||||
=== select the number of CPU core used ===
|
||||
Select the number of CPU core used:
|
||||
***********************************
|
||||
|
||||
By default lutin manage only 1 CPU core (faster to debug) but for speed requirement you can use use multiple core:
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
#for 5 core
|
||||
lutin -j5
|
||||
lutin --jobs 5
|
||||
[/code]
|
||||
```
|
||||
|
||||
=== Force rebuild all ===
|
||||
Force rebuild all:
|
||||
******************
|
||||
|
||||
Sometime it is needed to rebuild all the program, just do :
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
lutin -B
|
||||
lutin --force-build
|
||||
[/code]
|
||||
```
|
||||
|
||||
=== Force rebuild all ===
|
||||
Force strip all library and programs:
|
||||
*************************************
|
||||
|
||||
Force strip of output binary (remove symboles)
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
lutin -s
|
||||
lutin --force-strip
|
||||
[/code]
|
||||
```
|
||||
|
||||
Manage Cross compilation:
|
||||
-------------------------
|
||||
|
||||
The main objective of lutin is managing the cross compilation to build from linux to other platform:
|
||||
|
||||
For android you can use:
|
||||
|
||||
```bash
|
||||
lutin -t Android your-module
|
||||
lutin -t Windows your-module
|
||||
```
|
||||
|
||||
Build in debug mode:
|
||||
--------------------
|
||||
|
||||
To developp it is fasted with debug tools
|
||||
|
||||
```bash
|
||||
lutin -m debug your-module
|
||||
lutin -m release your-module
|
||||
```
|
||||
|
||||
You can desire to have compilation optimisation when you build in debug mode:
|
||||
|
||||
```bash
|
||||
lutin -m debug --force-optimisation your-module
|
||||
```
|
||||
|
||||
Execute yout program after building it:
|
||||
---------------------------------------
|
||||
|
||||
You can execute some action in a single line for a module:
|
||||
|
||||
```bash
|
||||
lutin -m debug your-module?clean?build?run:--run-option1:--run-option2
|
||||
```
|
||||
|
||||
Why use ```?run``` istead of direct calling the binary?
|
||||
|
||||
This is simple: you does nok knoww where the binary is installed... when you build for linux in debug it will be set in ```out/Linux_x86_64/debug/staging/clang/edn/edn.app/``` for edn application.
|
||||
Note that the path is distinct for gcc/clang, debug/release, Linux/windows/Android/..., 64/32 bits, and for every applications ...
|
||||
|
||||
Then it is really easy to run the wrong binary.
|
||||
|
||||
|
||||
|
||||
-w / --warning
|
||||
Store warning in a file build file
|
||||
[next doc:Create a new module](030_Create_a_new_module.md)
|
480
doc/030_Create_a_new_module.md
Normal file
480
doc/030_Create_a_new_module.md
Normal file
@ -0,0 +1,480 @@
|
||||
Create a new Module:
|
||||
====================
|
||||
|
||||
To create a new module you will use a generic naming:
|
||||
|
||||
```
|
||||
lutin_module-name.py
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```python
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
|
||||
# A simple list of type:
|
||||
# - BINARY
|
||||
# - BINARY_SHARED
|
||||
# - BINARY_STAND_ALONE
|
||||
# - LIBRARY
|
||||
# - LIBRARY_DYNAMIC
|
||||
# - LIBRARY_STATIC
|
||||
# - PACKAGE
|
||||
# - PREBUILD
|
||||
# - DATA
|
||||
def get_type():
|
||||
return "LIBRARY"
|
||||
|
||||
# simple description of the module that appear in the 'lutin -h'
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_desc():
|
||||
return "Ewol tool kit"
|
||||
|
||||
# type of licence:
|
||||
# "APACHE-2"
|
||||
# "BSD-1" / "BSD-2" / "BSD-3" / "BSD-4"
|
||||
# "GPL-1" / "GPL-2" / "GPL-3"
|
||||
# "LGPL-1" / "LGPL-2" / "LGPL-3"
|
||||
# PROPRIETARY
|
||||
# ...
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_licence():
|
||||
return "APACHE-2"
|
||||
|
||||
# type of compagny that provide the software:
|
||||
# com : Commercial
|
||||
# net : Network??
|
||||
# org : Organisation
|
||||
# gov : Governement
|
||||
# mil : Military
|
||||
# edu : Education
|
||||
# pri : Private
|
||||
# museum : ...
|
||||
# ...
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_compagny_type():
|
||||
return "com"
|
||||
|
||||
# Name of the compagny
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_compagny_name():
|
||||
return "hello-compagny"
|
||||
|
||||
# People to contact if a problem appear in the build system / library
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_maintainer():
|
||||
return ["Mr NAME SurName <my-email@group.com>"]
|
||||
|
||||
# Version of the library
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_version():
|
||||
return [0,9,"dev"]
|
||||
|
||||
# create the module
|
||||
# @param[in] target reference on the Target that is currently build
|
||||
# @param[in] module_name Name of the module that is extract from the file name (to be generic)
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
...
|
||||
return my_module
|
||||
```
|
||||
|
||||
Thes it is simple to specify build for:
|
||||
|
||||
Create a new Module (LIBRARY):
|
||||
-----------------------------
|
||||
|
||||
What to change:
|
||||
```python
|
||||
def get_type():
|
||||
return "LIBRARY"
|
||||
```
|
||||
|
||||
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:
|
||||
```python
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
```
|
||||
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:
|
||||
```python
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
|
||||
def get_sub_type():
|
||||
return "TEST"
|
||||
```
|
||||
or:
|
||||
```python
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
|
||||
def get_sub_type():
|
||||
return "TOOL"
|
||||
```
|
||||
|
||||
|
||||
Create a new Module (DATA):
|
||||
---------------------------
|
||||
|
||||
This pode permit to only copy data and no dependency with compilling system
|
||||
|
||||
What to change:
|
||||
```python
|
||||
def get_type():
|
||||
return "DATA"
|
||||
```
|
||||
|
||||
|
||||
Module internal specifications:
|
||||
===============================
|
||||
|
||||
Add file to compile:
|
||||
--------------------
|
||||
|
||||
This is simple: (you just need to specify all the file to compile)
|
||||
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
# add the file to compile:
|
||||
my_module.add_src_file([
|
||||
'module-name/file1.cpp',
|
||||
'module-name/file2.cpp',
|
||||
'module-name/file3.S'
|
||||
])
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
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:
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
my_module.add_header_file([
|
||||
'module-name/file1.h',
|
||||
'module-name/file2.h'
|
||||
])
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
You can add a path to your local include:
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
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:
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
# add dependency of the generic C library:
|
||||
my_module.add_module_depend('c')
|
||||
# add dependency of the generic C++ library:
|
||||
my_module.add_module_depend('cxx')
|
||||
# add dependency of the generic math library:
|
||||
my_module.add_module_depend('m')
|
||||
# or other user lib:
|
||||
my_module.add_module_depend('lib-name')
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
The system can have optinnal sub-library, then if you just want to add an optionnal dependency:
|
||||
```python
|
||||
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"])
|
||||
|
||||
# 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)
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
Compilation adn link flags/libs:
|
||||
--------------------------------
|
||||
|
||||
It is possible to define local and external flags (external are set internal too):
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
# 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")
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
build dependency mode and/or target:
|
||||
------------------------------------
|
||||
|
||||
To add somes element dependent of the build mode:
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
if target.get_mode() == "release":
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
To add somes element dependent of the target type:
|
||||
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
if "Windows" in target.get_type():
|
||||
pass
|
||||
elif "MacOs" in target.get_type():
|
||||
pass
|
||||
elif "IOs" in target.get_type():
|
||||
pass
|
||||
elif "Linux" in target.get_type():
|
||||
pass
|
||||
elif "Android" in target.get_type():
|
||||
pass
|
||||
...
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
# copy file in the share/binanyName/ path (no sub path)
|
||||
my_module.copy_path('data/icon.svg')
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
Copy multiple files (change path)
|
||||
|
||||
```python
|
||||
def create(target, module_name):
|
||||
...
|
||||
|
||||
my_module.copy_path('data/*', 'destinationPath')
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
display some debug to help writing code:
|
||||
----------------------------------------
|
||||
|
||||
|
||||
```python
|
||||
import lutin.debug as debug
|
||||
|
||||
def function(...):
|
||||
|
||||
debug.error("comment that stop the build")
|
||||
debug.warning("comment that print a simple warning")
|
||||
debug.info("comment that print a simple information")
|
||||
debug.debug("comment that print a simple debug")
|
||||
debug.verbose("comment that print a simple verbose")
|
||||
|
||||
```
|
||||
|
||||
A Full template:
|
||||
================
|
||||
|
||||
```
|
||||
lutin_module-name.py
|
||||
```
|
||||
|
||||
```python
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import lutin.debug as debug
|
||||
import os
|
||||
|
||||
# A simple list of type:
|
||||
# - BINARY
|
||||
# - BINARY_SHARED
|
||||
# - BINARY_STAND_ALONE
|
||||
# - LIBRARY
|
||||
# - LIBRARY_DYNAMIC
|
||||
# - LIBRARY_STATIC
|
||||
# - PACKAGE
|
||||
# - PREBUILD
|
||||
# - DATA
|
||||
def get_type():
|
||||
return "LIBRARY"
|
||||
|
||||
# simple description of the module that appear in the 'lutin -h'
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_desc():
|
||||
return "Descriptiuon of the PROGRAMM"
|
||||
|
||||
# type of licence:
|
||||
# "APACHE-2"
|
||||
# "BSD-1" / "BSD-2" / "BSD-3" / "BSD-4"
|
||||
# "GPL-1" / "GPL-2" / "GPL-3"
|
||||
# "LGPL-1" / "LGPL-2" / "LGPL-3"
|
||||
# PROPRIETARY
|
||||
# ...
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_licence():
|
||||
return "PROPRIETARY"
|
||||
|
||||
# type of compagny that provide the software:
|
||||
# com : Commercial
|
||||
# net : Network??
|
||||
# org : Organisation
|
||||
# gov : Governement
|
||||
# mil : Military
|
||||
# edu : Education
|
||||
# pri : Private
|
||||
# museum : ...
|
||||
# ...
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_compagny_type():
|
||||
return "com"
|
||||
|
||||
# Name of the compagny
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_compagny_name():
|
||||
return "hello-compagny"
|
||||
|
||||
# People to contact if a problem appear in the build system / library
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_maintainer():
|
||||
return ["Mr NAME SurName <my-email@group.com>"]
|
||||
|
||||
# Version of the library
|
||||
# Note: this fucntion is optionnal.
|
||||
def get_version():
|
||||
return [0,1,"dev"]
|
||||
|
||||
# create the module
|
||||
# @param[in] target reference on the Target that is currently build
|
||||
# @param[in] module_name Name of the module that is extract from the file name (to be generic)
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
|
||||
# add the file to compile:
|
||||
my_module.add_src_file([
|
||||
'module-name/file1.cpp',
|
||||
'module-name/file2.cpp',
|
||||
'module-name/file3.S'
|
||||
])
|
||||
|
||||
my_module.add_header_file([
|
||||
'module-name/file1.h',
|
||||
'module-name/file2.h'
|
||||
])
|
||||
|
||||
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')
|
||||
# add dependency of the generic C++ library:
|
||||
my_module.add_module_depend('cxx')
|
||||
# add dependency of the generic math library:
|
||||
my_module.add_module_depend('m')
|
||||
# or other user lib:
|
||||
my_module.add_module_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"])
|
||||
|
||||
# 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)
|
||||
|
||||
# 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")
|
||||
|
||||
if target.get_mode() == "release":
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
if "Windows" in target.get_type():
|
||||
pass
|
||||
elif "MacOs" in target.get_type():
|
||||
pass
|
||||
elif "IOs" in target.get_type():
|
||||
pass
|
||||
elif "Linux" in target.get_type():
|
||||
pass
|
||||
elif "Android" in target.get_type():
|
||||
pass
|
||||
|
||||
# copy file in the share/binanyName/ path (no sub path)
|
||||
my_module.copy_path('data/icon.svg')
|
||||
|
||||
my_module.copy_path('data/*', 'destinationPath')
|
||||
|
||||
return my_module
|
||||
```
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
=?= [center]Lutin Build system[/center] =?=
|
||||
___________________________________________
|
||||
Lutin Build system
|
||||
==================
|
||||
|
||||
===What is Lutin, and how can I use it?===
|
||||
|
||||
What is Lutin, and how can I use it?
|
||||
------------------------------------
|
||||
|
||||
Lutin is an application/library builder, it is designed to concurence CMake, Makefile, Ant, graddle ...
|
||||
|
||||
@ -10,64 +12,77 @@ Lutin is deveopped in Python 2.x and 3.x to permit many user to play with it.
|
||||
Python permit to Lutin to be used in many environement in a fast way.
|
||||
|
||||
Lutin support can compile every thing you want, just add a builder that you need (not in the common way). Basicly Lutin support languages:
|
||||
:** C (ainsi/89/99) ==> .o;
|
||||
:** C++ (98/99/03/11/14/...) ==> .o;
|
||||
:** .S (assembleur) ==> .o;
|
||||
:** .java ==> .class;
|
||||
:** .class ==> jar;
|
||||
:** .o ==> .a;
|
||||
:** .o ==> .so;
|
||||
:** .o/.a ==> binary.
|
||||
- C (ainsi/89/99) ==> .o;
|
||||
- C++ (98/99/03/11/14/...) ==> .o;
|
||||
- .S (assembleur) ==> .o;
|
||||
- .java ==> .class;
|
||||
- .class ==> jar;
|
||||
- .o ==> .a;
|
||||
- .o ==> .so;
|
||||
- .o/.a ==> binary.
|
||||
|
||||
Some packege can be generate for some platform:
|
||||
:** debian package;
|
||||
:** windows application zip;
|
||||
:** MacOs application .app;
|
||||
:** iOs package;
|
||||
:** Android Package .apk.
|
||||
- debian package;
|
||||
- windows application zip;
|
||||
- MacOs application .app;
|
||||
- iOs package;
|
||||
- Android Package .apk.
|
||||
|
||||
Compilation is availlable for:
|
||||
:** gcc/g++;
|
||||
:** clang/clang++.
|
||||
- gcc/g++;
|
||||
- clang/clang++.
|
||||
|
||||
Manage [b]workspace build[/b] (in oposition of CMake/make/...)
|
||||
|
||||
|
||||
=== Install: ===
|
||||
Install:
|
||||
--------
|
||||
|
||||
Requirements: ``Python >= 2.7`` and ``pip``
|
||||
|
||||
==== Install lutin: ===
|
||||
Just run:
|
||||
[code style=bash]
|
||||
pip install lutin
|
||||
[/code]
|
||||
Install lutin:
|
||||
**************
|
||||
|
||||
Just run:
|
||||
```bash
|
||||
pip install lutin
|
||||
```
|
||||
|
||||
Install pip:
|
||||
************
|
||||
|
||||
==== Install pip ====
|
||||
Install pip on debian/ubuntu:
|
||||
[code style=bash]
|
||||
```bash
|
||||
sudo apt-get install pip
|
||||
[/code]
|
||||
```
|
||||
|
||||
Install pip on ARCH-linux:
|
||||
[code style=bash]
|
||||
```bash
|
||||
sudo pacman -S pip
|
||||
[/code]
|
||||
```
|
||||
|
||||
Install pip on MacOs:
|
||||
[code style=bash]
|
||||
```bash
|
||||
sudo easy_install pip
|
||||
[/code]
|
||||
```
|
||||
|
||||
==== Install from sources ====
|
||||
Install from sources:
|
||||
*********************
|
||||
|
||||
[code style=bash]
|
||||
```bash
|
||||
git clone http://github.com/HeeroYui/lutin.git
|
||||
cd lutin
|
||||
sudo ./setup.py install
|
||||
[/code]
|
||||
```
|
||||
|
||||
=== License (APACHE v2.0) ===
|
||||
Tutoral entry point:
|
||||
--------------------
|
||||
|
||||
[tutorial](000_basic_concept.md)
|
||||
|
||||
|
||||
License (APACHE v2.0)
|
||||
---------------------
|
||||
|
||||
Copyright lutin Edouard DUPIN
|
||||
|
||||
@ -84,17 +99,16 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
=== History: ===
|
||||
History:
|
||||
--------
|
||||
|
||||
I work with some builder, Every one have theire own adventages, and their problems.
|
||||
The main point I see, is that the polimorphisme of the worktree is really hard.
|
||||
The second point is the generation on different platforms is hard too.
|
||||
|
||||
Some other problem example:
|
||||
:** Makefile is too slow on windows mingw;
|
||||
:** Cmake does not create end point package;
|
||||
:** none is really simple to write.
|
||||
- Makefile is too slow on windows mingw;
|
||||
- Cmake does not create end point package;
|
||||
- none is really simple to write.
|
||||
|
||||
Then I create a simple interface that manage all I need. and written in python to permit to be faster on every platform.
|
||||
|
||||
[tutorial[000_Build | Tutorials]]
|
@ -141,14 +141,14 @@ class Module:
|
||||
## @brief add Some copilation flags for this module (and only this one)
|
||||
##
|
||||
def add_extra_compile_flags(self):
|
||||
self.compile_flags('c', [
|
||||
self.add_flag('c', [
|
||||
"-Wall",
|
||||
"-Wsign-compare",
|
||||
"-Wreturn-type",
|
||||
#"-Wint-to-pointer-cast",
|
||||
"-Wno-write-strings",
|
||||
"-Wno-unused-variable"]);
|
||||
self.compile_flags('c++', [
|
||||
self.add_flag('c++', [
|
||||
"-Woverloaded-virtual",
|
||||
"-Wnon-virtual-dtor"]);
|
||||
#only for gcc : "-Wunused-variable", "-Wunused-but-set-variable",
|
||||
@ -157,10 +157,10 @@ class Module:
|
||||
## @brief remove all unneeded warning on compilation ==> for extern libs ...
|
||||
##
|
||||
def remove_compile_warning(self):
|
||||
self.compile_flags('c', [
|
||||
self.add_flag('c', [
|
||||
"-Wno-int-to-pointer-cast"
|
||||
]);
|
||||
self.compile_flags('c++', [
|
||||
self.add_flag('c++', [
|
||||
"-Wno-c++11-narrowing"
|
||||
])
|
||||
# only for gcc :"-Wno-unused-but-set-variable"
|
||||
@ -456,9 +456,9 @@ class Module:
|
||||
# TODO : Add optionnal Flags ...
|
||||
# ==> do it really better ...
|
||||
if export == False:
|
||||
self.compile_flags(option[0], option[1]);
|
||||
self.add_flag(option[0], option[1]);
|
||||
else:
|
||||
self.add_export_flag(option[0], option[1]);
|
||||
self.add_flag(option[0], option[1], export=True);
|
||||
# add at the heritage list :
|
||||
self.sub_heritage_list.add_heritage_list(inherit_list)
|
||||
for dep in self.depends:
|
||||
@ -854,13 +854,22 @@ class Module:
|
||||
def add_path(self, list, type='c'):
|
||||
tools.list_append_to_2(self.path["local"], type, list)
|
||||
|
||||
def add_export_flag(self, type, list):
|
||||
tools.list_append_to_2(self.flags["export"], type, list)
|
||||
|
||||
# add the link flag at the module
|
||||
# TODO : Rename this in add_flag
|
||||
def add_flag(self, type, list, export=False):
|
||||
if export == True:
|
||||
tools.list_append_to_2(self.flags["export"], type, list)
|
||||
else:
|
||||
tools.list_append_to_2(self.flags["local"], type, list)
|
||||
|
||||
## deprecated ...
|
||||
def add_export_flag(self, type, list):
|
||||
debug.warning("add_export_flag is deprecated ==> use add_flag(xxx, yyy, export=True)")
|
||||
self.add_flag(type, list, export=True)
|
||||
|
||||
## deprecated ...
|
||||
def compile_flags(self, type, list):
|
||||
tools.list_append_to_2(self.flags["local"], type, list)
|
||||
debug.warning("compile_flags is deprecated ==> use add_flag(xxx, yyy)")
|
||||
self.add_flag(type, list)
|
||||
|
||||
def compile_version(self, compilator_type, version, same_as_api=True, gnu=False):
|
||||
if compilator_type == "c++" \
|
||||
|
@ -69,7 +69,7 @@ def create_module_from_system(target, dict):
|
||||
# add element flags to export
|
||||
for elem in dict["system"].export_flags:
|
||||
debug.verbose("add element :" + str(elem) + " elems=" + str(dict["system"].export_flags[elem]))
|
||||
myModule.add_export_flag(elem, dict["system"].export_flags[elem])
|
||||
myModule.add_flag(elem, dict["system"].export_flags[elem], export=True)
|
||||
# add module dependency
|
||||
myModule.add_module_depend(dict["system"].export_depends)
|
||||
# add exporting sources
|
||||
|
@ -173,6 +173,23 @@ class Target:
|
||||
def __repr__(self):
|
||||
return "{lutin.Target}"
|
||||
|
||||
##
|
||||
## @brief Get the type of the target: ["Linux, ...]
|
||||
## @return The current target name and other sub name type (ubuntu ...)
|
||||
##
|
||||
def get_type(self):
|
||||
out = [self.name]
|
||||
if self.name != self.config_based_on:
|
||||
out.append(self.config_based_on)
|
||||
return out
|
||||
|
||||
##
|
||||
## @brief Get build mode of the target: ["debug", "release"]
|
||||
## @return The current target build mode.
|
||||
##
|
||||
def get_mode(self):
|
||||
return self.config["mode"]
|
||||
|
||||
def add_flag(self, type, list):
|
||||
tools.list_append_to_2(self.global_flags, type, list)
|
||||
|
||||
|
@ -23,7 +23,7 @@ class System(system.System):
|
||||
# no check needed ==> just add this:
|
||||
self.add_module_depend(['c'])
|
||||
self.add_export_flag('link-lib', 'X11')
|
||||
if env.get_isolate_system() == False:
|
||||
if env.get_isolate_system() == True:
|
||||
self.add_header_file([
|
||||
"/usr/include/X11/*"
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user