Compare commits

...

32 Commits
0.1.0 ... 0.5.0

Author SHA1 Message Date
b0d300e3ff [DEV] add version of C build 2015-02-26 21:12:06 +01:00
4b3072ddf2 [DEV] add dependency of Gcc version 2015-02-25 22:05:00 +01:00
ffeb404d52 [DEBUG] correct include in boost 2015-02-25 21:28:07 +01:00
185d3c290c [DEV] WORK on a port for BOOST (temporary remove support of X11 2015-02-24 22:20:11 +01:00
e3a2e19fe6 [DEV] add dependency of generic module 2015-02-23 22:14:48 +01:00
91b0cecc28 [DEV] add getter version of gcc 2015-02-20 21:40:03 +01:00
95b2206da6 [DEV] compile again for Android 2015-02-16 21:39:28 +01:00
512651e746 [DEBUG] correct MacOs package generation 2015-02-15 21:50:31 +01:00
03e67ae8d6 [DEBUG] update to the 8.1 version of IOS & correct a simulator request 2015-02-12 23:18:32 +01:00
fc77789f93 [DEBUG] correct build of system module 2015-02-12 22:08:23 +01:00
220364c116 [DEV] some system interface upgrade 2015-02-12 21:02:51 +01:00
1ec26df856 [DEV] add some system prebuild packages 2015-02-06 23:32:12 +01:00
134e0b523e [DEV] remove some unneeded elements 2015-01-12 23:47:53 +01:00
2a58657df5 [DEV] add gcov property 2014-11-25 22:07:48 +01:00
288207e4e1 [DEBUG] package copy subDirectory 2014-10-22 21:23:56 +02:00
dd03e46832 [DEV] separate multiprocess log and display it corectly with the compile line 2014-10-17 21:46:31 +02:00
7c72aa8b84 [LOG] change log comment and level for an uncompilable file 2014-10-09 21:23:19 +02:00
0f4349e65a [DEBUG] correction of missing file in dependency 2014-10-08 21:52:22 +02:00
d0fb9045c4 [DEV] error android debug key 2014-10-01 22:12:31 +02:00
0042e68581 [DEV] debug clean 2014-09-17 21:13:35 +02:00
0cb58135fd [DEBUG] android build is back 2014-09-17 00:28:54 +02:00
33dc55d84b [DEV] Add target searching and multi processor compilation 2014-09-16 21:40:07 +02:00
67297b3063 [DEV] start think on multiple architecture type 2014-09-15 22:37:53 +02:00
e46e6add5e [DEBUG] windows compilation (32 bit only) 2014-09-15 21:46:47 +02:00
b1cbee3b4b Merge remote-tracking branch 'origin/dev' 2014-09-11 06:52:47 +02:00
02a72568c9 [DEV] remove resize image when no PIL is found (for TRAVIS building) 2014-09-09 06:40:16 +02:00
dd46d2d7b4 [DEV] remove resize image when no PIL is found (for TRAVIS building) 2014-09-09 06:25:29 +02:00
92c552fd59 [DEV] update android build to new ndk r10 2014-08-28 21:04:03 +02:00
885a60f22c [DEBUG] missing heritage instance on prebuilt element 2014-08-18 22:57:06 +02:00
db4a587a44 [LICENCE] change BSD => apache v2.0 2014-08-09 23:55:31 +02:00
9d6418eed9 [DEV] add autocompletion for lutin.py 2014-08-07 21:00:31 +02:00
ec60375c9f [DEBUG] correct the android path defining 2014-06-18 14:57:24 +02:00
37 changed files with 1497 additions and 2504 deletions

View File

@@ -22,38 +22,20 @@ you can see exemple for some type in :
edn : package
glew : prebuild
Copyright (c)
=============
License (APACHE v2.0)
=====================
2011, Edouard DUPIN
Copyright lutin Edouard DUPIN
License (DSB)
=============
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
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
http://www.apache.org/licenses/LICENSE-2.0
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
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.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

90
bash-autocompletion/lutin.py Executable file
View File

@@ -0,0 +1,90 @@
_lutin()
{
local cur prev optshorts opts renameprev listmodule
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
optshorts="-h -v -C -f -P -j -s -t -c -m -r -p"
opts="--help --verbose --color --force --pretty --jobs --force-strip --target --compilator --mode --prj --package --simulation"
renameprev=${prev}
case "${renameprev}" in
-h)
renameprev="--help"
;;
-v)
renameprev="--verbose"
;;
-C)
renameprev="--color"
;;
-f)
renameprev="--force"
;;
-P)
renameprev="--pretty"
;;
-j)
renameprev="--jobs"
;;
-s)
renameprev="--force-strip"
;;
-t)
renameprev="--target"
;;
-c)
renameprev="--compilator"
;;
-m)
renameprev="--mode"
;;
-r)
renameprev="--prj"
;;
-p)
renameprev="--package"
;;
esac
#
# Complete the arguments to some of the basic commands.
#
case "${renameprev}" in
--compilator)
local names="clang gcc"
COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
return 0
;;
--jobs)
local names="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
return 0
;;
--target)
local names=`lutin.py --list-target`
COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
return 0
;;
--mode)
local names="debug release"
COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
return 0
;;
*)
;;
esac
if [[ ${cur} == --* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${optshorts}" -- ${cur}) )
return 0
fi
listmodule=`lutin.py --list-module`
COMPREPLY=( $(compgen -W "${listmodule}" -- ${cur}) )
return 0
}
complete -F _lutin lutin.py

View File

@@ -0,0 +1,6 @@
to install autocompletion for lutin :
sudo cp bash-autocompletion/lutin.py /etc/bash_completion.d
==> and restart bash ...

13
licence.txt Normal file
View File

@@ -0,0 +1,13 @@
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.

View File

@@ -1,32 +0,0 @@
Copyright (c) 2011, Edouard DUPIN
License (DSB)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.L

106
lutin.py
View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
# for path inspection:
import sys
import os
@@ -13,7 +21,7 @@ import lutinArg
myLutinArg = lutinArg.LutinArg()
myLutinArg.add(lutinArg.ArgDefine("h", "help", desc="display this help"))
myLutinArg.add_section("option", "Can be set one time in all case")
myLutinArg.add(lutinArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"]], desc="display makefile debug level (verbose) default =2"))
myLutinArg.add(lutinArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2"))
myLutinArg.add(lutinArg.ArgDefine("C", "color", desc="display makefile output in color"))
myLutinArg.add(lutinArg.ArgDefine("f", "force", desc="Force the rebuild without checking the dependency"))
myLutinArg.add(lutinArg.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
@@ -21,12 +29,16 @@ myLutinArg.add(lutinArg.ArgDefine("j", "jobs", haveParam=True, desc="Specifies t
myLutinArg.add(lutinArg.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
myLutinArg.add_section("properties", "keep in the sequency of the cible")
myLutinArg.add(lutinArg.ArgDefine("t", "target", list=[["Android",""],["Linux",""],["MacOs",""],["IOs",""],["Windows",""]], desc="Select a target (by default the platform is the computer that compile this"))
myLutinArg.add(lutinArg.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
myLutinArg.add(lutinArg.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
myLutinArg.add(lutinArg.ArgDefine("r", "prj", desc="Use external project management (not build with lutin..."))
myLutinArg.add(lutinArg.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
myLutinArg.add(lutinArg.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
myLutinArg.add(lutinArg.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
myLutinArg.add(lutinArg.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code"))
myLutinArg.add(lutinArg.ArgDefine("", "simulation", desc="simulater mode (availlable only for IOS)"))
myLutinArg.add(lutinArg.ArgDefine("", "list-target", desc="list all availlables targets ==> for auto completion"))
myLutinArg.add(lutinArg.ArgDefine("", "list-module", desc="list all availlables module ==> for auto completion"))
myLutinArg.add_section("cible", "generate in order set")
localArgument = myLutinArg.parse()
@@ -37,6 +49,7 @@ localArgument = myLutinArg.parse()
def usage():
# generic argument displayed :
myLutinArg.display()
print " All target can finish with '-clean' '-dump' ..."
print " all"
print " build all (only for the current selected board) (bynary and packages)"
print " clean"
@@ -45,7 +58,7 @@ def usage():
print " Dump all the module dependency and properties"
listOfAllModule = lutinModule.list_all_module_with_desc()
for mod in listOfAllModule:
print " " + mod[0] + " / " + mod[0] + "-clean / " + mod[0] + "-dump"
print " " + mod[0]
if mod[1] != "":
print " " + mod[1]
print " ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all"
@@ -58,6 +71,28 @@ def parseGenericArg(argument,active):
if active==False:
usage()
return True
if argument.get_option_nName() == "list-module":
if active==False:
listOfModule = lutinModule.list_all_module()
retValue = ""
for moduleName in listOfModule:
if retValue != "":
retValue += " "
retValue += moduleName
print retValue
exit(0)
return True
if argument.get_option_nName() == "list-target":
if active==False:
listOfTarget = lutinTarget.list_all_target()
retValue = ""
for targetName in listOfTarget:
if retValue != "":
retValue += " "
retValue += targetName
print retValue
exit(0)
return True
elif argument.get_option_nName()=="jobs":
if active==True:
lutinMultiprocess.set_core_number(int(argument.get_arg()))
@@ -91,6 +126,7 @@ if __name__ == "__main__":
# now import other standard module (must be done here and not before ...
import lutinTarget
import lutinSystem
import lutinHost
import lutinTools
@@ -100,50 +136,59 @@ import lutinTools
def Start():
#available target : Linux / MacOs / Windows / Android ...
targetName=lutinHost.OS
#compilation base
compilator="gcc"
# build mode
mode="release"
# package generationMode
generatePackage=True
config = {
"compilator":"gcc",
"mode":"release",
"bus-size":"auto",
"arch":"auto",
"generate-package":True,
"simulation":False,
"gcov":False
}
# load the default target :
target = None
simulationMode=False
actionDone=False
#build with extern tool
externBuild=False
# parse all argument
for argument in localArgument:
if True==parseGenericArg(argument, False):
continue
elif argument.get_option_nName() == "package":
generatePackage=False
config["generate-package"]=False
elif argument.get_option_nName() == "simulation":
simulationMode=True
elif argument.get_option_nName() == "prj":
externBuild=True
config["simulation"]=True
elif argument.get_option_nName() == "gcov":
config["gcov"]=True
elif argument.get_option_nName() == "bus":
config["bus-size"]=argument.get_arg()
elif argument.get_option_nName() == "arch":
config["arch"]=argument.get_arg()
elif argument.get_option_nName() == "compilator":
if compilator!=argument.get_arg():
if config["compilator"] != argument.get_arg():
debug.debug("change compilator ==> " + argument.get_arg())
compilator=argument.get_arg()
config["compilator"] = argument.get_arg()
#remove previous target
target = None
elif argument.get_option_nName() == "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")
debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release")
#reset properties by defauult:
compilator="gcc"
mode="release"
generatePackage=True
simulationMode=False
config = {
"compilator":"gcc",
"mode":"release",
"bus-size":"auto",
"arch":"auto",
"generate-package":True,
"simulation":False,
"gcov":False
}
#remove previous target
target = None
elif argument.get_option_nName() == "mode":
if mode!=argument.get_arg():
mode = argument.get_arg()
debug.debug("change mode ==> " + mode)
if config["mode"]!=argument.get_arg():
config["mode"] = argument.get_arg()
debug.debug("change mode ==> " + config["mode"])
#remove previous target
target = None
else:
@@ -153,14 +198,14 @@ def Start():
else:
#load the target if needed :
if target == None:
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode)
target = lutinTarget.load_target(targetName, config)
target.build(argument.get_arg())
actionDone=True
# if no action done : we do "all" ...
if actionDone==False:
#load the target if needed :
if target == None:
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode)
target = lutinTarget.load_target(targetName, config)
target.build("all")
# stop all started threads
lutinMultiprocess.un_init()
@@ -184,6 +229,9 @@ if __name__ == '__main__':
and folder.lower()!="out" :
debug.debug("Automatic load path: '" + folder + "'")
lutinModule.import_path(folder)
lutinSystem.import_path(folder)
lutinTarget.import_path(folder)
#lutinSystem.display()
Start()

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import lutinDebug as debug

View File

@@ -1,8 +1,17 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os
import thread
import lutinMultiprocess
import threading
import re
debugLevel=3
debugColor=False
@@ -23,6 +32,10 @@ def set_level(id):
debugLevel = id
#print "SetDebug level at " + str(debugLevel)
def get_level():
global debugLevel
return debugLevel
def enable_color():
global debugColor
debugColor = True
@@ -41,58 +54,89 @@ def enable_color():
global color_cyan
color_cyan = "\033[36m"
def verbose(input):
def extreme_verbose(input, force=False):
global debugLock
global debugLevel
if debugLevel >= 5:
if debugLevel >= 6 \
or force == True:
debugLock.acquire()
print(color_blue + input + color_default)
debugLock.release()
def debug(input):
def verbose(input, force=False):
global debugLock
global debugLevel
if debugLevel >= 4:
if debugLevel >= 5 \
or force == True:
debugLock.acquire()
print(color_blue + input + color_default)
debugLock.release()
def debug(input, force=False):
global debugLock
global debugLevel
if debugLevel >= 4 \
or force == True:
debugLock.acquire()
print(color_green + input + color_default)
debugLock.release()
def info(input):
def info(input, force=False):
global debugLock
global debugLevel
if debugLevel >= 3:
if debugLevel >= 3 \
or force == True:
debugLock.acquire()
print(input + color_default)
debugLock.release()
def warning(input):
def warning(input, force=False):
global debugLock
global debugLevel
if debugLevel >= 2:
if debugLevel >= 2 \
or force == True:
debugLock.acquire()
print(color_purple + "[WARNING] " + input + color_default)
debugLock.release()
def error(input, threadID=-1):
def error(input, threadID=-1, force=False, crash=True):
global debugLock
global debugLevel
if debugLevel >= 1:
if debugLevel >= 1 \
or force == True:
debugLock.acquire()
print(color_red + "[ERROR] " + input + color_default)
debugLock.release()
lutinMultiprocess.error_occured()
if threadID != -1:
thread.interrupt_main()
exit(-1)
#os_exit(-1)
#raise "error happend"
if crash==True:
lutinMultiprocess.error_occured()
if threadID != -1:
thread.interrupt_main()
exit(-1)
#os_exit(-1)
#raise "error happend"
def print_element(type, lib, dir, name):
def print_element(type, lib, dir, name, force=False):
global debugLock
global debugLevel
if debugLevel >= 3:
if debugLevel >= 3 \
or force == True:
debugLock.acquire()
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
debugLock.release()
def print_compilator(myString):
global debugColor
global debugLock
if debugColor == True:
myString = myString.replace('\\n', '\n')
myString = myString.replace('\\t', '\t')
myString = myString.replace('error:', color_red+'error:'+color_default)
myString = myString.replace('warning:', color_purple+'warning:'+color_default)
myString = myString.replace('note:', color_green+'note:'+color_default)
myString = re.sub(r'([/\w_-]+\.\w+):', r'-COLORIN-\1-COLOROUT-:', myString)
myString = myString.replace('-COLORIN-', color_yellow)
myString = myString.replace('-COLOROUT-', color_default)
debugLock.acquire()
print(myString)
debugLock.release()

View File

@@ -1,51 +1,64 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os
import lutinDebug as debug
import lutinEnv as environement
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
debug.verbose("Resuest check of dependency of :")
debug.verbose(" dst='" + str(dst) + "'")
debug.verbose(" str='" + str(src) + "'")
debug.verbose(" dept='" + str(dependFile) + "'")
debug.verbose(" cmd='" + str(file_cmd) + "'")
debug.extreme_verbose("Resuest check of dependency of :")
debug.extreme_verbose(" dst='" + str(dst) + "'")
debug.extreme_verbose(" str='" + str(src) + "'")
debug.extreme_verbose(" dept='" + str(dependFile) + "'")
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
# if force mode selected ==> just force rebuild ...
if environement.get_force_mode():
debug.verbose(" ==> must rebuild (force mode)")
debug.extreme_verbose(" ==> must rebuild (force mode)")
return True
# check if the destination existed:
if dst != "" \
and dst != None \
and os.path.exists(dst) == False:
debug.verbose(" ==> must rebuild (dst does not exist)")
debug.extreme_verbose(" ==> must rebuild (dst does not exist)")
return True
if dst != "" \
and dst != None \
and os.path.exists(src) == False:
debug.warning(" ==> unexistant file :'" + src + "'")
return True
# chek the basic date if the 2 files
if dst != "" \
and dst != None \
and os.path.getmtime(src) > os.path.getmtime(dst):
debug.verbose(" ==> must rebuild (source time greater)")
debug.extreme_verbose(" ==> must rebuild (source time greater)")
return True
if dependFile != "" \
and dependFile != None \
and os.path.exists(dependFile) == False:
debug.verbose(" ==> must rebuild (no depending file)")
debug.extreme_verbose(" ==> must rebuild (no depending file)")
return True
if file_cmd != "" \
and file_cmd != None:
if os.path.exists(file_cmd) == False:
debug.verbose(" ==> must rebuild (no commandLine file)")
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
return True
# check if the 2 cmdline are similar :
file2 = open(file_cmd, "r")
firstAndUniqueLine = file2.read()
if firstAndUniqueLine != cmdLine:
debug.verbose(" ==> must rebuild (cmdLines are not identical)")
debug.verbose(" ==> '" + cmdLine + "'")
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
debug.extreme_verbose(" ==> '" + cmdLine + "'")
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
file2.close()
return True
# the cmdfile is correct ...
@@ -53,7 +66,7 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
if dependFile != "" \
and dependFile != None:
debug.verbose(" start parsing dependency file : '" + dependFile + "'")
debug.extreme_verbose(" start parsing dependency file : '" + dependFile + "'")
file = open(dependFile, "r")
for curLine in file.readlines():
# normal file : end with : ": \\n"
@@ -68,36 +81,36 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
testFile=""
if curLine[len(curLine)-1:] == ':':
debug.verbose(" Line (no check (already done) : '" + curLine + "'");
debug.extreme_verbose(" Line (no check (already done) : '" + curLine + "'");
elif len(curLine) == 0 \
or curLine == '\\':
debug.verbose(" Line (Not parsed) : '" + curLine + "'");
debug.extreme_verbose(" Line (Not parsed) : '" + curLine + "'");
else:
testFile = curLine
debug.verbose(" Line (might check) : '" + testFile + "'");
debug.extreme_verbose(" Line (might check) : '" + testFile + "'");
# really check files:
if testFile!="":
debug.verbose(" ==> test");
debug.extreme_verbose(" ==> test");
if False==os.path.exists(testFile):
debug.verbose(" ==> must rebuild (a dependency file does not exist)")
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
file.close()
return True
if os.path.getmtime(testFile) > os.path.getmtime(dst):
debug.verbose(" ==> must rebuild (a dependency file time is newer)")
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
file.close()
return True
# close the current file :
file.close()
debug.verbose(" ==> Not rebuild (all dependency is OK)")
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
return False
def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
debug.verbose("Resuest check of dependency of :")
debug.verbose(" dst='" + dst + "'")
debug.verbose(" src()=")
debug.extreme_verbose("Resuest check of dependency of :")
debug.extreme_verbose(" dst='" + dst + "'")
debug.extreme_verbose(" src()=")
for src in srcList:
debug.verbose(" '" + src + "'")
@@ -106,39 +119,39 @@ def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
# if force mode selected ==> just force rebuild ...
if environement.get_force_mode():
debug.verbose(" ==> must re-package (force mode)")
debug.extreme_verbose(" ==> must re-package (force mode)")
return True
# check if the destination existed:
if False==os.path.exists(dst):
debug.verbose(" ==> must re-package (dst does not exist)")
debug.extreme_verbose(" ==> must re-package (dst does not exist)")
return True
# chek the basic date if the 2 files
if len(srcList)==0:
debug.verbose(" ==> must re-package (no source ???)")
debug.extreme_verbose(" ==> must re-package (no source ???)")
return True
for src in srcList:
if os.path.getmtime(src) > os.path.getmtime(dst):
debug.verbose(" ==> must re-package (source time greater) : '" + src + "'")
debug.extreme_verbose(" ==> must re-package (source time greater) : '" + src + "'")
return True
if ""!=file_cmd:
if False==os.path.exists(file_cmd):
debug.verbose(" ==> must rebuild (no commandLine file)")
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
return True
# check if the 2 cmdline are similar :
file2 = open(file_cmd, "r")
firstAndUniqueLine = file2.read()
if firstAndUniqueLine != cmdLine:
debug.verbose(" ==> must rebuild (cmdLines are not identical)")
debug.verbose(" ==> '" + cmdLine + "'")
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
debug.extreme_verbose(" ==> '" + cmdLine + "'")
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
file2.close()
return True
# the cmdfile is correct ...
file2.close()
debug.verbose(" ==> Not re-package (all dependency is OK)")
debug.extreme_verbose(" ==> Not re-package (all dependency is OK)")
return False

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
@@ -21,7 +29,7 @@ printPrettyMode=False
def set_print_pretty_mode(val):
global printPrettyMode
if val==True:
if val == True:
printPrettyMode = True
else:
printPrettyMode = False
@@ -30,9 +38,10 @@ def get_print_pretty_mode():
global printPrettyMode
return printPrettyMode
def print_pretty(myString):
def print_pretty(myString, force=False):
global printPrettyMode
if True==printPrettyMode:
if printPrettyMode == True \
or force == True:
if myString[len(myString)-1]==' ' :
tmpcmdLine = myString[:len(myString)-1]
else :
@@ -41,7 +50,27 @@ def print_pretty(myString):
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
baseElementList = ["-o", "-D", "-I", "-L", "g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib", "-framework", "-isysroot", "-arch"]
baseElementList = ["-o",
"-D",
"-I",
"-L",
"g++",
"gcc",
"clang",
"clang++",
"ar",
"ld",
"ranlib",
"-framework",
"-isysroot",
"-arch",
"-keystore",
"-sigalg",
"-digestalg",
"<",
"<<",
">",
">>"]
for element in baseElementList:
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
baseElementList = ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]

View File

@@ -1,14 +0,0 @@
#!/usr/bin/python
import lutinDebug as debug
import datetime
import lutinTools
import lutinModule
class ExtProjectGenerator:
def __init__(self, extType):
self.extType = extType
self.name = "emptyName"
#This is a distionnaty of all groups :
self.groups = {}

View File

@@ -1,693 +0,0 @@
#!/usr/bin/python
import lutinDebug as debug
import datetime
import lutinTools as tools
import os
import fnmatch
import lutinExtProjectGenerator
from collections import defaultdict
# id example : FFBA2F79187F44AE0034CC66
genericID = 100000
def convert_name_in_base_id(name,fill=True):
out = "FF"
for element in name.lower():
if element == "a": out += "01"
elif element == "b": out += "02"
elif element == "c": out += "03"
elif element == "d": out += "04"
elif element == "e": out += "05"
elif element == "f": out += "06"
elif element == "g": out += "07"
elif element == "h": out += "08"
elif element == "i": out += "09"
elif element == "j": out += "10"
elif element == "k": out += "11"
elif element == "l": out += "12"
elif element == "m": out += "13"
elif element == "n": out += "14"
elif element == "o": out += "15"
elif element == "p": out += "16"
elif element == "q": out += "17"
elif element == "r": out += "18"
elif element == "s": out += "19"
elif element == "t": out += "20"
elif element == "u": out += "21"
elif element == "v": out += "22"
elif element == "w": out += "23"
elif element == "x": out += "24"
elif element == "y": out += "25"
elif element == "z": out += "27"
else: out += "FF"
if len(out) >= 18:
return out
if fill == True:
for iii in range(0,256):
out += "A"
if len(out) >= 18:
return out
return out
dictId = {}
def convert_folder_in_base_id(name, package):
global dictId
debug.verbose(" generate Id for : " + package + ":" + name);
if package not in dictId.keys():
dictId[package] = {"lastID": 100000, "sub":{}}
if name not in dictId[package]["sub"].keys():
generatedID = convert_name_in_base_id(package) + str(dictId[package]["lastID"])
dictId[package]["lastID"] = dictId[package]["lastID"] + 1
dictId[package]["sub"][name] = {"id":generatedID}
return dictId[package]["sub"][name]["id"]
FILE_MARKER = '<files>'
##
## @brief generate a tree from the specific file
##
def attach(branch, trunk):
parts = branch.split('/', 1)
if len(parts) == 1: # branch is a file
trunk[FILE_MARKER].append(parts[0])
else:
node, others = parts
if node not in trunk:
trunk[node] = defaultdict(dict, ((FILE_MARKER, []),))
attach(others, trunk[node])
##
## @brief display a specific path tree field
##
def prettify(d, indent=0):
for key, value in d.iteritems():
if key == FILE_MARKER:
if value:
debug.debug(' ' * indent + str(value))
else:
debug.debug(' ' * indent + str(key))
if isinstance(value, dict):
prettify(value, indent+1)
else:
debug.debug(' ' * (indent+1) + str(value))
def generate_tree(treedata, package, tree = []):
data = ""
tmpPath = "?tree?"
if len(tree) != 0:
tmpPath = ""
for elem in tree:
if tmpPath != "":
tmpPath += '/'
tmpPath += elem
if len(tree) == 0:
data +=' ' + convert_folder_in_base_id(tmpPath, package) + ' /* ' + package + ' */ = {\n'
else:
data +=' ' + convert_folder_in_base_id(tmpPath, package) + ' /* ' + tree[-1] + ' */ = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
"""
data +=' FFBA2F8B187F44AE0034CC66 /* AppDelegate.h */,\n'
data +=' FFBA2F8C187F44AE0034CC66 /* AppDelegate.m */,\n'
data +=' FFBA2F8E187F44AE0034CC66 /* Main_iPhone.storyboard */,\n'
data +=' FFBA2F91187F44AE0034CC66 /* Main_iPad.storyboard */,\n'
data +=' FFBA2F94187F44AE0034CC66 /* Shader.fsh */,\n'
data +=' FFBA2F96187F44AE0034CC66 /* Shader.vsh */,\n'
data +=' FFBA2F98187F44AE0034CC66 /* ViewController.h */,\n'
data +=' FFBA2F99187F44AE0034CC66 /* ViewController.m */,\n'
data +=' FFBA2F9B187F44AE0034CC66 /* Images.xcassets */,\n'
data +=' FFBA2F83187F44AE0034CC66 /* Supporting Files */,\n'
"""
for key, value in treedata.iteritems():
if key == FILE_MARKER:
for file in value:
data +=' ' + convert_folder_in_base_id(tmpPath + '/' + file, package) + ' /* ' + file + ' */,\n'
else:
# TODO : Check if folder is empty ...
data +=' ' + convert_folder_in_base_id(tmpPath + '/' + key, package) + ' /* ' + key + ' */,\n'
"""
debug.debug(' ' * indent + str(key))
if isinstance(value, dict):
prettify(value, indent+1)
else:
debug.debug(' ' * (indent+1) + str(value))
"""
data +=' );\n'
if len(tree) == 0:
data +=' path = ' + package + ';\n'
else:
data +=' path = ' + tree[-1] + ';\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
# generate all subFolder :
for key, value in treedata.iteritems():
if key == FILE_MARKER:
continue
tree.append(key)
data += generate_tree(value, package, tree)
tree.pop()
return data
XCodeTypeElements = {
'a': ('archive.ar', 'PBXFrameworksBuildPhase', ''),
'xcodeproj': ('wrapper.pb-project', None, '""'),
'app': ('wrapper.application', None, ''),
'framework': ('wrapper.framework', 'PBXFrameworksBuildPhase', 'SDKROOT'),
'dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase', '"<group>"'),
'h': ('sourcecode.c.h', None, '"<group>"'),
'H': ('sourcecode.c.h', None, '"<group>"'),
'hpp': ('sourcecode.c.h', None, '"<group>"'),
'hxx': ('sourcecode.c.h', None, '"<group>"'),
'S': ('sourcecode.asm', 'PBXSourcesBuildPhase', '"<group>"'),
's': ('sourcecode.asm', 'PBXSourcesBuildPhase', '"<group>"'),
'c': ('sourcecode.c.c', 'PBXSourcesBuildPhase', '"<group>"'),
'cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase', '"<group>"'),
'cxx': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase', '"<group>"'),
'm': ('sourcecode.c.objc', 'PBXSourcesBuildPhase', '"<group>"'),
'j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase', '"<group>"'),
'mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase', '"<group>"'),
'icns': ('image.icns', 'PBXResourcesBuildPhase', '"<group>"'),
'nib': ('wrapper.nib', 'PBXResourcesBuildPhase', '"<group>"'),
'plist': ('text.plist.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'json': ('text.json', 'PBXResourcesBuildPhase', '"<group>"'),
'rtf': ('text.rtf', 'PBXResourcesBuildPhase', '"<group>"'),
'png': ('image.png', 'PBXResourcesBuildPhase', '"<group>"'),
'tiff': ('image.tiff', 'PBXResourcesBuildPhase', '"<group>"'),
'txt': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'fsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'frag': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'vsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'vert': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'svg': ('image.png', 'PBXResourcesBuildPhase', '"<group>"'),
'xml': ('sourcecode.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'prog': ('text.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'ttf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'conf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'emf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'xib': ('file.xib', 'PBXResourcesBuildPhase', '"<group>"'),
'strings': ('text.plist.strings', 'PBXResourcesBuildPhase', '"<group>"'),
'bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase', '"<group>"'),
'storyboard':('file.storyboard', 'PBXResourcesBuildPhase', '"<group>"')
}
class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
def __init__(self):
lutinExtProjectGenerator.ExtProjectGenerator.__init__(self, "XCode")
self.baseId = "FFFFFFFFFFFFFFFFFF"
# set default framwork:
self.add_files("Frameworks",
"System/Library/Frameworks",
[ "Foundation.framework",
"CoreGraphics.framework",
"UIKit.framework",
"GLKit.framework",
"OpenGLES.framework",
"XCTest.framework" ]);
def set_project_name(self, name):
self.name = name
self.baseId = convert_name_in_base_id(name)
def add_files(self, group, basePath, srcList):
if group not in self.groups.keys() :
self.groups[group] = {
"list-files" : [],
"extra-flags" : []
}
for element in srcList:
debug.info("plop : " + str(element))
debug.info("plop : " + str(basePath))
path = basePath + "/" + element
pos = path.rfind('/')
simpleName = path
if pos >= 0:
simpleName = path[pos+1:]
pos = simpleName.rfind('.')
extention = "";
if pos >= 0:
extention = simpleName[pos+1:]
self.groups[group]["list-files"].append({
"path" : path,
"name" : simpleName,
"extention":extention,
"declare-name":element})
def add_data_file(self, basePath, srcList):
realBasePath = os.path.realpath(basePath)
if realBasePath[-1] == "/":
realBasePath = realBasePath[:-1]
debug.debug("add data file : " + str(srcList))
for realName,destName in srcList:
tools.copy_file(realBasePath+'/'+realName, 'out/iOs/' + self.name + '/data/' + destName, force=True)
self.add_files("data", 'out/iOs/' + self.name + 'xcodeprj/data', [destName])
def add_data_folder(self, basePath, srcList):
realBasePath = basePath
if realBasePath[-1] == "/":
realBasePath = realBasePath[:-1]
debug.debug("add data folder : " + str(srcList))
for inputPath,outputPath in srcList:
tmpPath = os.path.dirname(os.path.realpath(realBasePath + '/' + inputPath))
tmpRule = os.path.basename(inputPath)
debug.warning(" add folder : '" + tmpPath + "' rule : '" + tmpRule + "'")
for root, dirnames, filenames in os.walk(tmpPath):
tmpList = filenames
if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
self.add_data_file(tmpPath, [[cycleFile, outputPath+cycleFile]])
def generate_project_file(self):
#debug.error(" list : " + str(self.groups))
data ='// !$*UTF8*$!\n'
data +='{\n'
data +=' archiveVersion = 1;\n'
data +=' classes = {\n'
data +=' };\n'
data +=' objectVersion = 46;\n'
data +=' objects = {\n'
data +='\n'
data +='/* Begin PBXBuildFile section */\n'
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
debug.debug(" PBXBuildFile ?? " + str(files))
if files["extention"] in XCodeTypeElements.keys():
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase" \
or XCodeTypeElements[files["extention"]][1] == "PBXFrameworksBuildPhase"\
or XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase"\
or XCodeTypeElements[files["extention"]][1] == "PBXVariantGroup":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + files["name"] + ' in ' + group + ' */ = {'
data +=' isa = PBXBuildFile;'
data +=' fileRef = ' + convert_folder_in_base_id(files["declare-name"], group) + ';'
data +=' };\n'
data +='/* End PBXBuildFile section */\n'
data +='\n'
data +='/* Begin PBXContainerItemProxy section */\n'
# I did not understand this section ...
data +=' ' + convert_folder_in_base_id("?PBXContainerItemProxy?", self.name) + ' /* PBXContainerItemProxy */ = {\n'
data +=' isa = PBXContainerItemProxy;\n'
data +=' containerPortal = ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Project object */;\n'
data +=' proxyType = 1;\n'
data +=' remoteGlobalIDString = ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ';\n'
data +=' remoteInfo = ' + self.name + ';\n'
data +=' };\n'
data +='/* End PBXContainerItemProxy section */\n'
data +='\n'
data +='/* Begin PBXFileReference section */\n'
data +=' ' + convert_folder_in_base_id("?app?", self.name) + ' /* ' + self.name + '.app */ = {\n'
data +=' isa = PBXFileReference;\n'
data +=' explicitFileType = wrapper.application;\n'
data +=' includeInIndex = 0;\n'
data +=' path = ' + self.name + '.app;\n'
data +=' sourceTree = BUILT_PRODUCTS_DIR;\n'
data +=' };\n'
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
debug.debug(" PBXBuildFile ?? " + str(files))
data +=' /* ' + files["name"] + ' */\n'
if files["extention"] in XCodeTypeElements.keys():
data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {'
data +=' isa = PBXBuildFile;'
data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';'
data +=' path = ' + files["path"] + ';'
data +=' name = ' + files["name"] + ';'
data +=' sourceTree = ' + XCodeTypeElements[files["extention"]][2] + '; };\n'
else:
data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {'
data +=' isa = PBXBuildFile;'
#data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';'
data +=' path = ' + files["path"] + ';'
data +=' name = ' + files["name"] + ';'
data +=' sourceTree = "<group>"; };\n'
data +='/* End PBXFileReference section */\n'
data +='\n'
data +='/* Begin PBXFrameworksBuildPhase section */\n'
data +=' ' + convert_folder_in_base_id("?Frameworks?", self.name) + ' /* Frameworks */ = {\n'
data +=' isa = PBXFrameworksBuildPhase;\n'
data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n'
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXFrameworksBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + files["name"] + ' in ' + group + '*/,\n'
data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n'
data +='/* End PBXFrameworksBuildPhase section */\n'
data +='\n'
data +='/* Begin PBXGroup section */\n'
data +=' ' + convert_folder_in_base_id("?mainTreeGroup?", self.name) + ' = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
for group in self.groups:
data +=' ' + convert_folder_in_base_id("?tree?", group) + ' /* ' + group + ' */,\n'
data +=' ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */,\n'
data +=' );\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */ = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
data +=' ' + convert_folder_in_base_id("?app?", self.name) + ' /* ' + self.name + '.app */,\n'
data +=' );\n'
data +=' name = Products;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
# treeview :
for group in self.groups:
element = self.groups[group]
main_dict = defaultdict(dict, ((FILE_MARKER, []),))
for line in element["list-files"]:
attach(line["declare-name"], main_dict)
#prettify(main_dict);
data += generate_tree(main_dict, group)
data +='/* End PBXGroup section */\n'
data +='\n'
data +='/* Begin PBXNativeTarget section */\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ' /* edn */ = {\n'
data +=' isa = PBXNativeTarget;\n'
data +=' buildConfigurationList = ' + convert_folder_in_base_id("?PBXNativeTarget?", self.name) + ' /* Build configuration list for PBXNativeTarget "edn" */;\n'
data +=' buildPhases = (\n'
data +=' FFBA2F71187F44AE0034CC66 /* Sources */,\n'
data +=' ' + convert_folder_in_base_id("?Frameworks?", self.name) + ' /* Frameworks */,\n'
data +=' ' + convert_folder_in_base_id("?Resources?", self.name) + ' /* Resources */,\n'
data +=' );\n'
data +=' buildRules = (\n'
data +=' );\n'
data +=' dependencies = (\n'
data +=' );\n'
data +=' name = edn;\n'
data +=' productName = edn;\n'
data +=' productReference = ' + convert_folder_in_base_id("?app?", self.name) + ' /* ' + self.name + '.app */;\n'
data +=' productType = "com.apple.product-type.application";\n'
data +=' };\n'
data +='/* End PBXNativeTarget section */\n'
data +='\n'
data +='/* Begin PBXProject section */\n'
data +=' ' + convert_folder_in_base_id("?Project-object?", self.name) + ' /* Project object */ = {\n'
data +=' isa = PBXProject;\n'
data +=' attributes = {\n'
data +=' LastUpgradeCheck = 0500;\n'
data +=' ORGANIZATIONNAME = "Edouard DUPIN";\n'
data +=' TargetAttributes = {\n'
data +=' ' + convert_folder_in_base_id("?Project-object?targetAttribute", self.name) + ' = {\n'
data +=' TestTargetID = ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ';\n'
data +=' };\n'
data +=' };\n'
data +=' };\n'
data +=' buildConfigurationList = ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Build configuration list for PBXProject "edn" */;\n'
data +=' compatibilityVersion = "Xcode 3.2";\n'
data +=' developmentRegion = English;\n'
data +=' hasScannedForEncodings = 0;\n'
data +=' knownRegions = (\n'
data +=' en,\n'
data +=' Base,\n'
data +=' );\n'
data +=' mainGroup = ' + convert_folder_in_base_id("?mainTreeGroup?", self.name) + ';\n'
data +=' productRefGroup = ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */;\n'
data +=' projectDirPath = "";\n'
data +=' projectRoot = "";\n'
data +=' targets = (\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ' /* edn */,\n'
data +=' );\n'
data +=' };\n'
data +='/* End PBXProject section */\n'
data +='\n'
data +='/* Begin PBXResourcesBuildPhase section */\n'
data +=' ' + convert_folder_in_base_id("?Resources?", self.name) + ' /* Resources */ = {\n'
data +=' isa = PBXResourcesBuildPhase;\n'
data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n'
# list of all resources to copy
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] in XCodeTypeElements.keys():
if XCodeTypeElements[files["extention"]][1] == "PBXResourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group) + ' = {'
data +=' /* ' + files["name"] + ' in ' + group + ' */'
data +=' ,\n'
data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n'
data +='/* End PBXResourcesBuildPhase section */\n'
data +='\n'
data +='/* Begin PBXSourcesBuildPhase section */\n'
data +=' FFBA2F71187F44AE0034CC66 /* Sources */ = {\n'
data +=' isa = PBXSourcesBuildPhase;\n'
data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n'
# list of all file to compile ...
# TODO : review this ==> generate to many files ...
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + group + " : " + files["name"] + ' */,\n'
data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n'
data +='/* End PBXSourcesBuildPhase section */\n'
data +='\n'
data +='/* Begin PBXTargetDependency section */\n'
# nothing ...
data +='/* End PBXTargetDependency section */\n'
data +='\n'
data +='/* Begin PBXVariantGroup section */\n'
# not really needed, because it is for internal system data position ==> maybe change it if necessary ...
"""
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
"""
"""
data +=' FFBA2F85187F44AE0034CC66 /* InfoPlist.strings */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2F86187F44AE0034CC66 /* en */,\n'
data +=' );\n'
data +=' name = InfoPlist.strings;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' FFBA2F8E187F44AE0034CC66 /* Main_iPhone.storyboard */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2F8F187F44AE0034CC66 /* Base */,\n'
data +=' );\n'
data +=' name = Main_iPhone.storyboard;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' FFBA2F91187F44AE0034CC66 /* Main_iPad.storyboard */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2F92187F44AE0034CC66 /* Base */,\n'
data +=' );\n'
data +=' name = Main_iPad.storyboard;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' FFBA2FAB187F44AF0034CC66 /* InfoPlist.strings */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2FAC187F44AF0034CC66 /* en */,\n'
data +=' );\n'
data +=' name = InfoPlist.strings;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
"""
data +='/* End PBXVariantGroup section */\n'
data +='\n'
data +='/* Begin XCBuildConfiguration section */\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Debug", self.name) + ' /* Debug */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ALWAYS_SEARCH_USER_PATHS = NO;\n'
data +=' ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";\n'
data +=' CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";\n'
data +=' CLANG_CXX_LIBRARY = "libc++";\n'
data +=' CLANG_ENABLE_MODULES = YES;\n'
data +=' CLANG_ENABLE_OBJC_ARC = YES;\n'
data +=' CLANG_WARN_BOOL_CONVERSION = YES;\n'
data +=' CLANG_WARN_CONSTANT_CONVERSION = YES;\n'
data +=' CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n'
data +=' CLANG_WARN_EMPTY_BODY = YES;\n'
data +=' CLANG_WARN_ENUM_CONVERSION = YES;\n'
data +=' CLANG_WARN_INT_CONVERSION = YES;\n'
data +=' CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n'
data +=' CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n'
data +=' "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";\n'
data +=' COPY_PHASE_STRIP = NO;\n'
data +=' GCC_C_LANGUAGE_STANDARD = gnu99;\n'
data +=' GCC_DYNAMIC_NO_PIC = NO;\n'
data +=' GCC_OPTIMIZATION_LEVEL = 0;\n'
data +=' GCC_PREPROCESSOR_DEFINITIONS = (\n'
data +=' "DEBUG=1",\n'
data +=' "$(inherited)",\n'
data +=' );\n'
data +=' GCC_SYMBOLS_PRIVATE_EXTERN = NO;\n'
data +=' GCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n'
data +=' GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n'
data +=' GCC_WARN_UNDECLARED_SELECTOR = YES;\n'
data +=' GCC_WARN_UNINITIALIZED_AUTOS = YES;\n'
data +=' GCC_WARN_UNUSED_FUNCTION = YES;\n'
data +=' GCC_WARN_UNUSED_VARIABLE = YES;\n'
data +=' IPHONEOS_DEPLOYMENT_TARGET = 7.0;\n'
data +=' ONLY_ACTIVE_ARCH = YES;\n'
data +=' SDKROOT = iphoneos;\n'
data +=' TARGETED_DEVICE_FAMILY = "1,2";\n'
data +=' };\n'
data +=' name = Debug;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Release", self.name) + ' /* Release */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ALWAYS_SEARCH_USER_PATHS = NO;\n'
data +=' ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";\n'
data +=' CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";\n'
data +=' CLANG_CXX_LIBRARY = "libc++";\n'
data +=' CLANG_ENABLE_MODULES = YES;\n'
data +=' CLANG_ENABLE_OBJC_ARC = YES;\n'
data +=' CLANG_WARN_BOOL_CONVERSION = YES;\n'
data +=' CLANG_WARN_CONSTANT_CONVERSION = YES;\n'
data +=' CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n'
data +=' CLANG_WARN_EMPTY_BODY = YES;\n'
data +=' CLANG_WARN_ENUM_CONVERSION = YES;\n'
data +=' CLANG_WARN_INT_CONVERSION = YES;\n'
data +=' CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n'
data +=' CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n'
data +=' "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";\n'
data +=' COPY_PHASE_STRIP = YES;\n'
data +=' ENABLE_NS_ASSERTIONS = NO;\n'
data +=' GCC_C_LANGUAGE_STANDARD = gnu99;\n'
data +=' GCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n'
data +=' GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n'
data +=' GCC_WARN_UNDECLARED_SELECTOR = YES;\n'
data +=' GCC_WARN_UNINITIALIZED_AUTOS = YES;\n'
data +=' GCC_WARN_UNUSED_FUNCTION = YES;\n'
data +=' GCC_WARN_UNUSED_VARIABLE = YES;\n'
data +=' IPHONEOS_DEPLOYMENT_TARGET = 7.0;\n'
data +=' SDKROOT = iphoneos;\n'
data +=' TARGETED_DEVICE_FAMILY = "1,2";\n'
data +=' VALIDATE_PRODUCT = YES;\n'
data +=' };\n'
data +=' name = Release;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Debug", self.name) + ' /* Debug */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n'
data +=' ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n'
data +=' GCC_PRECOMPILE_PREFIX_HEADER = YES;\n'
data +=' GCC_PREFIX_HEADER = "edn/edn-Prefix.pch";\n'
data +=' INFOPLIST_FILE = "edn/edn-Info.plist";\n'
data +=' PRODUCT_NAME = "$(TARGET_NAME)";\n'
data +=' WRAPPER_EXTENSION = app;\n'
data +=' };\n'
data +=' name = Debug;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Release", self.name) + ' /* Release */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n'
data +=' ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n'
data +=' GCC_PRECOMPILE_PREFIX_HEADER = YES;\n'
data +=' GCC_PREFIX_HEADER = "edn/edn-Prefix.pch";\n'
data +=' INFOPLIST_FILE = "edn/edn-Info.plist";\n'
data +=' PRODUCT_NAME = "$(TARGET_NAME)";\n'
data +=' WRAPPER_EXTENSION = app;\n'
data +=' };\n'
data +=' name = Release;\n'
data +=' };\n'
data += '/* End XCBuildConfiguration section */\n'
data += '\n'
data += '/* Begin XCConfigurationList section */\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Build configuration list for PBXProject "' + self.name + '" */ = {\n'
data +=' isa = XCConfigurationList;\n'
data +=' buildConfigurations = (\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Debug", self.name) + ' /* Debug */,\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Release", self.name) + ' /* Release */,\n'
data +=' );\n'
data +=' defaultConfigurationIsVisible = 0;\n'
data +=' defaultConfigurationName = Release;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?", self.name) + ' /* Build configuration list for PBXNativeTarget "PBXNativeTarget" */ = {\n'
data +=' isa = XCConfigurationList;\n'
data +=' buildConfigurations = (\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Debug", self.name) + ' /* Debug */,\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Release", self.name) + ' /* Release */,\n'
data +=' );\n'
data +=' defaultConfigurationIsVisible = 0;\n'
data +=' };\n'
data +='/* End XCConfigurationList section */\n'
data +=' };\n'
data +=' rootObject = ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Project object */;\n'
data +='}\n'
#debug.info(data)
outName = 'out/iOs/' + self.name + '.xcodeproj/project.pbxproj'
tools.create_directory_of_file(outName)
tools.file_write_data(outName, data)
# TODO : Generate all dependency files ...
"""
# this is a file generated by xcode for his internal properties ...
# create workspace file:
data = '<?xml version="1.0" encoding="UTF-8"?>\n'
data += '<Workspace\n'
data += ' version = "1.0">\n'
data += ' <FileRef\n'
data += ' location = "self:' + self.name + '.xcodeproj">\n'
data += ' </FileRef>\n'
data += '</Workspace>\n'
outName = 'out/iOs/' + self.name + '.xcodeproj/project.xcworkspace/contents.xcworkspacedata'
tools.create_directory_of_file(outName)
tools.file_write_data(outName, data)
"""

View File

@@ -1,5 +1,14 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import copy
import lutinDebug as debug
@@ -22,6 +31,8 @@ class HeritageList:
self.flags_xx=[]
self.flags_m=[]
self.flags_mm=[]
self.flags_xx_version=1999
self.flags_cc_version=1989
# sources list:
self.src=[]
self.path=[]
@@ -55,6 +66,8 @@ class HeritageList:
self.flags_ld=[]
self.flags_cc=[]
self.flags_xx=[]
self.flags_xx_version=1999
self.flags_xx_version=1989
self.flags_m=[]
self.flags_mm=[]
# sources list:
@@ -96,7 +109,10 @@ class HeritageList:
append_to_list(self.flags_mm, element.flags_mm)
append_to_list(self.path, element.path)
append_to_list(self.src, element.src)
if self.flags_xx_version < element.flags_xx_version:
self.flags_xx_version = element.flags_xx_version
if self.flags_cc_version < element.flags_cc_version:
self.flags_cc_version = element.flags_cc_version
class heritage:
@@ -108,6 +124,8 @@ class heritage:
self.flags_ld=[]
self.flags_cc=[]
self.flags_xx=[]
self.flags_xx_version=1999
self.flags_cc_version=1989
self.flags_m=[]
self.flags_mm=[]
# sources list:
@@ -119,13 +137,18 @@ class heritage:
if type(module) != type(None):
# all the parameter that the upper classe need when build
self.name = module.name
self.depends = module.depends
self.depends = copy.deepcopy(module.depends)
self.flags_ld = module.export_flags_ld
self.flags_cc = module.export_flags_cc
self.flags_xx = module.export_flags_xx
self.flags_m = module.export_flags_m
self.flags_mm = module.export_flags_mm
self.path = module.export_path
self.flags_xx_version = module.xx_version_api
self.flags_cc_version = module.cc_version_api
def add_depends(self, depend):
self.depends.append(depend)
def add_flag_LD(self, list):
append_to_list(self.flags_ld, list)
@@ -164,3 +187,9 @@ class heritage:
self.add_flag_MM(other.flags_mm)
self.add_import_path(other.path)
self.add_sources(other.src)
if self.flags_xx_version < module.xx_version_api:
self.flags_xx_version = module.xx_version_api
if self.flags_cc_version < module.cc_version_api:
self.flags_cc_version = module.cc_version_api

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import platform
import sys
import lutinDebug as debug
@@ -13,8 +21,13 @@ elif platform.system() == "Darwin":
else:
debug.error("Unknow the Host OS ... '" + platform.system() + "'")
debug.debug(" host.OS = " + OS)
debug.debug("host.OS = " + OS)
OS64BITS = sys.maxsize > 2**32
OS32BITS = OS64BITS==False
if sys.maxsize > 2**32:
BUS_SIZE = 64
else:
BUS_SIZE = 32
debug.debug("host.BUS_SIZE = " + str(BUS_SIZE))

View File

@@ -1,15 +1,27 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinTools as tools
import platform
import os
import lutinMultiprocess
import lutinDepend as dependency
if platform.system() == "Darwin":
import CoreGraphics
else:
from PIL import Image
enableResizeImage = True
try:
if platform.system() == "Darwin":
import CoreGraphics
else:
from PIL import Image
except:
enableResizeImage = False
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
def get_pow_2_multiple(size):
base = 2
@@ -22,6 +34,8 @@ def get_pow_2_multiple(size):
# check if time change
# check if command line change
def resize(srcFile, destFile, x, y, cmd_file=None):
if enableResizeImage == False:
return
if os.path.exists(srcFile) == False:
debug.error("Request a resize an image that does not existed : '" + srcFile + "'")
cmd_line = "resize Image : " + srcFile + " ==> " + destFile + " newSize=(" + str(x) + "x" + str(y) + ")"

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import os
import inspect
@@ -25,6 +33,7 @@ class Module:
##
def __init__(self, file, moduleName, moduleType):
## Remove all variable to prevent error of multiple deffinition of the module ...
debug.verbose("Create a new module : '" + moduleName + "' TYPE=" + moduleType)
self.originFile=''
self.originFolder=''
# type of the module:
@@ -33,6 +42,9 @@ class Module:
self.name=moduleName
# Dependency list:
self.depends = []
# Dependency list (optionnal module):
self.depends_optionnal = []
self.depends_find = []
# Documentation list:
self.documentation = None
# export PATH
@@ -58,6 +70,11 @@ class Module:
self.files = []
self.folders = []
self.isbuild = False
# CPP version:
self.xx_version = 1999
self.xx_version_api = 1999
self.cc_version = 1989
self.cc_version_api = 1989
## end of basic INIT ...
if moduleType == 'BINARY' \
or moduleType == 'LIBRARY' \
@@ -91,7 +108,7 @@ class Module:
"RIGHT" : [],
"ADMOD_POSITION" : "top"
}
self.subHeritageList = None
##
## @brief add Some copilation flags for this module (and only this one)
@@ -101,7 +118,7 @@ class Module:
"-Wall",
"-Wsign-compare",
"-Wreturn-type",
"-Wint-to-pointer-cast",
#"-Wint-to-pointer-cast",
"-Wno-write-strings",
"-Woverloaded-virtual",
"-Wnon-virtual-dtor",
@@ -125,6 +142,17 @@ class Module:
##
def compile_mm_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
xx_version = max(self.xx_version, depancy.flags_xx_version)
if xx_version == 2014:
debug.error("not supported flags for X14 ...");
local_xx_version_flags=["-std=c++14", "-D__CPP_VERSION__=2014"]
elif xx_version == 2011:
local_xx_version_flags=["-std=c++11", "-D__CPP_VERSION__=2011"]
elif xx_version == 2003:
local_xx_version_flags=["-std=c++03", "-D__CPP_VERSION__=2003"]
else:
local_xx_version_flags=["-D__CPP_VERSION__=1999"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.xx,
@@ -135,6 +163,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_xx_version_flags,
target.global_flags_cc,
target.global_flags_mm,
depancy.flags_cc,
@@ -160,6 +189,16 @@ class Module:
##
def compile_m_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
cc_version = max(self.cc_version, depancy.flags_cc_version)
if cc_version == 2011:
local_cc_version_flags=["-std=c11", "-D__C_VERSION__=2011"]
elif cc_version == 1999:
local_cc_version_flags=["-std=c99", "-D__C_VERSION__=1999"]
elif cc_version == 1990:
local_cc_version_flags=["-std=c90", "-D__C_VERSION__=1990"]
else:
local_cc_version_flags=["-std=c89", "-D__C_VERSION__=1989"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.cc,
@@ -170,6 +209,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_cc_version_flags,
target.global_flags_cc,
target.global_flags_m,
depancy.flags_cc,
@@ -195,6 +235,17 @@ class Module:
##
def compile_xx_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
xx_version = max(self.xx_version, depancy.flags_xx_version)
if xx_version == 2014:
debug.error("not supported flags for X14 ...");
local_xx_version_flags=["-std=c++14", "-D__CPP_VERSION__=2014"]
elif xx_version == 2011:
local_xx_version_flags=["-std=c++11", "-D__CPP_VERSION__=2011"]
elif xx_version == 2003:
local_xx_version_flags=["-std=c++03", "-D__CPP_VERSION__=2003"]
else:
local_xx_version_flags=["-D__CPP_VERSION__=1999"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.xx,
@@ -205,6 +256,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_xx_version_flags,
target.global_flags_cc,
target.global_flags_xx,
depancy.flags_cc,
@@ -229,6 +281,16 @@ class Module:
##
def compile_cc_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
cc_version = max(self.cc_version, depancy.flags_cc_version)
if cc_version == 2011:
local_cc_version_flags=["-std=c11", "-D__C_VERSION__=2011"]
elif cc_version == 1999:
local_cc_version_flags=["-std=c99", "-D__C_VERSION__=1999"]
elif cc_version == 1990:
local_cc_version_flags=["-std=c90", "-D__C_VERSION__=1990"]
else:
local_cc_version_flags=["-std=c89", "-D__C_VERSION__=1989"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.cc,
@@ -239,6 +301,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_cc_version_flags,
target.global_flags_cc,
depancy.flags_cc,
self.flags_cc,
@@ -318,7 +381,7 @@ class Module:
lutinTools.create_directory_of_file(file_dst)
debug.print_element("SharedLib", libName, "==>", file_dst)
lutinMultiprocess.run_command(cmdLine)
if "release"==target.buildMode \
if target.config["mode"] == "release" \
or lutinEnv.get_force_strip_mode()==True:
# get the file size of the non strip file
originSize = lutinTools.file_size(file_dst);
@@ -360,7 +423,7 @@ class Module:
debug.print_element("Executable", self.name, "==>", file_dst)
lutinMultiprocess.run_command(cmdLine)
if "release"==target.buildMode \
if "release"==target.config["mode"] \
or lutinEnv.get_force_strip_mode()==True:
# get the file size of the non strip file
originSize = lutinTools.file_size(file_dst);
@@ -420,13 +483,15 @@ class Module:
##
def folders_to_staging(self, binaryName, target):
for source, destination in self.folders:
debug.verbose("Might copy folder : " + source + "==>" + destination)
debug.debug("Might copy folder : " + source + "==>" + destination)
lutinTools.copy_anything_target(target, self.originFolder + "/" + source, destination)
# call here to build the module
def build(self, target, packageName):
# ckeck if not previously build
if target.is_module_build(self.name)==True:
if self.subHeritageList == None:
self.localHeritage = heritage.heritage(self)
return self.subHeritageList
# create the packege heritage
self.localHeritage = heritage.heritage(self)
@@ -440,9 +505,22 @@ class Module:
# TODO : Set it better ...
None
# build dependency befor
# build dependency before
listSubFileNeededTobuild = []
self.subHeritageList = heritage.HeritageList()
# optionnal dependency :
for dep, option, export in self.depends_optionnal:
inheritList, isBuilt = target.build_optionnal(dep, packageName)
if isBuilt == True:
self.localHeritage.add_depends(dep);
# TODO : Add optionnal Flags ...
# ==> do it really better ...
if export == False:
self.compile_flags_CC("-D"+option);
else:
self.add_export_flag_CC("-D"+option);
# add at the heritage list :
self.subHeritageList.add_heritage_list(inheritList)
for dep in self.depends:
inheritList = target.build(dep, packageName)
# add at the heritage list :
@@ -452,35 +530,26 @@ class Module:
for file in self.src:
#debug.info(" " + self.name + " <== " + file);
fileExt = file.split(".")[-1]
if fileExt == "c" \
or fileExt == "C":
if fileExt in ["c", "C"]:
resFile = self.compile_cc_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
elif fileExt == "cpp" \
or fileExt == "CPP" \
or fileExt == "cxx" \
or fileExt == "CXX" \
or fileExt == "xx" \
or fileExt == "XX":
elif fileExt in ["cpp", "CPP", "cxx", "CXX", "xx", "XX", "CC", "cc"]:
resFile = self.compile_xx_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
elif fileExt == "mm" \
or fileExt == "MM":
elif fileExt in ["mm", "MM"]:
resFile = self.compile_mm_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
elif fileExt == "m" \
or fileExt == "M":
elif fileExt in ["m", "M"]:
resFile = self.compile_m_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
else:
debug.verbose(" TODO : gcc " + self.originFolder + "/" + file)
debug.warning(" UN-SUPPORTED file format: '" + self.originFolder + "/" + file + "'")
# when multiprocess availlable, we need to synchronize here ...
lutinMultiprocess.pool_synchrosize()
# generate end point:
if self.type=='PREBUILD':
# nothing to add ==> just dependence
None
debug.print_element("Prebuild", self.name, "==>", "find")
elif self.type=='LIBRARY':
resFile = self.link_to_a(listSubFileNeededTobuild, packageName, target, self.subHeritageList)
self.localHeritage.add_sources(resFile)
@@ -566,6 +635,9 @@ class Module:
def add_module_depend(self, list):
self.append_to_internalList(self.depends, list, True)
def add_optionnal_module_depend(self, module_name, compilation_flags="", export=False):
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
def add_export_path(self, list):
self.append_to_internalList(self.export_path, list)
@@ -606,6 +678,22 @@ class Module:
def compile_flags_S(self, list):
self.append_to_internalList(self.flags_s, list)
def compile_version_XX(self, version, same_as_api=True):
cpp_version_list = [1999, 2003, 2011, 2014]
if version not in cpp_version_list:
debug.error("can not select CPP version : " + str(version) + " not in " + str(cpp_version_list))
self.xx_version = version
if same_as_api == True:
self.xx_version_api = self.xx_version
def compile_version_CC(self, version, same_as_api=True):
c_version_list = [1989, 1990, 1999, 2011]
if version not in c_version_list:
debug.error("can not select C version : " + str(version) + " not in " + str(c_version_list))
self.cc_version = version
if same_as_api == True:
self.cc_version_api = self.cc_version
def add_src_file(self, list):
self.append_to_internalList(self.src, list, True)
@@ -632,6 +720,7 @@ class Module:
print ' file:"%s"' %self.originFile
print ' folder:"%s"' %self.originFolder
self.print_list('depends',self.depends)
self.print_list('depends_optionnal', self.depends_optionnal)
self.print_list('flags_ld',self.flags_ld)
self.print_list('flags_cc',self.flags_cc)
self.print_list('flags_xx',self.flags_xx)
@@ -767,6 +856,13 @@ def import_path(path):
debug.debug("integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
moduleList.append([moduleName,os.path.join(root, filename)])
def exist(target, name):
global moduleList
for mod in moduleList:
if mod[0] == name:
return True
return False
def load_module(target, name):
global moduleList
for mod in moduleList:

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import lutinDebug as debug
import threading
@@ -8,11 +16,21 @@ import os
import subprocess
import lutinTools
import lutinEnv
import shlex
queueLock = threading.Lock()
workQueue = Queue.Queue()
currentThreadWorking = 0
threads = []
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
currentIdExecution = 0
errorExecution = {
"id":-1,
"cmd":"",
"return":0,
"err":"",
"out":"",
}
exitFlag = False # resuest stop of the thread
isinit = False # the thread are initialized
@@ -24,7 +42,6 @@ def store_command(cmdLine, file):
if file != "" \
and file != None:
# Create directory:
debug.warning("lklk " + file)
lutinTools.create_directory_of_file(file)
# Store the command Line:
file2 = open(file, "w")
@@ -32,28 +49,86 @@ def store_command(cmdLine, file):
file2.flush()
file2.close()
def run_command(cmdLine, storeCmdLine=""):
debug.debug(lutinEnv.print_pretty(cmdLine))
##
## @brief Execute the command and ruturn generate data
##
def run_command_direct(cmdLine):
# prepare command line:
args = shlex.split(cmdLine)
debug.verbose("cmd = " + str(args))
try:
retcode = subprocess.call(cmdLine, shell=True)
except OSError as e:
print >>sys.stderr, "Execution failed:", e
if retcode != 0:
global errorOccured
# create the subprocess
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e:
debug.error("subprocess.CalledProcessError : " + str(args))
# launch the subprocess:
output, err = p.communicate()
# Check error :
if p.returncode == 0:
if output == None:
return err[:-1];
return output[:-1];
else:
return False
def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
global errorOccured
global exitFlag
global currentIdExecution
# prepare command line:
args = shlex.split(cmdLine)
debug.verbose("cmd = " + str(args))
try:
# create the subprocess
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e:
debug.error("subprocess.CalledProcessError : TODO ...")
# launch the subprocess:
output, err = p.communicate()
# Check error :
if p.returncode == 0:
debug.debug(lutinEnv.print_pretty(cmdLine))
queueLock.acquire()
# TODO : Print the output all the time .... ==> to show warnings ...
if buildId >= 0 and (output != "" or err != ""):
debug.warning("output in subprocess compiling: '" + file + "'")
if output != "":
debug.print_compilator(output)
if err != "":
debug.print_compilator(err)
queueLock.release()
else:
errorOccured = True
global exitFlag
exitFlag = True
if retcode == 2:
debug.error("can not compile file ... [keyboard interrrupt]")
# if No ID : Not in a multiprocess mode ==> just stop here
if buildId < 0:
debug.debug(lutinEnv.print_pretty(cmdLine), force=True)
debug.print_compilator(output)
debug.print_compilator(err)
if p.returncode == 2:
debug.error("can not compile file ... [keyboard interrrupt]")
else:
debug.error("can not compile file ... ret : " + str(p.returncode))
else:
debug.error("can not compile file ... ret : " + str(retcode))
# in multiprocess interface
queueLock.acquire()
# if an other write an error before, check if the current process is started before ==> then is the first error
if errorExecution["id"] >= buildId:
# nothing to do ...
queueLock.release()
return;
errorExecution["id"] = buildId
errorExecution["cmd"] = cmdLine
errorExecution["return"] = p.returncode
errorExecution["err"] = err,
errorExecution["out"] = output,
queueLock.release()
# not write the command file...
return
debug.verbose("done 3")
# write cmd line only after to prevent errors ...
store_command(cmdLine, storeCmdLine)
@@ -69,7 +144,7 @@ class myThread(threading.Thread):
global exitFlag
global currentThreadWorking
workingSet = False
while False==exitFlag:
while exitFlag == False:
self.lock.acquire()
if not self.queue.empty():
if workingSet==False:
@@ -82,8 +157,8 @@ class myThread(threading.Thread):
comment = data[2]
cmdLine = data[1]
cmdStoreFile = data[3]
debug.print_element( "[" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
run_command(cmdLine, cmdStoreFile)
debug.print_element( "[" + str(data[4]) + "][" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
run_command(cmdLine, cmdStoreFile, buildId=data[4], file=comment[3])
else:
debug.warning("unknow request command : " + data[0])
else:
@@ -139,21 +214,24 @@ def un_init():
def run_in_pool(cmdLine, comment, storeCmdLine=""):
global currentIdExecution
if processorAvaillable <= 1:
debug.print_element(comment[0], comment[1], comment[2], comment[3])
run_command(cmdLine, storeCmdLine)
run_command(cmdLine, storeCmdLine, file=comment[3])
return
# multithreaded mode
init()
# Fill the queue
queueLock.acquire()
debug.verbose("add : in pool cmdLine")
workQueue.put(["cmdLine", cmdLine, comment, storeCmdLine])
workQueue.put(["cmdLine", cmdLine, comment, storeCmdLine, currentIdExecution])
currentIdExecution +=1;
queueLock.release()
def pool_synchrosize():
global errorOccured
global errorExecution
if processorAvaillable <= 1:
#in this case : nothing to synchronise
return
@@ -172,7 +250,17 @@ def pool_synchrosize():
if False==errorOccured:
debug.verbose("queue is empty")
else:
debug.debug("Thread return with error ... ==> stop all the pool")
un_init()
debug.error("Pool error occured ...")
debug.debug("Thread return with error ... ==> stop all the pool")
if errorExecution["id"] == -1:
debug.error("Pool error occured ... (No return information on Pool)")
return
debug.error("Error in an pool element : [" + str(errorExecution["id"]) + "]", crash=False)
debug.debug(lutinEnv.print_pretty(errorExecution["cmd"]), force=True)
debug.print_compilator(str(errorExecution["out"][0]))
debug.print_compilator(str(errorExecution["err"][0]))
if errorExecution["return"] == 2:
debug.error("can not compile file ... [keyboard interrrupt]")
else:
debug.error("can not compile file ... return value : " + str(errorExecution["return"]))

163
lutinSystem.py Normal file
View File

@@ -0,0 +1,163 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import os
import inspect
import fnmatch
import lutinDebug as debug
import datetime
import lutinTools
import lutinModule as module
import lutinImage
import lutinHost
class System:
def __init__(self):
self.valid=False;
self.help="";
self.include_cc=[]
self.export_flags_cc=[]
self.export_flags_xx=[]
self.export_flags_mm=[]
self.export_flags_m=[]
self.export_flags_ar=[]
self.export_flags_ld=[]
self.export_flags_ld_shared=[]
self.export_libs_ld=[]
self.export_libs_ld_shared=[]
def append_and_check(self, listout, newElement, order):
for element in listout:
if element==newElement:
return
listout.append(newElement)
if True==order:
listout.sort()
def append_to_internalList(self, listout, list, order=False):
if type(list) == type(str()):
self.append_and_check(listout, list, order)
else:
# mulyiple imput in the list ...
for elem in list:
self.append_and_check(listout, elem, order)
def add_export_flag_LD(self, list):
self.append_to_internalList(self.export_flags_ld, list)
def add_export_flag_CC(self, list):
self.append_to_internalList(self.export_flags_cc, list)
def add_export_flag_XX(self, list):
self.append_to_internalList(self.export_flags_xx, list)
def add_export_flag_M(self, list):
self.append_to_internalList(self.export_flags_m, list)
def add_export_flag_MM(self, list):
self.append_to_internalList(self.export_flags_mm, list)
def createModuleFromSystem(target, dict):
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD')
myModule.add_export_flag_CC(dict["system"].export_flags_cc)
myModule.add_export_flag_LD(dict["system"].export_flags_ld)
myModule.add_export_flag_XX(dict["system"].export_flags_xx)
myModule.add_export_flag_M(dict["system"].export_flags_m)
myModule.add_export_flag_MM(dict["system"].export_flags_mm)
# add the currrent module at the
return myModule
# Dictionnaire of Target name
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
systemList={}
__startSystemName="lutinSystem_"
def import_path(path):
global targetList
matches = []
debug.debug('Start find sub File : "%s"' %path)
for root, dirnames, filenames in os.walk(path):
tmpList = fnmatch.filter(filenames, __startSystemName + "*.py")
# Import the module :
for filename in tmpList:
debug.verbose(' Find a file : "%s"' %os.path.join(root, filename))
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
systemName = filename.replace('.py', '')
systemName = systemName.replace(__startSystemName, '')
targetType, systemName = systemName.split('_')
debug.debug("integrate system: '" + targetType + "':'" + systemName + "' from '" + os.path.join(root, filename) + "'")
if targetType in systemList:
systemList[targetType].append({"name":systemName,
"path":os.path.join(root, filename),
"system":None,
"loaded":False,
"exist":False,
"module":None})
else:
systemList[targetType] = [{"name":systemName,
"path":os.path.join(root, filename),
"system":None,
"loaded":False,
"exist":False,
"module":None}]
def display():
global systemList
for elementName in systemList:
debug.info("integrate system: '" + elementName +"'")
for data in systemList[elementName]:
debug.info(" '" + data["name"] +"' in " + data["path"])
def exist(lib_name, target_name) :
global systemList
if target_name not in systemList:
return False
for data in systemList[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"] + "'")
theSystem = __import__(__startSystemName + target_name + "_" + data["name"])
#create the system module
try:
data["system"] = theSystem.System()
data["exist"] = data["system"].valid
except:
debug.debug("Not find: '" + data["name"] + "'")
return data["exist"]
return False
def load(target, lib_name, target_name):
global systemList
if target_name not in systemList:
debug.error("you must call this function after checking of the system exist() !1!")
for data in systemList[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"] = createModuleFromSystem(target, data)
data["loaded"] = True
target.add_module(data["module"])
return

View File

@@ -1,50 +1,69 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import os
import inspect
import fnmatch
import lutinDebug as debug
import lutinHeritage as heritage
import datetime
import lutinTools
import lutinModule
import lutinSystem
import lutinImage
import lutinHost
import lutinMultiprocess as multiprocess
class Target:
def __init__(self, name, typeCompilator, debugMode, generatePackage, arch, cross, sumulator=False):
def __init__(self, name, config, arch):
self.config = config
#processor type selection (auto/arm/ppc/x86)
self.selectArch = config["arch"]; # TODO : Remove THIS ...
#bus size selection (auto/32/64)
self.selectBus = config["bus-size"]; # TODO : Remove THIS ...
if config["bus-size"] == "auto":
debug.error("system error ==> must generate the default 'bus-size' config")
if config["arch"] == "auto":
debug.error("system error ==> must generate the default 'bus-size' config")
debug.debug("config=" + str(config))
if arch != "":
self.arch = "-arch " + arch
else:
self.arch = ""
self.sumulator = sumulator
self.cross = cross
# todo : remove this :
self.sumulator = config["simulation"]
self.name=name
self.endGeneratePackage = generatePackage
self.endGeneratePackage = config["generate-package"]
debug.info("=================================");
debug.info("== Target='" + self.name + "'");
debug.info("== Target='" + self.name + "' " + config["bus-size"] + " bits for arch '" + config["arch"] + "'");
debug.info("=================================");
self.ar=self.cross + "ar"
self.ranlib=self.cross + "ranlib"
if typeCompilator == "clang":
self.cc=self.cross + "clang"
self.xx=self.cross + "clang++"
#self.ar=self.cross + "llvm-ar"
#self.ranlib="ls"
else:
self.cc=self.cross + "gcc"
self.xx=self.cross + "g++"
#self.ar=self.cross + "ar"
#self.ranlib=self.cross + "ranlib"
self.ld=self.cross + "ld"
self.nm=self.cross + "nm"
self.strip=self.cross + "strip"
self.dlltool=self.cross + "dlltool"
self.set_cross_base()
###############################################################################
# Target global variables.
###############################################################################
self.global_include_cc=[]
self.global_flags_cc=['-D__TARGET_OS__'+self.name,
'-D__TARGET_ARCH__'+self.selectArch,
'-D__TARGET_ADDR__'+self.selectBus + 'BITS',
'-D_REENTRANT']
if self.name != "Windows":
self.global_flags_xx=['-std=c++11']
self.global_flags_mm=['-std=c++11']
else:
self.global_flags_xx=['-static-libgcc', '-static-libstdc++', '-L', '-std=c++11']
self.global_flags_xx=[]
self.global_flags_mm=[]
if self.name == "Windows":
self.global_flags_xx=['-static-libgcc', '-static-libstdc++']
self.global_flags_mm=[]
self.global_flags_m=[]
self.global_flags_ar=['rcs']
@@ -65,19 +84,22 @@ class Target:
self.folder_arch="/" + self.name
if "debug" == debugMode:
self.buildMode = "debug"
if "debug" == self.config["mode"]:
self.global_flags_cc.append("-g")
self.global_flags_cc.append("-DDEBUG")
self.global_flags_cc.append("-O0")
else:
self.buildMode = "release"
self.global_flags_cc.append("-DNDEBUG")
self.global_flags_cc.append("-O3")
self.folder_out="/out" + self.folder_arch + "/" + self.buildMode
self.folder_final="/final/" + typeCompilator
self.folder_staging="/staging/" + typeCompilator
self.folder_build="/build/" + typeCompilator
## To add code coverate on build result system
if self.config["gcov"] == True:
self.global_flags_cc.append("-fprofile-arcs")
self.global_flags_cc.append("-ftest-coverage")
self.global_flags_ld.append("-fprofile-arcs")
self.global_flags_ld.append("-ftest-coverage")
self.update_folder_tree()
self.folder_bin="/usr/bin"
self.folder_lib="/usr/lib"
self.folder_data="/usr/share"
@@ -89,19 +111,54 @@ class Target:
self.listFinalFile=[]
self.sysroot=""
self.externProjectManager = None
def set_use_of_extern_build_tool(self, mode):
if mode == True:
if self.externProjectManager == None:
debug.error("This target does not support extern tool")
def update_folder_tree(self):
self.folder_out="/out/" + self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"] + "/" + self.config["mode"]
self.folder_final="/final/" + self.config["compilator"]
self.folder_staging="/staging/" + self.config["compilator"]
self.folder_build="/build/" + self.config["compilator"]
def create_number_from_version_string(self, data):
list = data.split(".")
out = 0;
offset = 1000**(len(list)-1)
for elem in list:
out += offset*int(elem)
debug.verbose("get : " + str(int(elem)) + " tmp" + str(out))
offset /= 1000
return out
def set_cross_base(self, cross=""):
self.cross = cross
debug.debug("== Target='" + self.cross + "'");
self.ar = self.cross + "ar"
self.ranlib = self.cross + "ranlib"
if self.config["compilator"] == "clang":
self.cc = self.cross + "clang"
self.xx = self.cross + "clang++"
#self.ar=self.cross + "llvm-ar"
#self.ranlib="ls"
else:
# remove extern tool generator...
self.externProjectManager = None
self.cc = self.cross + "gcc"
self.xx = self.cross + "g++"
#self.ar=self.cross + "ar"
#self.ranlib=self.cross + "ranlib"
#get g++ compilation version :
ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
if ret == False:
debug.error("Can not get the g++/clang++ version ...")
self.xx_version = self.create_number_from_version_string(ret)
debug.debug(self.config["compilator"] + "++ version=" + str(ret) + " number=" + str(self.xx_version))
self.ld = self.cross + "ld"
self.nm = self.cross + "nm"
self.strip = self.cross + "strip"
self.dlltool = self.cross + "dlltool"
self.update_folder_tree()
def get_build_mode(self):
return self.buildMode
return self.config["mode"]
def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None):
for source, dst, x, y, cmdFile2 in self.listFinalFile:
@@ -209,7 +266,7 @@ class Target:
return False
def add_module(self, newModule):
debug.debug("Import nodule for Taget : " + newModule.name)
debug.debug("Add nodule for Taget : " + newModule.name)
self.moduleList.append(newModule)
@@ -236,11 +293,27 @@ class Target:
return
debug.error("request to clean an un-existant module name : '" + name + "'")
def load_if_needed(self, name):
def load_if_needed(self, name, optionnal=False):
for elem in self.moduleList:
if elem.name == name:
return
lutinModule.load_module(self, name)
return True
if optionnal == False:
lutinModule.load_module(self, name)
return True
else:
# TODO : Check internal module and system module ...
# need to import the module (or the system module ...)
exist = lutinSystem.exist(name, self.name)
if exist == True:
lutinSystem.load(self, name, self.name)
return True;
# try to find in the local Modules:
exist = lutinModule.exist(self, name)
if exist == True:
lutinModule.load_module(self, name)
return True;
else:
return False;
def load_all(self):
listOfAllTheModule = lutinModule.list_all_module()
@@ -253,81 +326,128 @@ class Target:
module.ext_project_add_module(self, projectMng, addedModule)
return
def build_optionnal(self, moduleName, packagesName=None):
present = self.load_if_needed(moduleName, optionnal=True)
if present == False:
return [heritage.HeritageList(), False]
# clean requested
for mod in self.moduleList:
if mod.name == moduleName:
debug.debug("build module '" + moduleName + "'")
return [mod.build(self, None), True]
debug.warning("not know module name : '" + moduleName + "' to '" + "build" + "' it")
return [heritage.HeritageList(), False]
def build(self, name, packagesName=None):
if name == "dump":
debug.info("dump all")
self.load_all()
for mod in self.moduleList:
mod.display(self)
elif self.externProjectManager != None:
# TODO : Do it only if needed:
debug.debug("generate project")
# TODO : Set an option to force Regeneration of the project or the oposite....
return
if name == "all":
debug.info("build all")
self.load_all()
for mod in self.moduleList:
if mod.name != "edn":
continue
if mod.type == "PACKAGE":
mod.create_project(self, self.externProjectManager)
# TODO : Run project or do something else ...
debug.error("stop here ...")
else:
if name == "all":
debug.info("build all")
self.load_all()
for mod in self.moduleList:
if self.name=="Android":
if mod.type == "PACKAGE":
mod.build(self, None)
else:
if mod.type == "BINARY" \
or mod.type == "PACKAGE":
mod.build(self, None)
elif name == "clean":
debug.info("clean all")
self.load_all()
for mod in self.moduleList:
mod.clean(self)
else:
# get the action an the module ....
gettedElement = name.split("-")
moduleName = gettedElement[0]
if len(gettedElement)>=2:
actionName = gettedElement[1]
else :
actionName = "build"
debug.verbose("requested : " + moduleName + "-" + actionName)
if actionName == "install":
self.build(moduleName + "-build")
self.install_package(moduleName)
elif actionName == "uninstall":
self.un_install_package(moduleName)
elif actionName == "log":
self.Log(moduleName)
if self.name=="Android":
if mod.type == "PACKAGE":
mod.build(self, None)
else:
self.load_if_needed(moduleName)
# clean requested
for mod in self.moduleList:
if mod.name == moduleName:
if actionName == "dump":
debug.info("dump module '" + moduleName + "'")
return mod.display(self)
elif actionName == "clean":
debug.info("clean module '" + moduleName + "'")
return mod.clean(self)
elif actionName == "build":
debug.debug("build module '" + moduleName + "'")
return mod.build(self, None)
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
if mod.type == "BINARY" \
or mod.type == "PACKAGE":
mod.build(self, None)
elif name == "clean":
debug.info("clean all")
self.load_all()
for mod in self.moduleList:
mod.clean(self)
else:
# get the action an the module ....
gettedElement = name.split("-")
moduleName = gettedElement[0]
if len(gettedElement)>=2:
actionName = gettedElement[1]
else :
actionName = "build"
debug.verbose("requested : " + moduleName + "-" + actionName)
if actionName == "install":
self.build(moduleName + "-build")
self.install_package(moduleName)
elif actionName == "uninstall":
self.un_install_package(moduleName)
elif actionName == "log":
self.Log(moduleName)
else:
self.load_if_needed(moduleName)
# clean requested
for mod in self.moduleList:
if mod.name == moduleName:
if actionName == "dump":
debug.info("dump module '" + moduleName + "'")
return mod.display(self)
elif actionName == "clean":
debug.info("clean module '" + moduleName + "'")
return mod.clean(self)
elif actionName == "build":
debug.debug("build module '" + moduleName + "'")
return mod.build(self, None)
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
__startTargetName="lutinTarget"
def target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode):
theTarget = __import__(__startTargetName + targetName)
#try:
tmpTarget = theTarget.Target(compilator, mode, generatePackage, simulationMode)
tmpTarget.set_use_of_extern_build_tool(externBuild)
return tmpTarget
#except:
# debug.error("Can not create the Target : '" + targetName + "'")
targetList=[]
__startTargetName="lutinTarget_"
def import_path(path):
global targetList
matches = []
debug.debug('Start find sub File : "%s"' %path)
for root, dirnames, filenames in os.walk(path):
tmpList = fnmatch.filter(filenames, __startTargetName + "*.py")
# Import the module :
for filename in tmpList:
debug.debug(' Find a file : "%s"' %os.path.join(root, filename))
#matches.append(os.path.join(root, filename))
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
targetName = filename.replace('.py', '')
targetName = targetName.replace(__startTargetName, '')
debug.debug("integrate module: '" + targetName + "' from '" + os.path.join(root, filename) + "'")
targetList.append([targetName,os.path.join(root, filename)])
def load_target(name, config):
global targetList
debug.debug("load target: " + name)
if len(targetList) == 0:
debug.error("No target to compile !!!")
debug.debug("list target: " + str(targetList))
for mod in targetList:
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 target : '" + __startTargetName + name + "'")
theTarget = __import__(__startTargetName + name)
#create the target
tmpTarget = theTarget.Target(config)
return tmpTarget
def list_all_target():
global targetList
tmpListName = []
for mod in targetList:
tmpListName.append(mod[0])
return tmpListName
def list_all_target_with_desc():
global targetList
tmpList = []
for mod in targetList:
sys.path.append(os.path.dirname(mod[1]))
theTarget = __import__(__startTargetName + mod[0])
try:
tmpdesc = theTarget.get_desc()
tmpList.append([mod[0], tmpdesc])
except:
debug.warning("has no name : " + mod[0])
tmpList.append([mod[0], ""])
return tmpList

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os
import shutil
import errno
@@ -27,6 +35,11 @@ def create_directory_of_file(file):
except:
os.makedirs(folder)
def get_list_sub_folder(path):
# TODO : os.listdir(path)
for dirname, dirnames, filenames in os.walk(path):
return dirnames
return []
def remove_folder_and_sub_folder(path):
if os.path.isdir(path):
@@ -97,25 +110,34 @@ def copy_anything(src, dst):
tmpPath = os.path.dirname(os.path.realpath(src))
tmpRule = os.path.basename(src)
for root, dirnames, filenames in os.walk(tmpPath):
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
tmpList = filenames
if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
copy_file(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
debug.verbose("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
copy_file(tmpPath+"/"+cycleFile, dst+"/"+cycleFile)
def copy_anything_target(target, src, dst):
tmpPath = os.path.dirname(os.path.realpath(src))
tmpRule = os.path.basename(src)
for root, dirnames, filenames in os.walk(tmpPath):
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
tmpList = filenames
if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
target.add_file_staging(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
newDst = dst
if len(newDst) != 0 and newDst[-1] != "/":
newDst += "/"
if root[len(src)-1:] != "":
newDst += root[len(src)-1:]
if len(newDst) != 0 and newDst[-1] != "/":
newDst += "/"
debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)

View File

@@ -0,0 +1,25 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-framework CoreAudio")
self.add_export_flag_LD("-framework AudioToolbox")

View File

@@ -0,0 +1,29 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n - libasound2-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/alsa/asoundlib.h") \
and not os.path.isfile("/usr/include/dssi/alsa/asoundlib.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-lasound")

View File

@@ -0,0 +1,33 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n - libboost-all-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/boost/chrono.hpp"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD([
"-lboost_system",
"-lboost_thread",
"-lboost_chrono"
])

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n - libjack-jackd2-dev (new)\n - libjack-dev (old)"
# check if the library exist:
if not os.path.isfile("/usr/include/jack/jack.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-ljack")

View File

@@ -0,0 +1,30 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="OSS : Linux Open Sound System\n Can be install with the package:\n - ... TODO ..."
# check if the library exist:
"""
if not os.path.isfile("/usr/include/jack/jack.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_CC("-ljack")
"""

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="PULSE : The Linux PulseAudio\n Can be install with the package:\n - libpulse-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/pulse/pulseaudio.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD(["-lpulse-simple", "-lpulse"])

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="Z : z library \n Can be install with the package:\n - zlib1g-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/zlib.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD(["-lz"])

View File

@@ -0,0 +1,24 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-framework CoreAudio")
self.add_export_flag_LD("-framework CoreFoundation")

View File

View File

@@ -0,0 +1,31 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="DirectSound : Direct sound API for windows audio interface"
# check if the library exist:
if not os.path.isfile("/usr/i686-w64-mingw32/include/dsound.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD(["-ldsound",
"-lwinmm",
"-lole32"
])

View File

@@ -1,16 +1,34 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinTarget
import lutinTools
import lutinTools as tools
import lutinHost
import lutinImage
import lutinMultiprocess
import lutinHost
import os
import sys
class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False):
def __init__(self, config):
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "arm"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = "32"
arch = ""#"ARMv7"
lutinTarget.Target.__init__(self, "Android", config, arch)
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
@@ -21,7 +39,7 @@ class Target(lutinTarget.Target):
if folder=="android":
self.folder_ndk = folder + "/ndk"
if self.folder_ndk == "AUTO":
self.folder_ndk = lutinTools.get_run_folder() + "/../android/ndk"
self.folder_ndk = tools.get_run_folder() + "/../android/ndk"
# auto search SDK
if self.folder_sdk == "AUTO":
for folder in os.listdir("."):
@@ -29,28 +47,32 @@ class Target(lutinTarget.Target):
if folder=="android":
self.folder_sdk = folder + "/sdk"
if self.folder_sdk == "AUTO":
self.folder_sdk = lutinTools.get_run_folder() + "/../android/sdk"
self.folder_sdk = tools.get_run_folder() + "/../android/sdk"
if not os.path.isdir(self.folder_ndk):
debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
if not os.path.isdir(self.folder_sdk):
debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
arch = ""#"ARMv7"
tmpOsVal = "64"
gccVersion = "4.8"
if lutinHost.OS64BITS==True:
if lutinHost.BUS_SIZE==64:
tmpOsVal = "_64"
if typeCompilator == "clang":
cross = self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/"
if self.config["compilator"] == "clang":
self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/")
else:
baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
cross = baseFolderArm + "arm-linux-androideabi-"
self.set_cross_base(baseFolderArm + "arm-linux-androideabi-")
if not os.path.isdir(baseFolderArm):
debug.error("Gcc Arm pah does not exist !!!")
debug.error("Gcc Arm path does not exist !!!")
if not os.path.isdir(baseFolderMips):
debug.info("Gcc Mips pah does not exist !!!")
debug.info("Gcc Mips path does not exist !!!")
if not os.path.isdir(baseFolderX86):
debug.info("Gcc x86 pah does not exist !!!")
debug.info("Gcc x86 path does not exist !!!")
lutinTarget.Target.__init__(self, "Android", typeCompilator, debugMode, generatePackage, arch, cross, sumulator)
arch = "ARMv7"
# for gcc :
@@ -73,7 +95,7 @@ class Target(lutinTarget.Target):
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
if True:
if typeCompilator == "clang":
if self.config["compilator"] == "clang":
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
if arch == "ARMv5":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
@@ -177,7 +199,7 @@ class Target(lutinTarget.Target):
debug.info("Generate package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName
if "debug"==self.buildMode:
if self.config["mode"] == "debug":
pkgNameApplicationName += "debug"
# FINAL_FOLDER_JAVA_PROJECT
self.folder_javaProject= self.get_staging_folder(pkgName) \
@@ -197,14 +219,14 @@ class Target(lutinTarget.Target):
debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
# Create folder :
lutinTools.create_directory_of_file(self.file_finalAbstraction)
tools.create_directory_of_file(self.file_finalAbstraction)
# Create file :
tmpFile = open(self.file_finalAbstraction, 'w')
if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
tmpFile.write( "/**\n")
tmpFile.write( " * @author Edouard DUPIN, Kevin BILLONNEAU\n")
tmpFile.write( " * @copyright 2011, Edouard DUPIN, all right reserved\n")
tmpFile.write( " * @license BSD v3 (see license file)\n")
tmpFile.write( " * @license APACHE v2.0 (see license file)\n")
tmpFile.write( " * @note This file is autogenerate ==> see documantation to generate your own\n")
tmpFile.write( " */\n")
tmpFile.write( "package "+ compleatePackageName + ";\n")
@@ -293,7 +315,7 @@ class Target(lutinTarget.Target):
tmpFile.write( "/**\n")
tmpFile.write( " * @author Edouard DUPIN, Kevin BILLONNEAU\n")
tmpFile.write( " * @copyright 2011, Edouard DUPIN, all right reserved\n")
tmpFile.write( " * @license BSD v3 (see license file)\n")
tmpFile.write( " * @license APACHE v2.0 (see license file)\n")
tmpFile.write( " * @note This file is autogenerate ==> see documantation to generate your own\n")
tmpFile.write( " */\n")
tmpFile.write( "package "+ compleatePackageName + ";\n")
@@ -309,7 +331,7 @@ class Target(lutinTarget.Target):
tmpFile.flush()
tmpFile.close()
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
if "ICON" in pkgProperties.keys() \
and pkgProperties["ICON"] != "":
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256)
@@ -322,7 +344,7 @@ class Target(lutinTarget.Target):
if pkgProperties["ANDROID_MANIFEST"]!="":
debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
lutinTools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
else:
if "VERSION_CODE" not in pkgProperties:
pkgProperties["VERSION_CODE"] = "1"
@@ -341,7 +363,7 @@ class Target(lutinTarget.Target):
tmpFile.write( ' <application android:label="' + pkgNameApplicationName + '" \n')
if "ICON" in pkgProperties.keys():
tmpFile.write( ' android:icon="@drawable/icon" \n')
if "debug"==self.buildMode:
if self.config["mode"] == "debug":
tmpFile.write( ' android:debuggable="true" \n')
tmpFile.write( ' >\n')
if "ADMOD_ID" in pkgProperties:
@@ -350,7 +372,7 @@ class Target(lutinTarget.Target):
tmpFile.write( ' <activity android:name=".' + pkgNameApplicationName + '" \n')
tmpFile.write( ' android:label="' + pkgProperties['NAME'])
if "debug"==self.buildMode:
if self.config["mode"] == "debug":
tmpFile.write("-debug")
tmpFile.write( '"\n')
if "ICON" in pkgProperties.keys():
@@ -375,7 +397,7 @@ class Target(lutinTarget.Target):
tmpFile.write( ' >\n')
tmpFile.write( ' <service android:name=".' + pkgNameApplicationName + '" \n')
tmpFile.write( ' android:label="' + pkgProperties['NAME'])
if "debug"==self.buildMode:
if self.config["mode"] == "debug":
tmpFile.write("-debug")
tmpFile.write( '"\n')
if "ICON" in pkgProperties.keys():
@@ -448,7 +470,7 @@ class Target(lutinTarget.Target):
if pkgProperties["ANDROID_APPL_TYPE"]!="APPL":
#create the Wallpaper sub files : (main element for the application
debug.print_element("pkg", pkgNameApplicationName + "_resource.xml", "<==", "package configurations")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml", 'w')
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
@@ -461,7 +483,7 @@ class Target(lutinTarget.Target):
tmpFile.close()
# create wallpaper setting if needed (class and config file)
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
lutinTools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
tools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
debug.print_element("pkg", self.folder_javaProject + pkgNameApplicationName + "Settings.java", "<==", "package configurations")
tmpFile = open(self.folder_javaProject + pkgNameApplicationName + "Settings.java", 'w');
tmpFile.write( "package " + compleatePackageName + ";\n")
@@ -493,7 +515,7 @@ class Target(lutinTarget.Target):
tmpFile.close()
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", "<==", "package configurations")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", 'w');
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
@@ -524,7 +546,7 @@ class Target(lutinTarget.Target):
for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
if WALL_type == "list":
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
tmpFile = open(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n")
@@ -550,14 +572,20 @@ class Target(lutinTarget.Target):
for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
if res_source == "":
continue
lutinTools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
tools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
# Doc :
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
debug.print_element("pkg", "R.java", "<==", "Resources files")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
androidToolPath = self.folder_sdk + "/build-tools/19.0.3/"
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
androidToolPath = self.folder_sdk + "/build-tools/"
# find android tool version
dirnames = tools.get_list_sub_folder(androidToolPath)
if len(dirnames) != 1:
debug.error("an error occured when getting the tools for android")
androidToolPath += dirnames[0] + "/"
adModResouceFolder = ""
if "ADMOD_ID" in pkgProperties:
adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
@@ -572,7 +600,7 @@ class Target(lutinTarget.Target):
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
# -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
debug.print_element("pkg", "*.class", "<==", "*.java")
# more information with : -Xlint
# + self.file_finalAbstraction + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java
@@ -642,7 +670,7 @@ class Target(lutinTarget.Target):
# http://developer.android.com/tools/publishing/app-signing.html
# Create a key for signing your application:
# keytool -genkeypair -v -keystore AndroidKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500
if "debug"==self.buildMode:
if self.config["mode"] == "debug":
tmpFile = open("tmpPass.boo", 'w')
tmpFile.write("Pass__AndroidDebugKey\n")
tmpFile.write("PassKey__AndroidDebugKey\n")
@@ -654,7 +682,7 @@ class Target(lutinTarget.Target):
debugOption = ""
cmdLine = "jarsigner " \
+ debugOption \
+ "-keystore " + lutinTools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
+ "-keystore " + tools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ " alias__AndroidDebugKey < tmpPass.boo"
@@ -679,24 +707,24 @@ class Target(lutinTarget.Target):
lutinMultiprocess.run_command(cmdLine)
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
lutinTools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
tools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
# verbose mode : -v
cmdLine = self.folder_sdk + "/tools/zipalign 4 " \
cmdLine = androidToolPath + "zipalign 4 " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
lutinMultiprocess.run_command(cmdLine)
# copy file in the final stage :
lutinTools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
force=True)
tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
force=True)
def install_package(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName
if "debug"==self.buildMode:
if self.config["mode"] == "debug":
pkgNameApplicationName += "debug"
cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
@@ -707,7 +735,7 @@ class Target(lutinTarget.Target):
debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName
if "debug"==self.buildMode:
if self.config["mode"] == "debug":
pkgNameApplicationName += "debug"
cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName
RlutinMultiprocess.unCommand(cmdLine)

View File

@@ -1,30 +1,47 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinTarget
import lutinTools
import lutinImage
import os
import stat
import lutinExtProjectGeneratorXCode
import lutinMultiprocess
import lutinHost
import random
import re
class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False):
if typeCompilator == "gcc":
def __init__(self, config):
if config["compilator"] == "gcc":
debug.info("compile only with clang for IOs");
typeCompilator = "clang"
config["compilator"] = "clang"
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "arm"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = "64"
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
if sumulator == True:
if config["simulation"] == True:
arch = "i386"
cross = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
else:
arch="arm64" # for ipad air
#arch="armv7" # for Iphone 4
cross = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
lutinTarget.Target.__init__(self, "IOs", typeCompilator, debugMode, generatePackage, arch, cross, sumulator)
lutinTarget.Target.__init__(self, "IOs", config, arch)
if self.config["simulation"] == True:
self.set_cross_base("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/")
else:
self.set_cross_base("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/")
# remove unneeded ranlib ...
self.ranlib=""
@@ -37,13 +54,13 @@ class Target(lutinTarget.Target):
self.suffix_binary=''
self.suffix_package=''
if self.sumulator == True:
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk"
self.global_flags_ld.append("-mios-simulator-version-min=7.0")
self.global_flags_cc.append("-mios-simulator-version-min=7.0")
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk"
self.global_flags_ld.append("-mios-simulator-version-min=8.0")
self.global_flags_cc.append("-mios-simulator-version-min=8.0")
else:
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk"
self.global_flags_ld.append("-miphoneos-version-min=7.0")
self.global_flags_cc.append("-miphoneos-version-min=7.0")
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk"
self.global_flags_ld.append("-miphoneos-version-min=8.0")
self.global_flags_cc.append("-miphoneos-version-min=8.0")
self.global_flags_ld.append([
"-Xlinker",
@@ -57,9 +74,6 @@ class Target(lutinTarget.Target):
self.global_flags_m.append("-fobjc-arc")
#self.global_flags_m.append("-fmodules")
#add a project generator:
self.externProjectManager = lutinExtProjectGeneratorXCode.ExtProjectGeneratorXCode()
def get_staging_folder(self, binaryName):
return lutinTools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinTarget
import lutinTools as tools
@@ -6,10 +14,25 @@ import os
import stat
import re
import lutinMultiprocess
import lutinHost
class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False):
lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode, generatePackage, "", "")
def __init__(self, config):
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
lutinTarget.Target.__init__(self, "Linux", config, "")
if self.config["bus-size"] == "64":
# 64 bits
if lutinHost.BUS_SIZE != 64:
self.global_flags_cc.append("-m64")
else:
# 32 bits
if lutinHost.BUS_SIZE != 32:
self.global_flags_cc.append("-m32")
def generate_list_separate_coma(self, list):
result = ""

View File

@@ -1,17 +1,30 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinTarget
import lutinTools
import lutinHost
import os
import stat
class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False):
cross = ""
def __init__(self, config):
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
lutinTarget.Target.__init__(self, "MacOs", typeCompilator, debugMode, generatePackage, "", cross)
lutinTarget.Target.__init__(self, "MacOs", config, "")
self.folder_bin="/MacOS"
self.folder_lib="/lib"
@@ -37,7 +50,7 @@ class Target(lutinTarget.Target):
if "ICON" in pkgProperties.keys() \
and pkgProperties["ICON"] != "":
lutinTools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", True)
lutinTools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", force=True)
# http://www.sandroid.org/imcross/#Deployment
infoFile=self.get_staging_folder(pkgName) + "/Info.plist"
@@ -53,7 +66,7 @@ class Target(lutinTarget.Target):
tmpFile.write(" <string>"+pkgName+"</string>\n")
tmpFile.write(" <key>CFBundleIdentifier</key>\n")
tmpFile.write(" <string>" + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
tmpFile.write(" <key>CFBundleSignature</key>\n")
tmpFile.write(" <key>CFBundleSignature</key>\n")
tmpFile.write(" <string>????</string>\n")
tmpFile.write(" <key>CFBundleIconFile</key>\n")
tmpFile.write(" <string>icon.icns</string>\n")

View File

@@ -1,30 +1,53 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinTarget
import lutinTools
import lutinHost
import os
import stat
import lutinHost
import sys
class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False):
def __init__(self, config):
if config["compilator"] != "gcc":
debug.error("Windows does not support '" + config["compilator"] + "' compilator ... availlable : [gcc]")
config["compilator"] = "gcc"
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
lutinTarget.Target.__init__(self, "Windows", config, "")
# on windows board the basic path is not correct
# TODO : get external PATH for the minGW path
# TODO : Set the cyngwin path ...
if lutinHost.OS == "Windows":
cross = "c:\\MinGW\\bin\\"
self.set_cross_base("c:\\MinGW\\bin\\")
sys.path.append("c:\\MinGW\\bin" )
os.environ['PATH'] += ";c:\\MinGW\\bin\\"
else:
#cross = "i586-mingw32msvc-"
cross = "x86_64-w64-mingw32-"
#cross = "i686-w64-mingw32-"
if typeCompilator!="gcc":
debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]")
lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, generatePackage, "", cross)
if self.config["bus-size"] == "64":
# 64 bits
self.set_cross_base("x86_64-w64-mingw32-")
else:
# 32 bits
self.set_cross_base("i686-w64-mingw32-")
# force static link to prenvent many errors ...
self.global_flags_ld.append(["-static-libgcc",
"-static-libstdc++",
"-static"])
self.folder_bin=""
self.folder_lib="/lib"

File diff suppressed because it is too large Load Diff