Compare commits

...

125 Commits
1.2.6 ... dev

Author SHA1 Message Date
201eef96df [DEV] update header only library 2022-02-15 23:20:53 +01:00
c74c1b1805 [DEBUG] correct heritage 2022-02-15 23:47:11 +01:00
2c5642d5c8 [DEV] update model 2022-02-11 22:14:44 +01:00
6a6961fb3d [DEBUG] error in heriage 2022-02-08 23:02:38 +01:00
c31aad7e01 [DEV] cahnge config file 2022-02-06 23:20:50 +01:00
88834cc4d0 [DEV] upgrade to support multiple run test and chach at the end only (add suport of gnuc++ on GLB (bad hook) 2022-02-06 22:30:17 +01:00
1604b08af7 [DEV] correct selection of building mode 2022-01-16 23:48:21 +01:00
b4687319a2 [DEV] add capability to test multiple nodes 2022-01-16 23:40:03 +01:00
98a474d49c [DEV] remove dead idea 2022-01-16 22:35:16 +01:00
28cd4ef882 [DEBUG] add some correction 2022-01-15 00:33:58 +01:00
76b9b883ee [DEV] add some element 2022-01-14 22:24:58 +01:00
4db61cf9f2 [DEV] add a proto of nasm 2022-01-12 22:53:32 +01:00
64d016880e [DEV] update lutiun to support corectly multiple build model 2022-01-12 00:04:08 +01:00
9dc5218775 [DEV] update GLD parsing 2021-12-21 09:27:01 +01:00
08e50c35b3 [DEV] add generic flags for code quality 2021-11-17 21:53:36 +01:00
fced469b14 [DEV] update to GLD stupid repo compatibility 2021-11-15 22:47:04 +01:00
5555a74aa4 [DEV] update gld interpreatation 2021-11-10 23:50:26 +01:00
21eb62613d [DEV] continue interation of GLD ==> for cmake compatibility 2021-11-07 23:16:09 +01:00
e98d901fa4 [DEV] update the model 2021-10-28 23:56:18 +02:00
cdb88347ed [DEV] add GLD compatibility 2021-10-18 00:09:51 +02:00
3458fd1536 [VERSION] update dev tag version 2019-08-28 23:18:49 +02:00
608f14af02 [RELEASE] Release v2.7.1 2019-08-28 23:18:49 +02:00
2caa0eb792 [DEBUG] wrong include file 2019-08-28 23:18:30 +02:00
981eff73ea [VERSION] update dev tag version 2019-08-28 23:14:41 +02:00
f5ab931d42 [RELEASE] Release v2.7.0 2019-08-28 23:14:41 +02:00
3e5a35fa74 [DEBUG] correct the readme rst to md 2019-08-28 23:11:26 +02:00
58602345b5 [DEV] correct the wrong version number when install 2019-08-28 22:54:41 +02:00
843c1296a6 [VERSION] update dev tag version 2019-08-28 01:09:03 +02:00
f164407750 [RELEASE] Release v2.6.0 2019-08-28 01:09:03 +02:00
bc9ecbf0df [DEV] add version file 2019-08-28 00:31:29 +02:00
9ca3f693a2 [DEV] update version model 2019-08-28 00:23:32 +02:00
48d1ff1937 [RELEASE] new version 2.5.0 2019-04-26 23:56:04 +02:00
6386467b45 [DEV] update at the new external argument parser (death) 2019-04-26 23:41:11 +02:00
017cbc50ba [DEV] update at the new external log system 2019-04-26 23:41:11 +02:00
d3be28a1a3 [RELEASE] new version 2.4.0 2019-04-15 22:41:41 +02:00
cb4c8c050f [DEV] update doc to commit on pip 2019-04-15 22:40:22 +02:00
3a39092af2 [DEV] add some logs 2019-04-01 22:15:41 +02:00
a7732fba54 [DEV] add C++20 2018-08-16 23:10:54 +02:00
66e98727b9 [DEBUG] correct the run of the library 2018-07-09 21:56:54 +02:00
55e5f44c42 [DOC] update doc for gcov 2018-06-19 21:01:15 +02:00
d7383332cb [DOC] add helper doc 2018-06-19 07:14:58 +02:00
f29316f493 [DEV] add ysql interface 2018-04-12 23:17:42 +02:00
6b2563483f [DEV] small fix 2018-02-27 21:17:34 +01:00
3058308f18 [DEV] add ccache 2018-02-27 21:17:34 +01:00
b4bce09b46 [DEBUG] correct the log display 2018-01-12 21:25:15 +01:00
a994af78d4 [DEBUG] remove UTF8 error print when add some µs in files 2017-10-21 23:19:47 +02:00
f6abd70d75 [DEBUG] some naming correction 2017-10-09 10:23:52 +02:00
0946252a10 [DEV] try to remove dependency on STL 2017-09-07 23:35:23 +02:00
03742be308 [DEV] try isolate in macOs 2017-09-07 23:35:35 +02:00
7ca034a430 [DEV] add doc and set android in openGL ES 3 limit at API 19(4.3) 2017-06-28 08:20:50 +02:00
9131d375b8 [DEV] add a get version 2017-04-21 21:07:04 +02:00
ed7fc49324 [DEBUG] correct pulseaudio (step 3) 2017-04-13 21:36:11 +02:00
64d39a9def [DEBUG] correct pulseaudio (step 2) 2017-04-13 21:10:27 +02:00
87bd7f8e7a [DEV] set back pulseaudio 2017-04-12 23:32:32 +02:00
94c3c82543 [RELEASE] new version 2.3.0 2017-03-30 21:56:15 +02:00
abfae29839 [DEV] corect wrong log 2017-03-27 23:50:52 +02:00
75f237b349 [DEV] add generate data file 2017-03-21 22:32:11 +01:00
162f7785f0 [DEBUG] copy empty file 2017-03-20 21:45:37 +01:00
898a730f70 Revert "[DEV] optimise check of file date (3.2s->2.9s in userland and 0.60s->0.26s in kernel)" ==> reate compilation bug
This reverts commit 3457215994.
2017-02-01 23:33:22 +01:00
25028a136c Revert "[TEST] remove log in the debug, verbose, extreme_verbose and speed move 2.95s to 2.64s ==> not enougth"
This reverts commit b509625653.
2017-01-31 23:03:46 +01:00
b509625653 [TEST] remove log in the debug, verbose, extreme_verbose and speed move 2.95s to 2.64s ==> not enougth 2017-01-31 23:01:45 +01:00
3457215994 [DEV] optimise check of file date (3.2s->2.9s in userland and 0.60s->0.26s in kernel)
I expected more gain
2017-01-31 22:44:04 +01:00
791c7fe6e8 [DEV] add xdg compose 2017-01-17 22:16:53 +01:00
87d5cde1ae [DEBUG] add missing link in wayland 2017-01-14 22:05:33 +01:00
27a84e888f [DEV] add some element needed for wayland client port 2017-01-11 23:04:13 +01:00
dd6adc574e Change licence APACHE-2 to MPL-2 ==> force source redistribution and permit static link 2017-01-05 21:28:23 +01:00
ee61965e07 [DEV] missing dome include for X11 2016-12-29 21:58:46 +01:00
75c6381481 [DEV] add generated src in auto set 2016-11-25 21:02:42 +01:00
f24e1a6d90 [DEV] add macro concept 2016-11-24 21:13:08 +01:00
0e7458cc06 [DEV] integrate PACKAGE generation and run binary inside 2016-11-23 22:08:43 +01:00
fad39e0bb9 [DEV] try think at a correct package 2016-11-23 00:10:37 +01:00
49bb4ffa2b [DEV] add control on a specific new clang flag 2016-11-17 23:43:35 +01:00
98e4dc9e8d [DEV] add an API to add flag when a optionnal dependence is not found 2016-11-17 22:10:56 +01:00
0a536b5203 [RELEASE] release version 2.2.2 2016-11-10 21:56:36 +01:00
1c66efa105 [DEV] simplify naming of asset 2016-11-10 21:14:42 +01:00
edfe7a1c96 [DEV] add add_src_path and add_header_path 2016-11-09 23:33:38 +01:00
92a0e5198c [DEV] add base of emscripten build for firefox test 2016-11-04 22:54:25 +01:00
156abe3533 [CI] correct build CI 2016-10-28 00:31:06 +02:00
2992699ec5 [DEBUG] correct local simple C test 2016-10-28 00:08:46 +02:00
44dbcdd56d [DEV] add a dependency graph generator
lutin dependency:LD ; dot -Tsvg dependency.dot -o dependency.svg ; firefox dependency.svg
2016-10-28 00:06:05 +02:00
f2060d4c97 [RELEASE] release version 2.2.1 2016-10-27 21:13:24 +02:00
cfde4a549f [DEBUG] correct version number parsing 2016-10-27 21:13:24 +02:00
72e956f06a [DEBUG] correct ARM7 or ARM64 selection 2016-10-11 21:14:19 +02:00
058c425feb [RELEASE] new version 2.2.0 2016-10-23 13:59:54 +02:00
7e6f391dbf [DEV] remove deprecated 2016-10-23 13:58:35 +02:00
e25ceee5a8 (DEV) add some element of Mac OS framework 2016-10-11 21:14:19 +02:00
42e3deed44 [DEV] add better flag for android 2016-10-11 21:00:08 +02:00
f0690cd75a [DEV] add some include in windows platform 2016-10-10 21:18:17 +02:00
acc69912a0 [DEV] correct run api for IOs 2016-10-07 21:02:35 +02:00
73a230826b [DEBUG] missing depend in specific target interface 2016-10-06 22:51:40 +02:00
da8233d34e [DEV] add ws2 include support for windows 2016-09-28 23:41:41 +02:00
27f6a95d41 [DEBUG] correct basic path to create the zip file in Windows Target 2016-10-05 23:45:46 +02:00
71e0f242bf [DEV] zip data for windows and create a zip package for final output 2016-10-05 22:57:30 +02:00
092843cd02 [DEV] add support of heritage of target and better support of Debian distro 2016-10-05 21:17:12 +02:00
3b37e78dd3 [DEBUG] wrong deprecated version 2016-10-04 23:19:05 +02:00
94d8b82321 [API/DEV] set ICON and ANDROID_SIGN in relative only 2016-10-04 22:56:40 +02:00
4c883f177c [DEV] set relative path in add path 2016-10-04 22:42:54 +02:00
b6a5f7e539 [DEV] update build to support configure instead of create in module ==> permit to get back the version ... order issue 2016-10-04 21:08:06 +02:00
fb4b03a441 [DEV] add run on linux for windows 2016-09-29 21:29:29 +02:00
ed3a26a638 [DEV] add rpc for gtest and gui mode for graphic windows application 2016-09-28 23:41:41 +02:00
2a9f3feed7 [DEV] add many system support for MacOs, IOs and Windows.Correct the target flags 2016-09-28 23:39:14 +02:00
e148a7e204 [DEV] add ptherd for Windows cross compile 2016-09-27 23:16:41 +02:00
13e6d98ac4 [DEV] add prebuild SDL 2016-09-26 21:00:33 +02:00
45bd6e6213 [DEV] add get_compilator in target 2016-09-25 21:35:07 +02:00
82e8946227 [DOC] add help to deploy on IOs 2016-09-22 21:33:06 +02:00
aa96a415b5 [DEBUG] correct MacOS releae build 2016-09-21 21:35:13 +02:00
52729c3c71 [DEV/DEBUG] correct the build of IOs target and correct the resize installed image 2016-09-20 22:33:00 +02:00
62d084b351 [DEV/DOC] correct template of module, add API of set file with dependency availlable 2016-09-20 21:57:00 +02:00
1c76227b27 [DEBUG] write error when action on target does not exist 2016-09-18 22:49:56 +02:00
f46c5116b1 [DEBUG] Run / intall executable on MacOs 2016-09-18 22:40:01 +02:00
1cf731910d [DEBUG] build on MacOs 2016-09-16 23:06:51 +02:00
a2fdd6eef9 [DEV] update flags on MacOs 2016-09-15 23:19:57 +02:00
9c9809c359 [DEV] change warning in debug 2016-09-15 23:29:21 +02:00
3bea09cfc2 [DEBUG] set comiplation for Windows on Linux back 2016-09-14 23:53:22 +02:00
cc397679bb [DEV] wrong code specification 2016-09-13 23:56:20 +02:00
33688801bb [RELEASE] new version 2.1.0 2016-09-12 23:14:16 +02:00
6440dc6309 [DEV] integrate the version in the get version in file 2016-09-12 21:46:11 +02:00
e1e896fcc1 [DOC] wrong doc number 2016-09-09 23:22:15 +02:00
8c85a2ea09 [RELEASE] new version 2.0.0 2016-09-09 22:55:43 +02:00
082556e591 [DOC] better documentation 2016-09-09 21:30:25 +02:00
604078f1c0 [DEV/API] update API to use a mximum of accessor instead of variable, some deprecation 2016-09-08 22:56:16 +02:00
40d2e8eac1 [API/DOC] change API to have a good coherency 2016-09-07 22:17:41 +02:00
2ebe27a5a4 [DOC/DEV] continue documentation and update API ==> end of normalisation 2016-09-06 21:04:01 +02:00
dff87a00ee [CI] add ci of gitlab 2016-09-05 21:39:25 +02:00
9fc593fb59 [DOC] update documentation and add better stanadart API 2016-09-05 21:08:58 +02:00
171 changed files with 11623 additions and 3219 deletions

9
.gitignore vendored
View File

@@ -1,9 +0,0 @@
# Compiled python modules.
*.pyc
# Setuptools distribution folder.
/dist/
/build/
# Python egg metadata, regenerated from source files by setuptools.
/*.egg-info

34
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,34 @@
# This file is a template, and might need editing before it works on your project.
# use the official gcc image, based on debian
# can use verions as well, like gcc:5.2
# see https://hub.docker.com/_/gcc/
image: gcc
before_script:
- pwd
- git clone --depth 1 --branch master https://gitlab.com/atria-soft/ci.git
- ls -l *
- ls -l ..
- apt-get update -qy
- apt-get install -y python-dev python-pip
#- pip install setuptools
- ./setup.py install
#- export PYTHONPATH=$PYTHONPATH:./lutin/build/lib.linux-x86_64-2.7/:./lutin/build/lib.linux-x86_64-2.7/lutin/:./lutin/build/lib:./lutin/build/lib/lutin/
# - ./ci/build_send.py --tag=$TAG --status=START;
build:
stage: build
# instead of calling g++ directly you can also use some build toolkit like make
# install the necessary build tools when needed
# before_script:
# - apt update && apt -y install make autoconf
script:
- export TARGET=-tLinux
- export CONF=-mdebug
- export BUILDER=-cgcc
- lutin -w -j4 -C -P $TARGET $BUILDER $COMPILATOR_OPTION $BUS $CONF $GCOV $DISABLE_PACKAGE test-c; STATUS=$?
# - ./ci/build_send.py --tag=$TAG --status="$STATUS";
# artifacts:
# paths:
# - mybinary

17
.project Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lutin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

5
.pydevproject Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
</pydev_project>

View File

@@ -0,0 +1,62 @@
eclipse.preferences.version=1
encoding//bin/lutin=utf-8
encoding//lutin/__init__.py=utf-8
encoding//lutin/builder.py=utf-8
encoding//lutin/depend.py=utf-8
encoding//lutin/env.py=utf-8
encoding//lutin/heritage.py=utf-8
encoding//lutin/macro.py=utf-8
encoding//lutin/module.py=utf-8
encoding//lutin/moduleGLD.py=utf-8
encoding//lutin/multiprocess.py=utf-8
encoding//lutin/system.py=utf-8
encoding//lutin/target.py=utf-8
encoding//lutin/tools.py=utf-8
encoding//lutin/z_builder/__init__.py=utf-8
encoding//lutin/z_builder/lutinBuilder_binary.py=utf-8
encoding//lutin/z_builder/lutinBuilder_c++.py=utf-8
encoding//lutin/z_builder/lutinBuilder_c.py=utf-8
encoding//lutin/z_builder/lutinBuilder_jar.py=utf-8
encoding//lutin/z_builder/lutinBuilder_java.py=utf-8
encoding//lutin/z_builder/lutinBuilder_javah.py=utf-8
encoding//lutin/z_builder/lutinBuilder_libraryDynamic.py=utf-8
encoding//lutin/z_builder/lutinBuilder_libraryStatic.py=utf-8
encoding//lutin/z_builder/lutinBuilder_m.py=utf-8
encoding//lutin/z_builder/lutinBuilder_mm.py=utf-8
encoding//lutin/z_builder/lutinBuilder_nasm.py=utf-8
encoding//lutin/z_builder/lutinBuilder_s.py=utf-8
encoding//lutin/z_system/lutinSystem_Android_c.py=utf-8
encoding//lutin/z_system/lutinSystem_Android_cxx.py=utf-8
encoding//lutin/z_system/lutinSystem_Android_m.py=utf-8
encoding//lutin/z_system/lutinSystem_IOs_c.py=utf-8
encoding//lutin/z_system/lutinSystem_IOs_cxx.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_alsa.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_bsd.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_bz2.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_c.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_cxx.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_egl.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_gnutls.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_khr.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_m.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_mysql.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_opengl.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_pthread.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_python3-numpy.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_python3.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_rt.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_sodium.py=utf-8
encoding//lutin/z_system/lutinSystem_Linux_z.py=utf-8
encoding//lutin/z_system/lutinSystem_MacOs_Cocoa.py=utf-8
encoding//lutin/z_system/lutinSystem_Windows_ole.py=utf-8
encoding//lutin/z_system/lutinSystem_Windows_oleaut.py=utf-8
encoding//lutin/z_system/lutinSystem_Windows_psapi.py=utf-8
encoding//lutin/z_system/lutinSystem_Windows_shell.py=utf-8
encoding//lutin/z_system/lutinSystem_Windows_start-mode-gui.py=utf-8
encoding//lutin/z_target/lutinTarget_Android.py=utf-8
encoding//lutin/z_target/lutinTarget_Debian.py=utf-8
encoding//lutin/z_target/lutinTarget_IOs.py=utf-8
encoding//lutin/z_target/lutinTarget_Linux.py=utf-8
encoding//lutin/z_target/lutinTarget_MacOs.py=utf-8
encoding//lutin/z_target/lutinTarget_Windows.py=utf-8
encoding//lutin/zip.py=utf-8

View File

@@ -1,6 +1,8 @@
#language: python
language: cpp
sudo: false
#sudo: false
sudo: required
dist: trusty
branches:
only:
@@ -24,14 +26,14 @@ addons:
matrix:
include:
- os: linux
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9"
compiler: gcc
- os: linux
env: CONF=debug BUILDER=clang TARGET=Linux
compiler: clang
- os: linux
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
compiler: gcc
compiler: x86_64-w64-mingw32-gcc
- os: linux
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
compiler: gcc
@@ -43,6 +45,8 @@ matrix:
compiler: clang
install:
- ./setup.py build
- export PYTHONPATH=$PYTHONPATH:./lutin/build/lib.linux-x86_64-2.7/:./lutin/build/lib.linux-x86_64-2.7/lutin/:./lutin/build/lib:./lutin/build/lib/lutin/
- cd ..
# download NDK
- if [ "$TAG" == "Android" ]; then
@@ -53,15 +57,16 @@ install:
- cd -
before_script:
- ./setup.py build
- export PYTHONPATH=$PYTHONPATH:./lutin/build/lib.linux-x86_64-2.7/:./lutin/build/lib.linux-x86_64-2.7/lutin/:./lutin/build/lib:./lutin/build/lib/lutin/
- cd ..
- pwd
- ls -l *
- ls -l
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export PATH=$PATH:/Users/travis/Library/Python/2.7/bin/;
fi
- ./ci/build_send.py --tag=$TAG --status=START;
script:
- ./lutin/build/scripts-2.7/lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE test-c; STATUS=$?
- ./lutin/build/scripts-2.7/lutin -w -j4 -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE test-c; STATUS=$?
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
notifications:

13
COPYING
View File

@@ -1,13 +0,0 @@
Copyright lutin Edouard DUPIN
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

373
LICENSE Normal file
View File

@@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View File

@@ -1,2 +1,3 @@
include README.rst
include README.md
include bash-autocompletion/lutin
include version.txt

73
README.md Normal file
View File

@@ -0,0 +1,73 @@
Lutin
=====
`lutin` is a generic builder and package maker is a FREE software tool.
[![Badge](https://badge.fury.io/py/lutin.png](https://pypi.python.org/pypi/lutin)
Instructions
------------
This is a tool to generate the binary, shared library, static library and package independently of the OS
This software builds C, C++, m, m++, to object file and generate associated libraries (.so & .a) end create final Executable file
This tool can generate package for Linux, MacOs, Android
Lutin is under a FREE license that can be found in the COPYING file.
Any contribution is more than welcome ;)
git repository
--------------
http://github.com/HeeroYui/lutin/
Documentation
-------------
http://HeeroYui.github.io/lutin/
Installation
------------
Requirements: ``Python >= 2.7`` and ``pip``
Just run:
```
pip install lutin
```
Install pip on debian/ubuntu:
```
sudo apt-get install pip
```
Install pip on ARCH-linux:
```
sudo pacman -S pip
```
Install pip on MacOs:
```
sudo easy_install pip
```
License (MPL v2.0)
---------------------
Copyright lutin Edouard DUPIN
Licensed under the Mozilla Public License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.mozilla.org/MPL/2.0/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,113 +0,0 @@
Lutin
=====
`lutin` is a generic builder and package maker is a FREE software tool.
.. image:: https://badge.fury.io/py/lutin.png
:target: https://pypi.python.org/pypi/lutin
Release (master)
----------------
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=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)
------------------
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=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
------------
This is a tool to generate the binary, shared library, static library and package independently of the OS
This software builds C, C++, m, m++, to object file and generate associated libraries (.so & .a) end create final Executable file
This tool can generate package for Linux, MacOs, Android
Lutin is under a FREE license that can be found in the COPYING file.
Any contribution is more than welcome ;)
git repository
--------------
http://github.com/HeeroYui/lutin/
Documentation
-------------
http://github.io/HeeroYui/lutin/
Installation
------------
Requirements: ``Python >= 2.7`` and ``pip``
Just run:
pip install lutin
Install pip on debian/ubuntu:
sudo apt-get install pip
Install pip on ARCH-linux:
sudo pacman -S pip
Install pip on MacOs:
sudo easy_install pip
License (APACHE v2.0)
---------------------
Copyright lutin Edouard DUPIN
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

369
bin/lutin
View File

@@ -1,20 +1,22 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
# for path inspection:
import sys
import os
import copy
import json
from realog import debug as debug
import lutin
import lutin.debug as debug
import lutin.arg as arguments
import death.Arguments as arguments
import death.ArgElement as arg_element
import lutin.host as host
import lutin.module as module
import lutin.target as target
@@ -24,33 +26,36 @@ import lutin.tools as tools
import lutin.host as lutinHost
import lutin.tools as lutinTools
myArgs = arguments.LutinArg()
myArgs.add(arguments.ArgDefine("h", "help", desc="Display this help"))
myArgs.add(arguments.ArgDefine("H", "HELP", desc="Display this help (with all compleate information)"))
myArgs = arguments.Arguments()
myArgs.add("h", "help", desc="Display this help")
myArgs.add("H", "HELP", desc="Display this help (with all compleate information)")
myArgs.add("", "version", desc="Display the application version")
myArgs.add_section("option", "Can be set one time in all case")
myArgs.add(arguments.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2"))
myArgs.add(arguments.ArgDefine("C", "color", desc="Display makefile output in color"))
myArgs.add(arguments.ArgDefine("B", "force-build", desc="Force the rebuild without checking the dependency"))
myArgs.add(arguments.ArgDefine("P", "pretty", desc="Print the debug has pretty display"))
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
myArgs.add(arguments.ArgDefine("d", "depth", haveParam=True, desc="Depth of the search of sub element lutin_*.py (default=" + str(env.get_parse_depth()) + ")"))
myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
myArgs.add(arguments.ArgDefine("o", "force-optimisation", desc="Force optimisation of the build"))
myArgs.add(arguments.ArgDefine("w", "warning", desc="Store warning in a file build file"))
myArgs.add(arguments.ArgDefine("i", "isolate-system", desc="Isolate system build (copy header of c and c++ system lib to not include unneeded external libs) EXPERIMENTAL (archlinux)"))
myArgs.add("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2")
myArgs.add("C", "color", desc="Display makefile output in color")
myArgs.add("B", "force-build", desc="Force the rebuild without checking the dependency")
myArgs.add("P", "pretty", desc="Print the debug has pretty display")
myArgs.add("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously")
myArgs.add("d", "depth", haveParam=True, desc="Depth of the search of sub element lutin_*.py (default=" + str(env.get_parse_depth()) + ")")
myArgs.add("s", "force-strip", desc="Force the stripping of the compile elements")
myArgs.add("o", "force-optimisation", desc="Force optimisation of the build")
myArgs.add("w", "warning", desc="Store warning in a file build file")
myArgs.add("i", "isolate-system", desc="Isolate system build (copy header of c and c++ system lib to not include unneeded external libs) EXPERIMENTAL (archlinux)")
myArgs.add("K", "ccache", desc="Enable the ccache interface")
myArgs.add("A", "async-fail", desc="Asynchronous fail of all the run execution, this permit to execute all test and report all fails")
myArgs.add_section("properties", "keep in the sequency of the cible")
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
myArgs.add(arguments.ArgDefine("", "compilator-version", haveParam=True, desc="With travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9"))
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
myArgs.add(arguments.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
myArgs.add(arguments.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code"))
myArgs.add(arguments.ArgDefine("", "simulation", desc="Simulater mode (availlable only for IOS)"))
myArgs.add(arguments.ArgDefine("", "list-target", desc="List all availlables targets ==> for auto completion"))
myArgs.add(arguments.ArgDefine("", "list-module", desc="List all availlables module ==> for auto completion"))
myArgs.add("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'")
myArgs.add("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default " + lutinHost.HOST_DEFAULT_COMPILATOR + " will be used)")
myArgs.add("", "compilator-version", haveParam=True, desc="With travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9")
myArgs.add("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)")
myArgs.add("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile")
myArgs.add("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)")
myArgs.add("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)")
myArgs.add("g", "gcov", desc="Enable code coverage intrusion in code")
myArgs.add("", "simulation", desc="Simulater mode (availlable only for IOS)")
myArgs.add("", "list-target", desc="List all availlables targets ==> for auto completion")
myArgs.add("", "list-module", desc="List all availlables module ==> for auto completion")
myArgs.add_section("cible", "generate in order set")
localArgument = myArgs.parse()
@@ -59,18 +64,29 @@ localArgument = myArgs.parse()
display the help of this makefile
"""
def usage(full=False):
color = debug.get_color_set()
color = debug.get_color_set();
# generic argument displayed :
myArgs.display()
print(" All target can finish with '?clean' '?dump' '?gcov' ... ?action (@ can replace ?)" )
print(" " + color['green'] + "all" + color['default'])
print(" build all (only for the current selected board) (bynary and packages)")
print(" " + color['green'] + "clean" + color['default'])
print(" clean all (same as previous)")
print(" " + color['green'] + "dump" + color['default'])
print(" Dump all the module dependency and properties")
print(" " + color['green'] + "gcov" + color['default'])
print(" Parse all the code of the library with the gcov resolution")
myArgs.display();
print(" All target can finish with '?clean' '?dump' '?gcov' ... ?action (@ can replace ?)" );
print(" " + color['green'] + "all" + color['default']);
print(" build all (only for the current selected board) (bynary and packages)");
print(" " + color['green'] + "clean" + color['default']);
print(" clean all (same as previous)");
print(" " + color['green'] + "dump" + color['default']);
print(" Dump all the module dependency and properties");
print(" " + color['green'] + "dependency" + color['default']);
print(" generate a file dependency.dot that represent all the dependency link");
print(" Select what in included: 'dependency:LPBDK'");
print(" L: Library");
print(" P: Pre-build");
print(" D: Data");
print(" B: Binary");
print(" K: Package");
print(" eg: lutin dependency:LD ; dot -Tsvg dependency.dot -o dependency.svg ; firefox dependency.svg");
print(" " + color['green'] + "gcov" + color['default']);
print(" Parse all the code of the library with the gcov resolution");
print(" " + color['green'] + "run" + color['default']);
print(" Execute the application in the module. add ':' to add parameter to set in the program parameters");
listOfAllModule = module.list_all_module_with_desc()
for mod in listOfAllModule:
data_print = " "
@@ -117,7 +133,8 @@ def usage(full=False):
"""
print(data_print)
if mod["description"] != "":
if mod["description"] != None \
and mod["description"] != "":
print(" " + mod["description"])
if full == True:
if mod["type"] != None \
@@ -153,9 +170,28 @@ def usage(full=False):
print(" maintainers:")
for elem in mod["maintainer"]:
print(" " + str(elem))
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
print(" ex simple 1: " + sys.argv[0])
print(" ex simple 2: " + sys.argv[0] + " -t Windows")
print(" ex multiple platform : " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
print(" ex complex arguments : " + sys.argv[0] + " -cclang -mdebug zeus-package-base?build?run%zeus-launcher:--srv=user:--elog-level=5")
print(" ex gcov: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov")
print(" ex gcov with output: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov:output")
print(" ex multiple test execution with end resume: " + sys.argv[0] + " -cgcc -mdebug *-test?build?run")
exit(0)
##
## @brief Display the version of this package.
##
def version():
color = debug.get_color_set()
import pkg_resources
print("version: " + str(pkg_resources.get_distribution('lutin').version))
foldername = os.path.dirname(__file__)
print("source folder is: " + foldername)
exit(0)
def check_boolean(value):
if value == "" \
or value == "1" \
@@ -169,18 +205,22 @@ def check_boolean(value):
def parseGenericArg(argument, active):
debug.extreme_verbose("parse arg : " + argument.get_option_name() + " " + argument.get_arg() + " active=" + str(active))
if argument.get_option_name() == "help":
if active==False:
if active == False:
usage()
return True
if argument.get_option_name() == "version":
if active == False:
version()
return True
if argument.get_option_name() == "HELP":
if active==False:
if active == False:
usage(True)
return True
if argument.get_option_name() == "list-module":
if active==False:
listOfModule = module.list_all_module()
if active == False:
list_of_module = module.list_all_module()
retValue = ""
for moduleName in listOfModule:
for moduleName in list_of_module:
if retValue != "":
retValue += " "
retValue += moduleName
@@ -188,72 +228,86 @@ def parseGenericArg(argument, active):
exit(0)
return True
if argument.get_option_name() == "list-target":
if active==False:
listOfTarget = target.list_all_target()
retValue = ""
for targetName in listOfTarget:
if active == False:
list_of_target = target.list_all_target();
retValue = "";
for targetName in list_of_target:
if retValue != "":
retValue += " "
retValue += targetName
print(retValue)
exit(0)
retValue += " ";
retValue += targetName;
print(retValue);
exit(0);
return True
elif argument.get_option_name()=="jobs":
if active==True:
multiprocess.set_core_number(int(argument.get_arg()))
if active == True:
multiprocess.set_core_number(int(argument.get_arg()));
return True
elif argument.get_option_name()=="depth":
if active==True:
env.set_parse_depth(int(argument.get_arg()))
if active == True:
env.set_parse_depth(int(argument.get_arg()));
return True
elif argument.get_option_name()=="async-fail":
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_async_fail(True);
else:
env.set_async_fail(False);
return True
elif argument.get_option_name()=="ccache":
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_ccache(True)
else:
env.set_ccache(False)
return True
elif argument.get_option_name() == "verbose":
if active==True:
if active == True:
debug.set_level(int(argument.get_arg()))
return True
elif argument.get_option_name() == "color":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
debug.enable_color()
else:
debug.disable_color()
return True
elif argument.get_option_name() == "force-build":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_mode(True)
else:
env.set_force_mode(False)
return True
elif argument.get_option_name() == "pretty":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_print_pretty_mode(True)
else:
env.set_print_pretty_mode(False)
return True
elif argument.get_option_name() == "force-optimisation":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_optimisation(True)
else:
env.set_force_optimisation(False)
return True
elif argument.get_option_name() == "isolate-system":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_isolate_system(True)
else:
env.set_isolate_system(False)
return True
elif argument.get_option_name() == "force-strip":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_strip_mode(True)
else:
env.set_force_strip_mode(False)
return True
elif argument.get_option_name() == "warning":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_warning_mode(True)
else:
@@ -261,55 +315,76 @@ def parseGenericArg(argument, active):
return True
return False
"""
simple configuration in file ".lutin/config.json"
{
"exclude-path":[
"archive",
"sdk"
],
"parsing-depth": 3,
"jobs": 12,
"color: true,
"debug-level": 3,
"print-pretty": true,
"isolate-system": false,
"force-optimization": false
}
"""
# open configuration of lutin:
config_file_name = "lutinConfig.py"
config_file_name = ".lutin/config.json"
config_file = os.path.join(tools.get_run_path(), config_file_name)
if os.path.isfile(config_file) == True:
sys.path.append(os.path.dirname(config_file))
debug.debug("Find basic configuration file: '" + config_file + "'")
sys.path.append(os.path.dirname(config_file));
debug.debug("Find basic configuration file: '" + config_file + "'");
config_data_file = tools.file_read_data(config_file);
# the file exist, we can open it and get the initial configuration:
configuration_file = __import__(config_file_name[:-3])
config_data = json.loads(config_data_file);
if "get_exclude_path" in dir(configuration_file):
data = configuration_file.get_exclude_path()
if "exclude-path" in config_data.keys():
data = config_data["exclude-path"];
debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
env.set_exclude_search_path(data)
if "get_parsing_depth" in dir(configuration_file):
data = configuration_file.get_parsing_depth()
if "parsing-depth" in config_data.keys():
data = config_data["parsing-depth"];
debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("depth", str(data)), True)
parseGenericArg(arg_element.ArgElement("depth", str(data)), True)
if "get_default_jobs" in dir(configuration_file):
data = configuration_file.get_default_jobs()
if "ccache" in config_data.keys():
data = config_data["ccache"];
debug.debug(" get default config 'get_ccache' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("ccache", str(data)), True)
if "jobs" in config_data.keys():
data = config_data["jobs"];
debug.debug(" get default config 'get_default_jobs' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("jobs", str(data)), True)
parseGenericArg(arg_element.ArgElement("jobs", str(data)), True)
if "get_default_color" in dir(configuration_file):
data = configuration_file.get_default_color()
if "color" in config_data.keys():
data = config_data["color"];
debug.debug(" get default config 'get_default_color' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("color", str(data)), True)
parseGenericArg(arg_element.ArgElement("color", str(data)), True)
if "get_default_debug_level" in dir(configuration_file):
data = configuration_file.get_default_debug_level()
if "debug-level" in config_data.keys():
data = config_data["debug-level"];
debug.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("verbose", str(data)), True)
parseGenericArg(arg_element.ArgElement("verbose", str(data)), True)
if "get_default_print_pretty" in dir(configuration_file):
data = configuration_file.get_default_print_pretty()
if "print-pretty" in config_data.keys():
data = config_data["print-pretty"];
debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("pretty", str(data)), True)
parseGenericArg(arg_element.ArgElement("pretty", str(data)), True)
if "get_default_force_optimisation" in dir(configuration_file):
data = configuration_file.get_default_force_optimisation()
if "force-optimization" in config_data.keys():
data = config_data["force-optimization"];
debug.debug(" get default config 'get_default_force_optimisation' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("force-optimisation", str(data)), True)
parseGenericArg(arg_element.ArgElement("force-optimisation", str(data)), True)
if "get_default_isolate_system" in dir(configuration_file):
data = configuration_file.get_default_isolate_system()
if "isolate-system" in config_data.keys():
data = config_data["isolate-system"];
debug.debug(" get default config 'get_default_isolate_system' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("isolate-system", str(data)), True)
parseGenericArg(arg_element.ArgElement("isolate-system", str(data)), True)
@@ -323,7 +398,7 @@ lutin.init()
#available target : Linux / MacOs / Windows / Android ...
targetName = host.OS
config = {
"compilator":"gcc",
"compilator":lutinHost.HOST_DEFAULT_COMPILATOR,
"mode":"release",
"bus-size":"auto",
"arch":"auto",
@@ -332,39 +407,40 @@ config = {
"gcov":False,
"compilator-version":""
}
elementErrors = [];
# load the default target :
my_target = None
actionDone=False
my_target = None;
actionDone=False;
# parse all argument
for argument in localArgument:
if parseGenericArg(argument, False) == True:
continue
continue;
elif argument.get_option_name() == "compilator-version":
config["compilator-version"] = argument.get_arg()
config["compilator-version"] = argument.get_arg();
elif argument.get_option_name() == "package":
config["generate-package"]=False
config["generate-package"]=False;
elif argument.get_option_name() == "simulation":
config["simulation"]=True
config["simulation"]=True;
elif argument.get_option_name() == "gcov":
config["gcov"]=True
config["gcov"]=True;
elif argument.get_option_name() == "bus":
config["bus-size"]=argument.get_arg()
config["bus-size"]=argument.get_arg();
elif argument.get_option_name() == "arch":
config["arch"]=argument.get_arg()
config["arch"]=argument.get_arg();
elif argument.get_option_name() == "compilator":
if config["compilator"] != argument.get_arg():
debug.debug("change compilator ==> " + argument.get_arg())
config["compilator"] = argument.get_arg()
debug.debug("change compilator ==> " + argument.get_arg());
config["compilator"] = argument.get_arg();
#remove previous target
my_target = None
my_target = None;
elif argument.get_option_name() == "target":
# No check input ==> this will be verify automaticly chen the target will be loaded
if targetName != argument.get_arg():
targetName = argument.get_arg()
debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release")
targetName = argument.get_arg();
debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release");
#reset properties by defauult:
config = {
"compilator":"gcc",
"compilator":lutinHost.HOST_DEFAULT_COMPILATOR,
"mode":"release",
"bus-size":"auto",
"arch":"auto",
@@ -372,53 +448,76 @@ for argument in localArgument:
"simulation":False,
"gcov":False,
"compilator-version":""
}
};
#remove previous target
my_target = None
my_target = None;
elif argument.get_option_name() == "mode":
if config["mode"] != argument.get_arg():
config["mode"] = argument.get_arg()
debug.debug("change mode ==> " + config["mode"])
config["mode"] = argument.get_arg();
debug.debug("change mode ==> " + config["mode"]);
#remove previous target
my_target = None
my_target = None;
else:
argument_value = argument.get_arg()
debug.debug("something request : '" + argument_value + "'")
argument_value = argument.get_arg();
debug.debug("something request : '" + argument_value + "'");
if argument.get_option_name() != "":
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
usage()
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'");
usage();
break;
name2 = argument_value.replace("@", "?")
gettedElement = name2.split("?")
module_name = gettedElement[0]
action_list = gettedElement[1:]
name2 = argument_value.replace("@", "?");
gettedElement = name2.split("?");
module_name = gettedElement[0];
action_list = gettedElement[1:];
if len(action_list) == 0:
action_list = "build"
debug.debug("requested: '" + module_name + "' ? actions:'" + str(action_list) + "'")
multiple_module_list = []
action_list = "build";
debug.debug("requested: '" + module_name + "' ? actions:'" + str(action_list) + "'");
multiple_module_list = [];
if module_name[-1] == "*":
base_name = module_name[:-1]
base_name = module_name[:-1];
for mod in module.list_all_module():
if mod[:len(base_name)] == base_name:
debug.verbose("need do it for: " + mod);
multiple_module_list.append(mod)
multiple_module_list.append(mod);
else:
multiple_module_list.append(module_name)
debug.debug("Will do: '" + str(multiple_module_list) + "' ? actions:'" + str(action_list) + "'")
multiple_module_list.append(module_name);
debug.debug("Will do: '" + str(multiple_module_list) + "' ? actions:'" + str(action_list) + "'");
for module_name in multiple_module_list:
#load the target if needed :
if my_target == None:
my_target = target.load_target(targetName, copy.deepcopy(config))
my_target.build(module_name, actions=action_list)
actionDone=True
my_target = target.load_target(targetName, copy.deepcopy(config));
heritage, is_build, error_nodes = my_target.build(module_name, actions=action_list);
if error_nodes != None:
for err in error_nodes:
elementErrors.append(err);
actionDone=True;
# if no action done : we do "all" ...
if actionDone==False:
#load the target if needed :
if my_target == None:
my_target = target.load_target(targetName, config)
my_target.build("all")
my_target = target.load_target(targetName, config);
heritage, is_build, error_nodes = my_target.build("all");
if error_nodes != None:
for err in error_nodes:
elementErrors.append(err);
if len(elementErrors) != 0:
have_error = False;
for elret in elementErrors:
out = " '" + str(elret["module"]) + "'";
if elret["bin"] != None:
out += " ==> bin name='" + str(elret["bin"]) + "'";
if len(elret["options"]) != 0:
out += " with option: " + str(elret["options"]);
if elret["return"] != 0:
debug.warning("[ FAIL ] " + out + " RETURN value: " + str(elret["return"]));
have_error = True;
else:
debug.info("[ OK ] " + out);
if have_error:
debug.error("Execution fail...");
# stop all started threads;
multiprocess.un_init()

20
cmake/CMakeLists.txt Normal file
View File

@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.20)
project(GlobalSearch)
message("List of modules: ${CMAKE_MODULE_PATH}")
#LIST(APPEND CMAKE_MODULE_PATH "cmake")
#find_package(GLDBuilder REQUIRED)
include("cmake/GLDBuilder.cmake")
#GLD_import("./" "etk-core")
get_filename_component(LOCAL_FILE_PATH "." ABSOLUTE)
GLD_auto_prebuild_load_all("${LOCAL_FILE_PATH}")
GLD_auto_load_all("${LOCAL_FILE_PATH}")
GLD_instanciate()

944
cmake/GLDBuilder.cmake Normal file
View File

@@ -0,0 +1,944 @@
cmake_minimum_required(VERSION 3.20)
include("cmake/GLDJson.cmake")
include("cmake/GLDTargetConfig.cmake")
include("cmake/GLDTools.cmake")
function(GLD_import_full_group NAME_GLD_MODULE MY_JSON_STRING ELEMENT_TO_CHECK TYPE_VARIABLE)
json_get_type(TYPE ${MY_JSON_STRING} ${ELEMENT_TO_CHECK})
#message("target type = ${TYPE}")
if (${TYPE} STREQUAL "OBJECT")
json_object_keys(LIST_KEY ${MY_JSON_STRING} ${ELEMENT_TO_CHECK})
foreach (III ${LIST_KEY})
# check the target, no need to had unknown target ...
if (${III} STREQUAL "*")
json_object_values(DATA_TARGET ${MY_JSON_STRING} ${ELEMENT_TO_CHECK} "*")
#message("target(*) data: ${DATA_TARGET}")
GLD_import_full(NAME_GLD_MODULE DATA_TARGET)
elseif (${III} STREQUAL ${TYPE_VARIABLE})
json_object_values(DATA_TARGET ${MY_JSON_STRING} ${ELEMENT_TO_CHECK} "${III}")
GLD_import_full(NAME_GLD_MODULE DATA_TARGET)
#message("target(${III}) data: ${DATA_TARGET}")
else()
message("TODO: get dependency manage '${ELEMENT_TO_CHECK}' : ${III}")
endif()
endforeach()
elseif(${TYPE} STREQUAL "NOTFOUND" OR ${TYPE} STREQUAL "NULL")
# nothing to do ..
else()
message("ERROR : '${ELEMENT_TO_CHECK}' can not be other than an json object : ${TYPE}")
endif()
endfunction()
function(GLD_import_element_dependency NAME_GLD_MODULE MY_JSON_STRING)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
##########################################################
## DEPENDENCY:
##########################################################
json_get_type(TYPE ${MY_JSON_STRING} "dependency")
set(LIST_VALUE "")
set(LIST_OPTIONAL_VALUE "")
#message("Dependency type = ${TYPE}")
if (${TYPE} STREQUAL "ARRAY")
json_size(SIZE ${MY_JSON_STRING} "dependency")
#message("Dependency SIZE = ${SIZE}")
if (SIZE GREATER 0)
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "dependency")
MATH(EXPR SIZE "${SIZE}-1")
set(VAR_OUT_TMP "")
foreach(IDX RANGE ${SIZE})
json_get_data(ELEMENT ${OBJECT_DATA} ${IDX})
json_get_type(TYPE ${OBJECT_DATA} ${IDX})
if (${TYPE} STREQUAL "STRING")
message(" - <dep> : ${ELEMENT}")
list(APPEND VAR_OUT_TMP ${ELEMENT})
elseif (${TYPE} STREQUAL "OBJECT")
json_get_type(TYPE ${ELEMENT} "name")
if (${TYPE} STREQUAL "STRING")
json_get_data(DEPENDENCY_NAME ${ELEMENT} "name")
json_get_type(TYPE ${ELEMENT} "optional")
#message("optional type = ${TYPE} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ${DEPENDENCY_NAME}")
if (${TYPE} STREQUAL "BOOLEAN")
json_get_data(DEPENDENCY_OPTIONAL ${ELEMENT} "optional")
if (${DEPENDENCY_OPTIONAL})
message(" - <dep> : ${DEPENDENCY_NAME} (optional) ==> not managed now ...")
#message("optional value ==========================> '${DEPENDENCY_OPTIONAL}' ==> MAYBE")
list(APPEND LIST_OPTIONAL_VALUE ${DEPENDENCY_NAME})
else()
message(" - <dep> : ${DEPENDENCY_NAME}")
#message("optional value ==========================> '${DEPENDENCY_OPTIONAL}' ==> MUST")
list(APPEND VAR_OUT_TMP ${DEPENDENCY_NAME})
endif()
else()
message(" - <dep> : ${DEPENDENCY_NAME}")
list(APPEND VAR_OUT_TMP ${DEPENDENCY_NAME})
endif()
#message("optional type = ${TYPE} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ${DEPENDENCY_NAME}")
else()
message("Dependency 'name' is not a string or is missing type: ${TYPE}")
endif()
else()
message("dependency element not manage data : ${ELEMENT}")
## TODO add in dependency if optional : check if the element exit in the current module list ...
endif()
endforeach()
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
endif()
elseif(${TYPE} STREQUAL "NOTFOUND")
return()
endif()
set(MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY ${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY} ${LIST_VALUE} CACHE INTERNAL "")
endfunction()
function(GLD_import_element_source NAME_GLD_MODULE MY_JSON_STRING)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
##########################################################
## SOURCE:
##########################################################
set(LIST_VALUE "")
json_get_type(TYPE ${MY_JSON_STRING} "source")
if (${TYPE} STREQUAL "STRING")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "source")
message(" - <src> : ${OBJECT_DATA}")
list(APPEND LIST_VALUE ${OBJECT_DATA})
elseif (${TYPE} STREQUAL "ARRAY")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "source")
json_size(SIZE ${MY_JSON_STRING} "source")
#message("Dependency SIZE = ${SIZE}")
if (SIZE GREATER 0)
MATH(EXPR SIZE "${SIZE}-1")
set(VAR_OUT_TMP "")
foreach(IDX RANGE ${SIZE})
json_get_data(ELEMENT ${OBJECT_DATA} ${IDX})
json_get_type(TYPE ${OBJECT_DATA} ${IDX})
if (${TYPE} STREQUAL "STRING")
message(" - <src> : ${ELEMENT}")
list(APPEND LIST_VALUE ${ELEMENT})
elseif (${TYPE} STREQUAL "OBJECT")
message(" - <src2> : ${ELEMENT}")
json_get_type(TYPE ${ELEMENT} "source")
json_get_data(ELEMENT_SOURCE ${ELEMENT} "source")
if (${TYPE} STREQUAL "STRING")
message(" - <src> : ${ELEMENT_SOURCE}")
list(APPEND LIST_VALUE ${ELEMENT_SOURCE})
#message("optional type = ${TYPE} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ${DEPENDENCY_NAME}")
elseif (${TYPE} STREQUAL "ARRAY")
message(" - <src> : ${ELEMENT_SOURCE}")
list(APPEND LIST_VALUE ${ELEMENT_SOURCE})
else()
message("Dependency 'name' is not a string or is missing type: ${TYPE}")
endif()
# TODO: add the source specific flags or other things ...
else()
message("'source' element not manage data : ${ELEMENT}")
## TODO add in dependency if optional : check if the element exit in the current module list ...
endif()
endforeach()
endif()
elseif (${TYPE} STREQUAL "OBJECT")
# todo: manage object with source like { "c++":[...]...}
elseif(${TYPE} STREQUAL "NOTFOUND")
return()
else()
message(WARNING "Unmanaged type='${TYPE}' for 'source' node")
endif()
set(MODULE_MAP_${LOCAL_MODULE_NAME}_SOURCE ${MODULE_MAP_${LOCAL_MODULE_NAME}_SOURCE} ${LIST_VALUE} CACHE INTERNAL "")
endfunction()
function(GLD_import_element_header NAME_GLD_MODULE MY_JSON_STRING)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
##########################################################
## HEADER:
##########################################################
set(LIST_VALUE "")
json_get_type(TYPE ${MY_JSON_STRING} "header")
if (${TYPE} STREQUAL "STRING")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "header")
message(" - <header> : ${OBJECT_DATA}")
list(APPEND LIST_VALUE ${OBJECT_DATA})
elseif (${TYPE} STREQUAL "ARRAY")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "header")
json_size(SIZE ${MY_JSON_STRING} "header")
#message("Dependency SIZE = ${SIZE}")
if (SIZE GREATER 0)
MATH(EXPR SIZE "${SIZE}-1")
set(VAR_OUT_TMP "")
foreach(IDX RANGE ${SIZE})
json_get_data(ELEMENT ${OBJECT_DATA} ${IDX})
json_get_type(TYPE ${OBJECT_DATA} ${IDX})
if (${TYPE} STREQUAL "STRING")
message(" - <header> : ${ELEMENT}")
list(APPEND LIST_VALUE ${ELEMENT})
elseif (${TYPE} STREQUAL "OBJECT")
json_get_type(TYPE ${ELEMENT} "source")
if (${TYPE} STREQUAL "NOTFOUND")
json_get_type(TYPE ${ELEMENT} "path")
if (${TYPE} STREQUAL "STRING")
json_get_data(ELEMENT_PATH ${ELEMENT} "path")
json_get_data_or_default(ELEMENT_FILTER ${ELEMENT} "filter" "*")
json_get_data_or_default(ELEMENT_RECURSIVE ${ELEMENT} "path" OFF)
json_get_data_or_default(ELEMENT_TO ${ELEMENT} "to" "")
find_all_files(ALL_HEADER_FILES "${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}/${ELEMENT_PATH}" "${ELEMENT_FILTER}" 50)
#message("***********************************************************************")
#foreach(III ${ALL_HEADER_FILES})
# message(" ==> ${III}")
#endforeach()
#message("STATIC_PART = ${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}/${STATIC_PART}")
replace_base_path(ALL_HEADER_FILES_2 "${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}/${ELEMENT_PATH}" "${ALL_HEADER_FILES}")
#message("***********************************************************************")
set(ALL_HEADER_FILES "")
foreach(III ${ALL_HEADER_FILES_2})
#message(" ==> ${III}!${ELEMENT_PATH}:${ELEMENT_TO}")
list(APPEND ALL_HEADER_FILES "${III}!${ELEMENT_PATH}:${ELEMENT_TO}")
endforeach()
list(APPEND LIST_VALUE ${ALL_HEADER_FILES})
else()
message("Dependency 'path' is not a string or is missing type: ${TYPE} : STRING ...")
endif()
else()
if (${TYPE} STREQUAL "STRING")
json_get_data(ELEMENT_SOURCE ${ELEMENT} "source")
message(" - <header> : ${ELEMENT_SOURCE}")
list(APPEND LIST_VALUE ${ELEMENT_SOURCE})
#message("optional type = ${TYPE} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ${DEPENDENCY_NAME}")
elseif (${TYPE} STREQUAL "ARRAY")
json_get_data(ELEMENT_SOURCE ${ELEMENT} "source")
message(" - <header> : ${ELEMENT_SOURCE}")
list(APPEND LIST_VALUE ${ELEMENT_SOURCE})
else()
message("Dependency 'source' is not a string or is missing type: ${TYPE} : STRING or ARRAY ...")
endif()
endif()
# TODO: add the source specific flags or other things ...
else()
message("'header' element not manage data : ${ELEMENT}")
## TODO add in dependency if optional : check if the element exit in the current module list ...
endif()
endforeach()
endif()
elseif (${TYPE} STREQUAL "OBJECT")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "header")
# todo: manage object with source like { "c++":[...]...}
elseif(${TYPE} STREQUAL "NOTFOUND")
return()
else()
message(WARNING "Unmanaged type='${TYPE}' for 'header' node")
endif()
set(MODULE_MAP_${LOCAL_MODULE_NAME}_HEADER ${MODULE_MAP_${LOCAL_MODULE_NAME}_HEADER} ${LIST_VALUE} CACHE INTERNAL "")
endfunction()
function(GLD_import_element_path NAME_GLD_MODULE MY_JSON_STRING)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
##########################################################
## PATH:
##########################################################
set(LIST_VALUE "")
json_get_type(TYPE ${MY_JSON_STRING} "path")
if (${TYPE} STREQUAL "STRING")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "path")
message(" - <header> : ${OBJECT_DATA}")
list(APPEND LIST_VALUE ${OBJECT_DATA})
elseif (${TYPE} STREQUAL "ARRAY")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "path")
json_size(SIZE ${MY_JSON_STRING} "path")
#message("Dependency SIZE = ${SIZE}")
MATH(EXPR SIZE "${SIZE}-1")
set(VAR_OUT_TMP "")
foreach(IDX RANGE ${SIZE})
json_get_data(ELEMENT ${OBJECT_DATA} ${IDX})
json_get_type(TYPE ${OBJECT_DATA} ${IDX})
if (${TYPE} STREQUAL "STRING")
message(" - <header> : ${ELEMENT}")
list(APPEND LIST_VALUE ${ELEMENT})
else()
message("'path' element not manage data : ${ELEMENT}")
## TODO add in dependency if optional : check if the element exit in the current module list ...
endif()
endforeach()
elseif (${TYPE} STREQUAL "OBJECT")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "path")
# todo: manage object with source like { "c++":[...]...}
elseif(${TYPE} STREQUAL "NOTFOUND")
return()
else()
message(WARNING "Unmanaged type='${TYPE}' for 'path' node")
endif()
set(MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_LOCAL ${MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_LOCAL} ${LIST_VALUE} CACHE INTERNAL "")
endfunction()
function(GLD_import_element_compilation_version NAME_GLD_MODULE MY_JSON_STRING)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
##########################################################
## COMPILATION-VERSION:
##########################################################
endfunction()
function(GLD_import_element_copy NAME_GLD_MODULE MY_JSON_STRING)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
##########################################################
## COPY:
##########################################################
endfunction()
##
## @brief Get the list of all dependency even if they are optional.
## @param[out] VAR_OUT list of dependency library
## @param[out] VAR_OPTIONAL_OUT list of optional dependency library
## @param[in] MY_JSON_STRING Json string
## @note This function is dependent of the target
##
function(GLD_import_full NAME_GLD_MODULE MY_JSON_STRING)
GLD_import_element_dependency(${NAME_GLD_MODULE} ${MY_JSON_STRING})
GLD_import_element_source(${NAME_GLD_MODULE} ${MY_JSON_STRING})
GLD_import_element_header(${NAME_GLD_MODULE} ${MY_JSON_STRING})
GLD_import_element_path(${NAME_GLD_MODULE} ${MY_JSON_STRING})
GLD_import_element_compilation_version(${NAME_GLD_MODULE} ${MY_JSON_STRING})
GLD_import_element_copy(${NAME_GLD_MODULE} ${MY_JSON_STRING})
GLD_import_full_group(${NAME_GLD_MODULE} ${MY_JSON_STRING} "target" ${GLD_TARGET})
GLD_import_full_group(${NAME_GLD_MODULE} ${MY_JSON_STRING} "mode" ${GLD_MODE})
GLD_import_full_group(${NAME_GLD_MODULE} ${MY_JSON_STRING} "arch" ${GLD_ARCH})
GLD_import_full_group(${NAME_GLD_MODULE} ${MY_JSON_STRING} "bus-size" ${GLD_BUS_SIZE})
GLD_import_full_group(${NAME_GLD_MODULE} ${MY_JSON_STRING} "compiler" ${GLD_COMPILER})
GLD_import_full_group(${NAME_GLD_MODULE} ${MY_JSON_STRING} "sanity-compilation" ${GLD_SANITY_MODE})
endfunction()
function(GLD_load_from_file_if_needed VAR_OUT LIBRARY_PATH ELEMENT)
#message("Check element: ${ELEMENT}")
if("${ELEMENT}" MATCHES "file://*")
#message("match file://")
string(REPLACE "file://" "" FILENAME ${ELEMENT})
#message(" ==> ${FILENAME}")
file (STRINGS "${LIBRARY_PATH}/${FILENAME}" DATA_READ)
set(${VAR_OUT} "${DATA_READ}" PARENT_SCOPE)
else()
set(${VAR_OUT} "${ELEMENT}" PARENT_SCOPE)
endif()
endfunction()
function(GLD_get_import_folder VAR_OUT NAME_GLD_MODULE)
set(LIST_OUT "")
set(${VAR_OUT} "${LIST_OUT}" PARENT_SCOPE)
endfunction()
function(GLD_get_import_folder VAR_OUT NAME_GLD_MODULE)
set(LIST_OUT "")
set(${VAR_OUT} "${LIST_OUT}" PARENT_SCOPE)
endfunction()
function(GLD_get_project_dependency VAR_OUT NAME_GLD_MODULE DEPENDENCY)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
set(LIST_OUT "")
if (DEPENDENCY)
foreach(III "${DEPENDENCY}")
GLD_get_module_name(TMP_MODULE_NAME ${III})
list(APPEND LIST_OUT ${III})
endforeach()
endif()
set(${VAR_OUT} "${LIST_OUT}" PARENT_SCOPE)
endfunction()
function(GLD_import NAME_GLD_MODULE)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
# set(MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER ${FOLDER} CACHE INTERNAL "")
# set(MODULE_MAP_${LOCAL_MODULE_NAME}_FILENAME ${FILENAME} CACHE INTERNAL "")
# set(MODULE_MAP_${LOCAL_MODULE_NAME}_NAME ${NAME_GLD_MODULE} CACHE INTERNAL "")
# set(MODULE_MAP_LIST ${MODULE_MAP_LIST} ${NAME_GLD_MODULE} CACHE INTERNAL "")
# Read the JSON file.
set(MY_JSON_STRING ${MODULE_MAP_${LOCAL_MODULE_NAME}_JSON})
# Loop through each element of the JSON array (indices 0 though 1).
json_get_element(LIBRARY_TYPE ${MY_JSON_STRING} "type")
json_get_element(LIBRARY_SUB_TYPE ${MY_JSON_STRING} "sub-type")
json_get_element(LIBRARY_GROUP_ID ${MY_JSON_STRING} "group-id")
json_get_element(LIBRARY_DECRIPTION ${MY_JSON_STRING} "description")
json_get_element(LIBRARY_LICENCE ${MY_JSON_STRING} "license")
json_get_element(LIBRARY_LICENCE_FILE ${MY_JSON_STRING} "license-file")
json_get_element(LIBRARY_MAINTAINER ${MY_JSON_STRING} "maintainer")
json_get_element(LIBRARY_AUTHORS ${MY_JSON_STRING} "author")
json_get_element(LIBRARY_VERSION ${MY_JSON_STRING} "version")
json_get_element(CODE_QUALITY ${MY_JSON_STRING} "code-quality")
message("LIBRARY : ${LIBRARY_GROUP_ID}:${NAME_GLD_MODULE}")
message("LIBRARY_TYPE : ${LIBRARY_TYPE} / ${LIBRARY_SUB_TYPE}")
message("LIBRARY_DECRIPTION : ${LIBRARY_DECRIPTION}")
message("LIBRARY_LICENCE : ${LIBRARY_LICENCE}")
if (LIBRARY_LICENCE_FILE)
message("LIBRARY_LICENCE_FILE : ${LIBRARY_LICENCE_FILE}")
#GLD_load_from_file_if_needed(LIBRARY_LICENCE_FILE "${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}" "${LIBRARY_LICENCE_FILE}")
#message(" ==> : ${LIBRARY_LICENCE_FILE}")
endif()
if (LIBRARY_MAINTAINER)
message("LIBRARY_MAINTAINER : ${LIBRARY_MAINTAINER}")
GLD_load_from_file_if_needed(LIBRARY_MAINTAINER "${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}" "${LIBRARY_MAINTAINER}")
message(" ==> : ${LIBRARY_MAINTAINER}")
endif()
if (LIBRARY_AUTHORS)
message("LIBRARY_AUTHORS : ${LIBRARY_AUTHORS}")
GLD_load_from_file_if_needed(LIBRARY_AUTHORS "${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}" "${LIBRARY_AUTHORS}")
message(" ==> : ${LIBRARY_AUTHORS}")
endif()
if (LIBRARY_VERSION)
message("LIBRARY_VERSION : ${LIBRARY_VERSION}")
GLD_load_from_file_if_needed(LIBRARY_VERSION "${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}" "${LIBRARY_VERSION}")
message(" ==> : ${LIBRARY_VERSION}")
# NOTE CMAKE does not support DEV_MODEL, then we use the lact ELEMENT for dev version (666)
string(REPLACE "-dev" ".666" LIBRARY_VERSION ${LIBRARY_VERSION})
endif()
#string(REPLACE "-" "_" LIBRARY_NAME222 ${NAME_GLD_MODULE})
set(LIBRARY_NAME222 ${NAME_GLD_MODULE})
if (LIBRARY_VERSION)
project(${LIBRARY_NAME222} VERSION ${LIBRARY_VERSION})
set(${LIBRARY_NAME222} PROPERTIES CPACK_PACKAGE_VERSION ${LIBRARY_VERSION})
else()
project(${LIBRARY_NAME222})
endif()
set(MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_LOCAL "" CACHE INTERNAL "")
# TODO : Remove if no element in header...
if (MODULE_MAP_${LOCAL_MODULE_NAME}_HEADER)
set(MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_PUBLIC "${GLD_GLOBAL_BUILD_FOLDER}${NAME_GLD_MODULE}/include/" CACHE INTERNAL "")
endif()
# remove if no library generated
set(MODULE_MAP_${LOCAL_MODULE_NAME}_LIB_PATH "${GLD_GLOBAL_STAGING_FOLDER}${NAME_GLD_MODULE}/lib/" CACHE INTERNAL "")
# remove if no doc ...
set(MODULE_MAP_${LOCAL_MODULE_NAME}_DOC_PATH "${GLD_GLOBAL_STAGING_FOLDER}${NAME_GLD_MODULE}/doc/" CACHE INTERNAL "")
set(MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY "" CACHE INTERNAL "")
set(MODULE_MAP_${LOCAL_MODULE_NAME}_SOURCE "" CACHE INTERNAL "")
set(MODULE_MAP_${LOCAL_MODULE_NAME}_HEADER "" CACHE INTERNAL "")
GLD_import_full(${NAME_GLD_MODULE} ${MY_JSON_STRING})
set(TMP_LIST "")
foreach(III ${MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_LOCAL})
get_filename_component(BASE_FOLDER ${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}/${III} ABSOLUTE)
list(APPEND TMP_LIST "${BASE_FOLDER}")
endforeach()
set(MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_LOCAL "${TMP_LIST}" CACHE INTERNAL "")
message(" _INCLUDE_LOCAL : ${MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_LOCAL}")
message(" _INCLUDE_PUBLIC: ${MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_PUBLIC}")
message(" _LIB_PATH : ${MODULE_MAP_${LOCAL_MODULE_NAME}_LIB_PATH}")
message(" _DOC_PATH : ${MODULE_MAP_${LOCAL_MODULE_NAME}_DOC_PATH}")
message(" _DEPENDENCY : ${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY}")
message(" _SOURCE : ${MODULE_MAP_${LOCAL_MODULE_NAME}_SOURCE}")
message(" _HEADER : ${MODULE_MAP_${LOCAL_MODULE_NAME}_HEADER}")
GLD_get_project_dependency(LIST_PROJECT_DEPENDENCY ${NAME_GLD_MODULE} "${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY}")
message("===> dep = ${LIST_PROJECT_DEPENDENCY}")
set(TMP_LIST "")
foreach(III ${MODULE_MAP_${LOCAL_MODULE_NAME}_SOURCE})
get_filename_component(BASE_FOLDER ${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}/${III} ABSOLUTE)
list(APPEND TMP_LIST "${BASE_FOLDER}")
endforeach()
set(HAS_DATA_TO_BUILD OFF)
if(TMP_LIST)
set(HAS_DATA_TO_BUILD ON)
add_library(${LIBRARY_NAME222}_OBJ OBJECT ${TMP_LIST})
# allow relocation code for shared library:
set_property(TARGET ${LIBRARY_NAME222}_OBJ PROPERTY POSITION_INDEPENDENT_CODE 1)
endif()
foreach(III ${MODULE_MAP_${LOCAL_MODULE_NAME}_HEADER})
copy_file_with_reference(${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER} ${III} ${MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_PUBLIC})
endforeach()
if(HAS_DATA_TO_BUILD)
set(TMP_LIST ${MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_LOCAL})
list(APPEND TMP_LIST ${MODULE_MAP_${LOCAL_MODULE_NAME}_INCLUDE_PUBLIC})
if(TMP_LIST)
target_include_directories(${LIBRARY_NAME222}_OBJ PUBLIC "${TMP_LIST}")
endif()
add_library(${LIBRARY_NAME222}_dynamic SHARED $<TARGET_OBJECTS:${LIBRARY_NAME222}_OBJ>)
add_library(${LIBRARY_NAME222}_static STATIC $<TARGET_OBJECTS:${LIBRARY_NAME222}_OBJ>)
if (LIST_PROJECT_DEPENDENCY)
foreach(III ${LIST_PROJECT_DEPENDENCY})
message(">>>>>>>> ${III}")
add_dependencies(${LIBRARY_NAME222}_dynamic "${III}_dynamic")
add_dependencies(${LIBRARY_NAME222}_static "${III}_static")
endforeach()
endif()
if ("${GLD_TARGET}" STREQUAL "Windows")
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES OUTPUT_NAME ${LIBRARY_NAME222})
# static will keep the element static at the end (the windows architecture fore shared object need to have a static library to access to the DLL ==> create a conflict!!!
else()
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES OUTPUT_NAME ${LIBRARY_NAME222})
set_target_properties(${LIBRARY_NAME222}_static PROPERTIES OUTPUT_NAME ${LIBRARY_NAME222})
endif()
if (LIBRARY_VERSION)
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES VERSION ${LIBRARY_VERSION})
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES SOVERSION ${LIBRARY_VERSION})
endif()
if (LIBRARY_DECRIPTION)
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES DESCRIPTION ${LIBRARY_DECRIPTION})
endif()
# install dynamic & static library
install(TARGETS ${LIBRARY_NAME222}_dynamic EXPORT ${LIBRARY_NAME222}Targets
RUNTIME DESTINATION ${MODULE_MAP_${LOCAL_MODULE_NAME}_LIB_PATH}
)
install(TARGETS ${LIBRARY_NAME222}_static
RUNTIME DESTINATION ${MODULE_MAP_${LOCAL_MODULE_NAME}_LIB_PATH})
#install(TARGETS ${LIBRARY_NAME222} EXPORT ${LIBRARY_NAME222}Targets
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
# RUNTIME DESTINATION bin
# INCLUDES DESTINATION include
#)
# install exported headers
# this copy all the headers in a single folder:
#install(FILES ${EXPORT_HEADER_LIST} DESTINATION include)
# this keep the basic path for each folders:
set(BASE "${PROJECT_SOURCE_DIR}/install")
foreach(ITEM ${EXPORT_HEADER_LIST})
get_filename_component(ITEM_PATH ${ITEM} PATH)
string(REPLACE ${BASE} "" ITEM_PATH ${ITEM_PATH})
install(FILES ${ITEM}
DESTINATION "include/${ITEM_PATH}"
COMPONENT Devel)
endforeach()
include(CMakePackageConfigHelpers)
#write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}ConfigVersion.cmake"
# VERSION ${LIBRARY_VERSION}
# COMPATIBILITY AnyNewerVersion
#)
#
#export(EXPORT ${LIBRARY_NAME222}Targets
# FILE "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}Targets.cmake"
# NAMESPACE Upstream::
#)
##configure_file(cmake/${LIBRARY_NAME222}Config.cmake
## "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}Config.cmake"
## COPYONLY
##)
set(CONFIG_PACKAGE_LOCATION cmake/${LIBRARY_NAME222})
install(EXPORT ${LIBRARY_NAME222}Targets
FILE
${LIBRARY_NAME222}Targets.cmake
NAMESPACE
${LIBRARY_NAME222}::
DESTINATION
${CONFIG_PACKAGE_LOCATION}
)
endif()
#install(
# FILES
# cmake/${LIBRARY_NAME222}Config.cmake
# "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}ConfigVersion.cmake"
# DESTINATION
# ${CONFIG_PACKAGE_LOCATION}
# COMPONENT
# Devel
#)
message("CMAKE_INSTALL_LIBDIR===${CMAKE_INSTALL_LIBDIR}")
endfunction()
function(sdfsqdfqsdfqrezesrdtygfhsg LIST_OF_MODULE_AVAILLABLE)
include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/${LIBRARY_NAME222}Config.cmake.in
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}Config.cmake"
INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION}
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}ConfigVersion.cmake"
VERSION ${LIBRARY_VERSION}
COMPATIBILITY SameMajorVersion)
install(
FILES
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}Config.cmake"
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}ConfigVersion.cmake"
DESTINATION ${CONFIG_PACKAGE_LOCATION}
COMPONENT Devel)
endfunction()
function(GLD_generate_cmake_wrapping LIST_OF_MODULE_AVAILLABLE)
message("Generate cmake wrapping")
foreach(NAME_GLD_MODULE ${LIST_OF_MODULE_AVAILLABLE})
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
message("Import: ${NAME_GLD_MODULE}")
#MODULE_MAP_LIST_DEPENDENCE_RESOLVED
GLD_import(${NAME_GLD_MODULE})
endforeach()
message("Generate cmake wrapping (DONE)")
endfunction()
function(GLD_get_full_dependency_group VAR_OUT VAR_OPTIONAL_OUT MY_JSON_STRING ELEMENT_TO_CHECK TYPE_VARIABLE)
set(LIST_VALUE "")
set(LIST_OPTIONAL_VALUE "")
json_get_type(TYPE ${MY_JSON_STRING} ${ELEMENT_TO_CHECK})
#message("target type = ${TYPE}")
if (${TYPE} STREQUAL "OBJECT")
json_object_keys(LIST_KEY ${MY_JSON_STRING} ${ELEMENT_TO_CHECK})
foreach (III ${LIST_KEY})
# check the target, no need to had unknown target ...
if (${III} STREQUAL "*")
json_object_values(DATA_TARGET ${MY_JSON_STRING} ${ELEMENT_TO_CHECK} "*")
#message("target(*) data: ${DATA_TARGET}")
GLD_get_full_dependency(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP DATA_TARGET)
list(APPEND LIST_VALUE ${DATA_TARGET})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
elseif (${III} STREQUAL ${TYPE_VARIABLE})
json_object_values(DATA_TARGET ${MY_JSON_STRING} ${ELEMENT_TO_CHECK} "${III}")
GLD_get_full_dependency(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP DATA_TARGET)
#message("target(${III}) data: ${DATA_TARGET}")
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
else()
message("TODO: get dependency manage '${ELEMENT_TO_CHECK}' : ${III}")
endif()
endforeach()
elseif(${TYPE} STREQUAL "NOTFOUND" OR ${TYPE} STREQUAL "NULL")
# nothing to do ..
else()
message("ERROR : '${ELEMENT_TO_CHECK}' can not be other than an json object : ${TYPE}")
endif()
set(${VAR_OUT} ${LIST_VALUE} PARENT_SCOPE)
set(${VAR_OPTIONAL_OUT} ${LIST_OPTIONAL_VALUE} PARENT_SCOPE)
endfunction()
##
## @brief Get the list of all dependency even if they are optional.
## @param[out] VAR_OUT list of dependency library
## @param[out] VAR_OPTIONAL_OUT list of optional dependency library
## @param[in] MY_JSON_STRING Json string
## @note This function is dependent of the target
##
function(GLD_get_full_dependency VAR_OUT VAR_OPTIONAL_OUT MY_JSON_STRING)
json_get_type(TYPE ${MY_JSON_STRING} "dependency")
set(LIST_VALUE "")
set(LIST_OPTIONAL_VALUE "")
#message("Dependency type = ${TYPE}")
if (${TYPE} STREQUAL "ARRAY")
json_size(SIZE ${MY_JSON_STRING} "dependency")
#message("Dependency SIZE = ${SIZE}")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} "dependency")
MATH(EXPR SIZE "${SIZE}-1")
set(VAR_OUT_TMP "")
foreach(IDX RANGE ${SIZE})
json_get_data(ELEMENT ${OBJECT_DATA} ${IDX})
json_get_type(TYPE ${OBJECT_DATA} ${IDX})
if (${TYPE} STREQUAL "STRING")
message(" - : ${ELEMENT}")
list(APPEND VAR_OUT_TMP ${ELEMENT})
elseif (${TYPE} STREQUAL "OBJECT")
json_get_type(TYPE ${ELEMENT} "name")
if (${TYPE} STREQUAL "STRING")
json_get_data(DEPENDENCY_NAME ${ELEMENT} "name")
json_get_type(TYPE ${ELEMENT} "optional")
#message("optional type = ${TYPE} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ${DEPENDENCY_NAME}")
if (${TYPE} STREQUAL "BOOLEAN")
json_get_data(DEPENDENCY_OPTIONAL ${ELEMENT} "optional")
if (${DEPENDENCY_OPTIONAL})
message(" - : ${DEPENDENCY_NAME} (optional)")
#message("optional value ==========================> '${DEPENDENCY_OPTIONAL}' ==> MAYBE")
list(APPEND LIST_OPTIONAL_VALUE ${DEPENDENCY_NAME})
else()
message(" - : ${DEPENDENCY_NAME}")
#message("optional value ==========================> '${DEPENDENCY_OPTIONAL}' ==> MUST")
list(APPEND VAR_OUT_TMP ${DEPENDENCY_NAME})
endif()
else()
message(" - : ${DEPENDENCY_NAME}")
list(APPEND VAR_OUT_TMP ${DEPENDENCY_NAME})
endif()
#message("optional type = ${TYPE} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ${DEPENDENCY_NAME}")
else()
message("Dependency 'name' is not a string or is missing type: ${TYPE}")
endif()
else()
message("dependency element not manage data : ${ELEMENT}")
## TODO add in dependency if optional : check if the element exit in the current module list ...
endif()
endforeach()
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
endif()
GLD_get_full_dependency_group(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP MY_JSON_STRING "target" ${GLD_TARGET})
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
GLD_get_full_dependency_group(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP MY_JSON_STRING "mode" ${GLD_MODE})
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
GLD_get_full_dependency_group(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP MY_JSON_STRING "arch" ${GLD_ARCH})
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
GLD_get_full_dependency_group(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP MY_JSON_STRING "bus-size" ${GLD_BUS_SIZE})
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
GLD_get_full_dependency_group(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP MY_JSON_STRING "compiler" ${GLD_COMPILER})
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
GLD_get_full_dependency_group(VAR_OUT_TMP LIST_OPTIONAL_VALUE_TMP MY_JSON_STRING "sanity-compilation" ${GLD_SANITY_MODE})
list(APPEND LIST_VALUE ${VAR_OUT_TMP})
list(APPEND LIST_OPTIONAL_VALUE ${LIST_OPTIONAL_VALUE_TMP})
set(${VAR_OUT} ${LIST_VALUE} PARENT_SCOPE)
set(${VAR_OPTIONAL_OUT} ${LIST_OPTIONAL_VALUE} PARENT_SCOPE)
endfunction()
function(GLD_read_json_file VAR_OUT JSON_FILE)
file(READ ${JSON_FILE} MY_JSON_STRING)
if("${MY_JSON_STRING}" STREQUAL "")
message(WARNING "Empty json file : '${JSON_FILE}'")
else()
string(REPLACE " " "" MY_JSON_STRING ${MY_JSON_STRING})
string(REPLACE "\t" "" MY_JSON_STRING ${MY_JSON_STRING})
string(REPLACE "\n" "" MY_JSON_STRING ${MY_JSON_STRING})
endif()
set(${VAR_OUT} ${MY_JSON_STRING} PARENT_SCOPE)
endfunction()
set(MODULE_MAP_LIST "" CACHE INTERNAL "")
set(MODULE_MAP_LIST_DEPENDENCE_RESOLVED "" CACHE INTERNAL "")
function(GLD_get_module_name VAR_OUT BASE_NAME)
string(REPLACE "_" "_U_" TMP ${BASE_NAME})
string(REPLACE "." "_D_" TMP ${BASE_NAME})
string(REPLACE "-" "_S_" TMP ${TMP})
set(${VAR_OUT} ${TMP} PARENT_SCOPE)
endfunction()
function(GLD_add_module NAME_GLD_MODULE FOLDER FILENAME)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
message("Add module: ${LOCAL_MODULE_NAME} ==> ${NAME_GLD_MODULE} in ${FILENAME}")
# load all the json data:
GLD_read_json_file(JSON_DATA "${FOLDER}/${FILENAME}.json")
if("${JSON_DATA}" STREQUAL "")
message(WARNING "SKIP library: ${NAME_GLD_MODULE}")
else()
set(MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER ${FOLDER} CACHE INTERNAL "")
set(MODULE_MAP_${LOCAL_MODULE_NAME}_FILENAME ${FILENAME} CACHE INTERNAL "")
set(MODULE_MAP_${LOCAL_MODULE_NAME}_NAME ${NAME_GLD_MODULE} CACHE INTERNAL "")
set(MODULE_MAP_LIST ${MODULE_MAP_LIST} ${NAME_GLD_MODULE} CACHE INTERNAL "")
set(MODULE_MAP_${LOCAL_MODULE_NAME}_JSON "${JSON_DATA}" CACHE INTERNAL "")
endif()
endfunction()
function(GLD_generate_module_without_optionnal_inexistant NAME_GLD_MODULE)
GLD_get_module_name(LOCAL_MODULE_NAME ${NAME_GLD_MODULE})
#message("Call : GLD_get_full_dependency(outA, outB, ${MODULE_MAP_${LOCAL_MODULE_NAME}_JSON}) ${NAME_GLD_MODULE} ==> ${LOCAL_MODULE_NAME}")
GLD_get_full_dependency(DEPENDENCY DEPENDENCY_OPTIONAL ${MODULE_MAP_${LOCAL_MODULE_NAME}_JSON})
set(MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY ${DEPENDENCY} CACHE INTERNAL "")
set(MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY_OPTIONAL ${DEPENDENCY_OPTIONAL} CACHE INTERNAL "")
endfunction()
function(GLD_is_in_list VAR_OUT ELEM_TO_CHECK LIST_TO_CHECK)
set(ELEMENT_FIND "true")
#message(" verify '${ELEM_TO_CHECK}' in '${LIST_TO_CHECK}'")
foreach(ELEM ${LIST_TO_CHECK})
if ("${ELEM_TO_CHECK}" STREQUAL "${ELEM}")
set(${VAR_OUT} "true" PARENT_SCOPE)
#message(" ==> true")
return()
endif()
endforeach()
set(${VAR_OUT} "false" PARENT_SCOPE)
#message(" ==> false")
endfunction()
function(GLD_are_in_list VAR_OUT LIST_VALUES LIST_TO_CHECK)
set(ELEMENT_FIND "true")
#message(" verify '${LIST_VALUES}' are in '${LIST_TO_CHECK}'")
foreach(ELEM ${LIST_VALUES})
GLD_is_in_list(EXIST "${ELEM}" "${LIST_TO_CHECK}")
if (${EXIST} STREQUAL "false")
set(${VAR_OUT} "false" PARENT_SCOPE)
#message(" =>> false")
return()
endif()
endforeach()
set(${VAR_OUT} "true" PARENT_SCOPE)
#message(" =>> true")
endfunction()
## todo: REMOVE OPTIONNAL DEPENDENCY THAT DOES NOT EXIST IN THE LIST
## TODO: display and does not include element that dependency are not resolved and indicate which dependency is not found ...
function(GLD_order_dependency_list VAR_OUT DEPENDENCY_FAILED)
set(TMP_ORDERED "")####### crypto;edtaa3;luaWrapper;freetype;")
set(TMP_UN_ADDED "")
message("===========================================")
message("== STEP 1 : Add all module without dependency:")
message("===========================================")
# step 1 Add all module without dependency:
foreach(MODULE_ELEM ${MODULE_MAP_LIST})
message("check add element : ${MODULE_ELEM}")
message(" dependency = '${MODULE_ELEM}'")
GLD_get_module_name(LOCAL_MODULE_NAME ${MODULE_ELEM})
message(" dependency = '${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY}'")
# todo check dependency here ... ${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY}
list(LENGTH MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY LIST_LENGTH)
message(" ==> length'${LIST_LENGTH}'")
if (LIST_LENGTH EQUAL 0)
message("Add element ${III} (0 dependency) ******** ")
list(APPEND TMP_ORDERED ${MODULE_ELEM})
continue()
endif()
list(APPEND TMP_UN_ADDED ${MODULE_ELEM})
endforeach()
message("result: ${TMP_ORDERED}")
message("===========================================")
message("== STEP 2 : Add all when the dependency are available in the list:")
message("===========================================")
# step 2 Add all when the dependency are available in the list:
list(LENGTH TMP_UN_ADDED LIST_TOTAL_LENGTH)
message("unadded : ${LIST_TOTAL_LENGTH}")
# must be resolved in the number of cycle in the list (maximum)
foreach(III RANGE ${LIST_TOTAL_LENGTH})
message("cycle : ${III}")
set(TMP_UN_ADDED_TMP ${TMP_UN_ADDED})
set(TMP_UN_ADDED "")
foreach(ELEM_TO_ADD ${TMP_UN_ADDED_TMP})
message(" check to add : ${ELEM_TO_ADD}")
GLD_get_module_name(LOCAL_MODULE_NAME ${ELEM_TO_ADD})
message(" dependency : ${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY} in ? ${TMP_ORDERED}")
GLD_are_in_list(IS_ALL_PRESENT "${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY}" "${TMP_ORDERED}")
if (${IS_ALL_PRESENT} STREQUAL "true")
message("Add element ${ELEM_TO_ADD} (depend: ${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY})")
list(APPEND TMP_ORDERED ${ELEM_TO_ADD})
else()
list(APPEND TMP_UN_ADDED ${ELEM_TO_ADD})
endif()
endforeach()
endforeach()
message("result:")
foreach(ELEM ${TMP_ORDERED})
message(" - ${ELEM}")
endforeach()
message("===========================================")
message("== STEP 3 : All must be added before...")
message("===========================================")
# step 3 All must be added before...
list(LENGTH TMP_UN_ADDED LIST_TOTAL_LENGTH)
if (${LIST_TOTAL_LENGTH} GREATER_EQUAL 0)
message(WARNING "Some element are not added: (${LIST_TOTAL_LENGTH})")
foreach(ELEM ${TMP_UN_ADDED})
message(" - ${ELEM}")
GLD_get_module_name(LOCAL_MODULE_NAME ${ELEM})
message(" dep : ${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY}")
message(" dep(optional): ${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY_OPTIONAL}")
endforeach()
endif()
set(MODULE_MAP_LIST_DEPENDENCE_RESOLVED ${TMP_ORDERED} CACHE INTERNAL "")
set(${VAR_OUT} ${TMP_ORDERED} PARENT_SCOPE)
set(${DEPENDENCY_FAILED} ${TMP_UN_ADDED} PARENT_SCOPE)
endfunction()
function(GLD_load_all ROOT_FOLDER BASE_NAME COMMENT_ACTION)
message("Parse all files ${BASE_NAME}*.json: base: ${ROOT_FOLDER}")
#file(GLOB_RECURSE GLD_FILES "${ROOT_FOLDER}/GLD_*.json")
find_all_files_exeption(GLD_FILES "${ROOT_FOLDER}" "${BASE_NAME}*.json" 5)
message("List of GLD files:")
foreach(III ${GLD_FILES})
GET_FILENAME_COMPONENT(FILENAME ${III} NAME_WE)
set(FULL_FILENAME ${FILENAME})
string(REPLACE "${BASE_NAME}" "" FILENAME ${FILENAME})
GET_FILENAME_COMPONENT(FOLDER ${III} DIRECTORY)
message(" - ${COMMENT_ACTION} ${FOLDER} ==> ${FILENAME}")
GLD_add_module(${FILENAME} ${FOLDER} ${FULL_FILENAME})
endforeach()
#GLD_import("./" "etk-core")
endfunction()
function(GLD_auto_prebuild_load_all ROOT_FOLDER)
GLD_load_all(${ROOT_FOLDER} "GLDPrebuild_${GLD_TARGET}_" "(prebuild)")
endfunction()
function(GLD_auto_load_all ROOT_FOLDER)
GLD_load_all(${ROOT_FOLDER} "GLD_" "")
endfunction()
function(GLD_instanciate)
message("List of modules:")
foreach(III ${MODULE_MAP_LIST})
GLD_get_module_name(LOCAL_MODULE_NAME ${III})
message(" - ${III}")
endforeach()
foreach(III ${MODULE_MAP_LIST})
GLD_get_module_name(LOCAL_MODULE_NAME ${III})
GLD_generate_module_without_optionnal_inexistant(${III})
message(" - ${III}")
message(" FOLDER=${MODULE_MAP_${LOCAL_MODULE_NAME}_FOLDER}")
#message(" JSON=${MODULE_MAP_${LOCAL_MODULE_NAME}_JSON}")
message(" DEPENDENCY=${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY}")
message(" DEPENDENCY_OPTIONAL=${MODULE_MAP_${LOCAL_MODULE_NAME}_DEPENDENCY_OPTIONAL}")
endforeach()
GLD_order_dependency_list(DEPENDENCY_ORDER DEPENDENCY_FAILED)
GLD_generate_cmake_wrapping("${DEPENDENCY_ORDER}")
#message("dependency resolver & ordered:")
#foreach(III ${DEPENDENCY_ORDER})
# message(" - ${III}")
#endforeach()
#message("dependency fail:")
#foreach(III ${DEPENDENCY_FAILED})
# message(" - ${III}")
#endforeach()
endfunction()

106
cmake/GLDJson.cmake Normal file
View File

@@ -0,0 +1,106 @@
cmake_minimum_required(VERSION 3.20)
##
## @brief get the type of a variable
## @param[in] INPUT_JSON Json data.
## @param[in] VARIABLE Name of the variable.
## @param[out] OUT_VAR Retrun type of the node: NULL, NUMBER, STRING, BOOLEAN, ARRAY, OBJECT or NOTFOUND (if does not exist)
##
function(json_get_type OUT_VAR INPUT_JSON VARIABLE)
string(JSON VALUE ERROR_VARIABLE ${VARIABLE} TYPE ${INPUT_JSON} ${VARIABLE})
if (${VALUE} STREQUAL ${VARIABLE}-NOTFOUND)
set(${OUT_VAR} "NOTFOUND" PARENT_SCOPE)
else()
set(${OUT_VAR} "${VALUE}" PARENT_SCOPE)
endif()
endfunction()
function(json_size OUT_VAR INPUT_JSON VARIABLE)
string(JSON VALUE ERROR_VARIABLE ${VARIABLE} LENGTH ${INPUT_JSON} ${VARIABLE})
if (${VALUE} STREQUAL ${VARIABLE}-NOTFOUND)
set("${OUT_VAR}" 0 PARENT_SCOPE)
else ()
set("${OUT_VAR}" ${VALUE} PARENT_SCOPE)
endif()
endfunction()
function(json_get_data OUT_VAR INPUT_JSON VARIABLE)
string(JSON VALUE GET ${INPUT_JSON} ${VARIABLE})
set("${OUT_VAR}" ${VALUE} PARENT_SCOPE)
endfunction()
function(json_get_data_or_default OUT_VAR INPUT_JSON VARIABLE DEFAULT_VALUE)
json_get_type(TYPE ${INPUT_JSON} ${VARIABLE})
if (${TYPE} STREQUAL "NOTFOUND")
set("${OUT_VAR}" ${DEFAULT_VALUE} PARENT_SCOPE)
else()
string(JSON VALUE GET ${INPUT_JSON} ${VARIABLE})
set("${OUT_VAR}" ${VALUE} PARENT_SCOPE)
endif()
endfunction()
function(json_object_key OUT_VAR INPUT_JSON IDX)
string(JSON VALUE MEMBER ${INPUT_JSON} ${IDX})
set("${OUT_VAR}" ${VALUE} PARENT_SCOPE)
endfunction()
function(json_object_keys OUT_VAR MY_JSON_STRING VARIABLE)
json_size(SIZE ${MY_JSON_STRING} ${VARIABLE})
#message("target SIZE = ${SIZE}")
json_get_data(OBJECT_DATA ${MY_JSON_STRING} ${VARIABLE})
if (SIZE EQUAL 0)
return()
endif()
MATH(EXPR SIZE "${SIZE}-1")
set(OUT "")
foreach(IDX RANGE ${SIZE})
json_object_key(ELEMENT ${OBJECT_DATA} ${IDX})
#message(" - : ${ELEMENT}")
list(APPEND OUT ${ELEMENT})
endforeach()
set("${OUT_VAR}" ${OUT} PARENT_SCOPE)
endfunction()
function(json_object_values OUT_VAR INPUT_JSON VARIABLE KEYS)
string(JSON VALUE GET ${INPUT_JSON} ${VARIABLE} ${KEYS})
set("${OUT_VAR}" ${VALUE} PARENT_SCOPE)
endfunction()
function(json_get_list OUT_VAR INPUT_JSON VARIABLE)
string(JSON LIST_JSON_ELEMENTS ERROR_VARIABLE ${VARIABLE} GET ${INPUT_JSON} ${VARIABLE})
if (${LIST_JSON_ELEMENTS} STREQUAL ${VARIABLE}-NOTFOUND)
set("${OUT_VAR}" PARENT_SCOPE)
retrun()
endif()
#message("LIST_JSON_ELEMENTS : ${LIST_JSON_ELEMENTS}")
string(JSON LENGTH_VALUE LENGTH ${LIST_JSON_ELEMENTS})
#message("LENGTH_VALUE : ${LENGTH_VALUE}")
if (${LENGTH_VALUE} EQUAL 0)
set("${OUT_VAR}" PARENT_SCOPE)
retrun()
endif()
set(OUT_LIST)
MATH(EXPR LENGTH_VALUE "${LENGTH_VALUE}-1")
foreach(IDX RANGE ${LENGTH_VALUE})
string(JSON ELEM GET ${LIST_JSON_ELEMENTS} ${IDX})
#message(" - : ${ELEM}")
list(APPEND OUT_LIST ${ELEM})
endforeach()
#message("OUT_LIST : ${OUT_LIST}")
set("${OUT_VAR}" ${OUT_LIST} PARENT_SCOPE)
endfunction()
function(json_get_element OUT_VAR INPUT_JSON VARIABLE)
string(JSON ELEMENT ERROR_VARIABLE ${VARIABLE} GET ${INPUT_JSON} ${VARIABLE})
if ("${ELEMENT}" STREQUAL "${VARIABLE}-NOTFOUND")
set("${OUT_VAR}" "" PARENT_SCOPE)
elseif ("${ELEMENT}" STREQUAL "NOTFOUND")
set("${OUT_VAR}" "" PARENT_SCOPE)
else()
set("${OUT_VAR}" ${ELEMENT} PARENT_SCOPE)
endif()
endfunction()

View File

@@ -0,0 +1,19 @@
{
"type":"LIBRARY",
"sub-type":"PREBUILD",
"group-id":"gnu",
"description":"ALSA : Advanced Linux Sound Architecture",
"sanity-compilation": {
"intricate": {
"flag":{
"c-link": "-lasound"
},
"dependency":[
"c"
]
},
"!intricate":{
"error":true
}
}
}

View File

@@ -0,0 +1,17 @@
{
"type":"LIBRARY",
"sub-type":"PREBUILD",
"group-id":"gnu",
"description":"C: Generic gnu C library",
"license":"LGPL",
"sanity-compilation": {
"intricate": {
"flag":[
"c-remove": "-nostdinc"
]
},
"!intricate":{
"error":true
}
}
}

View File

@@ -0,0 +1,23 @@
{
"type":"LIBRARY",
"sub-type":"PREBUILD",
"group-id":"gnu",
"description":"CXX: Generic gnu C++ library",
"license":"LGPL",
"sanity-compilation": {
"intricate": {
"flag":{
"c++-remove": "-nostdlib",
"c++": "-D__STDCPP_GNU__"
},
"dependency":[
"c",
"m",
"pthread"
]
},
"!intricate":{
"error":true
}
}
}

View File

@@ -0,0 +1,20 @@
{
"type":"LIBRARY",
"sub-type":"PREBUILD",
"group-id":"gnu",
"description":"M: Generic math library",
"license":"LGPL",
"sanity-compilation": {
"intricate": {
"flag":{
"c-link": "-lm"
},
"dependency":[
"c"
]
},
"!intricate":{
"error":true
}
}
}

View File

@@ -0,0 +1,19 @@
{
"type":"LIBRARY",
"sub-type":"PREBUILD",
"group-id":"org.opengl",
"description":"OpenGL: Generic graphic library",
"sanity-compilation": {
"intricate": {
"flag":{
"c-link": "-lGL"
},
"dependency":[
"c"
]
},
"!intricate":{
"error":true
}
}
}

View File

@@ -0,0 +1,20 @@
{
"type":"LIBRARY",
"sub-type":"PREBUILD",
"group-id":"gnu",
"description":"pthread: Generic multithreading system",
"license":"LGPL",
"sanity-compilation": {
"intricate": {
"flag":{
"c-link": "-lpthread"
},
"dependency":[
"c"
]
},
"!intricate":{
"error":true
}
}
}

View File

@@ -0,0 +1,19 @@
{
"type":"LIBRARY",
"sub-type":"PREBUILD",
"group-id":"gnu",
"description":"Z : z library ",
"sanity-compilation": {
"intricate": {
"flag":{
"c-link": "-lz"
},
"dependency":[
"c"
]
},
"!intricate":{
"error":true
}
}
}

113
cmake/GLDTargetConfig.cmake Normal file
View File

@@ -0,0 +1,113 @@
cmake_minimum_required(VERSION 3.20)
if (WIN32)
set(CPACK_GENERATOR "ZIP")
else()
set(CPACK_GENERATOR "TGZ")
endif()
set(CPACK_VERBATIM_VARIABLES YES)
include(CPack)
## fist step is determining the target:
if (WIN32)
set(GLD_TARGET "Windows" CACHE INTERNAL "")
elseif(APPLE)
set(GLD_TARGET "MacOs" CACHE INTERNAL "")
elseif(LINUX)
set(GLD_TARGET "Linux" CACHE INTERNAL "")
elseif(UNIX AND NOT APPLE)
set(GLD_TARGET "Linux" CACHE INTERNAL "")
else()
message("GLD Can not determine the target !!!")
exit(-1)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(GLD_COMPILER "clang" CACHE INTERNAL "")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(GLD_COMPILER "gcc" CACHE INTERNAL "")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(GLD_COMPILER "intel" CACHE INTERNAL "")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(GLD_COMPILER "msvc" CACHE INTERNAL "")
else()
message("GLD Can not determine the compilator !!!")
exit(-1)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(GLD_MODE "debug" CACHE INTERNAL "")
elseif(CMAKE_BUILD_TYPE STREQUAL "debug")
set(GLD_MODE "debug" CACHE INTERNAL "")
else()
set(GLD_MODE "release" CACHE INTERNAL "")
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
set(GLD_ARCH "x86" CACHE INTERNAL "")
set(GLD_BUS_SIZE "64" CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
set(GLD_ARCH "x86" CACHE INTERNAL "")
set(GLD_BUS_SIZE "32" CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64")
set(GLD_ARCH "ppc" CACHE INTERNAL "")
set(GLD_BUS_SIZE "64" CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc")
set(GLD_ARCH "ppc" CACHE INTERNAL "")
set(GLD_BUS_SIZE "32" CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(GLD_ARCH "arm" CACHE INTERNAL "")
set(GLD_BUS_SIZE "64" CACHE INTERNAL "")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv9")
set(GLD_ARCH "arm" CACHE INTERNAL "")
set(GLD_BUS_SIZE "32" CACHE INTERNAL "")
else()
message("GLD Can not determine the architecture and bus-size !!!")
exit(-1)
endif()
# cmake does not support other mode than "intricate" the "isolate" mode is too much complicated to do.
set(GLD_SANITY_MODE "intricate" CACHE INTERNAL "")
# list of current supported language:
# - 'c': C language
# - 'c++': C++ language
# - 'asm': asembler language
# - 'm': Objective-C language
# - 'mm': Objective-C++ language
# - 'java': Java language
# - 'javah': generated c header with Java description (for JNI)
# TODO: maybe permit user to add some other... like "in", "masm", or other pre-step generation code???
set(GLD_SUPPORT_LANGUAGE "c;asm;c++;m;mm;java;javah" CACHE INTERNAL "")
set(GLD_SUPPORT_LANGUAGE_VARIABLE "C;ASM;CXX;M;MM;JAVA;JAVAH" CACHE INTERNAL "")
set(GLD_LANGUAGE_EXTENTION_C "c;C" CACHE INTERNAL "")
set(GLD_LANGUAGE_EXTENTION_CXX "cpp;CPP;cxx;CXX" CACHE INTERNAL "")
set(GLD_LANGUAGE_EXTENTION_ASM "s;S" CACHE INTERNAL "")
set(GLD_LANGUAGE_EXTENTION_M "m;M" CACHE INTERNAL "")
set(GLD_LANGUAGE_EXTENTION_MM "mm;MM" CACHE INTERNAL "")
set(GLD_LANGUAGE_EXTENTION_JAVA "java" CACHE INTERNAL "")
set(GLD_LANGUAGE_EXTENTION_JAVAH "javah" CACHE INTERNAL "")
# where is build the module
set(GLD_GLOBAL_BUILD_FOLDER "${CMAKE_CURRENT_BINARY_DIR}/${GLD_TARGET}_${GLD_ARCH}_${GLD_BUS_SIZE}/${GLD_MODE}/build/${GLD_COMPILER}/" CACHE INTERNAL "")
# where the package is prepared
set(GLD_GLOBAL_STAGING_FOLDER "${CMAKE_CURRENT_BINARY_DIR}/${GLD_TARGET}_${GLD_ARCH}_${GLD_BUS_SIZE}/${GLD_MODE}/staging/${GLD_COMPILER}/" CACHE INTERNAL "")
# whe the bundle (tar, jar ...) is set
set(GLD_GLOBAL_FINAL_FOLDER "${CMAKE_CURRENT_BINARY_DIR}/${GLD_TARGET}_${GLD_ARCH}_${GLD_BUS_SIZE}/${GLD_MODE}/final/${GLD_COMPILER}/" CACHE INTERNAL "")
message("Global GLD properties:")
message(" GLD_MODE : ${GLD_MODE}")
message(" GLD_COMPILER : ${GLD_COMPILER}")
message(" GLD_TARGET : ${GLD_TARGET}")
message(" GLD_ARCH : ${GLD_ARCH}")
message(" GLD_BUS_SIZE : ${GLD_BUS_SIZE}")
message(" GLD_SANITY_MODE : ${GLD_SANITY_MODE}")
message(" GLD_GLOBAL_BUILD_FOLDER : ${GLD_GLOBAL_BUILD_FOLDER}")
message(" GLD_GLOBAL_STAGING_FOLDER : ${GLD_GLOBAL_STAGING_FOLDER}")
message(" GLD_GLOBAL_FINAL_FOLDER : ${GLD_GLOBAL_FINAL_FOLDER}")

131
cmake/GLDTools.cmake Normal file
View File

@@ -0,0 +1,131 @@
cmake_minimum_required(VERSION 3.20)
##
## @brief List all folder in a specific inout folder.
## @param[out] VAR_OUT Result list of folders.
## @param[in] BASE_FOLDER Basic folder to parse.
##
function(sub_dir_list VAR_OUT BASE_FOLDER)
#message(" Search: ${BASE_FOLDER}" )
file(GLOB CHILDREN "${BASE_FOLDER}/*")
#message(" ==>>> ${children}" )
set(OUT_DATA "")
foreach(CHILD ${CHILDREN})
#message(" - ${child}" )
if(IS_DIRECTORY ${CHILD})
#message(" ==> is directory" )
list(APPEND OUT_DATA ${CHILD})
endif()
endforeach()
set(${VAR_OUT} ${OUT_DATA} PARENT_SCOPE)
endfunction()
function(replace_base_path VAR_OUT BASE LIST_ELEMENT)
set(OUT_DATA "")
foreach(ELEM ${LIST_ELEMENT})
string(REPLACE "${BASE}" "" TMP_VARIABLE ${ELEM})
list(APPEND OUT_DATA ${TMP_VARIABLE})
endforeach()
set(${VAR_OUT} ${OUT_DATA} PARENT_SCOPE)
endfunction()
function(copy_file_with_reference BASE_PATH SRC DST)
#check if input function if compatible with changing folder model...
string(FIND "${SRC}" "!" POSITION_IN_FILE REVERSE)
#message("POSITION_IN_FILE=${POSITION_IN_FILE}")
if(${POSITION_IN_FILE} GREATER 0)
string(SUBSTRING "${SRC}" 0 ${POSITION_IN_FILE} FILE_NAME)
MATH(EXPR POSITION_IN_FILE "${POSITION_IN_FILE}+1")
string(SUBSTRING "${SRC}" ${POSITION_IN_FILE} -1 PART_2)
string(FIND "${PART_2}" ":" POSITION_IN_FILE REVERSE)
string(SUBSTRING "${PART_2}" 0 ${POSITION_IN_FILE} FOLDER_SRC)
MATH(EXPR POSITION_IN_FILE "${POSITION_IN_FILE}+1")
string(SUBSTRING "${PART_2}" ${POSITION_IN_FILE} -1 FOLDER_DST)
#message("***********************************************************************")
#message("FILE_NAME=${FILE_NAME}")
#message("FOLDER_SRC=${FOLDER_SRC}")
#message("FOLDER_DST=${FOLDER_DST}")
configure_file(${BASE_PATH}/${FOLDER_SRC}/${FILE_NAME} ${DST}/${FOLDER_DST}/${FILE_NAME} COPYONLY)
else()
configure_file(${BASE_PATH}/${SRC} ${DST}/${SRC} COPYONLY)
endif()
endfunction()
##
## @brief Recursive search of a specific patter (stop whan find the pattern in a folder.
## (have a limit of parsing ==> optimise resarch in a worktree).
## @param[out] VAR_OUT List of all files that corespond of the reg-exp
## @param[in] BASE_FOLDER Basic folder to parse.
## @param[in] REG_EXP Regular expression to search the data.
## @param[in] LIMIT Lismit of folder to recursively parse.
##
function(find_all_files VAR_OUT BASE_FOLDER REG_EXP LIMIT)
if (${LIMIT} LESS_EQUAL 0)
set(${VAR_OUT} "" PARENT_SCOPE)
return()
endif()
MATH(EXPR LIMIT "${LIMIT}-1")
get_filename_component(BASE_FOLDER ${BASE_FOLDER} ABSOLUTE)
#message("KK Search in subDiratory: ${BASE_FOLDER}/${REG_EXP}" )
file(GLOB TMP_FILES "${BASE_FOLDER}/${REG_EXP}")
#message("-end-" )
set(GLD_FILES "")
#message("Find file: '${GLD_FILES}'" )
foreach(ELEM ${TMP_FILES})
if(IS_DIRECTORY "${ELEM}")
get_filename_component(DIR_NAME_RELATIVE ${ELEM} NAME)
#message(" =!=> DIR_NAME_RELATIVE = ${DIR_NAME_RELATIVE}" )
if("${ELEM}" STREQUAL "${BASE_FOLDER}" OR "${ELEM}" STREQUAL "${BASE_FOLDER}/" OR "${ELEM}" STREQUAL ".")
continue()
endif()
#message(" element: ${ELEM}" )
#message(" BASE_FOLDER: ${BASE_FOLDER}" )
find_all_files(OUT_SUB_LIST "${ELEM}" "${REG_EXP}" ${LIMIT})
#message(" start Add 1" )
list(APPEND GLD_FILES ${OUT_SUB_LIST})
#message(" -end-" )
else()
#message(" start Add 2" )
list(APPEND GLD_FILES ${ELEM})
#message(" -end-" )
endif()
endforeach()
set(${VAR_OUT} ${GLD_FILES} PARENT_SCOPE)
endfunction()
function(find_all_files_exeption VAR_OUT BASE_FOLDER REG_EXP LIMIT)
if (${LIMIT} LESS_EQUAL 0)
set(${VAR_OUT} "" PARENT_SCOPE)
return()
endif()
MATH(EXPR LIMIT "${LIMIT}-1")
get_filename_component(BASE_FOLDER ${BASE_FOLDER} ABSOLUTE)
#message("KK Search in subDiratory: ${BASE_FOLDER}/${REG_EXP}" )
file(GLOB GLD_FILES "${BASE_FOLDER}/${REG_EXP}")
#message("Find file: '${GLD_FILES}'" )
if("${GLD_FILES}" STREQUAL "")
#message("Search in subDiratory: ${BASE_FOLDER}" )
# no element continue search...
set(SUBDIRS "")
sub_dir_list(SUBDIRS "${BASE_FOLDER}")
#message(" =!=> : ${SUBDIRS}" )
foreach(ELEM ${SUBDIRS})
get_filename_component(DIR_NAME_RELATIVE ${ELEM} NAME)
#message(" =!=> DIR_NAME_RELATIVE = ${DIR_NAME_RELATIVE}" )
if("${DIR_NAME_RELATIVE}" STREQUAL ".git" OR "${DIR_NAME_RELATIVE}" STREQUAL ".island" OR "${DIR_NAME_RELATIVE}" STREQUAL "archive" OR "${DIR_NAME_RELATIVE}" STREQUAL "out" OR "${DIR_NAME_RELATIVE}" STREQUAL "target" OR "${DIR_NAME_RELATIVE}" STREQUAL "lutin")
continue()
endif()
if("${ELEM}" STREQUAL "${BASE_FOLDER}" OR "${ELEM}" STREQUAL "${BASE_FOLDER}/")
continue()
endif()
#message(" element: ${ELEM}" )
#message(" BASE_FOLDER: ${BASE_FOLDER}" )
find_all_files_exeption(OUT_SUB_LIST "${ELEM}" "${REG_EXP}" ${LIMIT})
list(APPEND GLD_FILES ${OUT_SUB_LIST})
endforeach()
endif()
set(${VAR_OUT} ${GLD_FILES} PARENT_SCOPE)
endfunction()

351
cmake/old.cmake Normal file
View File

@@ -0,0 +1,351 @@
function(GLD_import_old FOLDER LIBRARY_NAME)
# add the executable
# add_executable(Tutorial tutorial.cxx)
set(LIBRARY_NAME "etk-core")
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/GLD_${LIBRARY_NAME}.json
)
# Read the JSON file.
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/GLD_${LIBRARY_NAME}.json MY_JSON_STRING)
# Loop through each element of the JSON array (indices 0 though 1).
json_get_element(LIBRARY_TYPE ${MY_JSON_STRING} "type")
json_get_element(LIBRARY_GROUP_ID ${MY_JSON_STRING} "group-id")
json_get_element(LIBRARY_DECRIPTION ${MY_JSON_STRING} "description")
json_get_element(LIBRARY_LICENCE ${MY_JSON_STRING} "licence")
json_get_element(LIBRARY_LICENCE_FILE ${MY_JSON_STRING} "licence-file")
json_get_element(LIBRARY_MAINTAINER ${MY_JSON_STRING} "maintainer")
json_get_element(LIBRARY_AUTHORS ${MY_JSON_STRING} "authors")
json_get_element(LIBRARY_VERSION ${MY_JSON_STRING} "version")
json_get_element(LIBRARY_SOURCES ${MY_JSON_STRING} "sources")
json_get_element(LIBRARY_HEADERS ${MY_JSON_STRING} "headers")
json_get_list(LIBRARY_PATH ${MY_JSON_STRING} "path")
json_get_element(LIBRARY_COMPILATION_VERSION ${MY_JSON_STRING} "compilation-version")
json_get_list(LIBRARY_DEPENDENCY ${MY_JSON_STRING} "dependency")
json_get_element(LIBRARY_TARGET ${MY_JSON_STRING} "target")
json_get_element(LIBRARY_COMPILATION_VERSION_LANGUAGE ${MY_JSON_STRING} "language")
json_get_element(LIBRARY_COMPILATION_VERSION_VALUE ${MY_JSON_STRING} "version")
message("LIBRARY_NAME : ${LIBRARY_NAME}")
message("LIBRARY_TYPE : ${LIBRARY_TYPE}")
message("LIBRARY_GROUP_ID : ${LIBRARY_GROUP_ID}")
message("LIBRARY_DECRIPTION : ${LIBRARY_DECRIPTION}")
message("LIBRARY_LICENCE : ${LIBRARY_LICENCE}")
message("LIBRARY_LICENCE_FILE : ${LIBRARY_LICENCE_FILE}")
message("LIBRARY_MAINTAINER : ${LIBRARY_MAINTAINER}")
message("LIBRARY_AUTHORS : ${LIBRARY_AUTHORS}")
message("LIBRARY_VERSION : ${LIBRARY_VERSION}")
message("LIBRARY_COMPILATION_VERSION : ${LIBRARY_COMPILATION_VERSION_LANGUAGE} : ${LIBRARY_COMPILATION_VERSION_VALUE}")
#message("LIBRARY_SOURCES: ${LIBRARY_SOURCES}")
#message("LIBRARY_HEADERS: ${LIBRARY_HEADERS}")
message("LIBRARY_PATH: ${LIBRARY_PATH}")
#message("LIBRARY_COMPILATION_VERSION: ${LIBRARY_COMPILATION_VERSION}")
message("LIBRARY_DEPENDENCY: ${LIBRARY_DEPENDENCY}")
#message("LIBRARY_TARGET: ${LIBRARY_TARGET}")
json_get_list(SOURCES_LIST ${LIBRARY_SOURCES} "list")
message("SOURCES_LIST: ${SOURCES_LIST}")
json_get_list(EXPORT_HEADER_LIST ${LIBRARY_HEADERS} "list")
json_get_element(EXPORT_HEADER_LIST_PATH ${LIBRARY_HEADERS} "destination-path")
message("EXPORT_HEADER_LIST: ${EXPORT_HEADER_LIST}")
message("EXPORT_HEADER_LIST_PATH: ${EXPORT_HEADER_LIST_PATH}")
string(JSON LIBRARY_PLOP ERROR_VARIABLE "qsdfqsdfqsdf" GET ${MY_JSON_STRING} "qsdfqsdfqsdf")
#string(JSON LIBRARY_MEMBERS MEMBER ${MY_JSON_STRING} )
#message("LIBRARY_MEMBERS : ${LIBRARY_MEMBERS}")
message("LIBRARY_PLOP : ${LIBRARY_PLOP}")
string(REPLACE "-" "_" LIBRARY_NAME222 ${LIBRARY_NAME})
set(LIBRARY_NAME222 ${LIBRARY_NAME})
project(${LIBRARY_NAME222} VERSION ${LIBRARY_VERSION})
set(${LIBRARY_NAME222} PROPERTIES CPACK_PACKAGE_VERSION ${LIBRARY_VERSION})
add_library(${LIBRARY_NAME222}_OBJ OBJECT ${SOURCES_LIST})
# shared libraries need PIC
set_property(TARGET ${LIBRARY_NAME222}_OBJ PROPERTY POSITION_INDEPENDENT_CODE 1)
#set_target_properties(${LIBRARY_NAME222} PROPERTIES PUBLIC_HEADER ${EXPORT_HEADER_LIST})
target_include_directories(${LIBRARY_NAME222}_OBJ PUBLIC
${LIBRARY_PATH}
)
add_library(${LIBRARY_NAME222}_dynamic SHARED $<TARGET_OBJECTS:${LIBRARY_NAME222}_OBJ>)
add_library(${LIBRARY_NAME222}_static STATIC $<TARGET_OBJECTS:${LIBRARY_NAME222}_OBJ>)
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES OUTPUT_NAME ${LIBRARY_NAME222})
if (NOT WIN32)
set_target_properties(${LIBRARY_NAME222}_static PROPERTIES OUTPUT_NAME ${LIBRARY_NAME222})
endif()
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES VERSION ${LIBRARY_VERSION})
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES SOVERSION ${LIBRARY_VERSION})
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES DESCRIPTION ${LIBRARY_DECRIPTION})
# install dynamic & static library
install(TARGETS ${LIBRARY_NAME222}_dynamic EXPORT ${LIBRARY_NAME222}Targets
RUNTIME DESTINATION lib
)
install(TARGETS ${LIBRARY_NAME222}_static
RUNTIME DESTINATION lib)
#install(TARGETS ${LIBRARY_NAME222} EXPORT ${LIBRARY_NAME222}Targets
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
# RUNTIME DESTINATION bin
# INCLUDES DESTINATION include
#)
# install exported headers
# this copy all the headers in a single folder:
#install(FILES ${EXPORT_HEADER_LIST} DESTINATION include)
# this keep the basic path for each folders:
set(BASE "${PROJECT_SOURCE_DIR}/install")
foreach(ITEM ${EXPORT_HEADER_LIST})
get_filename_component(ITEM_PATH ${ITEM} PATH)
string(REPLACE ${BASE} "" ITEM_PATH ${ITEM_PATH})
install(FILES ${ITEM}
DESTINATION "include/${ITEM_PATH}"
COMPONENT Devel)
endforeach()
include(CMakePackageConfigHelpers)
#write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}ConfigVersion.cmake"
# VERSION ${LIBRARY_VERSION}
# COMPATIBILITY AnyNewerVersion
#)
#
#export(EXPORT ${LIBRARY_NAME222}Targets
# FILE "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}Targets.cmake"
# NAMESPACE Upstream::
#)
##configure_file(cmake/${LIBRARY_NAME222}Config.cmake
## "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}Config.cmake"
## COPYONLY
##)
set(CONFIG_PACKAGE_LOCATION cmake/${LIBRARY_NAME222})
install(EXPORT ${LIBRARY_NAME222}Targets
FILE
${LIBRARY_NAME222}Targets.cmake
NAMESPACE
${LIBRARY_NAME222}::
DESTINATION
${CONFIG_PACKAGE_LOCATION}
)
#install(
# FILES
# cmake/${LIBRARY_NAME222}Config.cmake
# "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}ConfigVersion.cmake"
# DESTINATION
# ${CONFIG_PACKAGE_LOCATION}
# COMPONENT
# Devel
#)
message("CMAKE_INSTALL_LIBDIR===${CMAKE_INSTALL_LIBDIR}")
include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/${LIBRARY_NAME222}Config.cmake.in
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}Config.cmake"
INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION}
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}ConfigVersion.cmake"
VERSION ${LIBRARY_VERSION}
COMPATIBILITY SameMajorVersion)
install(
FILES
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}Config.cmake"
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}ConfigVersion.cmake"
DESTINATION ${CONFIG_PACKAGE_LOCATION}
COMPONENT Devel)
endfunction()
function(kjhghkjgkhjgkjhgkjhgkj LIBRARY_NAME)
json_get_element(LIBRARY_SOURCES ${MY_JSON_STRING} "source")
json_get_element(LIBRARY_HEADERS ${MY_JSON_STRING} "header")
json_get_list(LIBRARY_PATH ${MY_JSON_STRING} "path")
json_get_element(LIBRARY_COMPILATION_VERSION ${MY_JSON_STRING} "compilation-version")
json_get_list(LIBRARY_DEPENDENCY ${MY_JSON_STRING} "dependency")
json_get_element(LIBRARY_TARGET ${MY_JSON_STRING} "target")
json_get_element(LIBRARY_COMPILATION_VERSION_LANGUAGE ${MY_JSON_STRING} "language")
json_get_element(LIBRARY_COMPILATION_VERSION_VALUE ${MY_JSON_STRING} "version")
message("LIBRARY_COMPILATION_VERSION : ${LIBRARY_COMPILATION_VERSION_LANGUAGE} : ${LIBRARY_COMPILATION_VERSION_VALUE}")
#message("LIBRARY_SOURCES: ${LIBRARY_SOURCES}")
#message("LIBRARY_HEADERS: ${LIBRARY_HEADERS}")
message("LIBRARY_PATH: ${LIBRARY_PATH}")
#message("LIBRARY_COMPILATION_VERSION: ${LIBRARY_COMPILATION_VERSION}")
message("LIBRARY_DEPENDENCY: ${LIBRARY_DEPENDENCY}")
#message("LIBRARY_TARGET: ${LIBRARY_TARGET}")
json_get_list(SOURCES_LIST ${LIBRARY_SOURCES} "list")
message("SOURCES_LIST: ${SOURCES_LIST}")
json_get_list(EXPORT_HEADER_LIST ${LIBRARY_HEADERS} "list")
json_get_element(EXPORT_HEADER_LIST_PATH ${LIBRARY_HEADERS} "destination-path")
message("EXPORT_HEADER_LIST: ${EXPORT_HEADER_LIST}")
message("EXPORT_HEADER_LIST_PATH: ${EXPORT_HEADER_LIST_PATH}")
string(JSON LIBRARY_PLOP ERROR_VARIABLE "qsdfqsdfqsdf" GET ${MY_JSON_STRING} "qsdfqsdfqsdf")
#string(JSON LIBRARY_MEMBERS MEMBER ${MY_JSON_STRING} )
#message("LIBRARY_MEMBERS : ${LIBRARY_MEMBERS}")
message("LIBRARY_PLOP : ${LIBRARY_PLOP}")
string(REPLACE "-" "_" LIBRARY_NAME222 ${LIBRARY_NAME})
set(LIBRARY_NAME222 ${LIBRARY_NAME})
project(${LIBRARY_NAME222} VERSION ${LIBRARY_VERSION})
set(${LIBRARY_NAME222} PROPERTIES CPACK_PACKAGE_VERSION ${LIBRARY_VERSION})
add_library(${LIBRARY_NAME222}_OBJ OBJECT ${SOURCES_LIST})
# shared libraries need PIC
set_property(TARGET ${LIBRARY_NAME222}_OBJ PROPERTY POSITION_INDEPENDENT_CODE 1)
#set_target_properties(${LIBRARY_NAME222} PROPERTIES PUBLIC_HEADER ${EXPORT_HEADER_LIST})
target_include_directories(${LIBRARY_NAME222}_OBJ PUBLIC
${LIBRARY_PATH}
)
add_library(${LIBRARY_NAME222}_dynamic SHARED $<TARGET_OBJECTS:${LIBRARY_NAME222}_OBJ>)
add_library(${LIBRARY_NAME222}_static STATIC $<TARGET_OBJECTS:${LIBRARY_NAME222}_OBJ>)
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES OUTPUT_NAME ${LIBRARY_NAME222})
if (NOT WIN32)
set_target_properties(${LIBRARY_NAME222}_static PROPERTIES OUTPUT_NAME ${LIBRARY_NAME222})
endif()
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES VERSION ${LIBRARY_VERSION})
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES SOVERSION ${LIBRARY_VERSION})
set_target_properties(${LIBRARY_NAME222}_dynamic PROPERTIES DESCRIPTION ${LIBRARY_DECRIPTION})
# install dynamic & static library
install(TARGETS ${LIBRARY_NAME222}_dynamic EXPORT ${LIBRARY_NAME222}Targets
RUNTIME DESTINATION lib
)
install(TARGETS ${LIBRARY_NAME222}_static
RUNTIME DESTINATION lib)
#install(TARGETS ${LIBRARY_NAME222} EXPORT ${LIBRARY_NAME222}Targets
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
# RUNTIME DESTINATION bin
# INCLUDES DESTINATION include
#)
# install exported headers
# this copy all the headers in a single folder:
#install(FILES ${EXPORT_HEADER_LIST} DESTINATION include)
# this keep the basic path for each folders:
set(BASE "${PROJECT_SOURCE_DIR}/install")
foreach(ITEM ${EXPORT_HEADER_LIST})
get_filename_component(ITEM_PATH ${ITEM} PATH)
string(REPLACE ${BASE} "" ITEM_PATH ${ITEM_PATH})
install(FILES ${ITEM}
DESTINATION "include/${ITEM_PATH}"
COMPONENT Devel)
endforeach()
include(CMakePackageConfigHelpers)
#write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}ConfigVersion.cmake"
# VERSION ${LIBRARY_VERSION}
# COMPATIBILITY AnyNewerVersion
#)
#
#export(EXPORT ${LIBRARY_NAME222}Targets
# FILE "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}Targets.cmake"
# NAMESPACE Upstream::
#)
##configure_file(cmake/${LIBRARY_NAME222}Config.cmake
## "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}Config.cmake"
## COPYONLY
##)
set(CONFIG_PACKAGE_LOCATION cmake/${LIBRARY_NAME222})
install(EXPORT ${LIBRARY_NAME222}Targets
FILE
${LIBRARY_NAME222}Targets.cmake
NAMESPACE
${LIBRARY_NAME222}::
DESTINATION
${CONFIG_PACKAGE_LOCATION}
)
#install(
# FILES
# cmake/${LIBRARY_NAME222}Config.cmake
# "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME222}/${LIBRARY_NAME222}ConfigVersion.cmake"
# DESTINATION
# ${CONFIG_PACKAGE_LOCATION}
# COMPONENT
# Devel
#)
message("CMAKE_INSTALL_LIBDIR===${CMAKE_INSTALL_LIBDIR}")
include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/${LIBRARY_NAME222}Config.cmake.in
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}Config.cmake"
INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION}
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}ConfigVersion.cmake"
VERSION ${LIBRARY_VERSION}
COMPATIBILITY SameMajorVersion)
install(
FILES
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}Config.cmake"
"${PROJECT_BINARY_DIR}/${LIBRARY_NAME222}ConfigVersion.cmake"
DESTINATION ${CONFIG_PACKAGE_LOCATION}
COMPONENT Devel)
endfunction()

View File

@@ -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===

80
doc/010_basic_concept.md Normal file
View File

@@ -0,0 +1,80 @@
Basic concept {#lutin_concept}
=============
@tableofcontents
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.
**Index:**
- @ref mainpage
- @ref lutin_concept
- @ref lutin_use
- @ref lutin_module

View File

@@ -1,153 +0,0 @@
=?= [center]Basic concept[/center] =?=
___________________________________________
Lutin permit simply to compile applications and library.
To simply understand the use, we will use a simple library:
[code style=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 ==
It is really simple:
[code style=bash]
lutin yourModuleName
#example:
lutin etk
[/code]
== Option working ==
Lutin have a complex option methodologie. We can consider 3 part of the option:
:** Global option
:** target option
:** modules
== Generic options ==
=== Display help ===
Availlable everywhere ...
[code style=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.
At the end of the help you an see an help about the etk librery with the associated help.
=== Build in color ===
[code style=bash]
lutin -C
lutin --color
[/code]
=== Display build line in pretty print mode ===
when an error apear, the gcc or clang compile line can be really unreadable:
[code]
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]
lutin -P
lutin --pretty
[/code]
result:
[code]
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
[/code]
=== lutin log ===
Lutin have an internal log system. To enable or disable it just select your debug level with the option:
[code style=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
=== 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]
#for 5 core
lutin -j5
lutin --jobs 5
[/code]
=== Force rebuild all ===
Sometime it is needed to rebuild all the program, just do :
[code style=bash]
lutin -B
lutin --force-build
[/code]
=== Force rebuild all ===
Force strip of output binary (remove symboles)
[code style=bash]
lutin -s
lutin --force-strip
[/code]
-w / --warning
Store warning in a file build file

229
doc/020_Compile_a_module.md Normal file
View File

@@ -0,0 +1,229 @@
How to use lutin {#lutin_use}
================
@tableofcontents
Lutin permit simply to compile applications and library.
To simply understand the use, we will use a simple library:
```{.sh}
git clone http://github.con/atria-soft/etk.git
```
compile a module: {#lutin_use_compile}
=================
It is really simple:
```{.sh}
lutin yourModuleName
#example:
lutin etk
```
Option working: {#lutin_use_options}
===============
Lutin have a complex option methodologie. We can consider 3 part of the option:
- global option
- target option
- modules
Global options: {#lutin_use_options_global}
---------------
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}
-------------
Availlable everywhere ...
```{.sh}
lutin -h
lutin --help
```
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(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: {#lutin_use_options_color}
---------------
```{.sh}
lutin -C
lutin --color
```
Display build line in pretty print mode: {#lutin_use_options_pretty}
----------------------------------------
when an error apear, the gcc or clang compile line can be really unreadable:
```{.sh}
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
```
whith this option you can transform this not obvious line in a readable line:
```{.sh}
lutin -P
lutin --pretty
```
result:
```{.sh}
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
```
lutin log: {#lutin_use_options_log}
----------
Lutin have an internal log system. To enable or disable it just select your debug level with the option:
```{.sh}
lutin -v4
lutin --verbose 4
```
The level availlables are:
- 0: None
- 1: error
- 2: warning (default)
- 3: info
- 4: debug
- 5: verbose
- 6: extreme_verbose
Select the number of CPU core used: {#lutin_use_options_cpu}
-----------------------------------
By default lutin manage only 1 CPU core (faster to debug) but for speed requirement you can use use multiple core:
```{.sh}
#for 5 core
lutin -j5
lutin --jobs 5
```
Force rebuild all: {#lutin_use_options_rebuild_force}
------------------
Sometime it is needed to rebuild all the program, just do:
```{.sh}
lutin -B
lutin --force-build
# or remove the build directory
rm -rf out/
```
Force strip all library and programs: {#lutin_use_options_strip}
-------------------------------------
Force strip of output binary (remove symboles)
```{.sh}
lutin -s
lutin --force-strip
```
Manage Cross compilation: {#lutin_use_options_cross_compile}
=========================
The main objective of lutin is managing the cross compilation to build from linux to other platform:
For android you can use:
```{.sh}
lutin -t Android your-module
lutin -t Windows your-module
```
Build in debug mode: {#lutin_use_options_debug_release}
====================
To developp it is fasted with debug tools
```{.sh}
lutin -m debug your-module
lutin -m release your-module
```
You can desire to have compilation optimisation when you build in debug mode:
```{.sh}
lutin -m debug --force-optimisation your-module
```
Execute your program after building it: {#lutin_use_options_execute}
=======================================
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.
Install your program after building it: {#lutin_use_options_install}
=======================================
You can install your build module:
```{.sh}
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

View File

@@ -0,0 +1,504 @@
Create a new Module: {#lutin_module}
====================
@tableofcontents
Base of the module file: {#lutin_module_base_file}
========================
To create a new module you will use a generic naming:
```{.sh}
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:
```{.py}
#!/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"
# "MPL-1" / "MPL-1.1" / "MPL-2"
# 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] my_module Module handle that migh be configured
# @return True The module is welled configure
# @return False The module is Not availlable (for this target or ...)
def configure(target, my_module):
...
return True
```
Thes it is simple to specify build for:
Create a new Module (LIBRARY): {#lutin_module_library}
==============================
What to change:
```{.py}
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): {#lutin_module_binary}
=============================
Generic Binary: {#lutin_module_binary_base}
---------------
What to change:
```{.py}
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): {#lutin_module_binary_tools}
------------------------------------------------
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:
```{.py}
def get_type():
return "BINARY"
def get_sub_type():
return "TEST"
```
or:
```{.py}
def get_type():
return "BINARY"
def get_sub_type():
return "TOOL"
```
Create a new Module (DATA): {#lutin_module_data}
===========================
This pode permit to only copy data and no dependency with compilling system
What to change:
```{.py}
def get_type():
return "DATA"
```
Module internal specifications: {#lutin_module_internal}
===============================
Add file to compile: {#lutin_module_internal_compile}
--------------------
This is simple: (you just need to specify all the file to compile)
```{.py}
def configure(target, my_module):
...
# 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: {#lutin_module_internal_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:
```{.py}
def configure(target, my_module):
...
my_module.add_header_file([
'module-name/file1.h',
'module-name/file2.h'
])
...
```
You can add a path to your local include:
```{.py}
def configure(target, my_module):
...
my_module.add_path(os.path.join(tools.get_current_path(__file__), "lib-name"))
...
```
Add Sub-dependency: {#lutin_module_internal_depend}
-------------------
All library need to add at minimum of a simple library (C lib) and other if needed. To do it jus call:
```{.py}
def configure(target, my_module):
...
# add dependency of the generic C library:
my_module.add_depend('c')
# add dependency of the generic C++ library:
my_module.add_depend('cxx')
# add dependency of the generic math library:
my_module.add_depend('m')
# or other user lib:
my_module.add_depend('lib-name')
...
```
The system can have optinnal sub-library, then if you just want to add an optionnal dependency:
```{.py}
def configure(target, my_module):
...
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
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_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
...
```
Compilation adn link flags/libs: {#lutin_module_internal_flag}
--------------------------------
It is possible to define local and external flags (external are set internal too):
```{.py}
def configure(target, my_module):
...
# 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_flag('c', "-DMODE_RELEASE")
...
```
build mode (release/debug): {#lutin_module_internal_target_mode}
---------------------------
To add somes element dependent of the build mode:
```{.py}
def configure(target, my_module):
...
if target.get_mode() == "release":
pass
else:
pass
...
```
build type target: {#lutin_module_internal_target_type}
------------------
To add somes element dependent of the target type:
```{.py}
def configure(target, my_module):
...
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): {#lutin_module_internal_data}
-----------------------------------------------
You can install a simple file:
```{.py}
def configure(target, my_module):
...
# copy file in the share/binanyName/ path (no sub path)
my_module.copy_path('data/icon.svg')
...
```
Copy multiple files (change path)
```{.py}
def configure(target, my_module):
...
my_module.copy_path('data/*', 'destinationPath')
...
```
display some debug to help writing code: {#lutin_module_internal_write_log}
----------------------------------------
```{.py}
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_full_template}
================
Create the file:
```{.sh}
lutin_module-name.py
```
With:
```{.py}
#!/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"
# "MPL-1" / "MPL-1.1" / "MPL-2"
# 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>"]
# return "authors.txt"
# Version of the library
# Note: this fucntion is optionnal.
def get_version():
return [0,1,"dev"]
# return "version.txt"
# create the module
# @param[in] target reference on the Target that is currently build
# @param[in] my_module Module handle that migh be configured
# @return True The module is welled configure
# @return False The module is Not availlable (for this target or ...)
def configure(target, my_module):
# 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_depend('c')
# add dependency of the generic C++ library:
my_module.add_depend('cxx')
# add dependency of the generic math library:
my_module.add_depend('m')
# or other user lib:
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_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_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_flag('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 True if the module is compatible with the target or ...
return True
```
**Index:**
- @ref mainpage
- @ref lutin_concept
- @ref lutin_use
- @ref lutin_module

112
doc/100_Use_on_Ios.md Normal file
View File

@@ -0,0 +1,112 @@
Build and deploy for IOS {#lutin_ios}
========================
@tableofcontents
Deploy on IOs is a little complicated, due to the fact Apple demand a developper licence.
To deploy you need to buy a [developper licence](https://developer.apple.com/account) nearly 99€ / year
Step 1: deploy your application with Xcode {#lutin_ios_xcode}
==========================================
it can be conplicated to do the first deploy (register tablette:watch ... or user ...)
Then the best way is now to create your first game sample application with XCode and deploy it on your device ...
when all your problem are solved, I can help you...
**Note:**
```
To add a device, in xcode select your top project, and in the section "signing" select "automatic manage signing", select your team and activate your device ...
```
step 2: Build for IOs {#lutin_ios_build}
=====================
This step is simpliest... All is integrated:
Select the target IOs
```{.sh}
lutin -C -D -tIOs yourApplication?build
```
This is done .... now deploy ...
step 3: Deploy {#lutin_ios_deploy}
==============
Do it ... it does not work ...
```{.sh}
lutin -C -D -tIOs yourApplication?install
```
Application ID
--------------
It miss some things to do:
create a reference of you application in [apple interface](https://developer.apple.com/account/ios/identifier/bundle/create)
your application id is:
```{.py}
get_compagny_type() + "." + get_compagny_name() + "." + module.get_name()
```
For example if you module is named: ```lutin_application.py```
And you set description:
```{.py}
def get_compagny_type():
return "com"
def get_compagny_name():
return "compagny NAME"
```
your id is: ```com.compagnyname.application```
When you have create the application, it will generate for you a unique ID, you can see it on the webpage, it is like: ```DFGDSFGSDFGS.com.compagnyname.application```
In your module definition you need to add:
```{.py}
my_module.set_pkg("APPLE_APPLICATION_IOS_ID", "DFGDSFGSDFGS");
```
Team signing ID
---------------
the second point to do is creating the file: ```.iosKey.txt``` in you root path of your workspace (where you execute lutin)
it will contain sothing like:
```
'iPhone Developer: Francis DUGENOUX (YRRQE5KGTH)'
```
you can optain it with executing:
```{.sh}
certtool y | grep "Developer"
```
Install:
--------
Now it works ...
```{.sh}
lutin -C -D -tIOs yourApplication?build
```

15
doc/101_Use_on_Android.md Normal file
View File

@@ -0,0 +1,15 @@
Connect device
To connect to a real device or phone via ADB under Arch, you must:
install android-udev
plug in your android device via USB.
Enable USB Debugging on your phone or device:
Jelly Bean (4.2) and newer: Go to Settings --> About Phone tap “Build Number” 7 times until you get a popup that you have become a developer. Then go to Settings --> Developer --> USB debugging and enable it. The device will ask to allow the computer with its fingerprint to connect. allowing it permanent will copy $HOME/.android/adbkey.pub onto the devices /data/misc/adb/adb_keys folder.
If android-udev has been installed, add yourself to the adbusers group:
# gpasswd -a username adbusers

View File

@@ -1,100 +0,0 @@
=?= [center]Lutin Build system[/center] =?=
___________________________________________
===What is Lutin, and how can I use it?===
Lutin is an application/library builder, it is designed to concurence CMake, Makefile, Ant, graddle ...
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.
Some packege can be generate for some platform:
:** debian package;
:** windows application zip;
:** MacOs application .app;
:** iOs package;
:** Android Package .apk.
Compilation is availlable for:
:** gcc/g++;
:** clang/clang++.
Manage [b]workspace build[/b] (in oposition of CMake/make/...)
=== Install: ===
Requirements: ``Python >= 2.7`` and ``pip``
==== Install lutin: ===
Just run:
[code style=bash]
pip install lutin
[/code]
==== Install pip ====
Install pip on debian/ubuntu:
[code style=bash]
sudo apt-get install pip
[/code]
Install pip on ARCH-linux:
[code style=bash]
sudo pacman -S pip
[/code]
Install pip on MacOs:
[code style=bash]
sudo easy_install pip
[/code]
==== Install from sources ====
[code style=bash]
git clone http://github.com/HeeroYui/lutin.git
cd lutin
sudo ./setup.py install
[/code]
=== License (APACHE v2.0) ===
Copyright lutin Edouard DUPIN
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=== 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.
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]]

144
doc/mainpage.md Normal file
View File

@@ -0,0 +1,144 @@
Lutin Build system {#mainpage}
==================
@tableofcontents
`lutin` is a generic builder and package maker is a FREE software tool.
![Py package](https://badge.fury.io/py/lutin.png) https://pypi.python.org/pypi/lutin
Release (master) {#lutin_mainpage_build_master}
================
![Build Status](https://travis-ci.org/HeeroYui/lutin.svg?branch=master) https://travis-ci.org/HeeroYui/lutin
Developement (dev) {#lutin_mainpage_build_dev}
==================
![Build Status](https://travis-ci.org/HeeroYui/lutin.svg?branch=dev) https://travis-ci.org/HeeroYui/lutin
What is Lutin? {#lutin_mainpage_intro}
==============
Lutin is an application/library builder, it is designed to concurence CMake, Makefile, Ant, graddle ...
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.
Some packege can be generate for some platform:
- debian package;
- windows application zip;
- MacOs application .app;
- iOs package;
- Android Package .apk.
Compilation is availlable for:
- gcc/g++;
- clang/clang++.
Manage **workspace build** (in oposition of CMake/make/...)
Install: {#lutin_mainpage_installation}
========
Requirements: ``Python >= 2.7`` and ``pip``
Install lutin:
--------------
Just run:
```{.sh}
pip install lutin
```
Install pip:
------------
Install pip on debian/ubuntu:
```{.sh}
sudo apt-get install pip
```
Install pip on ARCH-linux:
```{.sh}
sudo pacman -S pip
```
Install pip on MacOs:
```{.sh}
sudo easy_install pip
```
Install from sources:
---------------------
```{.sh}
git clone http://github.com/HeeroYui/lutin.git
cd lutin
sudo ./setup.py install
```
git repository {#lutin_mainpage_repository}
==============
http://github.com/HeeroYui/lutin/
Tutorals: {#lutin_mainpage_tutorial}
=========
- @ref lutin_concept
- @ref lutin_use
- @ref lutin_module
- @ref lutin_ios
License (MPL v2.0) {#lutin_mainpage_licence}
=====================
Copyright lutin Edouard DUPIN
Licensed under the Mozilla Public License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.mozilla.org/MPL/2.0/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
History: {#lutin_mainpage_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.
Then I create a simple interface that manage all I need. and written in python to permit to be faster on every platform.
[link macos account developper](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppStoreDistributionTutorial/AddingYourAccounttoXcode/AddingYourAccounttoXcode.html)

35
doxy_lutin.py Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/python
import os
import doxy.module as module
import doxy.debug as debug
import doxy.tools as tools
def create(target, module_name):
my_module = module.Module(__file__, module_name)
my_module.set_version([2,2,0])
my_module.set_title("lutin: build system and packager")
my_module.set_website("http://HeeroYui.github.io/" + module_name)
my_module.set_website_sources("http://github.com/HeeroYui/" + module_name)
my_module.add_path([
module_name,
"doc"
])
my_module.add_exclude_symbols([
'_*',
'lutinTarget_*',
'lutinSystem_*',
'lutinBuilder_*',
])
my_module.add_file_patterns([
#'*.py',
'builder.py',
'debug.py',
'env.py',
'host.py',
'module.py',
'system.py',
'target.py',
'*.md',
])
return my_module

View File

@@ -5,18 +5,19 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import os
import sys
import fnmatch
# Local import
from . import macro
from . import target
from . import builder
from . import system
from . import host
from . import tools
from . import debug
from realog import debug
from . import module
from . import env
is_init = False
@@ -56,13 +57,21 @@ def import_path_local(path, limit_sub_folder, exclude_path = [], base_name = "")
if path in exclude_path:
debug.debug("find '" + str(path) + "' in exclude_path=" + str(exclude_path))
return []
# filter elements:
# filter elements for lutin:
tmp_list_lutin_file = filter_name_and_file(path, list_files, base_name + "*.py")
debug.verbose("lutin files: " + str(path) + " : " + str(tmp_list_lutin_file))
# Import the module:
for filename in tmp_list_lutin_file:
out.append(os.path.join(path, filename))
debug.extreme_verbose(" Find a file : '" + str(out[-1]) + "'")
# filter elements for GLD:
tmp_list_gld_file = filter_name_and_file(path, list_files, "GLD_*.json")
debug.verbose("GLD files: " + str(path) + " : " + str(tmp_list_lutin_file))
# Import the module:
for filename in tmp_list_gld_file:
out.append(os.path.join(path, filename))
debug.extreme_verbose(" Find a file : '" + str(out[-1]) + "'")
need_parse_sub_folder = True
rm_value = -1
# check if we need to parse sub_folder
@@ -103,12 +112,10 @@ def import_path_local(path, limit_sub_folder, exclude_path = [], base_name = "")
out.append(elem)
return out
def init():
global is_init;
if is_init == True:
return
debug.verbose("Use Make as a make stadard")
sys.path.append(tools.get_run_path())
# create the list of basic folder:
basic_folder_list = []
@@ -148,6 +155,7 @@ def init():
module.import_path(list_of_lutin_files)
system.import_path(list_of_lutin_files)
target.import_path(list_of_lutin_files)
macro.import_path(list_of_lutin_files)
builder.init()
is_init = True

View File

@@ -1,262 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
# Local import
from . import debug
class ArgElement:
def __init__(self, option, value=""):
self.option = option;
self.arg = value;
def get_option_name(self):
return self.option
def get_arg(self):
return self.arg
def display(self):
if len(self.arg)==0:
debug.info("option : " + self.option)
elif len(self.option)==0:
debug.info("element : " + self.arg)
else:
debug.info("option : " + self.option + ":" + self.arg)
class ArgDefine:
def __init__(self,
smallOption="", # like v for -v
bigOption="", # like verbose for --verbose
list=[], # ["val", "description"]
desc="",
haveParam=False):
self.option_small = smallOption;
self.option_big = bigOption;
self.list = list;
if len(self.list)!=0:
self.have_param = True
else:
if True==haveParam:
self.have_param = True
else:
self.have_param = False
self.description = desc;
def get_option_small(self):
return self.option_small
def get_option_big(self):
return self.option_big
def need_parameters(self):
return self.have_param
def get_porperties(self):
return ""
def check_availlable(self, argument):
if len(self.list)==0:
return True
for element,desc in self.list:
if element == argument:
return True
return False
def display(self):
color = debug.get_color_set()
if self.option_small != "" and self.option_big != "":
print(" " + color['red'] + "-" + self.option_small + "" + color['default'] + " / " + color['red'] + "--" + self.option_big + color['default'])
elif self.option_small != "":
print(" " + color['red'] + "-" + self.option_small + color['default'])
elif self.option_big != "":
print(" " + color['red'] + "--" + self.option_big + color['default'])
else:
print(" ???? ==> internal error ...")
if self.description != "":
print(" " + self.description)
if len(self.list)!=0:
hasDescriptiveElement=False
for val,desc in self.list:
if desc!="":
hasDescriptiveElement=True
break;
if hasDescriptiveElement==True:
for val,desc in self.list:
print(" " + val + " : " + desc)
else:
tmpElementPrint = ""
for val,desc in self.list:
if len(tmpElementPrint)!=0:
tmpElementPrint += " / "
tmpElementPrint += val
print(" { " + tmpElementPrint + " }")
def parse(self, argList, currentID):
return currentID;
class ArgSection:
def __init__(self,
sectionName="",
desc=""):
self.section = sectionName;
self.description = desc;
def get_option_small(self):
return ""
def get_option_big(self):
return ""
def get_porperties(self):
color = debug.get_color_set()
return " [" + color['blue'] + self.section + color['default'] + "]"
def display(self):
color = debug.get_color_set()
print(" [" + color['blue'] + self.section + color['default'] + "] : " + self.description)
def parse(self, argList, currentID):
return currentID;
class LutinArg:
def __init__(self):
self.listProperties = []
def add(self, argument):
self.listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
def add_section(self, sectionName, sectionDesc):
self.listProperties.append(ArgSection(sectionName, sectionDesc))
def parse(self):
listArgument = [] # composed of list element
NotparseNextElement=False
for iii in range(1, len(sys.argv)):
# special case of parameter in some elements
if NotparseNextElement==True:
NotparseNextElement = False
continue
debug.verbose("parse [" + str(iii) + "]=" + sys.argv[iii])
argument = sys.argv[iii]
optionList = argument.split("=")
debug.verbose(str(optionList))
if type(optionList) == type(str()):
option = optionList
else:
option = optionList[0]
optionParam = argument[len(option)+1:]
debug.verbose(option)
argumentFound=False;
if option[:2]=="--":
# big argument
for prop in self.listProperties:
if prop.get_option_big()=="":
continue
if prop.get_option_big() == option[2:]:
# find it
debug.verbose("find argument 2 : " + option[2:])
if prop.need_parameters()==True:
internalSub = option[2+len(prop.get_option_big()):]
if len(internalSub)!=0:
if len(optionParam)!=0:
# wrong argument ...
debug.warning("maybe wrong argument for : '" + prop.get_option_big() + "' cmdLine='" + argument + "'")
prop.display()
continue
optionParam = internalSub
if len(optionParam)==0:
#Get the next parameters
if len(sys.argv) > iii+1:
optionParam = sys.argv[iii+1]
NotparseNextElement=True
else :
# missing arguments
debug.warning("parsing argument error : '" + prop.get_option_big() + "' Missing : subParameters ... cmdLine='" + argument + "'")
prop.display()
exit(-1)
if prop.check_availlable(optionParam)==False:
debug.warning("argument error : '" + prop.get_option_big() + "' SubParameters not availlable ... cmdLine='" + argument + "' option='" + optionParam + "'")
prop.display()
exit(-1)
listArgument.append(ArgElement(prop.get_option_big(),optionParam))
argumentFound = True
else:
if len(optionParam)!=0:
debug.warning("parsing argument error : '" + prop.get_option_big() + "' need no subParameters : '" + optionParam + "' cmdLine='" + argument + "'")
prop.display()
listArgument.append(ArgElement(prop.get_option_big()))
argumentFound = True
break;
if False==argumentFound:
debug.error("UNKNOW argument : '" + argument + "'")
elif option[:1]=="-":
# small argument
for prop in self.listProperties:
if prop.get_option_small()=="":
continue
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
# find it
debug.verbose("find argument 1 : " + option[1:1+len(prop.get_option_small())])
if prop.need_parameters()==True:
internalSub = option[1+len(prop.get_option_small()):]
if len(internalSub)!=0:
if len(optionParam)!=0:
# wrong argument ...
debug.warning("maybe wrong argument for : '" + prop.get_option_big() + "' cmdLine='" + argument + "'")
prop.display()
continue
optionParam = internalSub
if len(optionParam)==0:
#Get the next parameters
if len(sys.argv) > iii+1:
optionParam = sys.argv[iii+1]
NotparseNextElement=True
else :
# missing arguments
debug.warning("parsing argument error : '" + prop.get_option_big() + "' Missing : subParameters cmdLine='" + argument + "'")
prop.display()
exit(-1)
if prop.check_availlable(optionParam)==False:
debug.warning("argument error : '" + prop.get_option_big() + "' SubParameters not availlable ... cmdLine='" + argument + "' option='" + optionParam + "'")
prop.display()
exit(-1)
listArgument.append(ArgElement(prop.get_option_big(),optionParam))
argumentFound = True
else:
if len(optionParam)!=0:
debug.warning("parsing argument error : '" + prop.get_option_big() + "' need no subParameters : '" + optionParam + "' cmdLine='" + argument + "'")
prop.display()
listArgument.append(ArgElement(prop.get_option_big()))
argumentFound = True
break;
if argumentFound==False:
#unknow element ... ==> just add in the list ...
debug.verbose("unknow argument : " + argument)
listArgument.append(ArgElement("", argument))
#for argument in listArgument:
# argument.display()
#exit(0)
return listArgument;
def display(self):
print("usage:")
listOfPropertiesArg = "";
for element in self.listProperties :
listOfPropertiesArg += element.get_porperties()
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
for element in self.listProperties :
element.display()

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import sys
import os
@@ -13,7 +13,7 @@ import inspect
import fnmatch
import datetime
# Local import
from . import debug
from realog import debug
from . import heritage
from . import env
@@ -27,9 +27,13 @@ from . import env
builder_list=[]
__start_builder_name="Builder_"
##
## @brief Import all File that start with env.get_build_system_base_name() + __start_builder_name + XXX and register in the list of Builder
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
##
def import_path(path_list):
global builder_list
gld_base = env.get_gld_build_system_base_name()
global_base = env.get_build_system_base_name()
debug.debug("BUILDER: Init with Files list:")
for elem in path_list:
@@ -40,24 +44,36 @@ def import_path(path_list):
filename = filename[:-3]
base_file_name = filename
# Remove global base name:
filename = filename[len(global_base):]
# Check if it start with the local patern:
if filename[:len(__start_builder_name)] != __start_builder_name:
debug.extreme_verbose("BUILDER: Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
if filename[:len(gld_base)] == gld_base:
filename = filename[len(gld_base):]
# Check if it start with the local patern:
if filename[:len(__start_builder_name)] != __start_builder_name:
debug.extreme_verbose("BUILDER: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
continue
# Remove local patern
builder_name = filename[len(__start_builder_name):]
debug.verbose("BUILDER: Integrate: '" + builder_name + "' from '" + elem + "'")
the_builder = __import__(base_file_name)
builder_list.append({"name":builder_name,
"element":the_builder
})
debug.debug('BUILDER: type=' + the_builder.get_type() + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
elif filename[:len(global_base)] == global_base:
filename = filename[len(global_base):]
# Check if it start with the local patern:
if filename[:len(__start_builder_name)] != __start_builder_name:
debug.extreme_verbose("BUILDER: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
# Remove local patern
builder_name = filename[len(__start_builder_name):]
debug.verbose("BUILDER: Integrate: '" + builder_name + "' from '" + elem + "'")
the_builder = __import__(base_file_name)
builder_list.append({"name":builder_name,
"order":the_builder.get_order(),
"element":the_builder
})
debug.debug('BUILDER: type=' + the_builder.get_type() + " order=" + str(the_builder.get_order()) + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
debug.verbose("List of BUILDER: ")
for elem in builder_list:
debug.verbose(" " + str(elem["name"]))
# we must have call all import before ...
##
## @brief All builder are common (no target or comilator dependency). We need to load all of them when start lutin
##
def init():
global builder_list
debug.debug('BUILDER: Initialize all ...')
@@ -65,6 +81,10 @@ def init():
if element["element"] != None:
element["element"].init()
##
## @brief Get a builder tool with specifying the input type (like cpp, S ...)
## @param[in] input_type (string) extension file that can be compile
##
def get_builder(input_type):
global builder_list
for element in builder_list:
@@ -74,14 +94,66 @@ def get_builder(input_type):
# we can not find the builder ...
debug.error("Can not find builder for type : '" + str(input_type) + "'")
raise ValueError('type error :' + str(input_type))
##
## @brief Get a builder tool with his name
## @param[in] name (string) name of the builder
##
def get_builder_named(name):
global builder_list
for element in builder_list:
if element["name"] == name:
return element["element"]
# we can not find the builder ...
debug.error("Can not find builder for type : '" + str(input_type) + "'")
raise ValueError('type error :' + str(input_type))
##
## @brief get all the builder with extension to detect automaticly mode to compile
## @return a map with the key name of the builder, and a table of extension files
##
def get_full_builder_extention():
global builder_list
out = {};
for element in builder_list:
if element["element"] != None:
out[element["name"]] = element["element"].get_input_type();
return out;
def get_builder_with_output(input_type):
##
## @brief get all the builder in the common order build
## @return a list with the ordered builder names
##
def get_ordered_builder_list():
global builder_list
table = {};
for element in builder_list:
table[element["order"]] = element["name"];
out = []
for key in sorted(table.keys()):
out.append(table[key]);
debug.extreme_verbose("builder ordered=" + str(table));
debug.extreme_verbose(" ==> " + str(out));
return out;
def find_builder_with_input_extention(extension):
extention_map = get_full_builder_extention();
for builder_name in get_ordered_builder_list():
debug.extreme_verbose("builder_name: " + str(extension) + " in " + str(extention_map[builder_name]));
if extension in extention_map[builder_name]:
return builder_name;
debug.warning("does not find the builder: for extension: " + str(extension))
return "?";
##
## @brief Get a builder tool with specifying the output type (like .exe, .jar ...)
## @param[in] input_type (string) extension file that can be generated
##
def get_builder_with_output(output_type):
global builder_list
for element in builder_list:
if element["element"] != None:
if input_type in element["element"].get_output_type():
if output_type in element["element"].get_output_type():
return element["element"]
# we can not find the builder ...
debug.error("Can not find builder for type : '" + str(input_type) + "'")
raise ValueError('type error :' + str(input_type))
debug.error("Can not find builder for type : '" + str(output_type) + "'")
raise ValueError('type error :' + str(output_type))

View File

@@ -1,187 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os
import threading
import re
debug_level=3
debug_color=False
color_default= ""
color_red = ""
color_green = ""
color_yellow = ""
color_blue = ""
color_purple = ""
color_cyan = ""
debug_lock = threading.Lock()
def set_level(id):
global debug_level
debug_level = id
#print "SetDebug level at " + str(debug_level)
def get_level():
global debug_level
return debug_level
def enable_color():
global debug_color
debug_color = True
global color_default
color_default= "\033[00m"
global color_red
color_red = "\033[31m"
global color_green
color_green = "\033[32m"
global color_yellow
color_yellow = "\033[33m"
global color_blue
color_blue = "\033[01;34m"
global color_purple
color_purple = "\033[35m"
global color_cyan
color_cyan = "\033[36m"
def disable_color():
global debug_color
debug_color = True
global color_default
color_default= ""
global color_red
color_red = ""
global color_green
color_green = ""
global color_yellow
color_yellow = ""
global color_blue
color_blue = ""
global color_purple
color_purple = ""
global color_cyan
color_cyan = ""
def extreme_verbose(input, force=False):
global debug_lock
global debug_level
if debug_level >= 6 \
or force == True:
debug_lock.acquire()
print(color_blue + input + color_default)
debug_lock.release()
def verbose(input, force=False):
global debug_lock
global debug_level
if debug_level >= 5 \
or force == True:
debug_lock.acquire()
print(color_blue + input + color_default)
debug_lock.release()
def debug(input, force=False):
global debug_lock
global debug_level
if debug_level >= 4 \
or force == True:
debug_lock.acquire()
print(color_green + input + color_default)
debug_lock.release()
def info(input, force=False):
global debug_lock
global debug_level
if debug_level >= 3 \
or force == True:
debug_lock.acquire()
print(input + color_default)
debug_lock.release()
def warning(input, force=False):
global debug_lock
global debug_level
if debug_level >= 2 \
or force == True:
debug_lock.acquire()
print(color_purple + "[WARNING] " + input + color_default)
debug_lock.release()
def todo(input, force=False):
global debug_lock
global debug_level
if debug_level >= 3 \
or force == True:
debug_lock.acquire()
print(color_purple + "[TODO] " + input + color_default)
debug_lock.release()
def error(input, thread_id=-1, force=False, crash=True):
global debug_lock
global debug_level
if debug_level >= 1 \
or force == True:
debug_lock.acquire()
print(color_red + "[ERROR] " + input + color_default)
debug_lock.release()
if crash == True:
from . import multiprocess
multiprocess.set_error_occured()
if thread_id != -1:
threading.interrupt_main()
exit(-1)
#os_exit(-1)
#raise "error happend"
def print_element(type, lib, dir, name, force=False):
global debug_lock
global debug_level
if debug_level >= 3 \
or force == True:
debug_lock.acquire()
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
debug_lock.release()
def print_compilator(myString):
global debug_color
global debug_lock
if debug_color == True:
myString = myString.replace('\\n', '\n')
myString = myString.replace('\\t', '\t')
myString = myString.replace('error:', color_red+'error:'+color_default)
myString = myString.replace('warning:', color_purple+'warning:'+color_default)
myString = myString.replace('note:', color_green+'note:'+color_default)
myString = re.sub(r'([/\w_-]+\.\w+):', r'-COLORIN-\1-COLOROUT-:', myString)
myString = myString.replace('-COLORIN-', color_yellow)
myString = myString.replace('-COLOROUT-', color_default)
debug_lock.acquire()
print(myString)
debug_lock.release()
def get_color_set() :
global color_default
global color_red
global color_green
global color_yellow
global color_blue
global color_purple
global color_cyan
return {
"default": color_default,
"red": color_red,
"green": color_green,
"yellow": color_yellow,
"blue": color_blue,
"purple": color_purple,
"cyan": color_cyan,
}

View File

@@ -5,11 +5,11 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import os
# Local import
from . import debug
from realog import debug
from . import env
def _create_directory_of_file(file):
@@ -41,6 +41,11 @@ def _file_read_data(path, binary=False):
file.close()
return data_file
##
## @brief Creata a dependency file with a list of files
## @param[in] depend_file (string) filename to store a dependency data
## @param[in] list_files ([string,...]) List of file that depend the current element
##
def create_dependency_file(depend_file, list_files):
data = ""
for elem in list_files:
@@ -48,6 +53,16 @@ def create_dependency_file(depend_file, list_files):
_create_directory_of_file(depend_file)
_file_write_data(depend_file, data)
##
## @brief Check if all dependency of a file and dependency file is correct or not
## @param[in] dst (string) File that will be generated
## @param[in] src (string) Source File needed to generate the 'dst'
## @param[in] depend_file (string) Dependency file that contain all file that the src depending
## @param[in] file_cmd (string) Filename of where is store the cmdline to generate the 'dst'
## @param[in] cmd_line (string) Command line that will be use to generate the 'dst'
## @param[in] force_identical (string) for copy file this check if the src and dst are identical
## @return (bool) True: something change ==> need to rebuild, False otherwise
##
def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_identical=False):
debug.extreme_verbose("Request check of dependency of :")
debug.extreme_verbose(" dst='" + str(dst) + "'")
@@ -57,14 +72,14 @@ def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_id
debug.extreme_verbose(" force_identical='" + str(force_identical) + "'")
# if force mode selected ==> just force rebuild ...
if env.get_force_mode():
debug.extreme_verbose(" ==> must rebuild (force mode)")
debug.verbose(" ==> must rebuild (force mode)")
return True
# check if the destination existed:
if dst != "" \
and dst != None \
and os.path.exists(dst) == False:
debug.extreme_verbose(" ==> must rebuild (dst does not exist)")
debug.verbose(" ==> must rebuild (dst does not exist)")
return True
if src != "" \
and src != None \
@@ -77,25 +92,25 @@ def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_id
and src != "" \
and src != None \
and os.path.getmtime(src) > os.path.getmtime(dst):
debug.extreme_verbose(" ==> must rebuild (source time greater)")
debug.verbose(" ==> must rebuild (source time greater)")
return True
if depend_file != "" \
and depend_file != None \
and os.path.exists(depend_file) == False:
debug.extreme_verbose(" ==> must rebuild (no depending file)")
debug.verbose(" ==> must rebuild (no depending file)")
return True
if file_cmd != "" \
and file_cmd != None:
if os.path.exists(file_cmd) == False:
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
debug.verbose(" ==> must rebuild (no commandLine file)")
return True
# check if the 2 cmd_line are similar :
file2 = open(file_cmd, "r")
first_and_unique_line = file2.read()
if first_and_unique_line != cmd_line:
debug.extreme_verbose(" ==> must rebuild (cmd_lines are not identical)")
debug.verbose(" ==> must rebuild (cmd_lines are not identical)")
debug.extreme_verbose(" ==> '" + cmd_line + "'")
debug.extreme_verbose(" ==> '" + first_and_unique_line + "'")
file2.close()
@@ -109,56 +124,65 @@ def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_id
file = open(depend_file, "r")
for cur_line in file.readlines():
# normal file : end with : ": \\n"
cur_line = cur_line[:len(cur_line)-1]
cur_line_data = cur_line[:len(cur_line)-1]
# removing last \ ...
if cur_line[len(cur_line)-1:] == '\\' :
cur_line = cur_line[:len(cur_line)-1]
if cur_line_data[len(cur_line_data)-1:] == '\\' :
cur_line_data = cur_line_data[:len(cur_line_data)-1]
# remove white space :
#debug.verbose(" Line (read) : '" + cur_line + "'");
cur_line = cur_line.strip()
cur_line_data = cur_line_data.strip()
#debug.verbose(" Line (strip) : '" + cur_line + "'");
test_file=""
if cur_line[len(cur_line)-1:] == ':':
debug.extreme_verbose(" Line (no check (already done) : '" + cur_line + "'");
elif len(cur_line) == 0 \
or cur_line == '\\':
debug.extreme_verbose(" Line (Not parsed) : '" + cur_line + "'");
else:
test_file = cur_line
debug.extreme_verbose(" Line (might check) : '" + test_file + "'");
# really check files:
if test_file != "":
debug.extreme_verbose(" ==> test");
if False==os.path.exists(test_file):
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
file.close()
return True
if os.path.getmtime(test_file) > os.path.getmtime(dst):
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
file.close()
return True
for cur_line in cur_line_data.split(" "):
test_file=""
if cur_line[len(cur_line)-1:] == ':':
debug.extreme_verbose(" Line (no check (already done) : '" + cur_line + "'");
elif len(cur_line) == 0 \
or cur_line == '\\':
debug.extreme_verbose(" Line (Not parsed) : '" + cur_line + "'");
else:
test_file = cur_line
debug.extreme_verbose(" Line (might check) : '" + test_file + "'");
# really check files:
if test_file != "":
debug.extreme_verbose(" ==> test");
if False==os.path.exists(test_file):
debug.verbose(" ==> must rebuild (a dependency file does not exist) " + str(test_file))
file.close()
return True
if os.path.getmtime(test_file) > os.path.getmtime(dst):
debug.verbose(" ==> must rebuild (a dependency file time is newer)" + str(test_file))
file.close()
return True
# close the current file :
file.close()
# check the 2 files are identical:
if force_identical == True:
# check if the 2 cmd_line are similar :
# check if the 2 cmd_line are similar:
size_src = _file_size(src)
size_dst = _file_size(dst)
if size_src != size_dst:
debug.extreme_verbose(" Force Rewrite not the same size size_src=" + str(size_src) + " != size_dest=" + str(size_dst))
debug.info(" Force Rewrite not the same size size_src=" + str(size_src) + " != size_dest=" + str(size_dst))
return True
data_src = _file_read_data(src, binary=True)
data_dst = _file_read_data(dst, binary=True)
if data_src != data_dst:
debug.extreme_verbose(" Force Rewrite not the same data")
debug.info(" Force Rewrite not the same data")
return True
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
return False
##
## @brief
## @param[in] dst (string) File that will be generated
## @param[in] src_list ([string,...]) Source file list needed to generate the 'dst'
## @param[in] must_have_src (bool) All sources must be present
## @param[in] file_cmd (string) Filename of where is store the cmdline to generate the 'dst'
## @param[in] cmd_line (string) Command line that will be use to generate the 'dst'
## @return (bool) True: Need to regenerate the package, False otherwise
##
def need_re_package(dst, src_list, must_have_src, file_cmd="", cmd_line=""):
debug.extreme_verbose("Request check of dependency of :")
debug.extreme_verbose(" dst='" + str(dst) + "'")

View File

@@ -5,11 +5,11 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
# Local import
from . import debug
from realog import debug
@@ -86,6 +86,12 @@ def get_build_system_base_name():
global build_system_base_name
return build_system_base_name
gld_build_system_base_name = "GLD"
def get_gld_build_system_base_name():
global gld_build_system_base_name
return gld_build_system_base_name
print_pretty_mode=False
@@ -112,6 +118,29 @@ def get_warning_mode():
global store_warning
return store_warning
ccache=False;
def set_ccache(val):
global ccache;
if val == True:
ccache = True;
else:
ccache = False;
def get_ccache():
global ccache;
return ccache;
async_fail=False
def set_async_fail(val):
global async_fail;
if val == True:
async_fail = True;
else:
async_fail = False;
def get_async_fail():
global async_fail;
return async_fail;
def end_with(name, list):
for appl in list:

View File

@@ -5,12 +5,12 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import sys
import copy
# Local import
from . import debug
from realog import debug
def append_to_list(list_out, elem):
@@ -93,6 +93,7 @@ class HeritageList:
debug.extreme_verbose(" add: " + str(herit.name))
listHeritage.remove(herit)
self.list_heritage.append(copy.deepcopy(herit))
# check if nothing is include in heritage...
if currentHeritageSize == len(listHeritage):
debug.warning("Not resolve dependency between the library ==> can be a cyclic dependency !!!")
for herit in listHeritage:
@@ -151,8 +152,16 @@ class HeritageList:
self.path[ppp].append(iii)
debug.extreme_verbose("Path : " + str(self.path))
##
## @brief Generate a string representing the class (for str(xxx))
## @param[in] self (handle) Class handle
## @return (string) string of str() convertion
##
def __repr__(self):
return "{HeritageList:" + str(self.list_heritage) + "}"
dep = []
for elem in reversed(self.list_heritage):
dep.append(str(elem.name))
return "{HeritageList: " + str(dep) + "}"
class heritage:
def __init__(self, module, target):
@@ -169,19 +178,19 @@ class heritage:
self.path = {}
self.include = ""
# update is set at true when data are newly created ==> force upper element to update
self.hasBeenUpdated=False
self.has_been_updated=False
if type(module) != type(None):
# all the parameter that the upper classe need when build
self.name = module.name
self.depends = copy.deepcopy(module.depends)
self.name = module.get_name()
self.depends = copy.deepcopy(module.get_depends())
# keep reference because the flags can change in time
self.flags = module.flags["export"] # have no deep copy here is a feature ...
self.path = copy.deepcopy(module.path["export"])
self.flags = module._flags["export"] # have no deep copy here is a feature ...
self.path = copy.deepcopy(module._path["export"])
# if the user install some header ==> they will ba autoamaticaly exported ...
if target != None:
if len(module.header) > 0:
self.include = target.get_build_path_include(module.name)
if len(module._header) > 0:
self.include = target.get_build_path_include(module.get_name())
def add_depends(self, elements):
self.depends.append(elements)
@@ -218,14 +227,14 @@ class heritage:
self.path['c'].append(self.include)
def need_update(self, list):
self.hasBeenUpdated=True
self.has_been_updated=True
def add_sub(self, other):
if type(other) == type(None):
debug.verbose("input of the heriatege class is None !!!")
return
if other.hasBeenUpdated == True:
self.hasBeenUpdated = True
if other.has_been_updated == True:
self.has_been_updated = True
for flags in other.flags:
value = other.flags[flags]
if flags not in self.flags:
@@ -247,7 +256,11 @@ class heritage:
ver = self.flags["c++-version"]
self.flags["c++-version"] = ver
##
## @brief Generate a string representing the class (for str(xxx))
## @param[in] self (handle) Class handle
## @return (string) string of str() convertion
##
def __repr__(self):
return "{Heritage:" + str(self.name) + " ... }"
return "{Heritage:" + str(self.name) + " depend on: " + str(reversed(self.depends)) + " ... }"

View File

@@ -5,20 +5,23 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import platform
import sys
# Local import
from . import debug
from realog import debug
# print os.name # ==> 'posix'
if platform.system() == "Linux":
OS = "Linux"
HOST_DEFAULT_COMPILATOR = "gcc"
elif platform.system() == "Windows":
OS = "Windows"
HOST_DEFAULT_COMPILATOR = "gcc"
elif platform.system() == "Darwin":
OS = "MacOs"
HOST_DEFAULT_COMPILATOR = "clang"
else:
debug.error("Unknow the Host OS ... '" + platform.system() + "'")

View File

@@ -5,12 +5,12 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import platform
import os
# Local import
from . import debug
from realog import debug
from . import tools
from . import multiprocess
from . import depend
@@ -25,12 +25,25 @@ except:
enable_resize_image = False
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
##
## @brief Generate the upper pow 2 of the size in parameter
## @param[in] size (int) Size that might heve the upper pow(2)
## @return the new size in pow(2)
##
def get_pow_2_multiple(size):
base = 2
while size>base:
base = base * 2
return base
##
## @brief Resize an image
## @param[in] src_file (string) Path of the source image file
## @param[in] dest_file (string) Path out the destination image file
## @param[in] x (int) Width of the image
## @param[in] y (int) Height of the image
## @param[in] cmd_file (string) Filename of where is store the cmdline to generate the 'dst'
##
# TODO : 3 things to do :
# check if force requested
# check if time change

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
license_base = {
@@ -14,7 +14,7 @@ license_base = {
"contaminate-static":False,
"contaminate-dynamic":False,
"redistribute-source":False,
"title":"APACHE v2.0 license",
"title":"MPL v2.0 license",
"licence-file":"licence/apache-2.txt"
},
"GPL-2": {
@@ -88,7 +88,31 @@ license_base = {
"redistribute-source":False,
"title":"PNG License",
"licence-file":"licence/png.txt"
}
},
"MPL-1": {
"generic":True,
"contaminate-static":False,
"contaminate-dynamic":False,
"redistribute-source":True,
"title":"MPL: Mozilla Public Licence v1.0",
"licence-file":"licence/MPL-1.txt"
},
"MPL-1.1": {
"generic":True,
"contaminate-static":False,
"contaminate-dynamic":False,
"redistribute-source":True,
"title":"MPL: Mozilla Public Licence v1.1",
"licence-file":"licence/MPL-1.1.txt"
},
"MPL-2": {
"generic":True,
"contaminate-static":False,
"contaminate-dynamic":False,
"redistribute-source":True,
"title":"MPL: Mozilla Public Licence v2.0",
"licence-file":"licence/MPL-2.txt"
},
}
def get_basic_list():

85
lutin/macro.py Normal file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
import sys
import os
import inspect
import fnmatch
import datetime
# Local import
from realog import debug
from . import tools
from . import env
__macro_list=[]
__start_macro_name="Macro_"
##
## @brief Import all File that start with env.get_build_system_base_name() + __start_macro_name + XXX and register in the list of Target
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
##
def import_path(path_list):
global __macro_list
gld_base = env.get_gld_build_system_base_name()
global_base = env.get_build_system_base_name()
debug.debug("TARGET: Init with Files list:")
for elem in path_list:
sys.path.append(os.path.dirname(elem))
# Get file name:
filename = os.path.basename(elem)
# Remove .py at the end:
filename = filename[:-3]
# Remove global base name:
if filename[:len(gld_base)] == gld_base:
filename = filename[len(gld_base):]
# Check if it start with the local patern:
if filename[:len(__start_macro_name)] != __start_macro_name:
debug.extreme_verbose("MACRO: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
continue
elif filename[:len(global_base)] == global_base:
filename = filename[len(global_base):]
# Check if it start with the local patern:
if filename[:len(__start_macro_name)] != __start_macro_name:
debug.extreme_verbose("MACRO: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
# Remove local patern
target_name = filename[len(__start_macro_name):]
debug.verbose("MACRO: Integrate: '" + target_name + "' from '" + elem + "'")
__macro_list.append([target_name, elem])
debug.verbose("New list MACRO: ")
for elem in __macro_list:
debug.verbose(" " + str(elem[0]))
##
## @brief Load a specific target
##
def load_macro(name):
global __macro_list
debug.debug("load macro: " + name)
if len(__macro_list) == 0:
debug.error("No macro to compile !!!")
debug.debug("list macro: " + str(__macro_list))
for mod in __macro_list:
if mod[0] == name:
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
sys.path.append(os.path.dirname(mod[1]))
debug.verbose("import macro : '" + env.get_build_system_base_name() + __start_macro_name + name + "'")
the_macro = __import__(env.get_build_system_base_name() + __start_macro_name + name)
return the_macro
raise KeyError("No entry for : " + name)
def list_all_macro():
global __macro_list
tmp_list_name = []
for mod in __macro_list:
tmp_list_name.append(mod[0])
return tmp_list_name

File diff suppressed because it is too large Load Diff

770
lutin/moduleGLD.py Normal file
View File

@@ -0,0 +1,770 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
import sys
import os
import copy
import inspect
import fnmatch
import json
# Local import
from . import host
from . import tools
from realog import debug
from . import heritage
from . import builder
from . import multiprocess
from . import image
from . import module
from . import license
from . import env
from warnings import catch_warnings
from xmlrpc.client import boolean
def get_module_type_availlable():
return [
'BINARY',
'BINARY_DYNAMIC',
'BINARY_STAND_ALONE',
'LIBRARY',
'LIBRARY_HEADER_ONLY',
'LIBRARY_DYNAMIC',
'LIBRARY_STATIC',
'PACKAGE',
'PREBUILD',
'DATA'
]
list_of_property_module=[
"type",
"sub-type",
"group-id",
"description",
"license",
"license-file",
"author",
"maintainer",
"version",
"version-id",
"code-quality",
"visibility-map",
"header-install-mode",
"package" # package is for specifie some right in LUTIN
];
list_of_element_ignored=[
"comment", # just to post a comment in the configuration files
"todo", # just to post a todo in the configuration files
];
list_of_element_availlable=[
"source",
"header",
"path",
"compilation-version",
"dependency",
"copy",
"flag",
"flag-export",
"compiler",
"mode",
"target",
"arch",
"bus-size", # todo
"sanity-compilation", # todo "isolate", "intricate", "*" permit to specify element to copy for the isolation mode. intricate is for current mode where everything is mixed together ...
"compilator"
];
"""
{
"type":"LIBRARY",
"group-id":"com.atria-soft",
"description":"Ewol tool kit (base: container)",
"license":"MPL-2",
"license-file":"file://license.txt",
"maintainer":"Edouard DUPIN <yui.heero@gmail.com>",
"author":"file://../authors.txt",
"version":"1.5.3",
"__version":"file://../version.txt",
"code-quality":"MEDIUM",
"mode": {
"*": {
"target": {
"*": {
"arch": {
"*": {},
}
},
},
"arch": {}
},
"release": {
},
"debug": {
}
},
"source": [
{
"source":"xxx/plop.cpp",
"flag":[
...
]
},
"xxx/Yyy.cpp",
"xxx/YuyTer.cpp"
"xxx/plouf.java"
],
"source": { # this is the canocical mode ==> mermit to separate the language, otherwise this is auto-detection mode ...
"*": [
...
],
"c": [
...
],
"c++": [
...
],
"nasm": [
...
],
"java": [
...
],
"javah": [
...
] ...
},
"visibility-map": "libbsd/src/libbsd.map", # for application that need to control the visibility of the exports: -Wl,--version-script=/src/libbsd.map"
"header-install-mode": "AFTER", # or "BEFORE"<< default is before ==> better to isolate the include folder...
"header": [
"xxx/Yyy.hpp",
"xxx/YuyTer.hpp"
],
"header": { # this is the canocical mode ==> mermit to separate the language, otherwise this is auto-detection mode ...
"c": [
"xxx/Yyy.hpp",
"xxx/YuyTer.hpp"
]
},
"path":[
"."
],
"compilation-version": {
"c++": 2017, # -2017 for gnu17
"java": 16
},
"dependency": [
"c",
"m",
"pthread"
],
"copy":[
...
];
"mode": {
"*": {
},
"debug": {
},
"release": {
},
"coverage": {
}
},
"target": {
"*": {
},
"Android": {
"dependency": [
"SDK"
]
},
"MacOs": {
"dependency": [
"cxx"
]
},
"Windows": {
},
"Linux": {
"dependency": [
{
"name": "X11",
"optional": true,
"export": false,
"source": [
"gale/context/X11/Context.cpp"
],
"flag": {
"c++": "-DGALE_BUILD_X11"
},
"missing-flag": {
"c++": "-DGALE_DOES_NOT_BUILD_X11"
}
},
},
"Debian": { ## Debian/Ubuntu/Suze/RedHat/ArchLinux/Gento ... heritate from linux ...
},
"IOs": {
},
"Web": {
},
"MacOs|IOs": {
},
"comment": "For all element expect IOS and Android",
"!Android&!IOs": {
},
}
"flag": {
"c++": "-DGALE_BUILD_X11",
"c": [
"-DAPPL_VERSION={{{project.version}}}",
"-DAPPL_NAME={{{project.name}}}",
"-DAPPL_TYPE={{{project.type}}}",
"-DAPPL_PATH={{{project.path}}}"
]
},
"arch": {
"x86": {
},
"arm": {
},
"ppc": {
}
"misc": {
}
},
"bus-size": {
"*": {
},
"8": {
},
"16": {
},
"32": {
},
"64": {
},
"128": {
}
},
"compilator": {
"*": {
},
"gcc": {
},
"clang": {
},
"mingw": {
},
"msvc": {
},
"intel": {
}
},
"sanity-compilation": {
"*": {
},
"isolate": {
},
"intricate": {
}
},
"instruction-set":{
not present right now... :the instruction mode available...:
}
#### TODO: later
"import": [
"GDSFGH.json" ## import an other file to have generic definitions ...
]
}
get_compilator
get_mode
get_arch
"""
def check_compatible(mode, value, list_to_check, json_path):
if value == "":
debug.debug("the <" + mode + ">: condition '" + str(value) + "' empty element >> " + json_path);
return False;
if value == "*":
return True;
find_a_valid_key = False;
debug.verbose("Depact: " + value);
# fist step ==> split in the | value ==> multiple check cases
for elemOR in value.split("|"):
debug.verbose(" |: " + elemOR);
# check the condition is True:
condition = True;
if elemOR == "" or elemOR == " " or elemOR == "\t":
debug.warning("the <" + mode + ">: condition '" + str(value) + "' is not supported must not have ' ' or '\\t' or empty element >> " + json_path);
return False;
for elemAND in elemOR.split("&"):
debug.verbose(" &: " + elemAND);
if elemAND == "" or elemAND == " " or elemAND == "\t":
debug.warning("the <" + mode + ">: condition '" + str(value) + "' is not supported must not have ' ' or '\\t' or empty element >> " + json_path);
return False;
invert_condition = False;
if elemAND[0] == "!":
debug.verbose(" ==> invert condition");
invert_condition = True;
elemAND = elemAND[1:]
if elemAND in list_to_check:
debug.verbose(" ==> detect condition OK");
if invert_condition:
condition = False;
debug.verbose(" FALSE");
break;
else:
debug.verbose(" TRUE");
continue;
if invert_condition:
debug.verbose(" TRUE");
continue;
else:
condition = False;
debug.verbose(" FALSE");
break;
if condition:
debug.verbose(" Detect OR condition at TRUE !!!!");
find_a_valid_key = True;
break;
if find_a_valid_key:
return True;
"""
if "|" in value:
debug.warning("in <" + mode + ">: '" + str(value) + " not managed '|' >> " + json_path);
return False;
if "&" in value:
debug.warning("in <" + mode + ">: '" + str(value) + " not managed '&' >> " + json_path);
return False;
if "!" in value:
debug.warning("in <" + mode + ">: '" + str(value) + " not managed '!' >> " + json_path);
return False;
if value in list_to_check or value == "*":
return True;
"""
debug.debug("the <" + mode + ">: '" + str(value) + "' is not compatible with '" + str(list_to_check) + "' >> " + json_path);
return False;
def replace_dynamic_tags(my_module, data):
out = data;
out = out.replace("{{{project.version}}}", tools.version_to_string(my_module.get_version()));
out = out.replace("{{{project.name}}}", my_module.get_name());
out = out.replace("{{{project.type}}}", my_module.get_type());
out = out.replace("{{{project.path}}}", my_module.get_origin_path());
out = out.replace("{{{quote}}}", "\\'");
out = out.replace("{{{quote2}}}", "\\\""); # "
return out;
def parse_node_arch(target, path, json_path, my_module, data):
for elem in data.keys():
if check_compatible("arch", elem, target.get_arch(), json_path):
parse_node_generic(target, path, json_path, my_module, data[elem]);
def parse_node_mode(target, path, json_path, my_module, data):
for elem in data.keys():
if check_compatible("mode", elem, target.get_mode(), json_path):
parse_node_generic(target, path, json_path, my_module, data[elem]);
def parse_node_platform(target, path, json_path, my_module, data):
for elem in data.keys():
if check_compatible("target", elem, target.get_type(), json_path):
parse_node_generic(target, path, json_path, my_module, data[elem]);
def parse_node_flag(target, path, json_path, my_module, data, export = False):
if type(data) != dict:
debug.error("Can not parseflag other than dictionnary in: " + str(json_path));
for elem in data.keys():
if type(data[elem]) == list:
tmp = []
for elenFlag in data[elem]:
tmp.append(replace_dynamic_tags(my_module, elenFlag));
my_module.add_flag(elem, tmp, export);
elif type(data[elem]) == str:
my_module.add_flag(elem, replace_dynamic_tags(my_module, data[elem]), export);
else:
debug.error("not manage list of flag other than string and list of string, but it is " + str(type(data[elem])) + " in: '" + str(json_path) + "' for: " + str(data));
def parse_node_header_dict(target, path, json_path, my_module, data, builder_name = None):
if "path" in data.keys() or "to" in data.keys() or "recursive" in data.keys() or "filter" in data.keys():
#{'path': 'thirdparty/src/', 'filter': '*.h', 'to': 'g3log'}
elem_path = "";
elem_to = "";
elem_recursive = True;
elem_filter = "*"
if "path" in data:
elem_path = data["path"];
if "to" in data:
elem_to = data["to"];
if "recursive" in data:
elem_recursive = data["recursive"];
if "filter" in data:
elem_filter = data["filter"];
if elem_path == "":
debug.error("header does not support type of dict: " + str(data) + " ==> missing 'path'")
my_module.add_header_path(elem_path, regex=elem_filter, clip_path=None, recursive=elem_recursive, destination_path=elem_to, builder_name=builder_name);
else:
for builder_key in data.keys():
my_module.add_header_file(data[builder_key], builder_name=builder_key);
def parse_node_header_list(target, path, json_path, my_module, data, builder_name = None):
for elem in data:
if type(elem) == list or type(elem) == str:
my_module.add_header_file(elem, builder_name = builder_name);
elif type(elem) == dict:
parse_node_header_dict(target, path, json_path, my_module, elem, builder_name);
else:
debug.error("headers does not manage other than string, list and object");
def parse_node_header(target, path, json_path, my_module, data, builder_name = None):
if type(data) == str:
my_module.add_header_file(data, builder_name = builder_name);
if type(data) == list:
parse_node_header_list(target, path, json_path, my_module, data, builder_name);
elif type(data) == dict:
parse_node_header_dict(target, path, json_path, my_module, data, builder_name);
else:
debug.error("Wrong type for node 'headers' [] or {}");
def parse_node_generic(target, path, json_path, my_module, data, first = False ):
for elem in data.keys():
if elem in list_of_property_module:
if first == True:
continue;
else:
debug.error("key: '" + elem + "' is NOT allowed at expect in the root node: " + json_path);
continue;
if elem in list_of_element_ignored:
continue;
if elem not in list_of_element_availlable:
debug.warning("key: '" + elem + "' is unknown: " + json_path);
debug.warning("Available List: " + str(list_of_element_ignored) + " or: " + str(list_of_element_availlable));
if "source" in data.keys():
if type(data["source"]) == str:
my_module.add_src_file(data["source"]);
elif type(data["source"]) == list:
my_module.add_src_file(data["source"]);
elif type(data["source"]) == dict:
for builder_key in data["source"].keys():
my_module.add_src_file(data["source"][builder_key], builder_name=builder_key);
else:
debug.error("'" + json_path + "'Wrong type for node 'source' [] or {} or string");
if "header" in data.keys():
parse_node_header(target, path, json_path, my_module, data["header"]);
if "path" in data.keys():
if type(data["path"]) == list:
my_module.add_path(data["path"]);
elif type(data["path"]) == dict:
for key in data["path"]:
my_module.add_path(data["path"][key], type = key);
else:
debug.error("Wrong type for node 'path' [] or {}");
if "dependency" in data.keys():
if type(data["dependency"]) == list:
for elem in data["dependency"]:
GLD_add_depend(my_module, elem);
elif type(data["dependency"]) == str:
GLD_add_depend(my_module, data["dependency"]);
elif type(data["dependency"]) == dict:
GLD_add_depend(my_module, data["dependency"]);
else:
debug.error("Wrong type for node 'dependency' [] or {} or \"\"");
if "compilation-version" in data.keys():
if type(data["compilation-version"]) == dict:
GLD_compile_version(my_module, data["compilation-version"]);
else:
debug.error("Wrong type for node 'compilation-version' {'??lang??':1234}");
if "copy" in data.keys():
if type(data["copy"]) == list:
for elem in data["copy"]:
GLD_copy(my_module, elem);
elif type(data["copy"]) == dict:
GLD_copy(my_module, data["copy"]);
else:
debug.error("Wrong type for node 'dependency' []");
if "arch" in data.keys():
parse_node_arch(target, path, json_path, my_module, data["arch"]);
if "target" in data.keys():
parse_node_platform(target, path, json_path, my_module, data["target"]);
if "mode" in data.keys():
parse_node_mode(target, path, json_path, my_module, data["mode"]);
if "flag" in data.keys():
parse_node_flag(target, path, json_path, my_module, data["flag"], False);
if "flag-export" in data.keys():
parse_node_flag(target, path, json_path, my_module, data["flag-export"], True);
def load_module_from_GLD(target, name, path, json_path):
debug.debug("Parse file: "+ json_path + "'");
try:
data = json.load(open(json_path,))
except json.decoder.JSONDecodeError as ex:
debug.error("Can not parse the file : "+ json_path + " Detect error as : " + str(ex));
property = get_module_option_GLD(path, data, name)
# create the module:
my_module = module.Module(json_path, name, property["type"])
# debug.warning("plopppp " + json.dumps(property, sort_keys=True, indent=4))
# overwrite some package default property (if not set by user)
if property["compagny-type"] != None:
my_module._pkg_set_if_default("COMPAGNY_TYPE", property["compagny-type"])
if property["compagny-name"] != None:
my_module._pkg_set_if_default("COMPAGNY_NAME", property["compagny-name"])
if property["maintainer"] != None:
my_module._pkg_set_if_default("MAINTAINER", property["maintainer"])
if property["name"] != None:
my_module._pkg_set_if_default("NAME", property["name"])
if property["description"] != None:
my_module._pkg_set_if_default("DESCRIPTION", property["description"])
if property["license"] != None:
my_module._pkg_set_if_default("LICENSE", property["license"])
if property["version"] != None:
my_module._pkg_set_if_default("VERSION", property["version"])
if "visibility-map" in data.keys():
if type(data["visibility-map"]) == str:
my_module.set_visibility_map(data["visibility-map"]);
else:
debug.warning("can not support for element: 'visibility-map' must be a string (representing a file)");
if "header-install-mode" in data.keys():
if data["header-install-mode"] == "AFTER":
my_module.set_include_header_after(True);
elif data["header-install-mode"] == "BEFORE":
my_module.set_include_header_after(False);
else:
debug.warning("can not support for element: 'header-install-mode' other value than [BEFORE,AFTER]");
if "code-quality" in data.keys():
if data["code-quality"] in ["LOW","MEDIUM","HARD","PROFESSIONAL"]:
my_module.set_code_quality(data["code-quality"]);
else:
debug.warning("Does not support other level than [LOW, MEDIUM, HARD, PROFESSIONAL]");
# parsing all the file to configure:
parse_node_generic(target, path, json_path, my_module, data, True);
return my_module
def GLD_add_depend(my_module, data):
if type(data) == str:
my_module.add_depend(data);
elif type(data) == dict:
if "name" in data.keys():
name = data["name"];
else:
debug.error("Can not have dependency without name ...");
optional = False;
if "optional" in data.keys():
if type(data["optional"]) == boolean:
optional = data["optional"];
else:
debug.error("Can not have dependency 'optional' in an other type than boolean ...");
export = False;
if "export" in data.keys():
if type(data["export"]) == boolean:
optional = data["export"];
else:
debug.error("Can not have dependency 'export' in an other type than boolean ...");
flags_data = None;
if "flag" in data.keys():
for elem in data["flag"].keys():
flags_data = [elem, data["flag"][elem]]
missing_flags_data = None;
if "missing-flag" in data.keys():
if "language" in data["missing-flag"].keys() and "value" in data["missing-flag"].keys():
missing_flags_data = [data["missing-flag"]["language"], data["missing-flag"]["value"]]
else:
debug.error("Can not have dependency 'missing-flag' without value 'language' and 'value' ...");
src_file=[]
if "source" in data.keys():
if type(data["source"]) == list:
src_file = data["source"];
elif type(data["source"]) == str:
src_file = [ data["source"] ];
else:
debug.error("Can not have dependency 'source' in an other type than [] or string: '" + str(data["source"]) + "'");
header_file=[]
if "header" in data.keys():
if type(data["header"]) == list:
header_file = data["header"];
elif type(data["header"]) == str:
header_file = [ data["header"] ];
else:
debug.error("Can not have dependency 'header' in an other type than [] or string: '" + str(data["header"]) + "'");
compiler={}
if "compiler" in data.keys():
if type(data["compiler"]) == dict:
compiler = data["compiler"];
else:
debug.error("Can not have dependency 'compiler' in an other type than {}: '" + str(data["compiler"]) + "'");
if optional == False:
my_module.add_depend(name);
my_module.add_header_file(header_file);
my_module.add_src_file(src_file);
# TODO: add flags
else:
my_module.add_optionnal_depend(name, flags_data, export=export, compilation_flags_not_found = missing_flags_data, src_file=src_file, header_file=header_file)
else:
debug.error("dependency only support [ {} or string ]");
def GLD_compile_version(my_module, data):
for elem in data.keys():
if data[elem] < 0:
my_module.compile_version(elem, -data[elem], gnu=True)
else:
my_module.compile_version(elem, data[elem])
def GLD_copy(my_module, data):
try:
if type(data) == dict:
path_src = None;
file_src = None;
path_to = "";
group_folder = "in-shared";
recursive = False;
if "path" in data.keys():
path_src = data["path"];
if "group" in data.keys():
group_folder = data["group"];
if "file" in data.keys():
file_src = data["file"];
if "to" in data.keys():
path_to = data["to"];
if "recursive" in data.keys():
if type(data["recursive"]) == bool:
recursive = data["recursive"];
else:
debug.error("recursive is a boolean !!!");
if path_src == None and file_src == None:
debug.error("copy must at least have 'path' or 'file' !!!");
if path_src != None:
my_module.copy_path(path_src, path_to, group_folder=group_folder);
if file_src != None:
my_module.copy_file(file_src, path_to, group_folder=group_folder);
elif type(data) == str:
my_module.copy_file(data, "", group_folder=group_folder);
else:
debug.error("in module : " + my_module.get_name() + " not supported type for copy: " + type(data) + " string or object data=" + str(data));
except Exception as e:
debug.warning("in module : " + my_module.get_name());
raise e;
def get_module_option_GLD(path, data, name):
type = None;
if "type" in data.keys():
type = data["type"];
# TODO: check it is in a list ...
else:
debug.error(" the node 'type' must be provided in the module: " + name);
sub_type = None
if "sub-type" in data.keys():
sub_type = data["sub-type"];
compagny_type = None;
compagny_name = None;
group_id = None;
if "group-id" in data.keys():
compagny_name = data["group-id"];
group_id = data["group-id"];
description = None;
if "description" in data.keys():
description = data["description"];
license = None;
if "license" in data.keys():
license = data["license"];
license_file = None;
if "license-file" in data.keys():
license_file = data["license-file"];
maintainer = None;
if "author" in data.keys():
maintainer = tools.get_maintainer_from_file_or_direct(path, data["author"]);
version = None;
if "version" in data.keys():
version = tools.get_version_from_file_or_direct(path, data["version"]);
version_id = None;
if "version-id" in data.keys():
version_id = data["version-id"];
# check type property:
if type not in get_module_type_availlable():
debug.error("Does not support module type: '" + str(type) + "' not in " + str(get_module_type_availlable()) + " path: " + str(path));
list_sub_type = ["TEST", "SAMPLE", "TOOL", None];
if sub_type not in list_sub_type:
debug.error("Does not support module sub-type: '" + str(sub_type) + "' not in " + str(list_sub_type) + " path: " + str(path));
return {
"name":name,
"description":description,
"type":type,
"sub-type":sub_type,
"license":license,
"license-file":license_file,
"compagny-type":compagny_type,
"compagny-name":compagny_name,
"group-id":group_id,
"maintainer":maintainer,
"version":version,
"version-id":version_id,
}

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import sys
@@ -20,7 +20,7 @@ import os
import subprocess
import shlex
# Local import
from . import debug
from realog import debug
from . import tools
from . import env
from . import depend
@@ -55,11 +55,36 @@ def run_command_no_lock_out(cmd_line):
p = subprocess.Popen(args)
except subprocess.CalledProcessError as e:
debug.error("subprocess.CalledProcessError : " + str(args))
except:
debug.error("Exception on : " + str(args))
return
#except:
# debug.error("Exception on : " + str(args))
# launch the subprocess:
p.communicate()
def run_command_pwd(cmd_line, cwd):
# prepare command line:
args = shlex.split(cmd_line)
debug.verbose("cmd = " + str(args))
try:
# create the subprocess
"""
if cwd != None:
debug.info("path = " + cwd)
"""
p = subprocess.Popen(args, cwd=cwd);
except subprocess.CalledProcessError as e:
debug.error("subprocess.CalledProcessError : " + str(args))
except Exception as eee:
debug.warning("On : " + str(args))
debug.error("Exception: " + str(eee))
except:
print("Unexpected error:", sys.exc_info()[0])
raise
p.communicate();
# Check error :
return p.returncode
##
## @brief Execute the command and ruturn generate data
##
@@ -85,6 +110,7 @@ def run_command_direct(cmd_line):
return err[:-1];
return output[:-1];
else:
debug.warning("get an error cmd " + str(err))
return False
@@ -210,6 +236,10 @@ def set_error_occured():
global exit_flag
exit_flag = True
# set the debug system call us to stop threading
debug.set_callback_error(set_error_occured)
def set_core_number(number_of_core):
global processor_availlable
processor_availlable = number_of_core

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import sys
@@ -14,173 +14,318 @@ import inspect
import fnmatch
import datetime
# Local import
from . import debug
from realog import debug
from . import module
from . import tools
from . import env
##
## @brief System class represent the pre-build Module that are already install and accessible in the system environment
##
class System:
##
## @brief Constructor
## @param[in] self (handle) Class handle
## @return None
##
def __init__(self):
self.valid=False;
self.help="";
self.export_depends=[]
self.export_flags={}
self.export_src=[]
self.export_path=[]
self.action_on_state={}
self.headers=[]
self.version=None
self._valid=False;
self._help="";
self._export_depends=[]
self._export_flags={}
self._export_src=[]
self._export_path=[]
self._action_on_state={}
self._headers=[]
self._version=None
def add_export_sources(self, list):
tools.list_append_to(self.export_src, list)
##
## @brief Set the help of this system Module
## @param[in] self (handle) Class handle
## @param[in] help (string) Help for the user
## @return None
##
def set_help(self, help):
self._help = help;
##
## @brief Get the help of this system Module
## @param[in] self (handle) Class handle
## @return (string) Help for the user
##
def get_help(self):
return self._help;
##
## @brief Set validity state of the system Module
## @param[in] self (handle) Class handle
## @param[in] state (bool) New valididty state of the system module
## @return None
##
def set_valid(self, state):
self._valid = state
##
## @brief Get validity state of the system Module
## @param[in] self (handle) Class handle
## @return (bool) New valididty state of the system module
##
def get_valid(self):
return self._valid
##
## @brief Add source element
## @param[in] self (handle) Class handle
## @param[in] list ([string,...]) List of all Files to add. ex: *.a, *.so ...
## @return None
##
def add_sources(self, list):
tools.list_append_to(self._export_src, list)
##
## @brief Add include path of the sources
## @param[in] self (handle) Class handle
## @param[in] list ([string,...]) List of all path to add in the -I include element
## @return None
##
# todo : add other than C ...
def add_export_path(self, list):
tools.list_append_to(self.export_path, list)
def add_path(self, list):
tools.list_append_to(self._export_path, list)
def add_module_depend(self, list):
tools.list_append_to(self.export_depends, list, True)
##
## @brief Add a dependency on this module
## @param[in] self (handle) Class handle
## @param[in] list ([string,...] or string) Name(s) of the modules dependency
## @return None
##
def add_depend(self, list):
tools.list_append_to(self._export_depends, list, True)
def add_export_flag(self, type, list):
tools.list_append_to_2(self.export_flags, type, list)
##
## @brief Add compilation flags
## @param[in] self (handle) Class handle
## @param[in] type (string) inclusion group name 'c', 'c++', 'java' ...
## @param[in] list ([string,...] or string) List of path to include
## @return None
##
def add_flag(self, type, list):
tools.list_append_to_2(self._export_flags, type, list)
##
## @brief Set version of the module
## @param[in] self (handle) Class handle
## @param[in] version_list ([int,...]) Ids of the version. ex: [1,2,5] or [0,8,"dev"]
## @return None
##
def set_version(self, version_list):
self.version = version_list
self._version = version_list
## @copydoc lutin.module.Target.add_action
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
if name_of_state not in self.action_on_add_src_filestate:
self.action_on_state[name_of_state] = [[level, name, action]]
if name_of_state not in self._action_on_state:
self._action_on_state[name_of_state] = [[level, name, action]]
else:
self.action_on_state[name_of_state].append([level, name, action])
self._action_on_state[name_of_state].append([level, name, action])
## @copydoc lutin.module.Module.add_header_file
def add_header_file(self, list, destination_path=None, clip_path=None, recursive=False):
self.headers.append({
self._headers.append({
"list":list,
"dst":destination_path,
"clip":clip_path,
"recursive":recursive
})
##
## @brief Generate a string representing the class (for str(xxx))
## @param[in] self (handle) Class handle
## @return (string) string of str() convertion
##
def __repr__(self):
return "{lutin.System}"
##
## @brief Configure a module with internal datas
## @param[in] self (handle) Class handle
## @param[in] target (handle) @ref lutin.module.Target handle
## @param[in] module (handle) @ref lutin.module.Module handle
## @return None
##
def configure_module(self, target, module):
# add element flags to export
for elem in self._export_flags:
debug.verbose("add element :" + str(elem) + " elems=" + str(self._export_flags[elem]))
module.add_flag(elem, self._export_flags[elem], export=True)
# add module dependency
if self._export_depends != []:
module.add_depend(self._export_depends)
# add exporting sources
if self._export_src != []:
module.add_src_file(self._export_src)
# add export path
if self._export_path != []:
# no control on API
module._add_path(self._export_path, export=True)
# Export all actions ...
for elem in self._action_on_state:
level, name, action = self._action_on_state[elem]
target.add_action(elem, level, name, action)
for elem in self._headers:
module.add_header_file(
elem["list"],
destination_path=elem["dst"],
clip_path=elem["clip"],
recursive=elem["recursive"])
if self._version != None:
module.set_pkg("VERSION", self._version);
##
## @brief Create a @ref lutin.module.Module for the system list elements
## @param[in] target (handle) @ref lutin.target.Target handle
## @param[in] name (string) Name of the system module
##
def create_module_from_system(target, dict):
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD')
# 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])
# add module dependency
myModule.add_module_depend(dict["system"].export_depends)
# add exporting sources
myModule.add_src_file(dict["system"].export_src)
# add export path
myModule.add_export_path(dict["system"].export_path)
# Export all actions ...
for elem in dict["system"].action_on_state:
level, name, action = dict["system"].action_on_state[elem]
target.add_action(elem, level, name, action)
for elem in dict["system"].headers:
myModule.add_header_file(
elem["list"],
destination_path=elem["dst"],
clip_path=elem["clip"],
recursive=elem["recursive"])
if dict["system"].version != None:
myModule.package_prop["VERSION"] = dict["system"].version
return myModule
my_module = module.Module(dict["path"], dict["name"], 'PREBUILD')
dict["system"].configure_module(target, my_module)
return my_module
# Dictionnaire of Target name
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
system_list={}
__system_list={}
__start_system_name="System_"
##
## @brief Import all File that start with env.get_build_system_base_name() + __start_system_name + XXX and register in the list of System
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
##
def import_path(path_list):
global system_list
global __system_list
gld_base = env.get_gld_build_system_base_name()
global_base = env.get_build_system_base_name()
debug.debug("SYSTEM: Init with Files list:")
for elem in path_list:
sys.path.append(os.path.dirname(elem))
# Get file name:
filename = os.path.basename(elem)
# Remove .py at the end:
filename = filename[:-3]
# Remove global base name:
filename = filename[len(global_base):]
# Check if it start with the local patern:
if filename[:len(__start_system_name)] != __start_system_name:
debug.extreme_verbose("SYSTEM: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
if filename[:len(gld_base)] == gld_base:
filename = filename[len(gld_base):-5]
# Check if it start with the local patern:
if filename[:len(__start_system_name)] != __start_system_name:
debug.extreme_verbose("SYSTEM: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
continue
# Remove local patern
system_name = filename[len(__start_system_name):]
system_type, system_name = system_name.split('_')
debug.verbose("SYSTEM: Integrate: '" + system_type + "':'" + system_name + "' from '" + elem + "'")
if system_type in system_list:
system_list[system_type].append({"name":system_name,
"path":elem,
"system":None,
"loaded":False,
"exist":False,
"module":None})
else:
system_list[system_type] = [{"name":system_name,
"path":elem,
"system":None,
"loaded":False,
"exist":False,
"module":None}]
elif filename[:len(global_base)] == global_base:
filename = filename[len(global_base):-3]
# Check if it start with the local patern:
if filename[:len(__start_system_name)] != __start_system_name:
debug.extreme_verbose("SYSTEM: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
# Remove local patern
system_name = filename[len(__start_system_name):]
system_type, system_name = system_name.split('_')
debug.verbose("SYSTEM: Integrate: '" + system_type + "':'" + system_name + "' from '" + elem + "'")
if system_type in __system_list:
__system_list[system_type].append({"name":system_name,
"path":elem,
"system":None,
"loaded":False,
"exist":False,
"module":None})
else:
__system_list[system_type] = [{"name":system_name,
"path":elem,
"system":None,
"loaded":False,
"exist":False,
"module":None}]
debug.verbose("New list system: ")
for elem in system_list:
for elem in __system_list:
debug.verbose(" " + str(elem))
for val in system_list[elem]:
for val in __system_list[elem]:
debug.verbose(" " + str(val["name"]))
##
## @brief Display all the system binary that can be used
##
def display():
global system_list
for elementName in system_list:
global __system_list
for elementName in __system_list:
debug.info("SYSTEM: Integrate system: '" + elementName +"'")
for data in system_list[elementName]:
for data in __system_list[elementName]:
debug.info("SYSTEM: '" + data["name"] +"' in " + data["path"])
def exist(lib_name, target_name, target) :
global system_list
debug.verbose("exist= " + lib_name + " in " + target_name)
if target_name not in system_list:
##
## @brief Check if a system Module is availlable for a specific target
## @param[in] lib_name (string) Name of the Library
## @param[in] list_target_name ([string,...]) list of name of the target (ordered by request order)
## @param[in] target (handle) Handle on the @ref Target build engine
## @return (bool) find the system lib or not
##
def exist(lib_name, list_target_name, target) :
global __system_list
debug.verbose("exist= " + lib_name + " in " + str(list_target_name))
find_target = False
for target_name in list_target_name:
if target_name in __system_list:
find_target = True
if find_target == False:
return False
for data in system_list[target_name]:
if data["name"] == lib_name:
# we find it in the List ==> need to check if it is present in the system :
if data["loaded"] == False:
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
sys.path.append(os.path.dirname(data["path"]))
debug.verbose("import system : '" + data["name"] + "'")
the_system = __import__(env.get_build_system_base_name() + __start_system_name + target_name + "_" + data["name"])
#create the system module
debug.verbose("SYSTEM: request: " + str(data["name"]))
if "System" in dir(the_system):
data["system"] = the_system.System(target)
data["exist"] = data["system"].valid
else:
debug.warning("Not find: '" + data["name"] + "' ==> get exception")
return data["exist"]
for target_name in reversed(list_target_name):
if target_name not in __system_list:
continue
for data in __system_list[target_name]:
if data["name"] == lib_name:
# we find it in the List ==> need to check if it is present in the system :
if data["loaded"] == False:
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
sys.path.append(os.path.dirname(data["path"]))
debug.verbose("import system : '" + data["name"] + "'")
the_system = __import__(env.get_build_system_base_name() + __start_system_name + target_name + "_" + data["name"])
#create the system module
debug.verbose("SYSTEM: request: " + str(data["name"]))
if "System" in dir(the_system):
data["system"] = the_system.System(target)
data["exist"] = data["system"].get_valid()
"""
if data["exist"] == False:
debug.warning("Can not Import: '" + data["name"] + "' ==> disabled")
"""
else:
debug.warning("Not find: '" + data["name"] + "' ==> get exception")
return data["exist"]
return False
def load(target, lib_name, target_name):
global system_list
if target_name not in system_list:
##
## @brief Load a system Module for a specific target
## @param[in] target (handle) Handle on the @ref Target build engine
## @param[in] lib_name (string) Name of the Library
## @param[in] list_target_name ([string,...]) list of name of the target (ordered by request order)
## @return None
##
def load(target, lib_name, list_target_name):
global __system_list
find_target = False
for target_name in list_target_name:
if target_name in __system_list:
find_target = True
if find_target == False:
debug.error("you must call this function after checking of the system exist() !1!")
for data in system_list[target_name]:
if data["name"] == lib_name:
if data["exist"] == False:
debug.error("you must call this function after checking of the system exist() !2!")
if data["module"] == None:
# create a module from the system interface...
data["module"] = create_module_from_system(target, data)
data["loaded"] = True
target.add_module(data["module"])
return
return
for target_name in reversed(list_target_name):
if target_name not in __system_list:
continue
for data in __system_list[target_name]:
if data["name"] == lib_name:
if data["exist"] == False:
debug.error("you must call this function after checking of the system exist() !2!")
if data["module"] == None:
# create a module from the system interface...
data["module"] = create_module_from_system(target, data)
data["loaded"] = True
target.add_module(data["module"])
return

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
import os
@@ -14,7 +14,7 @@ import errno
import fnmatch
import stat
# Local import
from . import debug
from realog import debug
from . import depend
from . import env
@@ -61,6 +61,7 @@ def file_size(path):
return statinfo.st_size
def file_read_data(path, binary=False):
debug.verbose("path= " + path)
if not os.path.isfile(path):
return ""
if binary == True:
@@ -92,9 +93,10 @@ def version_to_string(version):
##
def file_write_data(path, data, only_if_new=False):
if only_if_new == True:
old_data = file_read_data(path)
if old_data == data:
return False
if os.path.exists(path) == True:
old_data = file_read_data(path)
if old_data == data:
return False
#real write of data:
create_directory_of_file(path)
file = open(path, "w")
@@ -170,6 +172,51 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
"need_copy":True}
return True
##
## @brief Get list of all Files in a specific path (with a regex)
## @param[in] path (string) Full path of the machine to search files (start with / or x:)
## @param[in] regex (string) Regular expression to search data
## @param[in] recursive (bool) List file with recursive search
## @param[in] remove_path (string) Data to remove in the path
## @return (list) return files requested
##
def get_list_of_file_in_path(path, regex="*", recursive = False, remove_path=""):
out = []
debug.verbose(" List all in : '" + str(path) + "'")
if os.path.isdir(os.path.realpath(path)):
tmp_path = os.path.realpath(path)
tmp_rule = regex
else:
debug.error("path does not exist : '" + str(path) + "'")
debug.verbose(" " + str(tmp_path) + ":")
for root, dirnames, filenames in os.walk(tmp_path):
deltaRoot = root[len(tmp_path):]
while len(deltaRoot) > 0 \
and ( deltaRoot[0] == '/' \
or deltaRoot[0] == '\\' ):
deltaRoot = deltaRoot[1:]
if recursive == False \
and deltaRoot != "":
return out
debug.verbose(" root='" + str(deltaRoot) + "'")
debug.extreme_verbose(" files=" + str(filenames))
tmpList = filenames
if len(tmp_rule) > 0:
tmpList = fnmatch.filter(filenames, tmp_rule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
add_file = os.path.join(tmp_path, deltaRoot, cycleFile)
if len(remove_path) != 0:
if add_file[:len(remove_path)] != remove_path:
debug.error("Request remove start of a path that is not the same: '" + add_file[:len(remove_path)] + "' demand remove of '" + str(remove_path) + "'")
else:
add_file = add_file[len(remove_path)+1:]
debug.verbose(" '" + add_file + "'")
out.append(add_file)
return out;
##
## @brief Copy a compleate directory in a specific folder
## @param[in] src Input folder path
@@ -263,6 +310,17 @@ def filter_extention(list_files, extentions, invert=False):
out.append(file)
return out
def filter_map(input_data, extentions, invert=False):
out = {}
for key in input_data.keys():
if invert:
if key not in extentions:
out[key] = input_data[key];
else:
if key in extentions:
out[key] = input_data[key];
return out
def move_if_needed(src, dst):
if not os.path.isfile(src):
@@ -316,6 +374,14 @@ def store_warning(file, output, err):
file2.flush()
file2.close()
def get_type_string(in_type):
if type(in_type) == str:
return "string"
elif type(in_type) == list:
return "list"
elif type(in_type) == dict:
return "dict"
return "unknow"
## List tools:
def list_append_and_check(listout, newElement, order):
@@ -339,13 +405,108 @@ def list_append_to(out_list, in_list, order=False):
else:
debug.warning("can not add in list other than {list/dict/str} : " + str(type(in_list)))
def list_append_to_2(listout, module, list, order=False):
def list_append_to_2(listout, module, in_list, order=False):
# sepcial cse of bool
if type(list) == bool:
listout[module] = list
if type(in_list) == bool:
listout[module] = in_list
return
# add list in the Map
if module not in listout:
listout[module] = []
# add elements...
list_append_to(listout[module], list, order)
list_append_to(listout[module], in_list, order)
##
## @brief The vertion number can be set in an external file to permit to have a singe position to change when create a vew version
## @param[in] path_module (string) Path of the module position
## @param[in] filename_or_version (string or list) Path of the version or the real version lint parameter
## @return (list) List of version number
##
def get_version_from_file_or_direct(path_module, filename_or_version):
# check case of iser set the version directly
if type(filename_or_version) == list:
return filename_or_version
# this use a version file
if filename_or_version[:7] == "file://":
filename_or_version = filename_or_version[7:];
# this use a version file
file_data = file_read_data(os.path.join(path_module, filename_or_version))
if len(file_data) == 0:
debug.warning("not enought data in the file version size=0 " + path_module + " / " + filename_or_version)
return [0,0,0]
lines = file_data.split("\n")
if len(lines) != 1:
debug.warning("More thatn one line in the file version ==> bas case use mode: 'XX', XX.YYY', 'XX.Y.ZZZ' or 'XX.Y-dev' : " + path_module + " / " + filename_or_version)
return [0,0,0]
line = lines[0]
debug.debug("Parse line: '" + line + "'")
#check if we have "-dev"
dev_mode = ""
list_tiret = line.split('-')
if len(list_tiret) > 2:
debug.warning("more than one '-' in version file " + str(filename_or_version) + " : '" + str(list_tiret) + "' in '" + path_module + "'")
if len(list_tiret) >= 2:
dev_mode = list_tiret[1]
line = list_tiret[0]
out = []
list_elem = line.split('.')
for elem in list_elem:
out.append(int(elem))
if dev_mode != "":
out.append(dev_mode)
debug.debug(" ==> " + str(out))
return out
##
## @brief Get the list of the authors frim an input list or a file
## @param[in] path_module (string) Path of the module position
## @param[in] filename_or_version (string or list) Path of the author file or the real list of authors
## @return (list) List of authors
##
def get_maintainer_from_file_or_direct(path_module, filename_or_author):
# check case of iser set the version directly
if type(filename_or_author) == list:
return filename_or_author
# this use a version file
if filename_or_author[:7] == "file://":
filename_or_author = filename_or_author[7:];
file_data = file_read_data(os.path.join(path_module, filename_or_author))
if len(file_data) == 0:
debug.warning("not enought data in the file author size=0 " + path_module + " / " + filename_or_author)
return []
# One user by line and # for comment line
out = []
for elem in file_data.split('\n'):
if len(elem) == 0:
continue
if elem[0] == "#":
# comment ...
continue
out.append(elem)
return out
def remove_element(data, to_remove):
base_data = []
for elem in data:
if type(elem) == list:
for elem2 in elem:
base_data.append(elem2)
else:
base_data.append(elem)
base_remove = []
for elem in to_remove:
if type(elem) == list:
for elem2 in elem:
base_remove.append(elem2)
else:
base_remove.append(elem)
out = []
for elem in base_data:
if elem not in base_remove:
out.append(elem)
return out;

View File

@@ -5,5 +5,5 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,7 +13,7 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
import os
@@ -31,6 +31,12 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 1100
##
## @brief Get builder input file type
@@ -58,7 +64,12 @@ def get_support_multithreading():
## @brief Commands for running gcc to link an executable.
##
def link(file, binary, target, depancy, flags, name, basic_path, static = False):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "bin")
file_src = file
file_dst = target.get_build_file_bin(name, static)
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
debug.extreme_verbose("list files = " + str(depancy.src))
list_static = []
list_dynamic = []
@@ -78,8 +89,12 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
lib_name = elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic
if lib_name not in depancy.src['dynamic']:
list_static.append(elem)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
#create comand line:
cmd = []
cmd = [compilator_ccache]
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
if "need-libstdc++" in depancy.flags \
and depancy.flags["need-libstdc++"] == True:
@@ -95,10 +110,6 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
cmd.append(target.sysroot)
except:
pass
try:
cmd.append(target.global_sysroot)
except:
pass
try:
cmd.append(["-o", file_dst])
except:
@@ -127,7 +138,7 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
cmd.append("-Wl,-R$ORIGIN/../lib/")
except:
pass
cmd.append("-Wl,-rpath,\"\$ORIGIN/../lib\"")
cmd.append("-Wl,-rpath,\"$ORIGIN/../lib\"")
try:
cmd.append(flags["local"]["link"])
except:

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,8 +13,9 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
# C++ default version:
default_version = 1999
default_version_gnu = False
@@ -39,6 +40,13 @@ def get_type():
def get_input_type():
return ["cpp", "CPP", "cxx", "CXX", "xx", "XX", "CC", "cc"]
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 600
##
## @brief Get builder output file type
## @return List of extention supported
@@ -54,12 +62,6 @@ def get_output_type():
def get_support_multithreading():
return True
def remove_element(data, to_remove):
out = []
for elem in data:
if elem not in to_remove:
out.append(elem)
return out;
##
## @brief Commands for running gcc to compile a C++ file in object file.
@@ -70,8 +72,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_path, file)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
# create the command line befor requesting start:
cmd = [
compilator_ccache,
target.xx,
"-o", file_dst,
target.arch,
@@ -94,48 +101,36 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
except:
pass
list_flags = [];
try:
if "c" in target.global_flags:
list_flags.append(target.global_flags["c"])
except:
pass
try:
if "c++" in target.global_flags:
list_flags.append(target.global_flags["c++"])
except:
pass
for type in ["c", "c++"]:
try:
if type in depancy.flags:
list_flags.append(depancy.flags[type])
except:
pass
for view in ["local", "export"]:
for type in ["c", "c++"]:
try:
list_flags.append(flags[view][type])
except:
pass
if view in flags:
for type in ["c", "c++"]:
if type in flags[view]:
list_flags.append(flags[view][type])
# get blacklist of flags
list_flags_blacklist = [];
try:
if "c-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c-remove"])
except:
pass
try:
if "c++-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c++-remove"])
except:
pass
for type in ["c-remove", "c++-remove"]:
try:
if type in depancy.flags:
list_flags_blacklist.append(depancy.flags[type])
except:
pass
for view in ["local", "export"]:
for type in ["c-remove", "c++-remove"]:
try:
list_flags_blacklist.append(flags[view][type])
except:
pass
if view in flags:
for type in ["c-remove", "c++-remove"]:
if type in flags[view]:
list_flags_blacklist.append(flags[view][type])
# apply blacklisting of data and add it on the cmdLine
cmd.append(remove_element(list_flags, list_flags_blacklist));
clean_flags = tools.remove_element(list_flags, list_flags_blacklist)
#debug.warning("plop " + str(list_flags_blacklist) + " " + str(list_flags) + " --> " + str(clean_flags) )
cmd.append(clean_flags);
cmd.append(["-c", "-MMD", "-MP"])
cmd.append(file_src)
# Create cmd line
@@ -164,13 +159,22 @@ def get_version_compilation_flags(flags, dependency_flags):
is_gnu = default_version_gnu
version = max(version_local, dependency_version)
if version == 2017:
debug.error("not supported flags for X17 ...");
if version == 2023:
if is_gnu == True:
out = ["-std=gnu++23", "-D__CPP_VERSION__=2023"]
else:
out = ["-std=c++23", "-D__CPP_VERSION__=2023"]
elif version == 2020:
if is_gnu == True:
out = ["-std=gnu++20", "-D__CPP_VERSION__=2020"]
else:
out = ["-std=c++20", "-D__CPP_VERSION__=2020"]
elif version == 2017:
if is_gnu == True:
out = ["-std=gnu++17", "-D__CPP_VERSION__=2017"]
else:
out = ["-std=c++17", "-D__CPP_VERSION__=2017"]
if version == 2014:
elif version == 2014:
if is_gnu == True:
out = ["-std=gnu++14", "-D__CPP_VERSION__=2014"]
else:

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,8 +13,9 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
# C version:
default_version = 1989
@@ -33,6 +34,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 400
##
## @brief Get builder input file type
## @return List of extention supported
@@ -65,8 +73,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_path, file)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
# create the command line befor requesting start:
cmd = [
compilator_ccache,
target.cc,
"-o", file_dst,
target.arch,
@@ -85,19 +98,30 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
cmd.append(get_version_compilation_flags(flags, depancy.flags))
except:
pass
try:
cmd.append(target.global_flags["c"])
except:
pass
try:
cmd.append(depancy.flags["c"])
except:
pass
list_flags = [];
if "c" in target.global_flags:
list_flags.append(target.global_flags["c"])
if "c" in depancy.flags:
list_flags.append(depancy.flags["c"])
for view in ["local", "export"]:
try:
cmd.append(flags[view]["c"])
except:
pass
if view in flags:
if "c" in flags[view]:
list_flags.append(flags[view]["c"])
# get blacklist of flags
list_flags_blacklist = [];
if "c-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c-remove"])
if "c-remove" in depancy.flags:
list_flags_blacklist.append(depancy.flags["c-remove"])
for view in ["local", "export"]:
if view in flags:
if "c-remove" in flags[view]:
list_flags_blacklist.append(flags[view]["c-remove"])
# apply blacklisting of data and add it on the cmdLine
clean_flags = tools.remove_element(list_flags, list_flags_blacklist)
#debug.warning("plop " + str(list_flags_blacklist) + " " + str(list_flags) + " --> " + str(clean_flags) )
cmd.append(clean_flags);
cmd.append("-c")
cmd.append("-MMD")
cmd.append("-MP")
@@ -129,21 +153,31 @@ def get_version_compilation_flags(flags, dependency_flags):
is_gnu = default_version_gnu
version = max(version_local, dependency_version)
if version == 2011:
if version == 2018:
if is_gnu ==True:
out = ["-std=gnu18", "-D__C_VERSION__=2018"]
else:
out = ["-std=c18", "-D__C_VERSION__=2018"]
elif version == 2017:
if is_gnu ==True:
out = ["-std=gnu17", "-D__C_VERSION__=2017"]
else:
out = ["-std=c17", "-D__C_VERSION__=2017"]
elif version == 2011:
if is_gnu ==True:
out = ["-std=gnu11", "-D__C_VERSION__=2011"]
else:
out = ["-std=c11", "-D__C_VERSION__=1989"]
out = ["-std=c11", "-D__C_VERSION__=2011"]
elif version == 1999:
if is_gnu ==True:
out = ["-std=gnu99", "-D__C_VERSION__=1999"]
else:
out = ["-std=c99", "-D__C_VERSION__=1989"]
out = ["-std=c99", "-D__C_VERSION__=1999"]
elif version == 1990:
if is_gnu ==True:
out = ["-std=gnu90", "-D__C_VERSION__=1990"]
else:
out = ["-std=c90", "-D__C_VERSION__=1989"]
out = ["-std=c90", "-D__C_VERSION__=1990"]
else:
if is_gnu ==True:
out = ["-std=gnu89", "-D__C_VERSION__=1989"]

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,7 +13,7 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
import os
@@ -31,6 +31,13 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 1200
##
## @brief Get builder input file type
## @return List of extention supported
@@ -57,7 +64,12 @@ def get_support_multithreading():
## @brief Commands for running gcc to link a shared library.
##
def link(file, binary, target, depancy, flags, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "jar")
file_src = file
file_dst = os.path.join(target.get_build_path(name), name + ".jar")
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
#create command Line
cmd = [
target.jar,

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,7 +13,7 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
##
@@ -29,6 +29,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 800
##
## @brief Get builder input file type
## @return List of extention supported

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,7 +13,7 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
##
@@ -29,6 +29,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 100
##
## @brief Get builder input file type
## @return List of extention supported

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,7 +13,7 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
import os
@@ -31,6 +31,13 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 900
##
## @brief Get builder input file type
## @return List of extention supported
@@ -56,8 +63,18 @@ def get_support_multithreading():
##
## @brief Commands for running gcc to link a shared library.
##
def link(file, binary, target, depancy, flags, name, basic_path, static=False):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-shared")
def link(file, binary, target, depancy, flags, name, basic_path, static=False, visibility_file = None):
file_src = file
file_dst = target.get_build_file_dynamic(name)
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
debug.extreme_verbose("file_dst = " + file_dst)
debug.extreme_verbose("file_depend = " + file_depend)
debug.extreme_verbose("file_cmd = " + file_cmd)
debug.extreme_verbose("file_warning = " + file_warning)
list_static = []
list_dynamic = []
if static == True:
@@ -76,8 +93,12 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
lib_name = elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic
if lib_name not in depancy.src['dynamic']:
list_static.append(elem)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
#create command Line
cmd = []
cmd = [compilator_ccache]
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
if "need-libstdc++" in depancy.flags \
and depancy.flags["need-libstdc++"] == True:
@@ -87,7 +108,7 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
cmd.append(["-o", file_dst])
try:
cmd.append(target.global_sysroot)
cmd.append(target.sysroot)
except:
pass
try:
@@ -129,6 +150,9 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
cmd.append("-Wl,-R$ORIGIN/../lib/")
except:
pass
if visibility_file != None:
cmd.append("-Wl,--version-script=" + visibility_file);
for view in ["local", "export"]:
if view not in flags:
continue
@@ -147,6 +171,8 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
return file_dst
tools.create_directory_of_file(file_dst)
debug.print_element("SharedLib", name, "==>", os.path.relpath(file_dst))
multiprocess.run_command(cmdLine, store_output_file=file_warning)
# strip the output file:
@@ -155,7 +181,7 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
# get the file size of the non strip file
originSize = tools.file_size(file_dst);
debug.print_element("SharedLib(strip)", name, "", "")
if target.name == "MacOs":
if "MacOs" in target.get_type():
cmdLineStrip=tools.list_to_str([
target.strip,
"-u",

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -13,7 +13,7 @@
##
from lutin import multiprocess
from lutin import tools
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
import os
@@ -31,6 +31,13 @@ def init():
def get_type():
return "linker"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 1000
##
## @brief Get builder input file type
## @return List of extention supported
@@ -57,9 +64,23 @@ def get_support_multithreading():
## @brief Commands for running ar.
##
def link(file, binary, target, depancy, flags, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-static")
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
file_src = file
file_dst = target.get_build_file_static(name)
file_depend = file_dst + target.suffix_dependence
file_cmd = file_dst + target.suffix_cmd_line
file_warning = file_dst + target.suffix_warning
debug.extreme_verbose("file_dst = " + file_dst)
debug.extreme_verbose("file_depend = " + file_depend)
debug.extreme_verbose("file_cmd = " + file_cmd)
debug.extreme_verbose("file_warning = " + file_warning)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
cmd = [
compilator_ccache,
target.ar
]
try:

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -14,8 +14,9 @@
from lutin import multiprocess
from lutin import tools
from lutin import builder
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
local_ref_on_builder_c = None
@@ -34,6 +35,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 500
##
## @brief Get builder input file type
## @return List of extention supported
@@ -65,8 +73,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_path, file)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
# create the command line befor requesting start:
cmd = [
compilator_ccache,
target.cc,
"-o", file_dst ,
target.arch,
@@ -87,25 +100,37 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
cmd.append(local_ref_on_builder_c.get_version_compilation_flags(flags, depancy.flags))
except:
pass
try:
cmd.append(target.global_flags["c"])
except:
pass
try:
cmd.append(target.global_flags["m"])
except:
pass
list_flags = [];
if "c" in target.global_flags:
list_flags.append(target.global_flags["c"])
if "m" in target.global_flags:
list_flags.append(target.global_flags["m"])
for type in ["c", "m"]:
try:
cmd.append(depancy.flags[type])
except:
pass
if type in depancy.flags:
list_flags.append(depancy.flags[type])
for view in ["local", "export"]:
for type in ["c", "m"]:
try:
cmd.append(flags[view][type])
except:
pass
if view in flags:
for type in ["c", "m"]:
if type in flags[view]:
list_flags.append(flags[view][type])
# get blacklist of flags
list_flags_blacklist = [];
if "c-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c-remove"])
if "m-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["m-remove"])
for type in ["c-remove", "m-remove"]:
if type in depancy.flags:
list_flags_blacklist.append(depancy.flags[type])
for view in ["local", "export"]:
if view in flags:
for type in ["c-remove", "m-remove"]:
if type in flags[view]:
list_flags_blacklist.append(flags[view][type])
# apply blacklisting of data and add it on the cmdLine
clean_flags = tools.remove_element(list_flags, list_flags_blacklist)
#debug.warning("plop " + str(list_flags_blacklist) + " " + str(list_flags) + " --> " + str(clean_flags) )
cmd.append(clean_flags);
cmd.append("-c -MMD -MP")
cmd.append("-x objective-c")
cmd.append(file_src)

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -14,8 +14,9 @@
from lutin import multiprocess
from lutin import tools
from lutin import builder
from lutin import debug
from realog import debug
from lutin import depend
from lutin import env
local_ref_on_builder_cpp = None
@@ -34,6 +35,13 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 700
##
## @brief Get builder input file type
## @return List of extention supported
@@ -65,8 +73,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_path, file)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
# create the command line befor requesting start:
cmd = [
compilator_ccache,
target.xx,
"-o", file_dst,
target.arch,
@@ -87,22 +100,45 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
except:
pass
list_flags = [];
if "c" in target.global_flags:
list_flags.append(target.global_flags["c"])
if "c++" in target.global_flags:
list_flags.append(target.global_flags["c++"])
if "m" in target.global_flags:
list_flags.append(target.global_flags["m"])
if "mm" in target.global_flags:
list_flags.append(target.global_flags["mm"])
for type in ["c", "c++", "m", "mm"]:
try:
cmd.append(target.global_flags[type])
except:
pass
for type in ["c", "c++", "m", "mm"]:
try:
cmd.append(depancy.flags[type])
except:
pass
for view in ["export", "local"]:
for type in ["c", "c++", "m", "mm"]:
try:
cmd.append(flags[view][type])
except:
pass
if type in depancy.flags:
list_flags.append(depancy.flags[type])
for view in ["local", "export"]:
if view in flags:
for type in ["c", "c++", "m", "mm"]:
if type in flags[view]:
list_flags.append(flags[view][type])
# get blacklist of flags
list_flags_blacklist = [];
if "c-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c-remove"])
if "c++-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c++-remove"])
if "m-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["m-remove"])
if "mm-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["mm-remove"])
for type in ["c-remove", "c++-remove","m-remove", "mm-remove"]:
if type in depancy.flags:
list_flags_blacklist.append(depancy.flags[type])
for view in ["local", "export"]:
if view in flags:
for type in ["c-remove", "c++-remove","m-remove", "mm-remove"]:
if type in flags[view]:
list_flags_blacklist.append(flags[view][type])
# apply blacklisting of data and add it on the cmdLine
clean_flags = tools.remove_element(list_flags, list_flags_blacklist)
#debug.warning("plop " + str(list_flags_blacklist) + " " + str(list_flags) + " --> " + str(clean_flags) )
cmd.append(clean_flags);
cmd.append("-c -MMD -MP")
cmd.append("-x objective-c++")
cmd.append(file_src)

View File

@@ -0,0 +1,134 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
##
## C++ builder
##
from lutin import multiprocess
from lutin import tools
from realog import debug
from lutin import depend
from lutin import env
##
## Initialize the builder, if needed ... to get dependency between builder (for example)
##
def init():
pass
##
## Get the current builder type.
## Return the type of builder
##
def get_type():
return "compiler"
##
## @brief Get builder input file type
## @return List of extention supported
##
def get_input_type():
return [];#["s"]
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 200
##
## @brief Get builder output file type
## @return List of extention supported
##
def get_output_type():
return ["o"]
##
## @brief Get builder support multi-threading or not
## @return True Multithreading supported
## @return False Multithreading NOT supported
##
def get_support_multithreading():
return True
##
## @brief Commands for running gcc to compile a C++ file in object file.
##
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_path, file)
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_path, file)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
# create the command line before requesting start:
cmd = [
compilator_ccache,
"nasm",
"-o", file_dst,
"-f", "elf64",
target.sysroot
]
for view in ["export", "local"]:
for type in ["nasm"]:
try:
cmd.append(tools.add_prefix("-I",path[view][type]))
except:
pass
for type in ["nasm"]:
try:
cmd.append(tools.add_prefix("-I",depancy.path[type]))
except:
pass
cmd.append(target.global_include_cc)
list_flags = [];
if "nasm" in target.global_flags:
list_flags.append(target.global_flags["nasm"])
for view in ["local", "export"]:
if view in flags:
for type in ["nasm"]:
if type in flags[view]:
list_flags.append(flags[view][type])
# get blacklist of flags
list_flags_blacklist = [];
if "nasm-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["nasm-remove"])
for type in ["nasm-remove"]:
if type in depancy.flags:
list_flags_blacklist.append(depancy.flags[type])
for view in ["local", "export"]:
if view in flags:
for type in ["c-nasm"]:
if type in flags[view]:
list_flags_blacklist.append(flags[view][type])
# apply blacklisting of data and add it on the cmdLine
clean_flags = tools.remove_element(list_flags, list_flags_blacklist)
#debug.warning("plop " + str(list_flags_blacklist) + " " + str(list_flags) + " --> " + str(clean_flags) )
cmd.append(clean_flags);
cmd.append(["-DPIC"])
cmd.append(["-MP"])
cmd.append(file_src)
# Create cmd line
cmdLine = tools.list_to_str(cmd)
# check the dependency for this file :
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
return {"action":"add", "file":file_dst}
tools.create_directory_of_file(file_dst)
comment = ["nasm", name, "<==", file]
#process element
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
return {"action":"add", "file":file_dst}

View File

@@ -5,7 +5,7 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
##
@@ -14,6 +14,7 @@
from lutin import multiprocess
from lutin import tools
from lutin import depend
from lutin import env
##
## Initialize the builder, if needed ... to get dependency between builder (for example)
@@ -28,24 +29,31 @@ def init():
def get_type():
return "compiler"
##
## @brief get the order of the current builder
## @return the string that define the build order
##
def get_order():
return 300
##
## @brief Get builder input file type
## @return List of extention supported
## @return List of extension supported
##
def get_input_type():
return ["s", "S"]
##
## @brief Get builder output file type
## @return List of extention supported
## @return List of extension supported
##
def get_output_type():
return ["o"]
##
## @brief Get builder support multi-threading or not
## @return True Multithreading supported
## @return False Multithreading NOT supported
## @return True Multi-threading supported
## @return False Multi-threading NOT supported
##
def get_support_multithreading():
return True
@@ -60,8 +68,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_path, file)
# set ccache interface:
compilator_ccache = ""
if env.get_ccache() == True:
compilator_ccache = "ccache"
# create the command line befor requesting start:
cmd = [
compilator_ccache,
target.cc,
"-o", file_dst,
target.arch,

View File

@@ -5,5 +5,5 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,11 +18,11 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="ADMOD: Android SDK ad-mod interface (auto-create interface for admod)\n"
self.set_help("ADMOD: Android SDK ad-mod interface (auto-create interface for admod)\n")
# todo : Check if present ...
self.valid = True
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_export_sources(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
self.add_sources(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
self.add_action("PACKAGE", 10, "admod-auto-wrapper", tool_generate_main_java_class)

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,15 +18,15 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="SDK: Android SDK basic interface java\n"
self.set_help("SDK: Android SDK basic interface java")
# jar file:
jar_file_path=os.path.join(target.path_sdk, "platforms", "android-" + str(target.board_id), "android.jar")
# TODO : Check if the android sdk android.jar is present ...
self.valid = True
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_export_sources(jar_file_path)
self.add_export_flag("link-lib", "dl")
self.add_export_flag("link-lib", "log")
self.add_export_flag("link-lib", "android")
self.add_sources(jar_file_path)
self.add_flag("link-lib", "dl")
self.add_flag("link-lib", "log")
self.add_flag("link-lib", "android")

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,6 +18,6 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "C: Generic C library"
self.valid = True
self.set_help("C: Generic C library")
self.set_valid(True)

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,60 +18,60 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "CXX: Generic C++ library"
self.valid = True
self.set_help("CXX: Generic C++ library")
self.set_valid(True)
if target.config["compilator"] == "clang":
if target.board_id < 21:
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
self.valid = False
return
self.add_export_flag("c++", "-D__STDCPP_LLVM__")
self.add_flag("c++", "-D__STDCPP_LLVM__")
# llvm is BSD-like licence
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "include"))
self.add_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "include"))
if target.type_arch == "armv5":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "armeabi")
self.add_export_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
elif target.type_arch == "armv7":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libs", "armeabi-v7a")
self.add_export_path( os.path.join(stdCppBasePath + "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libc++_static.a"))
self.add_path( os.path.join(stdCppBasePath + "include"))
self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libc++_static.a"))
elif target.type_arch == "mips":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "mips")
self.add_export_path( os.path.join(stdCppBasePath + "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath + "libc++_static.a"))
self.add_path( os.path.join(stdCppBasePath + "include"))
self.add_flag("link", os.path.join(stdCppBasePath + "libc++_static.a"))
elif target.type_arch == "x86":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "x86")
self.add_export_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
else:
debug.warning("unknow architecture: '" + str(target.arch) + "'");
else:
self.add_export_flag("c++", "-D__STDCPP_GNU__")
self.add_export_flag("c++-remove","-nostdlib")
self.add_export_flag("need-libstdc++", True)
self.add_flag("c++", "-D__STDCPP_GNU__")
self.add_flag("c++-remove","-nostdlib")
self.add_flag("need-libstdc++", True)
# GPL v3 (+ exception link for gcc compilator)
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include"))
self.add_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include"))
if target.type_arch == "armv5":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi")
self.add_export_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
elif target.type_arch == "armv7":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi-v7a")
self.add_export_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
self.add_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
elif target.type_arch == "mips":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "mips")
self.add_export_path( os.path.join(stdCppBasePath, "include/"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
self.add_path( os.path.join(stdCppBasePath, "include/"))
self.add_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
self.add_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
elif target.type_arch == "x86":
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "x86")
self.add_export_path( os.path.join(stdCppBasePath, "include"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
self.add_path( os.path.join(stdCppBasePath, "include"))
self.add_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
self.add_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
else:
debug.warning("unknow architecture: '" + str(target.arch) + "'");
debug.warning("plop")

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,10 +18,10 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
self.set_help("M : m library \n base of std libs (availlagle in GNU C lib and bionic")
# No check ==> on the basic std libs:
self.valid = True
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m")
self.add_flag("link-lib", "m")

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,10 +18,10 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "OpenGL: Generic graphic library"
self.valid = True
self.set_help("OpenGL: Generic graphic library")
self.set_valid(True)
# no check needed ==> just add this:
self.add_module_depend([
self.add_depend([
'c',
])
"""
@@ -31,6 +31,6 @@ class System(system.System):
destination_path="GL",
recursive=True)
"""
self.add_export_flag('link-lib', "GLESv2")
self.add_flag('link-lib', "GLESv3")

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,17 +18,17 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="pthread : Generic multithreading system\n Can be install with the package:\n - pthread-dev"
self.set_help("pthread : Generic multithreading system\n Can be install with the package:\n - pthread-dev")
# check if the library exist:
"""
if not os.path.isfile("/usr/include/pthread.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
"""
self.valid = True
self.set_valid(True)
# todo : create a searcher of the presence of the library:
#self.add_export_flag("link-lib", "pthread")
self.add_module_depend([
#self.add_flag("link-lib", "pthread")
self.add_depend([
'c'
])

View File

@@ -4,10 +4,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -17,13 +17,13 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="Z : z library \n Can be install with the package:\n - zlib1g-dev"
self.set_help("Z : z library \n Can be install with the package:\n - zlib1g-dev")
# check if the library exist:
if not os.path.isfile("/usr/include/zlib.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "z")
self.add_flag("link-lib", "z")

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,10 +18,10 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
self.valid = True
self.set_help("CoreAudio : Ios interface for audio (all time present, just system interface)")
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_export_flag("link", "-framework CoreAudio")
self.add_export_flag("link", "-framework AudioToolbox")
self.add_flag("link", "-framework CoreAudio")
self.add_flag("link", "-framework AudioToolbox")

View File

@@ -0,0 +1,27 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("CoreAudio : Ios interface for core graphic (all time present, just system interface)")
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link", "-framework CoreGraphics")
self.add_depend("UIKit")

View File

@@ -0,0 +1,27 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("CoreAudio : Ios interface for fundation (all time present, just system interface)")
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link", "-framework Foundation")
self.add_depend("QuartzCore")

View File

@@ -0,0 +1,27 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("CoreAudio : Ios interface for openGL (all time present, just system interface)")
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link", "-framework GLKit")
self.add_depend("Foundation")

View File

@@ -0,0 +1,26 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("CoreAudio : Ios interface for core application (all time present, just system interface)")
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link", "-framework QuartzCore")

View File

@@ -0,0 +1,27 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("CoreAudio : Ios interface for graphic UX (all time present, just system interface)")
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link", "-framework UIKit")
self.add_depend("GLKit")

View File

@@ -0,0 +1,24 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("C: Generic C library")
self.add_flag("c-remove","-nodefaultlibs")
self.set_valid(True)

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,11 +18,11 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "CXX: Generic C++ library"
self.valid = True
self.set_help("CXX: Generic C++ library")
self.set_valid(True)
# no check needed ==> just add this:
self.add_export_flag("c++", "-D__STDCPP_LLVM__")
self.add_export_flag("c++-remove", "-nostdlib")
self.add_export_flag("need-libstdc++", True)
self.add_flag("c++", "-D__STDCPP_LLVM__")
self.add_flag("c++-remove", "-nostdlib")
self.add_flag("need-libstdc++", True)

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,10 +18,10 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
self.set_help("M : m library \n base of std libs (availlagle in GNU C lib and bionic")
# No check ==> on the basic std libs:
self.valid = True
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m")
self.add_flag("link-lib", "m")

View File

@@ -0,0 +1,30 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("OpenGL: Generic graphic library")
self.set_valid(True)
# no check needed ==> just add this:
self.add_depend([
'c'
])
self.add_flag('link', [
"-framework OpenGLES"])

View File

@@ -0,0 +1,44 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("pthread : Generic multithreading system\n Can be install with the package:\n - pthread-dev")
# check if the library exist:
"""
if not os.path.isfile("/usr/include/pthread.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
"""
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "pthread")
self.add_depend([
'c'
])
"""
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sched.h",
"/usr/include/pthread.h"
],
clip_path="/usr/include/")
"""

View File

@@ -0,0 +1,46 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("SDL: SDL Gui abstraction")
# check if the library exist:
if not os.path.isfile("/usr/include/SDL/SDL.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.set_valid(True)
self.add_depend([
'opengl',
'c'
])
self.add_flag("link-lib", "SDL")
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/SDL/*",
],
destination_path="SDL",
recursive=True)
self.add_header_file([
"/usr/include/SDL/*",
],
destination_path="",
recursive=True)
else:
self.add_path("/usr/include/SDL/")

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,12 +18,14 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "X11: Basic interface of Linux Graphic interface"
self.valid = True
self.set_help("X11: Basic interface of Linux Graphic interface")
self.set_valid(True)
# no check needed ==> just add this:
self.add_module_depend(['c'])
self.add_export_flag('link-lib', 'X11')
if env.get_isolate_system() == False:
self.add_depend(['c'])
#self.add_flag('link-lib', 'Xv')
#self.add_flag('link-lib', 'Xt')
self.add_flag('link-lib', 'X11')
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/X11/*"
],

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,17 +18,17 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n - libasound2-dev"
self.set_help("ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n - libasound2-dev")
# check if the library exist:
if not os.path.isfile("/usr/include/alsa/asoundlib.h") \
and not os.path.isfile("/usr/include/dssi/alsa/asoundlib.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
self.set_valid(True)
if env.get_isolate_system() == False:
self.add_export_flag("link-lib", "asound")
self.add_flag("link-lib", "asound")
else:
self.add_export_flag("link-lib", "asound")
self.add_flag("link-lib", "asound")
self.add_header_file([
"/usr/include/alsa/*",
],
@@ -39,7 +39,7 @@ class System(system.System):
],
destination_path="dssi",
recursive=True)
self.add_module_depend([
self.add_depend([
'c'
])

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,21 +18,21 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="rpc : generic RPC library (developed by oracle)"
self.set_help("rpc : generic RPC library (developed by oracle)")
# check if the library exist:
if not os.path.isfile("/usr/include/arpa/ftp.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
# No check ==> on the basic std libs:
self.valid = True
self.set_valid(True)
if env.get_isolate_system() == True:
#self.add_export_flag("link-lib", "xns")
#self.add_flag("link-lib", "xns")
self.add_header_file([
"/usr/include/arpa/*"
],
destination_path="arpa",
recursive=True)
self.add_module_depend([
self.add_depend([
'c'
])

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,15 +18,15 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n - libboost-all-dev"
self.set_help("BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n - libboost-all-dev")
# check if the library exist:
if not os.path.isfile("/usr/include/boost/chrono.hpp"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
self.set_valid(True)
if env.get_isolate_system() == False:
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", [
self.add_flag("link-lib", [
"boost_system",
"boost_thread",
"boost_chrono"
@@ -37,7 +37,7 @@ class System(system.System):
],
destination_path="boost",
recursive=True)
self.add_module_depend([
self.add_depend([
'cxx'
])

View File

@@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("bz2 : ???")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "bsd")
self.add_depend([
'c'
])
"""
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sys/mman.h",
"/usr/include/sys/stat.h"
],
clip_path="/usr/include",
recursive=False)
"""

View File

@@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("bz2 : ???")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "bz2")
self.add_depend([
'c'
])
"""
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sys/mman.h",
"/usr/include/sys/stat.h"
],
clip_path="/usr/include",
recursive=False)
"""

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,10 +18,11 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "C: Generic C library"
self.valid = True
self.set_help("C: Generic C library")
self.set_valid(True)
if env.get_isolate_system() == False:
# We must have it ... all time
self.add_flag("c-remove", "-nostdinc")
pass
else:
# grep "This file is part of the GNU C Library" /usr/include/*
@@ -149,7 +150,7 @@ class System(system.System):
self.add_header_file([
"/usr/include/linux/*",
],
destination_path="linux",
destination_path="",
recursive=True)
self.add_header_file([
"/usr/include/asm/*",
@@ -171,5 +172,11 @@ class System(system.System):
],
destination_path="net",
recursive=True)
self.add_export_flag("link", "-B/usr/lib")
# remove dependency of libc to lib std c++ when compile with g++
#self.add_header_file([
# "stdarg.h",
# ],
# destination_path="",
# recursive=True)
self.add_flag("link", "-B/usr/lib")

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import multiprocess
@@ -19,20 +19,20 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "CXX: Generic C++ library"
self.valid = True
self.set_help("CXX: Generic C++ library")
self.set_valid(True)
# no check needed ==> just add this:
self.add_module_depend([
self.add_depend([
'c',
'm',
'pthread'
])
self.add_export_flag("c++", "-D__STDCPP_GNU__")
self.add_flag("c++", "-D__STDCPP_GNU__")
if env.get_isolate_system() == False:
self.add_export_flag("c++-remove", "-nostdlib")
self.add_export_flag("need-libstdc++", True)
self.add_flag("c++-remove", "-nostdlib")
self.add_flag("need-libstdc++", True) # regarder a quoi ca sert !!!!
else:
self.add_export_flag("link-lib", "stdc++")
self.add_flag("link-lib", "stdc++")
compilator_gcc = "g++"
if target.config["compilator-version"] != "":
compilator_gcc = compilator_gcc + "-" + target.config["compilator-version"]

View File

@@ -0,0 +1,36 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("OpenGL: Generic graphic library")
self.set_valid(True)
# no check needed ==> just add this:
self.add_depend([
# TODO: needed for wayland : 'khr',
])
self.add_flag('link-lib', 'EGL')
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/EGL/*"
],
destination_path="EGL",
recursive=True)

View File

@@ -0,0 +1,36 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("OpenGL: Generic graphic library")
self.set_valid(True)
# no check needed ==> just add this:
self.add_depend([
'opengl',
])
self.add_flag('link-lib', 'GLESv2')
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/GLES2/*"
],
destination_path="GLES2",
recursive=True)

View File

@@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("bz2 : ???")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "gnutls")
self.add_depend([
'c'
])
"""
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sys/mman.h",
"/usr/include/sys/stat.h"
],
clip_path="/usr/include",
recursive=False)
"""

View File

@@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("ICU : ICU is a generic interface to manage multiple language model")
# No check ==> on the basic std libs:
self.set_valid(True)
# todo : create a searcher of the presence of the library:
self.add_flag("link-lib", "icuuc")
self.add_flag("link-lib", "icui18n")
self.add_flag("link-lib", "icudata")
self.add_depend([
'c'
])
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/unicode/icuplug.h",
"/usr/include/unicode/icudataver.h"
],
clip_path="/usr/include",
recursive=False)

View File

@@ -5,10 +5,10 @@
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
## @license MPL v2.0 (see license file)
##
from lutin import debug
from realog import debug
from lutin import system
from lutin import tools
from lutin import env
@@ -18,17 +18,17 @@ class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n - libjack-jackd2-dev (new)\n - libjack-dev (old)"
self.set_help("JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n - libjack-jackd2-dev (new)\n - libjack-dev (old)")
# check if the library exist:
if not os.path.isfile("/usr/include/jack/jack.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
self.add_module_depend([
self.set_valid(True)
self.add_depend([
'uuid',
'c'
])
self.add_export_flag("link-lib", "jack")
self.add_flag("link-lib", "jack")
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/jack/*",

View File

@@ -0,0 +1,36 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license MPL v2.0 (see license file)
##
from realog 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("OpenGL: Generic graphic library")
self.set_valid(True)
# no check needed ==> just add this:
self.add_depend([
'c',
])
self.add_flag('link-lib', 'wayland-egl')
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/KHR/*"
],
destination_path="KHR",
recursive=True)

Some files were not shown because too many files have changed in this diff Show More