Kaydet (Commit) c5555c16 authored tarafından jan Iversen's avatar jan Iversen

gbuild-to-ide xcode-ide-integration

change target to use "make" for now.
this patch enables debug/build in xcode.

Change-Id: I1bac15beb77af35d7348eab9e645a1bf3522c2c8
üst 39ca8c72
...@@ -143,6 +143,8 @@ class GbuildParser: ...@@ -143,6 +143,8 @@ class GbuildParser:
moduleDict[module]['targets'] |= set([newObj]) moduleDict[module]['targets'] |= set([newObj])
moduleDict['include']={'headers':self.find_all_headers_include_git(), 'targets': {}} moduleDict['include']={'headers':self.find_all_headers_include_git(), 'targets': {}}
# sort ['sources'] and ['headers'] for each module
for module in sorted(moduleDict): for module in sorted(moduleDict):
self.modules[module] = moduleDict[module] self.modules[module] = moduleDict[module]
return self return self
...@@ -171,7 +173,7 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator): ...@@ -171,7 +173,7 @@ class EclipseCDTIntegrationGenerator(IdeIntegrationGenerator):
def __init__(self, gbuildparser, ide): def __init__(self, gbuildparser, ide):
IdeIntegrationGenerator.__init__(self, gbuildparser, ide) IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
def create_include_paths(self): def create_include_pathks(self):
for module in self.gbuildparser.modules: for module in self.gbuildparser.modules:
if module == 'include': if module == 'include':
continue continue
...@@ -548,7 +550,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -548,7 +550,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
def emit(self): def emit(self):
rootId = 'X0000001' rootId = 'X0000001'
mainGroupId = 'X0000002' mainGroupId = 'X0000002'
self.rootObj = {'attributes': {'LastUpgradeCheck': '0500', self.rootObj = {'attributes': {'LastUpgradeCheck': '0820',
'ORGANIZATIONNAME': 'LibreOffice', 'ORGANIZATIONNAME': 'LibreOffice',
'TargetAttributes': {}}, 'TargetAttributes': {}},
'compatibilityVersion': 'Xcode 3.2', 'compatibilityVersion': 'Xcode 3.2',
...@@ -557,7 +559,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -557,7 +559,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'hasScannedForEncodings': 0, 'hasScannedForEncodings': 0,
'knownRegions': ['en'], 'knownRegions': ['en'],
'mainGroup': mainGroupId, 'mainGroup': mainGroupId,
'projectDirPath': '', 'projectDirPath': self.gbuildparser.srcdir,
'projectRoot': '', 'projectRoot': '',
'buildConfigurationList': '', 'buildConfigurationList': '',
'targets': []} 'targets': []}
...@@ -569,22 +571,15 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -569,22 +571,15 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
mainGroupId : mainGroup}, mainGroupId : mainGroup},
'rootObject': rootId} 'rootObject': rootId}
for module in self.gbuildparser.modules: for module in self.gbuildparser.modules:
if module == 'include':
continue
sourceId, self.sourceObj = self.define_pbxgroup('Sources') sourceId, self.sourceObj = self.define_pbxgroup('Sources')
includeId, self.includeObj = self.define_pbxgroup('Headers') includeId, self.includeObj = self.define_pbxgroup('Headers')
targetId, targetObj = self.define_pbxgroup('Targets')
targetLibId, self.targetLibObj = self.define_pbxgroup('Libraries')
targetCUId, self.targetCUObj = self.define_pbxgroup('Unittests')
targetExeId, self.targetExeObj = self.define_pbxgroup('Executable')
moduleId, self.moduleObj = self.define_pbxgroup(module) moduleId, self.moduleObj = self.define_pbxgroup(module)
targetObj['children'] = [targetLibId, targetCUId,targetExeId] self.moduleObj['children'] = [sourceId, includeId]
self.moduleObj['children'] = [sourceId, includeId, targetId]
pbxproj['objects'].update( {sourceId: self.sourceObj, pbxproj['objects'].update( {sourceId: self.sourceObj,
includeId: self.includeObj, includeId: self.includeObj,
targetId: targetObj,
targetLibId: self.targetLibObj,
targetCUId: self.targetCUObj,
targetExeId: self.targetExeObj,
moduleId: self.moduleObj}) moduleId: self.moduleObj})
mainGroup['children'].append(moduleId) mainGroup['children'].append(moduleId)
...@@ -645,16 +640,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -645,16 +640,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
file.write('""') file.write('""')
def generate_ref_target(self, modulename):
result = {'isa': 'PBXFileReference',
'explicitFileType': 'compiled.mach-o.executable',
'includeInIndex': 0,
'path': modulename.name,
'sourceTree': 'BUILT_PRODUCTS_DIR'}
return result
def generate_target(self, modulename): def generate_target(self, modulename):
if modulename.build_type == 'Library': if modulename.build_type == 'Library':
product = 'com.apple.product-type.library.dynamic' product = 'com.apple.product-type.library.dynamic'
...@@ -665,15 +650,16 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -665,15 +650,16 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
else: else:
product = 'com.apple.product-type.something' product = 'com.apple.product-type.something'
result = {'isa': 'PBXNativeTarget', result = {'isa': 'PBXLegacyTarget',
'buildConfigurationList': self.configurationListId, 'buildConfigurationList': self.configurationListId,
'buildPhases': [self.sourcesBuildPhaseId, self.copyBuildPhaseId], 'buildArgumentsString': modulename.target_name,
'buildRules': [], 'buildPhases': [],
'dependencies': [], 'dependencies': [],
'name': modulename.name, # modulename, 'buildToolPath': 'make',
'productName': modulename.name, # modulename, 'buildWorkingDirectory': self.gbuildparser.builddir,
'productReference': self.targetRefId, 'name': modulename.target_name,
'productType': product} 'productName': modulename.name,
'passBuildSettingsEnvironment': 1}
return result return result
def generate_configuration_debug(self, modulename): def generate_configuration_debug(self, modulename):
...@@ -688,7 +674,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -688,7 +674,7 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'CLANG_WARN_BOOL_CONVERSION': 'YES', 'CLANG_WARN_BOOL_CONVERSION': 'YES',
'CLANG_WARN_CONSTANT_CONVERSION': 'YES', 'CLANG_WARN_CONSTANT_CONVERSION': 'YES',
'CLANG_WARN_DIRECT_OBJC_ISA_USAGE': 'YES_ERROR', 'CLANG_WARN_DIRECT_OBJC_ISA_USAGE': 'YES_ERROR',
'CLANG_WARN_DOCUMEjNTATION_COMMENTS': 'YES', 'CLANG_WARN_DOCUMENTATION_COMMENTS': 'YES',
'CLANG_WARN_EMPTY_BODY': 'YES', 'CLANG_WARN_EMPTY_BODY': 'YES',
'CLANG_WARN_ENUM_CONVERSION': 'YES', 'CLANG_WARN_ENUM_CONVERSION': 'YES',
'CLANG_WARN_INFINITE_RECURSION': 'YES', 'CLANG_WARN_INFINITE_RECURSION': 'YES',
...@@ -742,42 +728,15 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -742,42 +728,15 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'path': i + '.cxx', 'path': i + '.cxx',
'sourceTree': '<group>'} 'sourceTree': '<group>'}
def generate_sources_build_phase(self, modulename):
result = {'isa': 'PBXSourcesBuildPhase',
'buildActionMask': 2147483647,
'files': list(self.sourceList.keys()),
'runOnlyForDeploymentPostprocessing': 0}
return result
def generate_copy_build_phase(self, modulename):
result = {'isa': 'PBXCopyFilesBuildPhase',
'buildActionMask': 2147483647,
'dstPath' : '',
'dstSubfolderSpec': 0,
'files': [],
'runOnlyForDeploymentPostprocessing': 0}
return result
def generate_project(self, target): def generate_project(self, target):
self.targetId = self.generate_id() self.targetId = self.generate_id()
self.configurationListId = self.generate_id() self.configurationListId = self.generate_id()
self.sourcesBuildPhaseId = self.generate_id()
self.copyBuildPhaseId = self.generate_id()
self.targetRefId = self.generate_id()
self.configurationDebugId = self.generate_id() self.configurationDebugId = self.generate_id()
self.productReferenceId = self.generate_id() self.productReferenceId = self.generate_id()
self.productGroupId = self.generate_id() self.productGroupId = self.generate_id()
self.build_source_list(target) self.build_source_list(target)
self.sourceObj['children'].extend(list(self.sourceRefList.keys())) self.sourceObj['children'].extend(list(self.sourceRefList.keys()))
if target.build_type == 'Executable':
self.targetExeObj['children'].append(self.targetRefId)
elif target.build_type == 'Library':
self.targetLibObj['children'].append(self.targetRefId)
elif target.build_type == 'CppunitTest':
self.targetCUObj['children'].append(self.targetRefId)
else:
raise Exception('this should not happen')
self.rootObj['attributes']['TargetAttributes'].update({ self.rootObj['attributes']['TargetAttributes'].update({
self.targetId: {'CreatedOnToolsVersion': '8.2', self.targetId: {'CreatedOnToolsVersion': '8.2',
...@@ -785,25 +744,18 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -785,25 +744,18 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
self.rootObj['buildConfigurationList'] = self.configurationListId self.rootObj['buildConfigurationList'] = self.configurationListId
self.rootObj['targets'].append(self.targetId) self.rootObj['targets'].append(self.targetId)
objects = {self.targetId: self.generate_target(target), objects = {self.targetId: self.generate_target(target),
self.targetRefId: self.generate_ref_target(target),
self.sourcesBuildPhaseId: self.generate_sources_build_phase(target),
self.copyBuildPhaseId: self.generate_copy_build_phase(target),
self.configurationListId: self.generate_configuration_list(target), self.configurationListId: self.generate_configuration_list(target),
self.configurationDebugId: self.generate_configuration_debug(target) self.configurationDebugId: self.generate_configuration_debug(target)
} }
for i in self.sourceList.keys(): for i in self.sourceList.keys():
ref = self.sourceList[i] ref = self.sourceList[i]
objects[i] = {'isa': 'PBXBuildFile',
'fileRef': ref}
path = self.sourceRefList[ref]['path'] path = self.sourceRefList[ref]['path']
try: name = '/'.join(path.split('/')[2:])
name = path[path.rindex('/')+1:]
except:
name = path
objects[ref] = {'isa': 'PBXFileReference', objects[ref] = {'isa': 'PBXFileReference',
'lastKnownFileType': self.sourceRefList[ref]['lastKnownFileType'], 'lastKnownFileType': self.sourceRefList[ref]['lastKnownFileType'],
'path': '../' + path, 'path': path,
'name': name, 'name': name,
'fileEncoding': 4,
'sourceTree': '<group>'} 'sourceTree': '<group>'}
return objects return objects
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment