[DEV] add compilation of m and mm files and MacOs compilation

This commit is contained in:
Edouard DUPIN 2013-04-25 00:55:15 +02:00
parent e0cebcb1a0
commit d0356e2fd0
4 changed files with 67 additions and 39 deletions

View File

@ -140,7 +140,7 @@ def Start():
None # nothing to do ... None # nothing to do ...
elif argument[:13] == "--compilator=" or argument[:3] == "-C=": elif argument[:13] == "--compilator=" or argument[:3] == "-C=":
tmpArg="" tmpArg=""
if argument[:3] == "-p=": if argument[:3] == "-C=":
tmpArg=argument[3:] tmpArg=argument[3:]
else: else:
tmpArg=argument[13:] tmpArg=argument[13:]

View File

@ -8,7 +8,7 @@ if platform.system() == "Linux":
elif platform.system() == "Windows": elif platform.system() == "Windows":
OS = "Windows" OS = "Windows"
elif platform.system() == "Darwin": elif platform.system() == "Darwin":
OS = "Windows" OS = "MacOs"
else: else:
debug.error("Unknow the Host OS ... '" + platform.system() + "'") debug.error("Unknow the Host OS ... '" + platform.system() + "'")

View File

@ -7,7 +7,6 @@ import lutinModule as module
import lutinHost as host import lutinHost as host
import lutinTools import lutinTools
import lutinDebug as debug import lutinDebug as debug
import lutinList as buildList
import lutinHeritage as heritage import lutinHeritage as heritage
import lutinDepend as dependency import lutinDepend as dependency
import lutinMultiprocess import lutinMultiprocess
@ -100,44 +99,67 @@ class module:
## Commands for running gcc to compile a m++ file. ## Commands for running gcc to compile a m++ file.
############################################################################### ###############################################################################
def Compile_mm_to_o(self, file, binary, target, depancy): def Compile_mm_to_o(self, file, binary, target, depancy):
# TODO : Check depedency ... file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
lutinTools.CreateDirectoryOfFile(dst) # create the command line befor requesting start:
debug.printElement("m++", self.name, "<==", file) cmdLine=lutinTools.ListToStr([
""" target.xx,
cmdLine= $(TARGET_CXX) \ "-o", file_dst ,
-o " + dst + " \ target.global_include_cc,
$(TARGET_GLOBAL_C_INCLUDES) \ lutinTools.AddPrefix("-I",self.export_path),
$(PRIVATE_C_INCLUDES) \ lutinTools.AddPrefix("-I",self.local_path),
$(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \ lutinTools.AddPrefix("-I",depancy.path),
$(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(CXX_FLAGS_WARNINGS) \ target.global_flags_cc,
$(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \ target.global_flags_mm,
"-c -MMD -MP -g" depancy.flags_cc,
"-x objective-c" + depancy.flags_mm,
src self.flags_mm,
""" self.flags_cc,
return tmpList[1] 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. ## Commands for running gcc to compile a m file.
############################################################################### ###############################################################################
def Compile_m_to_o(self, file, binary, target, depancy): def Compile_m_to_o(self, file, binary, target, depancy):
# TODO : Check depedency ... file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
lutinTools.CreateDirectoryOfFile(dst) # create the command line befor requesting start:
debug.printElement("m", self.name, "<==", file) cmdLine=lutinTools.ListToStr([
""" target.cc,
$(TARGET_CC) \ "-o", file_dst ,
-o $@ \ target.global_include_cc,
$(TARGET_GLOBAL_C_INCLUDES) \ lutinTools.AddPrefix("-I",self.export_path),
$(PRIVATE_C_INCLUDES) \ lutinTools.AddPrefix("-I",self.local_path),
$(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \ lutinTools.AddPrefix("-I",depancy.path),
$(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(CXX_FLAGS_WARNINGS) \ target.global_flags_cc,
$(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \ target.global_flags_m,
-D__EWOL_APPL_NAME__="$(PROJECT_NAME2)" \ depancy.flags_cc,
-c -MMD -MP -g \ depancy.flags_m,
-x objective-c \ self.flags_m,
$(call path-from-top,$<) self.flags_cc,
""" self.export_flags_m,
return tmpList[1] 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. ## 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": 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) resFile = self.Compile_xx_to_o(file, packageName, target, subHeritage)
listSubFileNeededToBuild.append(resFile) listSubFileNeededToBuild.append(resFile)
elif fileExt == "mm" or fileExt == "MM":
resFile = self.Compile_mm_to_o(file, packageName, target, subHeritage)
listSubFileNeededToBuild.append(resFile)
else: else:
debug.verbose(" TODO : gcc " + self.originFolder + "/" + file) debug.verbose(" TODO : gcc " + self.originFolder + "/" + file)
# when multiprocess availlable, we need to synchronize here ... # when multiprocess availlable, we need to synchronize here ...

View File

@ -11,7 +11,7 @@ class Target(lutinTarget.Target):
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/ # http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # 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_bin="/MacOS"
self.folder_lib="/lib" self.folder_lib="/lib"
@ -19,14 +19,17 @@ class Target(lutinTarget.Target):
self.folder_doc="/doc" self.folder_doc="/doc"
self.suffix_lib_static='.a' self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dll' self.suffix_lib_dynamic='.dylib'
self.suffix_binary='.exe' self.suffix_binary=''
self.suffix_package='' self.suffix_package=''
def GetStagingFolder(self, binaryName): def GetStagingFolder(self, binaryName):
return lutinTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/" 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): def MakePackage(self, pkgName, pkgProperties):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'") debug.info("Generate package '" + pkgName + "'")