From d0356e2fd0ef6e8f34fd0ab673a016fc8b6b5b42 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 25 Apr 2013 00:55:15 +0200 Subject: [PATCH] [DEV] add compilation of m and mm files and MacOs compilation --- lutin.py | 2 +- lutinHost.py | 2 +- lutinModule.py | 93 ++++++++++++++++++++++++++++----------------- lutinTargetMacOs.py | 9 +++-- 4 files changed, 67 insertions(+), 39 deletions(-) diff --git a/lutin.py b/lutin.py index 2128e91..80fb690 100755 --- a/lutin.py +++ b/lutin.py @@ -140,7 +140,7 @@ def Start(): None # nothing to do ... elif argument[:13] == "--compilator=" or argument[:3] == "-C=": tmpArg="" - if argument[:3] == "-p=": + if argument[:3] == "-C=": tmpArg=argument[3:] else: tmpArg=argument[13:] diff --git a/lutinHost.py b/lutinHost.py index 2799063..e26d1af 100644 --- a/lutinHost.py +++ b/lutinHost.py @@ -8,7 +8,7 @@ if platform.system() == "Linux": elif platform.system() == "Windows": OS = "Windows" elif platform.system() == "Darwin": - OS = "Windows" + OS = "MacOs" else: debug.error("Unknow the Host OS ... '" + platform.system() + "'") diff --git a/lutinModule.py b/lutinModule.py index a889c0a..ed173bd 100644 --- a/lutinModule.py +++ b/lutinModule.py @@ -7,7 +7,6 @@ import lutinModule as module import lutinHost as host import lutinTools import lutinDebug as debug -import lutinList as buildList import lutinHeritage as heritage import lutinDepend as dependency import lutinMultiprocess @@ -100,44 +99,67 @@ class module: ## Commands for running gcc to compile a m++ file. ############################################################################### def Compile_mm_to_o(self, file, binary, target, depancy): - # TODO : Check depedency ... - lutinTools.CreateDirectoryOfFile(dst) - debug.printElement("m++", self.name, "<==", file) - """ - cmdLine= $(TARGET_CXX) \ - -o " + dst + " \ - $(TARGET_GLOBAL_C_INCLUDES) \ - $(PRIVATE_C_INCLUDES) \ - $(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \ - $(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(CXX_FLAGS_WARNINGS) \ - $(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \ - "-c -MMD -MP -g" - "-x objective-c" + - src - """ - return tmpList[1] + file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file) + # create the command line befor requesting start: + cmdLine=lutinTools.ListToStr([ + target.xx, + "-o", file_dst , + target.global_include_cc, + lutinTools.AddPrefix("-I",self.export_path), + lutinTools.AddPrefix("-I",self.local_path), + lutinTools.AddPrefix("-I",depancy.path), + target.global_flags_cc, + target.global_flags_mm, + depancy.flags_cc, + depancy.flags_mm, + self.flags_mm, + self.flags_cc, + self.export_flags_mm, + self.export_flags_cc, + "-c -MMD -MP -g", + "-x objective-c", + file_src]) + # check the dependency for this file : + if False==dependency.NeedReBuild(file_dst, file_src, file_depend, file_cmd, cmdLine): + return file_dst + lutinTools.CreateDirectoryOfFile(file_dst) + comment = ["m++", self.name, "<==", file] + #process element + lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd) + return file_dst ############################################################################### ## Commands for running gcc to compile a m file. ############################################################################### def Compile_m_to_o(self, file, binary, target, depancy): - # TODO : Check depedency ... - lutinTools.CreateDirectoryOfFile(dst) - debug.printElement("m", self.name, "<==", file) - """ - $(TARGET_CC) \ - -o $@ \ - $(TARGET_GLOBAL_C_INCLUDES) \ - $(PRIVATE_C_INCLUDES) \ - $(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \ - $(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(CXX_FLAGS_WARNINGS) \ - $(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \ - -D__EWOL_APPL_NAME__="$(PROJECT_NAME2)" \ - -c -MMD -MP -g \ - -x objective-c \ - $(call path-from-top,$<) - """ - return tmpList[1] + file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file) + # create the command line befor requesting start: + cmdLine=lutinTools.ListToStr([ + target.cc, + "-o", file_dst , + target.global_include_cc, + lutinTools.AddPrefix("-I",self.export_path), + lutinTools.AddPrefix("-I",self.local_path), + lutinTools.AddPrefix("-I",depancy.path), + target.global_flags_cc, + target.global_flags_m, + depancy.flags_cc, + depancy.flags_m, + self.flags_m, + self.flags_cc, + self.export_flags_m, + self.export_flags_cc, + "-c -MMD -MP -g", + "-x objective-c", + file_src]) + # check the dependency for this file : + if False==dependency.NeedReBuild(file_dst, file_src, file_depend, file_cmd, cmdLine): + return file_dst + lutinTools.CreateDirectoryOfFile(file_dst) + comment = ["m", self.name, "<==", file] + #process element + lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd) + return file_dst ############################################################################### ## Commands for running gcc to compile a C++ file. @@ -370,6 +392,9 @@ class module: elif fileExt == "cpp" or fileExt == "CPP" or fileExt == "cxx" or fileExt == "CXX" or fileExt == "xx" or fileExt == "XX": resFile = self.Compile_xx_to_o(file, packageName, target, subHeritage) listSubFileNeededToBuild.append(resFile) + elif fileExt == "mm" or fileExt == "MM": + resFile = self.Compile_mm_to_o(file, packageName, target, subHeritage) + listSubFileNeededToBuild.append(resFile) else: debug.verbose(" TODO : gcc " + self.originFolder + "/" + file) # when multiprocess availlable, we need to synchronize here ... diff --git a/lutinTargetMacOs.py b/lutinTargetMacOs.py index 83660fe..762b5f8 100644 --- a/lutinTargetMacOs.py +++ b/lutinTargetMacOs.py @@ -11,7 +11,7 @@ class Target(lutinTarget.Target): # http://biolpc22.york.ac.uk/pub/linux-mac-cross/ # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt - lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, "", cross) + lutinTarget.Target.__init__(self, "MacOs", typeCompilator, debugMode, "", cross) self.folder_bin="/MacOS" self.folder_lib="/lib" @@ -19,14 +19,17 @@ class Target(lutinTarget.Target): self.folder_doc="/doc" self.suffix_lib_static='.a' - self.suffix_lib_dynamic='.dll' - self.suffix_binary='.exe' + self.suffix_lib_dynamic='.dylib' + self.suffix_binary='' self.suffix_package='' def GetStagingFolder(self, binaryName): return lutinTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/" + def GetStagingFolderData(self, binaryName): + return self.GetStagingFolder(binaryName) + self.folder_data + "/" + def MakePackage(self, pkgName, pkgProperties): debug.debug("------------------------------------------------------------------------") debug.info("Generate package '" + pkgName + "'")