[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 ...
elif argument[:13] == "--compilator=" or argument[:3] == "-C=":
tmpArg=""
if argument[:3] == "-p=":
if argument[:3] == "-C=":
tmpArg=argument[3:]
else:
tmpArg=argument[13:]

View File

@ -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() + "'")

View File

@ -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 ...

View File

@ -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 + "'")