2016-09-09 21:30:25 +02:00
How to use lutin {#lutin_use}
================
@tableofcontents
2015-10-03 12:32:51 +02:00
Lutin permit simply to compile applications and library.
To simply understand the use, we will use a simple library:
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
git clone http://github.con/atria-soft/etk.git
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
compile a module: {#lutin_use_compile}
=================
2015-10-03 12:32:51 +02:00
It is really simple:
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
lutin yourModuleName
#example:
lutin etk
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Option working: {#lutin_use_options}
2016-09-05 21:08:58 +02:00
===============
2015-10-03 12:32:51 +02:00
Lutin have a complex option methodologie. We can consider 3 part of the option:
2016-09-05 21:08:58 +02:00
- global option
- target option
- modules
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Global options: {#lutin_use_options_global}
2016-09-05 21:08:58 +02:00
---------------
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Globals option is parse first and manage global setting of the build (not specific of a target)
this keep the last value config set
Display help: {#lutin_use_options_help}
-------------
2015-10-03 12:32:51 +02:00
Availlable everywhere ...
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
lutin -h
lutin --help
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
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.
2016-09-05 21:08:58 +02:00
But the system(OS) keep the data in cash, then the next time it is faster.
2015-10-03 12:32:51 +02:00
At the end of the help you an see an help about the etk librery with the associated help.
2016-09-09 21:30:25 +02:00
Build in color: {#lutin_use_options_color}
---------------
2015-10-03 12:32:51 +02:00
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
lutin -C
lutin --color
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Display build line in pretty print mode: {#lutin_use_options_pretty}
----------------------------------------
2015-10-03 12:32:51 +02:00
when an error apear, the gcc or clang compile line can be really unreadable:
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
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
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
whith this option you can transform this not obvious line in a readable line:
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
lutin -P
lutin --pretty
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
result:
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
g++ \
-o /home/XXX/dev/out/Linux_x86_64/release/build/gcc/etk/obj/etk/Color.cpp.o \
-I/home/XXX/dev/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/XXX/dev/etk/etk/Color.cpp
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
lutin log: {#lutin_use_options_log}
----------
2015-10-03 12:32:51 +02:00
Lutin have an internal log system. To enable or disable it just select your debug level with the option:
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
lutin -v4
lutin --verbose 4
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
The level availlables are:
2016-09-05 21:08:58 +02:00
- 0: None
- 1: error
- 2: warning (default)
- 3: info
- 4: debug
- 5: verbose
- 6: extreme_verbose
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Select the number of CPU core used: {#lutin_use_options_cpu}
-----------------------------------
2015-10-03 12:32:51 +02:00
By default lutin manage only 1 CPU core (faster to debug) but for speed requirement you can use use multiple core:
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
#for 5 core
lutin -j5
lutin --jobs 5
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Force rebuild all: {#lutin_use_options_rebuild_force}
------------------
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Sometime it is needed to rebuild all the program, just do:
2015-10-03 12:32:51 +02:00
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
lutin -B
lutin --force-build
2016-09-09 21:30:25 +02:00
# or remove the build directory
rm -rf out/
2016-09-05 21:08:58 +02:00
```
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Force strip all library and programs: {#lutin_use_options_strip}
-------------------------------------
2015-10-03 12:32:51 +02:00
Force strip of output binary (remove symboles)
2016-09-13 23:56:20 +02:00
```{.sh}
2015-10-03 12:32:51 +02:00
lutin -s
lutin --force-strip
2016-09-05 21:08:58 +02:00
```
2016-09-09 21:30:25 +02:00
Manage Cross compilation: {#lutin_use_options_cross_compile}
=========================
2016-09-05 21:08:58 +02:00
The main objective of lutin is managing the cross compilation to build from linux to other platform:
For android you can use:
2016-09-13 23:56:20 +02:00
```{.sh}
2016-09-05 21:08:58 +02:00
lutin -t Android your-module
lutin -t Windows your-module
```
2016-09-09 21:30:25 +02:00
Build in debug mode: {#lutin_use_options_debug_release}
====================
2016-09-05 21:08:58 +02:00
To developp it is fasted with debug tools
2016-09-13 23:56:20 +02:00
```{.sh}
2016-09-05 21:08:58 +02:00
lutin -m debug your-module
lutin -m release your-module
```
You can desire to have compilation optimisation when you build in debug mode:
2016-09-13 23:56:20 +02:00
```{.sh}
2016-09-05 21:08:58 +02:00
lutin -m debug --force-optimisation your-module
```
2016-09-09 21:30:25 +02:00
Execute your program after building it: {#lutin_use_options_execute}
=======================================
2016-09-05 21:08:58 +02:00
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 ...
2015-10-03 12:32:51 +02:00
2016-09-05 21:08:58 +02:00
Then it is really easy to run the wrong binary.
2015-10-03 12:32:51 +02:00
2016-09-09 21:30:25 +02:00
Install your program after building it: {#lutin_use_options_install}
=======================================
You can install your build module:
2016-09-13 23:56:20 +02:00
```{.sh}
2016-09-09 21:30:25 +02:00
lutin -m debug your-module?build?install
```
This option is not availlablke on all platform ...
**Index:**
- @ref mainpage
- @ref lutin_concept
- @ref lutin_use
- @ref lutin_module