[DEBUG] Run / intall executable on MacOs

This commit is contained in:
Edouard DUPIN 2016-09-18 22:40:01 +02:00
parent 1cf731910d
commit f46c5116b1
8 changed files with 95 additions and 49 deletions

View File

@ -41,7 +41,7 @@ myArgs.add("i", "isolate-system", desc="Isolate system build (copy header of c a
myArgs.add_section("properties", "keep in the sequency of the cible")
myArgs.add("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'")
myArgs.add("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)")
myArgs.add("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default " + lutinHost.HOST_DEFAULT_COMPILATOR + " will be used)")
myArgs.add("", "compilator-version", haveParam=True, desc="With travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9")
myArgs.add("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)")
myArgs.add("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile")
@ -323,7 +323,7 @@ lutin.init()
#available target : Linux / MacOs / Windows / Android ...
targetName = host.OS
config = {
"compilator":"gcc",
"compilator":lutinHost.HOST_DEFAULT_COMPILATOR,
"mode":"release",
"bus-size":"auto",
"arch":"auto",
@ -364,7 +364,7 @@ for argument in localArgument:
debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release")
#reset properties by defauult:
config = {
"compilator":"gcc",
"compilator":lutinHost.HOST_DEFAULT_COMPILATOR,
"mode":"release",
"bus-size":"auto",
"arch":"auto",

View File

@ -15,10 +15,13 @@ from . import debug
# print os.name # ==> 'posix'
if platform.system() == "Linux":
OS = "Linux"
HOST_DEFAULT_COMPILATOR = "gcc"
elif platform.system() == "Windows":
OS = "Windows"
HOST_DEFAULT_COMPILATOR = "gcc"
elif platform.system() == "Darwin":
OS = "MacOs"
HOST_DEFAULT_COMPILATOR = "clang"
else:
debug.error("Unknow the Host OS ... '" + platform.system() + "'")

View File

@ -55,8 +55,9 @@ def run_command_no_lock_out(cmd_line):
p = subprocess.Popen(args)
except subprocess.CalledProcessError as e:
debug.error("subprocess.CalledProcessError : " + str(args))
except:
debug.error("Exception on : " + str(args))
return
#except:
# debug.error("Exception on : " + str(args))
# launch the subprocess:
p.communicate()

View File

@ -87,25 +87,37 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
cmd.append(local_ref_on_builder_c.get_version_compilation_flags(flags, depancy.flags))
except:
pass
try:
cmd.append(target.global_flags["c"])
except:
pass
try:
cmd.append(target.global_flags["m"])
except:
pass
list_flags = [];
if "c" in target.global_flags:
list_flags.append(target.global_flags["c"])
if "m" in target.global_flags:
list_flags.append(target.global_flags["m"])
for type in ["c", "m"]:
try:
cmd.append(depancy.flags[type])
except:
pass
if type in depancy.flags:
list_flags.append(depancy.flags[type])
for view in ["local", "export"]:
for type in ["c", "m"]:
try:
cmd.append(flags[view][type])
except:
pass
if view in flags:
for type in ["c", "m"]:
if type in flags[view]:
list_flags.append(flags[view][type])
# get blacklist of flags
list_flags_blacklist = [];
if "c-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c-remove"])
if "m-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["m-remove"])
for type in ["c-remove", "m-remove"]:
if type in depancy.flags:
list_flags_blacklist.append(depancy.flags[type])
for view in ["local", "export"]:
if view in flags:
for type in ["c-remove", "m-remove"]:
if type in flags[view]:
list_flags_blacklist.append(flags[view][type])
# apply blacklisting of data and add it on the cmdLine
clean_flags = tools.remove_element(list_flags, list_flags_blacklist)
#debug.warning("plop " + str(list_flags_blacklist) + " " + str(list_flags) + " --> " + str(clean_flags) )
cmd.append(clean_flags);
cmd.append("-c -MMD -MP")
cmd.append("-x objective-c")
cmd.append(file_src)

View File

@ -87,22 +87,45 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
except:
pass
list_flags = [];
if "c" in target.global_flags:
list_flags.append(target.global_flags["c"])
if "c++" in target.global_flags:
list_flags.append(target.global_flags["c++"])
if "m" in target.global_flags:
list_flags.append(target.global_flags["m"])
if "mm" in target.global_flags:
list_flags.append(target.global_flags["mm"])
for type in ["c", "c++", "m", "mm"]:
try:
cmd.append(target.global_flags[type])
except:
pass
for type in ["c", "c++", "m", "mm"]:
try:
cmd.append(depancy.flags[type])
except:
pass
for view in ["export", "local"]:
for type in ["c", "c++", "m", "mm"]:
try:
cmd.append(flags[view][type])
except:
pass
if type in depancy.flags:
list_flags.append(depancy.flags[type])
for view in ["local", "export"]:
if view in flags:
for type in ["c", "c++", "m", "mm"]:
if type in flags[view]:
list_flags.append(flags[view][type])
# get blacklist of flags
list_flags_blacklist = [];
if "c-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c-remove"])
if "c++-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["c++-remove"])
if "m-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["m-remove"])
if "mm-remove" in target.global_flags:
list_flags_blacklist.append(target.global_flags["mm-remove"])
for type in ["c-remove", "c++-remove","m-remove", "mm-remove"]:
if type in depancy.flags:
list_flags_blacklist.append(depancy.flags[type])
for view in ["local", "export"]:
if view in flags:
for type in ["c-remove", "c++-remove","m-remove", "mm-remove"]:
if type in flags[view]:
list_flags_blacklist.append(flags[view][type])
# apply blacklisting of data and add it on the cmdLine
clean_flags = tools.remove_element(list_flags, list_flags_blacklist)
#debug.warning("plop " + str(list_flags_blacklist) + " " + str(list_flags) + " --> " + str(clean_flags) )
cmd.append(clean_flags);
cmd.append("-c -MMD -MP")
cmd.append("-x objective-c++")
cmd.append(file_src)

View File

@ -514,6 +514,6 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------")
debug.info("cmd: " + self.path_sdk + "/platform-tools/adb shell logcat ")
cmdLine = self.path_sdk + "/platform-tools/adb shell logcat "
multiprocess.run_command(cmdLine)
multiprocess.run_command_no_lock_out(cmdLine)

View File

@ -30,6 +30,9 @@ class Target(target.Target):
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = "64"
if config["compilator"] != "clang":
debug.warning("compilator is not clang ==> force it...")
config["compilator"] = "clang"
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
@ -55,7 +58,7 @@ class Target(target.Target):
#self.suffix_binary=''
#self.suffix_package=''
if False: #self.simulator == True:
if self.get_simulation() == True:
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
self.add_flag("link", "-mios-simulator-version-min=8.0")
self.add_flag("c", "-mios-simulator-version-min=8.0")
@ -69,7 +72,7 @@ class Target(target.Target):
"-objc_abi_version",
"-Xlinker 2",
"-Xlinker",
"-no_implicit_dylibs",
#"-no_implicit_dylibs",
"-stdlib=libc++",
"-fobjc-arc",
"-fobjc-link-runtime"
@ -186,7 +189,7 @@ class Target(target.Target):
data_file += " \n"
data_file += " <key>CFBundleResourceSpecification</key>\n"
data_file += " <string>ResourceRules.plist</string>\n"
if self.sumulator == False:
if self.get_simulation() == False:
data_file += " <key>LSRequiresIPhoneOS</key>\n"
data_file += " <true/>\n"
else:
@ -239,7 +242,7 @@ class Target(target.Target):
cmdLine += " -genpkginfo " + self.get_staging_path(pkg_name) + "/PkgInfo"
cmdLine += " -expandbuildsettings "
cmdLine += " -format binary "
if self.sumulator == False:
if self.get_simulation() == False:
cmdLine += " -platform iphonesimulator "
else:
cmdLine += " -platform iphoneos "
@ -315,7 +318,7 @@ class Target(target.Target):
# Must create the tarball of the application
#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
if self.sumulator == False:
if self.get_simulation() == False:
if "APPLE_APPLICATION_IOS_ID" not in pkg_properties:
pkg_properties["APPLE_APPLICATION_IOS_ID"] = "00000000"
debug.warning("Missing package property : APPLE_APPLICATION_IOS_ID USE " + pkg_properties["APPLE_APPLICATION_IOS_ID"] + " ID ... ==> CAN NOT WORK ..." )
@ -363,7 +366,7 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
if self.sumulator == False:
if self.get_simulation() == False:
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
debug.print_element("tool", "ios-deploy", "<==", "external sources")
cmdLine = 'cd ewol/ios-deploy ; make ; cd ../.. '
@ -407,7 +410,7 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
if self.sumulator == False:
if self.get_simulation() == False:
debug.warning("not implemented")
else:
simulatorIdFile = ".iosSimutatorId_" + pkg_name + ".txt"
@ -420,7 +423,7 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------")
debug.info("log of iOs board")
debug.debug("------------------------------------------------------------------------")
if self.sumulator == False:
if self.get_simulation() == False:
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
debug.print_element("tool", "ios-deploy", "<==", "external sources")
cmdLine = 'cd ewol/ios-deploy ; make ; cd ../.. '

View File

@ -25,6 +25,9 @@ class Target(target.Target):
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(host.BUS_SIZE)
if config["compilator"] != "clang":
debug.warning("compilator is not clang ==> force it...")
config["compilator"] = "clang"
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
target.Target.__init__(self, "MacOs", config, "")
@ -133,11 +136,11 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
debug.info("copy " + tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app in /Applications/")
debug.info("copy " + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") + " in /Applications/")
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
shutil.rmtree("/Applications/" + pkg_name + ".app")
# copy the application in the basic application path : /Applications/xxx.app
shutil.copytree(os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app"), os.path.join("/Applications", pkg_name + ".app"))
shutil.copytree(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app"), os.path.join("/Applications", pkg_name + ".app"))
def un_install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------")
@ -152,7 +155,8 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
appl_path = os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app", "bin", pkg_name)
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app" , "Contents", "MacOS", pkg_name)
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "Contents", "MacOS", pkg_name)
cmd = appl_path + " "
for elem in option_list:
cmd += elem + " "