Compare commits

...

115 Commits
2.1.0 ... 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
165 changed files with 9378 additions and 2489 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

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

View File

@@ -4,23 +4,7 @@ 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
Developement (dev)
------------------
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=dev
:target: https://travis-ci.org/HeeroYui/lutin
[![Badge](https://badge.fury.io/py/lutin.png](https://pypi.python.org/pypi/lutin)
Instructions
------------
@@ -51,32 +35,35 @@ Installation
Requirements: ``Python >= 2.7`` and ``pip``
Just run:
pip install lutin
```
pip install lutin
```
Install pip on debian/ubuntu:
sudo apt-get install pip
```
sudo apt-get install pip
```
Install pip on ARCH-linux:
sudo pacman -S pip
```
sudo pacman -S pip
```
Install pip on MacOs:
```
sudo easy_install pip
```
sudo easy_install pip
License (APACHE v2.0)
License (MPL v2.0)
---------------------
Copyright lutin Edouard DUPIN
Licensed under the Apache License, Version 2.0 (the "License");
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
http://www.apache.org/licenses/LICENSE-2.0
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,

325
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,9 +26,10 @@ import lutin.tools as tools
import lutin.host as lutinHost
import lutin.tools as lutinTools
myArgs = arguments.LutinArg()
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("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")
@@ -38,10 +41,12 @@ 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("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 gcc will be used)")
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")
@@ -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

@@ -7,7 +7,7 @@ Lutin permit simply to compile applications and library.
To simply understand the use, we will use a simple library:
```bash
```{.sh}
git clone http://github.con/atria-soft/etk.git
```
@@ -17,7 +17,7 @@ compile a module: {#lutin_use_compile}
It is really simple:
```bash
```{.sh}
lutin yourModuleName
#example:
lutin etk
@@ -47,7 +47,7 @@ Display help: {#lutin_use_options_help}
Availlable everywhere ...
```bash
```{.sh}
lutin -h
lutin --help
```
@@ -61,7 +61,7 @@ At the end of the help you an see an help about the etk librery with the associa
Build in color: {#lutin_use_options_color}
---------------
```bash
```{.sh}
lutin -C
lutin --color
```
@@ -70,19 +70,19 @@ Display build line in pretty print mode: {#lutin_u
----------------------------------------
when an error apear, the gcc or clang compile line can be really unreadable:
```bash
```{.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:
```bash
```{.sh}
lutin -P
lutin --pretty
```
result:
```bash
```{.sh}
g++ \
-o /home/XXX/dev/out/Linux_x86_64/release/build/gcc/etk/obj/etk/Color.cpp.o \
-I/home/XXX/dev/etk \
@@ -115,7 +115,7 @@ 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:
```bash
```{.sh}
lutin -v4
lutin --verbose 4
```
@@ -134,7 +134,7 @@ Select the number of CPU core used: {#lutin_use_op
By default lutin manage only 1 CPU core (faster to debug) but for speed requirement you can use use multiple core:
```bash
```{.sh}
#for 5 core
lutin -j5
lutin --jobs 5
@@ -145,7 +145,7 @@ Force rebuild all: {#lutin_use_options_rebuild_for
Sometime it is needed to rebuild all the program, just do:
```bash
```{.sh}
lutin -B
lutin --force-build
# or remove the build directory
@@ -157,7 +157,7 @@ Force strip all library and programs: {#lutin_use_
Force strip of output binary (remove symboles)
```bash
```{.sh}
lutin -s
lutin --force-strip
```
@@ -169,7 +169,7 @@ The main objective of lutin is managing the cross compilation to build from linu
For android you can use:
```bash
```{.sh}
lutin -t Android your-module
lutin -t Windows your-module
```
@@ -179,14 +179,14 @@ Build in debug mode: {#lutin_use_options_debug_rel
To developp it is fasted with debug tools
```bash
```{.sh}
lutin -m debug your-module
lutin -m release your-module
```
You can desire to have compilation optimisation when you build in debug mode:
```bash
```{.sh}
lutin -m debug --force-optimisation your-module
```
@@ -212,7 +212,7 @@ Install your program after building it: {#lutin_us
You can install your build module:
```bash
```{.sh}
lutin -m debug your-module?build?install
```

View File

@@ -9,7 +9,7 @@ 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
```
@@ -17,7 +17,7 @@ Replace your ``module-name`` with the delivery you want. The name can contain [a
In the module name you must define some values:
```python
```{.py}
#!/usr/bin/python
import lutin.module as module
import lutin.tools as tools
@@ -45,6 +45,7 @@ def get_desc():
# "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.
@@ -82,11 +83,12 @@ def get_version():
# create the module
# @param[in] target reference on the Target that is currently build
# @param[in] module_name Name of the module that is extract from the file name (to be generic)
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
# @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 my_module
return True
```
Thes it is simple to specify build for:
@@ -95,7 +97,7 @@ Create a new Module (LIBRARY): {#lutin_module_libr
==============================
What to change:
```python
```{.py}
def get_type():
return "LIBRARY"
```
@@ -112,7 +114,7 @@ Generic Binary: {#lutin_module_binar
---------------
What to change:
```python
```{.py}
def get_type():
return "BINARY"
```
@@ -126,7 +128,7 @@ Create a new Module (TEST-BINARY / TOOL-BINARY): {#lutin_module_binar
Two binary are really usefull in developpement, the tools and the test-unit, This is the reason why we specify for this 2 cases.
Add the subElement description:
```python
```{.py}
def get_type():
return "BINARY"
@@ -134,7 +136,7 @@ def get_sub_type():
return "TEST"
```
or:
```python
```{.py}
def get_type():
return "BINARY"
@@ -149,7 +151,7 @@ Create a new Module (DATA): {#lutin_module_data
This pode permit to only copy data and no dependency with compilling system
What to change:
```python
```{.py}
def get_type():
return "DATA"
```
@@ -163,8 +165,8 @@ Add file to compile: {#lutin_module_int
This is simple: (you just need to specify all the file to compile)
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
# add the file to compile:
@@ -186,8 +188,8 @@ The developper must isolate the external include and internal include, then luti
This permit to check error inclusion directly in developpement and separate the ```#include "XXX.h"``` and the ```#include <lib-xxx/XXX.h>```
Add file to external include:
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
my_module.add_header_file([
@@ -199,8 +201,8 @@ def create(target, module_name):
```
You can add a path to your local include:
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
my_module.add_path(os.path.join(tools.get_current_path(__file__), "lib-name"))
@@ -213,32 +215,32 @@ Add Sub-dependency: {#lutin_module_int
-------------------
All library need to add at minimum of a simple library (C lib) and other if needed. To do it jus call:
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
# add dependency of the generic C library:
my_module.add_module_depend('c')
my_module.add_depend('c')
# add dependency of the generic C++ library:
my_module.add_module_depend('cxx')
my_module.add_depend('cxx')
# add dependency of the generic math library:
my_module.add_module_depend('m')
my_module.add_depend('m')
# or other user lib:
my_module.add_module_depend('lib-name')
my_module.add_depend('lib-name')
...
```
The system can have optinnal sub-library, then if you just want to add an optionnal dependency:
```python
def create(target, module_name):
```{.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_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is exported in external upper build
my_module.add_optionnal_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
...
```
@@ -247,8 +249,8 @@ Compilation adn link flags/libs: {#lutin_module_int
--------------------------------
It is possible to define local and external flags (external are set internal too):
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
# external flags:
my_module.add_flag('link-lib', "pthread", export=True)
@@ -263,8 +265,8 @@ build mode (release/debug): {#lutin_module_int
---------------------------
To add somes element dependent of the build mode:
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
if target.get_mode() == "release":
@@ -280,8 +282,8 @@ build type target: {#lutin_module_int
To add somes element dependent of the target type:
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
if "Windows" in target.get_type():
@@ -308,8 +310,8 @@ Add some data in the install path (share path): {#lutin_module_in
You can install a simple file:
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
# copy file in the share/binanyName/ path (no sub path)
@@ -320,8 +322,8 @@ def create(target, module_name):
Copy multiple files (change path)
```python
def create(target, module_name):
```{.py}
def configure(target, my_module):
...
my_module.copy_path('data/*', 'destinationPath')
@@ -333,7 +335,7 @@ display some debug to help writing code: {#lutin_module_in
----------------------------------------
```python
```{.py}
import lutin.debug as debug
def function(...):
@@ -350,12 +352,12 @@ A Full template: {#lutin_module_fu
================
Create the file:
```
```{.sh}
lutin_module-name.py
```
With:
```python
```{.py}
#!/usr/bin/python
import lutin.module as module
import lutin.tools as tools
@@ -385,6 +387,7 @@ def get_desc():
# "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.
@@ -414,17 +417,20 @@ def get_compagny_name():
# 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] module_name Name of the module that is extract from the file name (to be generic)
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
# @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([
@@ -441,28 +447,28 @@ def create(target, module_name):
my_module.add_path(os.path.join(tools.get_current_path(__file__), "lib-name"))
# add dependency of the generic C library:
my_module.add_module_depend('c')
my_module.add_depend('c')
# add dependency of the generic C++ library:
my_module.add_module_depend('cxx')
my_module.add_depend('cxx')
# add dependency of the generic math library:
my_module.add_module_depend('m')
my_module.add_depend('m')
# or other user lib:
my_module.add_module_depend([
my_module.add_depend([
'lib-name1',
'lib-name2'
])
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
my_module.add_optionnal_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"])
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is exported in external upper build
my_module.add_optionnal_module_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
my_module.add_optionnal_depend('z', ["c++", "-DLIB_NAME_BUILD_ZLIB"], export=True)
# external flags:
my_module.add_flag('link-lib', "pthread", export=True)
my_module.add_flag('c++', "-DHELLO_FLAG=\"kljlkj\"", export=True)
# internal flags:
my_module.add_flags('c', "-DMODE_RELEASE")
my_module.add_flag('c', "-DMODE_RELEASE")
if target.get_mode() == "release":
pass
@@ -485,7 +491,8 @@ def create(target, module_name):
my_module.copy_path('data/*', 'destinationPath')
return my_module
# Return True if the module is compatible with the target or ...
return True
```

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

@@ -63,7 +63,7 @@ Install lutin:
--------------
Just run:
```bash
```{.sh}
pip install lutin
```
@@ -71,24 +71,24 @@ Install pip:
------------
Install pip on debian/ubuntu:
```bash
```{.sh}
sudo apt-get install pip
```
Install pip on ARCH-linux:
```bash
```{.sh}
sudo pacman -S pip
```
Install pip on MacOs:
```bash
```{.sh}
sudo easy_install pip
```
Install from sources:
---------------------
```bash
```{.sh}
git clone http://github.com/HeeroYui/lutin.git
cd lutin
sudo ./setup.py install
@@ -105,18 +105,19 @@ Tutorals: {#lutin_mainpage_tutorial}
- @ref lutin_concept
- @ref lutin_use
- @ref lutin_module
- @ref lutin_ios
License (APACHE v2.0) {#lutin_mainpage_licence}
License (MPL v2.0) {#lutin_mainpage_licence}
=====================
Copyright lutin Edouard DUPIN
Licensed under the Apache License, Version 2.0 (the "License");
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
http://www.apache.org/licenses/LICENSE-2.0
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,
@@ -138,3 +139,6 @@ Some other problem example:
- 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)

View File

@@ -6,7 +6,7 @@ import doxy.tools as tools
def create(target, module_name):
my_module = module.Module(__file__, module_name)
my_module.set_version([2,0,0])
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)

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,378 +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
from . import debug
##
## @brief Single argument class. It permit to define the getted argument.
##
class ArgElement:
##
## @brief Contructor.
## @param[in] self Class handle
## @param[in] option (string) Option name (write in fullmode ex: '--verbose' even if user write '-v')
## @param[in] value (string) Writed value by the user (defult '')
##
def __init__(self, option, value=""):
self.option = option;
self.arg = value;
##
## @brief Get the name of the argument: (write in fullmode ex: '--verbose' even if user write '-v')
## @param[in] self Class handle
## @return (string) The argument name
##
def get_option_name(self):
return self.option
##
## @brief Get argument data set by the user
## @param[in] self Class handle
## @return (string) The argument value
##
def get_arg(self):
return self.arg
##
## @brief Display the Argument property
## @param[in] self Class handle
##
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)
##
## @brief Declare a possibility of an argument value
##
class ArgDefine:
##
## @brief Contructor.
## @param[in] self Class handle
## @param[in] smallOption (char) Value for the small option ex: '-v' '-k' ... 1 single char element (no need of '-')
## @param[in] bigOption (string) Value of the big option name ex: '--verbose' '--kill' ... stated with -- and with the full name (no need of '--')
## @param[in] list ([[string,string],...]) Optionnal list of availlable option: '--mode=debug' ==> [['debug', 'debug mode'],['release', 'release the software']]
## @param[in] desc (string) user friendly description with this parameter (default "")
## @param[in] haveParam (bool) The option must have a parameter (default False)
##
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;
##
## @brief Get the small name of the option ex: '-v'
## @param[in] self Class handle
## @return (string) Small name value
##
def get_option_small(self):
return self.option_small
##
## @brief Get the big name of the option ex: '--verbose'
## @param[in] self Class handle
## @return (string) Big name value
##
def get_option_big(self):
return self.option_big
##
## @brief Get the status of getting user parameter value
## @param[in] self Class handle
## @return True The user must write a value
## @return False The user must NOT write a value
##
def need_parameters(self):
return self.have_param
##
## @brief Compatibility with @ref ArgSection class
## @param[in] self Class handle
## @return (string) empty string
##
def get_porperties(self):
return ""
##
## @brief Check if the user added value is correct or not with the list of availlable value
## @param[in] self Class handle
## @param[in] argument (string) User parameter value (string)
## @return True The parameter is OK
## @return False The parameter is NOT Availlable
##
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
##
## @brief Display the argument property when user request help
## @param[in] self Class handle
##
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 + " }")
##
## @brief Section Class definition (permit to add a comment when requesting help
##
class ArgSection:
##
## @brief Constructor
## @param[in] self Class handle
## @param[in] sectionName (string) Name of the cestion ex: "option" is displayed [option]
## @param[in] desc (string) Comment assiciated with the group
##
def __init__(self,
sectionName="",
desc=""):
self.section = sectionName;
self.description = desc;
##
## @brief Compatibility with @ref ArgDefine class
## @param[in] self Class handle
## @return empty string
##
def get_option_small(self):
return ""
##
## @brief Compatibility with @ref ArgDefine class
## @param[in] self Class handle
## @return empty string
##
def get_option_big(self):
return ""
##
## @brief get property print value with the correct writing mode
## @param[in] self Class handle
## @return String to display in the short line help
##
def get_porperties(self):
color = debug.get_color_set()
return " [" + color['blue'] + self.section + color['default'] + "]"
##
## @brief Display the argument property when user request help
## @param[in] self Class handle
##
def display(self):
color = debug.get_color_set()
print(" [" + color['blue'] + self.section + color['default'] + "] : " + self.description)
##
## @brief Class to define the agmument list availlable for a program
##
class LutinArg:
##
## @brief Constructor.
## @param[in] self Class handle
##
def __init__(self):
self.list_properties = []
##
## @brief Add a new argument possibilities...
## @param[in] self Class handle
## @param[in] smallOption (char) Value for the small option ex: '-v' '-k' ... 1 single char element (no need of '-')
## @param[in] bigOption (string) Value of the big option name ex: '--verbose' '--kill' ... stated with -- and with the full name (no need of '--')
## @param[in] list ([[string,string],...]) Optionnal list of availlable option: '--mode=debug' ==> [['debug', 'debug mode'],['release', 'release the software']]
## @param[in] desc (string) user friendly description with this parameter (default "")
## @param[in] haveParam (bool) The option must have a parameter (default False)
##
def add(self, smallOption="", bigOption="", list=[], desc="", haveParam=False):
self.list_properties.append(ArgDefine(smallOption, bigOption, list, desc, haveParam))
##
## @brief Add section on argument list
## @param[in] self Class handle
## @param[in] sectionName (string) Name of the cestion ex: "option" is displayed [option]
## @param[in] sectionDesc (string) Comment assiciated with the group
##
def add_section(self, sectionName, sectionDesc):
self.list_properties.append(ArgSection(sectionName, sectionDesc))
##
## @brief Parse the argument set in the command line
## @param[in] self Class handle
##
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.list_properties:
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.list_properties:
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;
##
## @brief Display help on console output
## @param[in] self Class handle
##
def display(self):
print("usage:")
listOfPropertiesArg = "";
for element in self.list_properties :
listOfPropertiesArg += element.get_porperties()
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
for element in self.list_properties :
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
@@ -33,6 +33,7 @@ __start_builder_name="Builder_"
##
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:
@@ -43,19 +44,28 @@ 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"]))
@@ -72,8 +82,8 @@ def init():
element["element"].init()
##
## @brief Get a builder tool with specifiying the input type (like cpp, S ...)
## @param[in] input_type (string) extention file that can be compile
## @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
@@ -84,10 +94,59 @@ 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 a builder tool with specifiying the output type (like .exe, .jar ...)
## @param[in] input_type (string) extention file that can be generated
## @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;
##
## @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

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 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()
##
## @brief Set log level of the console log system
## @param[in] id (int) Value of the log level:
## 0: None
## 1: error
## 2: warning
## 3: info
## 4: debug
## 5: verbose
## 6: extreme_verbose
##
def set_level(id):
global debug_level
debug_level = id
#print "SetDebug level at " + str(debug_level)
##
## @brief Get the current debug leval
## @return The value of the log level. Show: @ref set_level
##
def get_level():
global debug_level
return debug_level
##
## @brief Enable color of the console Log system
##
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"
##
## @brief Disable color of the console Log system
##
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 = ""
##
## @brief Print a extreme verbose log
## @param[in] input (string) Value to print if level is enough
## @param[in] force (bool) force display (no check of log level)
##
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()
##
## @brief Print a verbose log
## @param[in] input (string) Value to print if level is enough
## @param[in] force (bool) force display (no check of log level)
##
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()
##
## @brief Print a debug log
## @param[in] input (string) Value to print if level is enough
## @param[in] force (bool) force display (no check of log level)
##
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()
##
## @brief Print an info log
## @param[in] input (string) Value to print if level is enough
## @param[in] force (bool) force display (no check of log level)
##
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()
##
## @brief Print a warning log
## @param[in] input (string) Value to print if level is enough
## @param[in] force (bool) force display (no check of log level)
##
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()
##
## @brief Print a todo log
## @param[in] input (string) Value to print if level is enough
## @param[in] force (bool) force display (no check of log level)
##
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()
##
## @brief Print an error log
## @param[in] input (string) Value to print if level is enough
## @param[in] thread_id (int) Current thead ID of the builder thread
## @param[in] force (bool) force display (no check of log level)
## @param[in] crash (bool) build error has appear ==> request stop of all builds
##
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"
##
## @brief Print a log for a specific element action like generateing .so or binary ...
## @param[in] type (string) type of action. Like: "copy file", "StaticLib", "Prebuild", "Library" ...
## @param[in] lib (string) Name of the library/binary/package that action is done
## @param[in] dir (string) build direction. ex: "<==", "==>" ...
## @param[in] name (string) Destination of the data
## @param[in] force (bool) force display (no check of log level)
##
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()
##
## @brief Print a compilation return (output)
## @param[in] my_string (string) Std-error/std-info that is generate by the build system
##
def print_compilator(my_string):
global debug_color
global debug_lock
if debug_color == True:
my_string = my_string.replace('\\n', '\n')
my_string = my_string.replace('\\t', '\t')
my_string = my_string.replace('error:', color_red+'error:'+color_default)
my_string = my_string.replace('warning:', color_purple+'warning:'+color_default)
my_string = my_string.replace('note:', color_green+'note:'+color_default)
my_string = re.sub(r'([/\w_-]+\.\w+):', r'-COLORIN-\1-COLOROUT-:', my_string)
my_string = my_string.replace('-COLORIN-', color_yellow)
my_string = my_string.replace('-COLOROUT-', color_default)
debug_lock.acquire()
print(my_string)
debug_lock.release()
##
## @brief Get the list of default color
## @return A map with keys: "default","red","green","yellow","blue","purple","cyan"
##
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):
@@ -72,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 \
@@ -92,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()
@@ -124,35 +124,37 @@ 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:
@@ -161,12 +163,12 @@ def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_id
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)")

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:
@@ -157,7 +158,10 @@ class HeritageList:
## @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):
@@ -258,6 +262,5 @@ class heritage:
## @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

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,7 +14,7 @@ import inspect
import fnmatch
import datetime
# Local import
from . import debug
from realog import debug
from . import module
from . import tools
from . import env
@@ -155,11 +155,15 @@ class System:
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
module.add_depend(self._export_depends)
if self._export_depends != []:
module.add_depend(self._export_depends)
# add exporting sources
module.add_src_file(self._export_src)
if self._export_src != []:
module.add_src_file(self._export_src)
# add export path
module.add_path(self._export_path, export=True)
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]
@@ -199,38 +203,45 @@ __start_system_name="System_"
##
def import_path(path_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:
debug.verbose(" " + str(elem))
@@ -250,52 +261,71 @@ def display():
##
## @brief Check if a system Module is availlable for a specific target
## @param[in] lib_name (string) Name of the Library
## @param[in] target_name (string) Name of the target
## @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, target_name, target) :
def exist(lib_name, list_target_name, target) :
global __system_list
debug.verbose("exist= " + lib_name + " in " + target_name)
if target_name not in __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"].get_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
##
## @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] target_name (string) Name of the target
## @param[in] list_target_name ([string,...]) list of name of the target (ordered by request order)
## @return None
##
def load(target, lib_name, target_name):
def load(target, lib_name, list_target_name):
global __system_list
if target_name not in __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

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,7 +14,7 @@ import inspect
import fnmatch
import datetime
# Local import
from . import debug
from realog import debug
from . import heritage
from . import tools
from . import module
@@ -27,11 +27,15 @@ from . import env
class Target:
##
## @brief contructor
## @param[in] name (string) Name of the target
## @param[in] name ([string,...]) Name of the target
## @param[in] config (dict) User configuration
## @param[in] arch (string) specific parameter for gcc -arch element
##
def __init__(self, name, config, arch):
if tools.get_type_string(name) != "list":
debug.error("You must define a name in a list ...")
if len(name) < 1:
debug.error("You must define a name for your target ...")
## configuration of the build
self.config = config
@@ -48,10 +52,11 @@ class Target:
self.end_generate_package = config["generate-package"]
# todo : remove this :
self._name = name
self._config_based_on = [name]
self._name = name[-1]
self._config_based_on = name
debug.info("=================================");
debug.info("== Target='" + self._name + "' " + self.config["bus-size"] + " bits for arch '" + self.config["arch"] + "'");
debug.info("== Target list=" + str(self._config_based_on))
debug.info("=================================");
self.set_cross_base()
@@ -78,14 +83,22 @@ class Target:
self.path_generate_code="/generate_header"
self.path_arch = "/" + self._name
for elem in self._config_based_on:
self.add_flag("c", '-D__TARGET_OS__' + elem)
self.add_flag("c", [
'-D__TARGET_OS__' + self._name,
'-D__TARGET_ARCH__' + self.config["arch"],
'-D__TARGET_ADDR__' + self.config["bus-size"] + 'BITS',
'-D_REENTRANT'
])
if self.config["compilator"] == "clang" \
and self.xx_version >= 4002001: # >= 4.2.1
self.add_flag("c++", "-Wno-undefined-var-template")
self.add_flag("c", "-nodefaultlibs")
self.add_flag("c++", "-nostdlib")
# this disable the need to have the __cxa_guard_release
self.add_flag("c++", "-fno-threadsafe-statics")
#self.add_flag("c", "-nostdinc") #ignores standard C include directories
#self.add_flag("c++", "-nostdinc++") #ignores standard C++ include directories
self.add_flag("ar", 'rcs')
if self._name == "Windows":
@@ -96,7 +109,7 @@ class Target:
if "debug" == self.config["mode"]:
self.add_flag("c", [
"-g",
"-DDEBUG"
#"-DDEBUG"
])
if env.get_force_optimisation() == False:
self.add_flag("c", "-O0")
@@ -104,7 +117,7 @@ class Target:
self.add_flag("c", "-O3")
else:
self.add_flag("c", [
"-DNDEBUG",
#"-DNDEBUG",
"-O3"
])
@@ -131,6 +144,8 @@ class Target:
self.path_bin="bin"
self.path_lib="lib"
self.path_data="share"
self.path_data_in_shared="data_share"
self.path_data_in_bin="data_bin"
self.path_doc="doc"
self.path_include="include"
self.path_temporary_generate="generate"
@@ -206,15 +221,38 @@ class Target:
def get_simulation(self):
return self.config["simulation"]
##
## @brief Get compilator name (clang / gcc)
## @param[in] self (handle) Class handle
## @return (bool) name of the compilator requested
##
def get_compilator(self):
return self.config["compilator"]
##
## @brief Get architecture name (x86 / arm / ...)
## @param[in] self (handle) Class handle
## @return (bool) name of the arch requested
##
def get_arch(self):
return self.config["arch"]
##
## @brief Get architecture name (x86 / arm / ...)
## @param[in] self (handle) Class handle
## @return (bool) name of the arch requested
##
def get_bus_size(self):
return self.config["bus-size"]
##
## @brief Add global target 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
## @param[in] in_list ([string,...] or string) List of path to include
## @return None
##
def add_flag(self, type, list):
tools.list_append_to_2(self.global_flags, type, list)
def add_flag(self, in_type, in_list):
tools.list_append_to_2(self.global_flags, in_type, in_list)
##
## @brief Update basic tree path positions on the build tree
@@ -225,6 +263,7 @@ class Target:
self.path_out = os.path.join("out", self._name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"])
self.path_final = os.path.join("final", self.config["compilator"])
self.path_staging = os.path.join("staging", self.config["compilator"])
self.path_staging_tmp = os.path.join("staging_tmp", self.config["compilator"])
self.path_build = os.path.join("build", self.config["compilator"])
# TODO: Remove this from here ==> this is a tools
@@ -286,7 +325,7 @@ class Target:
if ret == False:
debug.error("Can not get the g++/clang++ version ...")
self.xx_version = self.create_number_from_version_string(ret)
debug.verbose(self.config["compilator"] + "++ version=" + str(ret) + " number=" + str(self.xx_version))
debug.debug(self.config["compilator"] + "++ version=" + str(ret) + " number=" + str(self.xx_version))
self.ld = self.cross + "ld"
self.nm = self.cross + "nm"
@@ -361,8 +400,11 @@ class Target:
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_staging_path(self, name):
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, name)
def get_staging_path(self, name, tmp=False):
if tmp == False:
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, name)
else:
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging_tmp, name)
##
## @brief Get the build path ==> dependency file, object files, cmdlines files, generate files, local install headers ...
@@ -404,10 +446,15 @@ class Target:
## @brief Get the data path where pre-write the install "data" files
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the module
## @param[in] group (enum [in-bin, in-shared]) Group of the destination
## @return (string) The path
##
def get_build_path_data(self, name):
return os.path.join(self.get_build_path(name), self.path_data, name)
def get_build_path_data(self, name, group):
if group == "in-shared":
return os.path.join(self.get_build_path(name), self.path_data_in_shared, name)
elif group == "in-bin":
return os.path.join(self.get_build_path(name), self.path_data_in_bin, name)
debug.error("wrong type (impossible case...)")
##
## @brief Get the include path where pre-install "include" headers files
@@ -433,8 +480,10 @@ class Target:
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_build_file_bin(self, name):
return os.path.join(self.get_build_path_bin(name), name + self.suffix_binary)
def get_build_file_bin(self, name, static):
if static == True:
return os.path.join(self.get_build_path_bin(name), name + "_static" + self.suffix_binary)
return os.path.join(self.get_build_path_bin(name), name + "_dynamic" + self.suffix_binary)
##
## @brief Get the path filename of the build static library name
@@ -461,8 +510,8 @@ class Target:
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_bin(self, name):
return os.path.join(self.get_staging_path(name), self.path_bin)
def get_staging_path_bin(self, name, tmp=False):
return os.path.join(self.get_staging_path(name, tmp), self.path_bin)
##
## @brief Get the lib path for staging step
@@ -470,17 +519,22 @@ class Target:
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_lib(self, name):
return os.path.join(self.get_staging_path(name), self.path_lib, name)
def get_staging_path_lib(self, name, tmp=False):
return os.path.join(self.get_staging_path(name, tmp), self.path_lib, name)
##
## @brief Get the data path for staging step
## @param[in] self (handle) Class handle
## @param[in] name (string) Name of the package
## @param[in] group (enum [in-bin, in-shared]) Group of the destination
## @return (string) The path
##
def get_staging_path_data(self, name):
return os.path.join(self.get_staging_path(name), self.path_data, name)
def get_staging_path_data(self, name, tmp=False, group = "in-shared"):
if group == "in-shared":
return os.path.join(self.get_staging_path(name, tmp), self.path_data, name)
elif group == "in-bin":
return os.path.join(self.get_staging_path(name, tmp), self.path_bin, name)
debug.error("wrong type (impossible case...)")
##
## @brief Get the include path for staging step
@@ -575,9 +629,9 @@ class Target:
module.load_module(self, name)
return True;
# need to import the module (or the system module ...)
exist = system.exist(name, self._name, self)
exist = system.exist(name, self._config_based_on, self)
if exist == True:
system.load(self, name, self._name)
system.load(self, name, self._config_based_on)
return True;
# we did not find the module ...
return False;
@@ -599,9 +653,11 @@ class Target:
## @param[in] name (string) Module to build
## @param[in] optionnal (bool) If the module is not accessible, this is not a probleme ==> optionnal dependency requested
## @param[in] actions ([string,...]) list of action to do. ex: build, gcov, dump, all, clean, install, uninstall, run, log
## @param[in] package_name Current package name that request the build
## @return (None|Module handle| ...) complicated return ...
##
def build(self, name, optionnal=False, actions=[]):
def build(self, name, optionnal=False, actions=[], package_name=None):
debug.extreme_verbose("call build ... " + str(name));
if len(name.split("?")) != 1\
or len(name.split("@")) != 1:
debug.error("need update")
@@ -620,124 +676,193 @@ class Target:
for mod in self.module_list:
mod.display()
return
if name[:10] == "dependency":
if len(name) > 10:
rules = name.split(":")[1]
else:
rules = "LBDPK"
# L for library
# B for binary
# D for Data
# P for prebuild
# K for package
debug.print_element("dot", "", "---", "dependency.dot")
self.load_all()
tmp_file = open("dependency.dot", 'w')
tmp_file.write('digraph G {\n')
tmp_file.write(' rankdir=\"LR\";\n')
for mod in self.module_list:
mod.dependency_generate(self, tmp_file, 1, rules)
# TODO : do it better ==> system library hook (do a oad of all avillable system library)
tmp_file.write(' node [\n');
tmp_file.write(' shape=square;\n');
tmp_file.write(' style=filled;\n');
tmp_file.write(' color=gray;\n');
tmp_file.write(' ];\n');
# TODO : End hook
for mod in self.module_list:
mod.dependency_generate(self, tmp_file, 2, rules)
tmp_file.write('}\n')
tmp_file.flush()
tmp_file.close()
debug.print_element("dot", "", "---", "dependency.dot")
return
if name == "all":
debug.info("build all")
self.load_all()
for mod in self.module_list:
if self._name=="Android":
if self._name == "Android":
if mod.get_type() == "PACKAGE":
mod.build(self, None)
mod.build(self, package_name)
else:
if mod.get_type() == "BINARY" \
or mod.get_type() == "PACKAGE":
mod.build(self, None)
mod.build(self, package_name)
elif name == "clean":
debug.info("clean all")
self.load_all()
for mod in self.module_list:
mod.clean(self)
else:
module_name = name
action_list = actions
for action_name in action_list:
debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
ret = None;
if action_name == "install":
try:
self.install_package(module_name)
except AttributeError:
debug.error("target have no 'install_package' instruction")
elif action_name == "uninstall":
try:
self.un_install_package(module_name)
except AttributeError:
debug.error("target have no 'un_install_package' instruction")
elif action_name[:3] == "run":
if len(action_name) > 3:
# we have option:
action_name2 = action_name.replace("\:", "1234COLUMN4321")
option_list = action_name2.split(":")
if len(option_list) == 0:
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
if name.find("*") != -1:
list_of_all_element = module.list_filtered_module(name);
else:
list_of_all_element = [name]
global_run_error = [];
for module_name in list_of_all_element:
action_list = actions
for action_name in action_list:
debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
ret = None;
if action_name == "install":
try:
self.install_package(module_name)
except AttributeError:
debug.error("target have no 'install_package' instruction")
elif action_name == "uninstall":
try:
self.un_install_package(module_name)
except AttributeError:
debug.error("target have no 'un_install_package' instruction")
elif action_name[:3] == "run":
sub_action_name = action_name[3:];
"""
if mod.get_type() != "BINARY" \
and mod.get_type() != "PACKAGE":
debug.error("Can not run other than 'BINARY' ... pakage='" + mod.get_type() + "' for module='" + module_name + "'")
"""
bin_name = None
if len(sub_action_name) > 0:
if sub_action_name[0] == '%':
bin_name = ""
for elem in sub_action_name[1:]:
if elem == ":":
break;
bin_name += elem
# we have option:
action_name2 = action_name.replace("\:", "1234COLUMN4321")
option_list = action_name2.split(":")
if len(option_list) == 0:
if bin_name != None:
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list = []
ret_value = self.run(module_name, option_list, bin_name);
else:
option_list_tmp = option_list[1:]
option_list = []
for elem in option_list_tmp:
option_list.append(elem.replace("1234COLUMN4321", ":"))
#try:
ret_value = self.run(module_name, option_list, bin_name)
if not env.get_async_fail():
if ret_value != 0:
debug.error("FAIL in execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret));
else:
if ret_value != 0:
debug.warning("FAIL execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret));
global_run_error.append({
"module": module_name,
"bin": bin_name,
"options": option_list,
"return": ret_value,
"type": "Execution Fail ..."
})
else:
global_run_error.append({
"module": module_name,
"bin": bin_name,
"options": option_list,
"return": ret_value,
"type": "Execution OK ..."
})
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
try:
self.show_log(module_name)
except AttributeError:
debug.error("target have no 'show_log' instruction")
else:
option_list = []
#try:
self.run(module_name, option_list)
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
try:
self.show_log(module_name)
except AttributeError:
debug.error("target have no 'show_log' instruction")
else:
present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \
and optionnal == True:
ret = [heritage.HeritageList(), False]
present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \
and optionnal == True:
ret = [heritage.HeritageList(), False, []]
else:
for mod in self.module_list:
debug.verbose("compare " + mod.get_name() + " == " + module_name)
if mod.get_name() == module_name:
if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'")
if len(action_name) > 4:
debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
ret = mod.display()
break
elif action_name[:5] == "clean":
debug.info("clean module '" + module_name + "'")
if len(action_name) > 5:
debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
ret = mod.clean(self)
break
elif action_name[:4] == "gcov":
debug.debug("gcov on module '" + module_name + "'")
if len(action_name) > 4:
# we have option:
option_list = action_name.split(":")
if len(option_list) == 0:
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
if "output" in option_list:
ret = mod.gcov(self, generate_output=True)
else:
ret = mod.gcov(self, generate_output=False)
break
elif action_name[:5] == "build":
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
ret = [mod.build(self, package_name), True, []]
break
# at the end of the build selected...
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False, []]
break
if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
#display errors
if len(global_run_error) != 0:
pass;
else:
for mod in self.module_list:
debug.verbose("compare " + mod.get_name() + " == " + module_name)
if mod.get_name() == module_name:
if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'")
if len(action_name) > 4:
debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
ret = mod.display()
break
elif action_name[:5] == "clean":
debug.info("clean module '" + module_name + "'")
if len(action_name) > 5:
debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
ret = mod.clean(self)
break
elif action_name[:4] == "gcov":
debug.debug("gcov on module '" + module_name + "'")
if len(action_name) > 4:
# we have option:
option_list = action_name.split(":")
if len(option_list) == 0:
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list = option_list[1:]
else:
option_list = []
if "output" in option_list:
ret = mod.gcov(self, generate_output=True)
else:
ret = mod.gcov(self, generate_output=False)
break
elif action_name[:5] == "build":
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
if optionnal == True:
ret = [mod.build(self, None), True]
else:
ret = mod.build(self, None)
break
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False]
break
if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
if len(action_list) == 1:
return ret
if len(action_list) == 1 and len(list_of_all_element) == 1:
return ret;
# end of all element processing...
return [None, False, global_run_error];
##
## @brief Add action to do for package specific part when build upper element
## @param[in] name_of_state (string) a state to call action
## - BINARY
## - BINARY_SHARED
## - BINARY_DYNAMIC
## - BINARY_STAND_ALONE
## - LIBRARY
## - LIBRARY_DYNAMIC
@@ -766,6 +891,7 @@ class Target:
## @param[in] static The package is build in static mode
##
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
debug.debug("make_package [START]")
#The package generated depend of the type of the element:
end_point_module_name = heritage_list.list_heritage[-1].name
module = self.get_module(end_point_module_name)
@@ -774,19 +900,19 @@ class Target:
if module.get_type() == 'PREBUILD':
#nothing to do ...
return
if module.get_type() == 'LIBRARY' \
or module.get_type() == 'LIBRARY_DYNAMIC' \
or module.get_type() == 'LIBRARY_STATIC':
elif module.get_type() == 'LIBRARY' \
or module.get_type() == 'LIBRARY_DYNAMIC' \
or module.get_type() == 'LIBRARY_STATIC':
debug.info("Can not create package for library");
return
if module.get_type() == 'BINARY' \
or module.get_type() == 'BINARY_STAND_ALONE':
elif module.get_type() == 'BINARY' \
or module.get_type() == 'BINARY_STAND_ALONE':
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
if module.get_type() == 'BINARY_SHARED':
elif module.get_type() == 'BINARY_DYNAMIC':
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
if module.get_type() == 'PACKAGE':
debug.info("Can not create package for package");
return
elif module.get_type() == 'PACKAGE':
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
debug.debug("make_package [STOP]")
return
##
@@ -799,6 +925,7 @@ class Target:
## @return False Nothing has been copied
##
def make_package_binary_data(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
debug.debug("make_package_binary_data [START]")
target_shared_path = os.path.join(path_package, self.pkg_path_data)
if static == True:
path_package_data = os.path.join(target_shared_path, pkg_name)
@@ -810,7 +937,7 @@ class Target:
debug.debug("heritage for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage:
debug.debug("sub elements: " + str(heritage.name))
path_src = self.get_build_path_data(heritage.name)
path_src = self.get_build_path_data(heritage.name, group="in-shared")
debug.verbose(" has directory: " + path_src)
if os.path.isdir(path_src):
if static == True:
@@ -833,6 +960,7 @@ class Target:
ret_copy = tools.copy_list(copy_list)
# remove unneded files (NOT folder ...)
ret_remove = tools.clean_directory(target_shared_path, copy_list)
debug.debug("make_package_binary_data [STOP]")
return ret_copy or ret_remove
##
@@ -845,21 +973,92 @@ class Target:
## @return False Nothing has been copied
##
def make_package_binary_bin(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
debug.debug("make_package_binary_bin [START]")
copy_list={}
# creata basic output path
path_package_bin = os.path.join(path_package, self.pkg_path_bin)
tools.create_directory_of_file(path_package_bin)
path_src = self.get_build_file_bin(pkg_name)
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary)
debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src,
path_dst,
in_list=copy_list)
# Local module binary
path_src = self.get_build_file_bin(pkg_name, static)
if os.path.exists(path_src) == True:
try:
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary)
debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src,
path_dst,
in_list=copy_list)
except:
debug.extreme_verbose("can not find : " + path_src)
pass
path_src = self.get_build_file_bin(pkg_name, static)
path_src = path_src[:len(path_src)-4] + "js"
if os.path.exists(path_src) == True:
try:
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary2)
debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src,
path_dst,
in_list=copy_list)
except:
debug.extreme_verbose("can not find : " + path_src)
pass
# heritage binary
debug.debug("heritage for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage:
debug.debug("sub elements: " + str(heritage.name))
path_src = self.get_build_file_bin(heritage.name, static)
if os.path.exists(path_src) == True:
try:
path_dst = os.path.join(path_package_bin, heritage.name + self.suffix_binary)
debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src,
path_dst,
in_list=copy_list)
except:
debug.extreme_verbose("can not find : " + path_src)
pass
path_src = self.get_build_file_bin(heritage.name, static)
path_src = path_src[:len(path_src)-4] + "js"
if os.path.exists(path_src) == True:
try:
path_dst = os.path.join(path_package_bin, heritage.name + self.suffix_binary2)
debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src,
path_dst,
in_list=copy_list)
except:
debug.extreme_verbose("can not find : " + path_src)
pass
# copy data for the data inside bin (stupid, but needed)
debug.debug("heritage for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage:
debug.debug("sub elements: " + str(heritage.name))
path_src = self.get_build_path_data(heritage.name, group="in-bin")
if os.path.isdir(path_src):
if static == True:
debug.debug(" need copy: " + path_src + " to " + path_package_bin)
#copy all data:
tools.copy_anything(path_src,
path_package_bin,
recursive=True,
force_identical=True,
in_list=copy_list)
else:
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + path_package_bin)
#copy all data:
tools.copy_anything(os.path.dirname(path_src),
path_package_bin,
recursive=True,
force_identical=True,
in_list=copy_list)
#real copy files
ret_copy = tools.copy_list(copy_list)
ret_remove = False
if self.pkg_path_bin != "":
# remove unneded files (NOT folder ...)
ret_remove = tools.clean_directory(path_package_bin, copy_list)
debug.debug("make_package_binary_bin [STOP]")
return ret_copy or ret_remove
##
@@ -872,6 +1071,7 @@ class Target:
## @return False Nothing has been copied
##
def make_package_binary_lib(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
debug.debug("make_package_binary_lib [START]")
copy_list={}
path_package_lib = os.path.join(path_package, self.pkg_path_lib)
if static == False:
@@ -895,10 +1095,12 @@ class Target:
if self.pkg_path_lib != "":
# remove unneded files (NOT folder ...)
ret_remove = tools.clean_directory(path_package_lib, copy_list)
debug.debug("make_package_binary_lib [STOP]")
return ret_copy or ret_remove
def make_package_generic_files(self, path_package, pkg_properties, pkg_name, base_pkg_path, heritage_list, static):
debug.debug("make_package_generic_files [START]")
## Create version file:
ret_version = tools.file_write_data(os.path.join(path_package, self.pkg_path_version_file),
tools.version_to_string(pkg_properties["VERSION"]),
@@ -959,6 +1161,7 @@ class Target:
ret_changelog = tools.file_write_data(change_log_file_dest,
"No changelog data " + pkg_name + "\n",
only_if_new=True)
debug.debug("make_package_generic_files [STOP]")
return ret_version \
or ret_maintainer \
or ret_appl_name \
@@ -966,6 +1169,31 @@ class Target:
or ret_readme \
or ret_changelog
def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------");
debug.info("-- Install package '" + pkg_name + "'");
debug.debug("------------------------------------------------------------------------");
debug.error("action not implemented ...");
def un_install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------");
debug.info("-- Un-Install package '" + pkg_name + "'");
debug.debug("------------------------------------------------------------------------");
debug.error("action not implemented ...");
def run(self, pkg_name, option_list, binary_name = None):
debug.debug("------------------------------------------------------------------------");
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list));
debug.debug("------------------------------------------------------------------------");
debug.warning("action not implemented ...");
return -1;
def show_log(self, pkg_name):
debug.debug("------------------------------------------------------------------------");
debug.info("-- Show log logcat '" + pkg_name + "'");
debug.debug("------------------------------------------------------------------------");
debug.error("action not implemented ...");
##
## @brief convert a s list of string in a string separated by a ","
## @param[in] list List of element to transform
@@ -992,6 +1220,7 @@ __start_target_name="Target_"
##
def import_path(path_list):
global __target_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:
@@ -1001,15 +1230,23 @@ def import_path(path_list):
# 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_target_name)] != __start_target_name:
debug.extreme_verbose("TARGET: NOT-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_target_name)] != __start_target_name:
debug.extreme_verbose("TARGET: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
continue
# Remove local patern
target_name = filename[len(__start_target_name):]
debug.verbose("TARGET: Integrate: '" + target_name + "' from '" + elem + "'")
__target_list.append([target_name, elem])
elif filename[:len(global_base)] == global_base:
filename = filename[len(global_base):]
# Check if it start with the local patern:
if filename[:len(__start_target_name)] != __start_target_name:
debug.extreme_verbose("TARGET: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
continue
# Remove local patern
target_name = filename[len(__start_target_name):]
debug.verbose("TARGET: Integrate: '" + target_name + "' from '" + elem + "'")
__target_list.append([target_name, elem])
debug.verbose("New list TARGET: ")
for elem in __target_list:
debug.verbose(" " + str(elem[0]))
@@ -1021,7 +1258,7 @@ def load_target(name, config):
global __target_list
debug.debug("load target: " + name)
if len(__target_list) == 0:
debug.error("No target to compile !!!")
debug.error("No target to execute !!!")
debug.debug("list target: " + str(__target_list))
for mod in __target_list:
if mod[0] == name:

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,16 +405,16 @@ 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)
##
@@ -362,6 +428,9 @@ def get_version_from_file_or_direct(path_module, filename_or_version):
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)
@@ -373,16 +442,19 @@ def get_version_from_file_or_direct(path_module, filename_or_version):
line = lines[0]
debug.debug("Parse line: '" + line + "'")
#check if we have "-dev"
dev_mode = False
if line[-4:] == "-dev":
dev_mode = True
line = line[:-4]
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 == True:
out.append("dev")
if dev_mode != "":
out.append(dev_mode)
debug.debug(" ==> " + str(out))
return out
@@ -397,6 +469,8 @@ def get_maintainer_from_file_or_direct(path_module, filename_or_author):
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)
@@ -410,4 +484,29 @@ def get_maintainer_from_file_or_direct(path_module, filename_or_author):
# comment ...
continue
out.append(elem)
return out
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
@@ -59,7 +65,7 @@ def get_support_multithreading():
##
def link(file, binary, target, depancy, flags, name, basic_path, static = False):
file_src = file
file_dst = target.get_build_file_bin(binary)
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
@@ -83,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:
@@ -128,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

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,7 +63,7 @@ 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):
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
@@ -86,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:
@@ -139,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
@@ -157,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:
@@ -165,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
@@ -68,7 +75,12 @@ def link(file, binary, target, depancy, flags, name, basic_path):
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

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

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

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

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

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
@@ -31,6 +31,6 @@ class System(system.System):
destination_path="GL",
recursive=True)
"""
self.add_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

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

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

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

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

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
@@ -22,6 +22,8 @@ class System(system.System):
self.set_valid(True)
# no check needed ==> just add this:
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([

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

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

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

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
@@ -22,6 +22,7 @@ class System(system.System):
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)
# 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
@@ -30,7 +30,7 @@ class System(system.System):
self.add_flag("c++", "-D__STDCPP_GNU__")
if env.get_isolate_system() == False:
self.add_flag("c++-remove", "-nostdlib")
self.add_flag("need-libstdc++", True)
self.add_flag("need-libstdc++", True) # regarder a quoi ca sert !!!!
else:
self.add_flag("link-lib", "stdc++")
compilator_gcc = "g++"

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

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)

View File

@@ -0,0 +1,35 @@
#!/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("lzma : ???")
# 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", "lzma")
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/lzma/lzma12.h",
"/usr/include/lzma.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

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("mysql: My sql interface (microsoft) or mariadB interface.")
# check if the library exist:
if not os.path.isfile("/usr/include/mysql/mysql.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", "mysqlclient")
self.add_flag("link-lib", "ssl")
self.add_depend([
'pthread',
'z',
'm',
#'ssl',
'crypto'
])
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/mysql/"
],
clip_path="/usr/include/mysql/")
else:
self.add_path("/usr/include/mysql/");

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
@@ -23,32 +23,14 @@ class System(system.System):
# no check needed ==> just add this:
self.add_depend([
'c',
'X11'
])
self.add_flag('link-lib', 'GL')
if env.get_isolate_system() == True:
self.add_header_file([
self.add_header_file([
"/usr/include/GL/*"
],
destination_path="GL",
recursive=True)
"""
if target.name=="Linux":
elif target.name=="Android":
my_module.add_flag('link-lib', "GLESv2")
elif target.name=="Windows":
my_module.add_depend([
"glew"
])
elif target.name=="MacOs":
my_module.add_flag('link', [
"-framework OpenGL"])
elif target.name=="IOs":
my_module.add_flag('link', [
"-framework OpenGLES"
])
"""

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

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

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