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

gbuild-to-ide xcode, added targets in menu

First step in removing make as builder.

Change-Id: I445627df5610a7d0b8bfbabddb66f1273e021b1a
üst 78c48c99
...@@ -437,11 +437,18 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -437,11 +437,18 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
def __init__(self, gbuildparser, ide): def __init__(self, gbuildparser, ide):
IdeIntegrationGenerator.__init__(self, gbuildparser, ide) IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
counter = 16777216 typeCounter = {'PBXProject' : 000000,
'PBXGroup' : 100000,
'PBXFileReference' : 200000,
'PBXNativeTarget' : 300000,
'XCConfigurationList' : 400000,
'PBXSourcesBuildPhase' : 500000,
'XCBuildConfiguration' : 600000,
'PBXBuildFile' : 700000}
def emit(self): def emit(self):
rootId = 'X0000001' mainGroupId, mainGroup = self.generate_PBXGroup(None)
mainGroupId = 'X0000002' rootId = self.generate_id('PBXProject')
self.rootObj = {'attributes': {'LastUpgradeCheck': '0820', self.rootObj = {'attributes': {'LastUpgradeCheck': '0820',
'ORGANIZATIONNAME': 'LibreOffice', 'ORGANIZATIONNAME': 'LibreOffice',
'TargetAttributes': {}}, 'TargetAttributes': {}},
...@@ -455,7 +462,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -455,7 +462,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'projectRoot': '', 'projectRoot': '',
'buildConfigurationList': '', 'buildConfigurationList': '',
'targets': []} 'targets': []}
mainGroup = {'isa': 'PBXGroup', 'children': [], 'sourceTree': '<group>'}
pbxproj = {'archiveVersion': 1, pbxproj = {'archiveVersion': 1,
'classes': {}, 'classes': {},
'objectVersion': 46, 'objectVersion': 46,
...@@ -465,27 +471,28 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -465,27 +471,28 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
for module in self.gbuildparser.modules: for module in self.gbuildparser.modules:
if module == 'include': if module == 'include':
continue continue
sourceId, sourceObj = self.define_pbxgroup('Sources') moduleId, moduleObj = self.generate_PBXGroup(module)
includeId, includeObj = self.define_pbxgroup('Headers') sourceId, sourceObj = self.generate_PBXGroup('Sources')
moduleId, moduleObj = self.define_pbxgroup(module) includeId, includeObj = self.generate_PBXGroup('Headers')
targetId, targetObj = self.generate_PBXGroup('Targets')
moduleObj['children'] = [sourceId, includeId] moduleObj['children'] = [sourceId, includeId, targetId]
pbxproj['objects'].update({sourceId: sourceObj, pbxproj['objects'].update({sourceId: sourceObj,
includeId: includeObj, includeId: includeObj,
moduleId: moduleObj}) moduleId: moduleObj,
targetId: targetObj})
mainGroup['children'].append(moduleId) mainGroup['children'].append(moduleId)
for i in self.gbuildparser.modules[module]['headers']: for i in self.gbuildparser.modules[module]['headers']:
ref = self.generate_id() ref = self.generate_id('PBXFileReference')
pbxproj['objects'][ref] = self.generate_PBXFileReference(module, i) pbxproj['objects'][ref] = self.generate_PBXFileReference(module, i)
includeObj['children'].append(ref) includeObj['children'].append(ref)
for i in self.gbuildparser.modules[module]['sources']: for i in self.gbuildparser.modules[module]['sources']:
ref = self.generate_id() ref = self.generate_id('PBXFileReference')
pbxproj['objects'][ref] = self.generate_PBXFileReference(module, i) pbxproj['objects'][ref] = self.generate_PBXFileReference(module, i)
sourceObj['children'].append(ref) sourceObj['children'].append(ref)
for target in self.gbuildparser.modules[module]['targets']: for target in self.gbuildparser.modules[module]['targets']:
pbxproj['objects'].update(self.generate_project(target, module, sourceObj['children'])) pbxproj['objects'].update(self.generate_target(target, module, targetObj, sourceObj['children']))
xcodeprojdir = './osx/libreoffice.xcodeproj' xcodeprojdir = './osx/libreoffice.xcodeproj'
try: try:
...@@ -496,13 +503,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -496,13 +503,6 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
f.write('// !$*UTF8*$!\n') f.write('// !$*UTF8*$!\n')
self.write_object(pbxproj, f, 0) self.write_object(pbxproj, f, 0)
def define_pbxgroup(self, name):
return self.generate_id(), {'isa': 'PBXGroup', 'children': [], 'name': name, 'sourceTree': '<group>'}
def generate_id(self):
XcodeIntegrationGenerator.counter += 1
return str('X%07x' % XcodeIntegrationGenerator.counter)
def indent(self, file, level): def indent(self, file, level):
if level != 0: if level != 0:
for i in range(0, level): for i in range(0, level):
...@@ -535,7 +535,34 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -535,7 +535,34 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
file.write(',') file.write(',')
file.write(')') file.write(')')
def generate_target(self, modulename): def generate_id(self, id):
self.typeCounter[id] += 1
return str('X%06d' % self.typeCounter[id])
def generate_target(self, target, module, targetObj, sourceObj):
targetId = self.generate_id('PBXNativeTarget')
configurationListId = self.generate_id('XCConfigurationList')
configurationDebugId = self.generate_id('XCBuildConfiguration')
fileId = self.generate_id('XCBuildConfiguration')
objects = {targetId: self.generate_PBXLegacyTarget(target, configurationListId),
configurationListId: self.generate_XCBuildConfiguration(target, configurationDebugId),
configurationDebugId: self.generate_XCBuildConfiguration(target, configurationDebugId, debug=True),
fileId : self.generate_PBXFileReference(module, target['LINKTARGET'], explicit=target['build_type'])
}
self.rootObj['attributes']['TargetAttributes'].update({
targetId: {'CreatedOnToolsVersion': '8.2', 'ProvisioningStyle': 'Automatic'}})
self.rootObj['buildConfigurationList'] = configurationListId
self.rootObj['targets'].append(targetId)
targetObj['children'].append(fileId)
return objects
def generate_PBXGroup(self, name):
obj = {'isa': 'PBXGroup', 'children': [], 'sourceTree': '<group>'}
if not name is None:
obj['name'] = name
return self.generate_id('PBXGroup'), obj
def generate_PBXLegacyTarget(self, modulename, configurationListId):
if modulename['build_type'] == 'Library': if modulename['build_type'] == 'Library':
product = 'com.apple.product-type.library.dynamic' product = 'com.apple.product-type.library.dynamic'
elif modulename['build_type'] == 'Executable': elif modulename['build_type'] == 'Executable':
...@@ -545,8 +572,8 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -545,8 +572,8 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
else: else:
product = 'com.apple.product-type.something' product = 'com.apple.product-type.something'
result = {'isa': 'PBXLegacyTarget', return {'isa': 'PBXLegacyTarget',
'buildConfigurationList': self.configurationListId, 'buildConfigurationList': configurationListId,
'buildArgumentsString': modulename['target_name'], 'buildArgumentsString': modulename['target_name'],
'buildPhases': [], 'buildPhases': [],
'dependencies': [], 'dependencies': [],
...@@ -555,88 +582,74 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator): ...@@ -555,88 +582,74 @@ class XcodeIntegrationGenerator(IdeIntegrationGenerator):
'name': modulename['target_name'], 'name': modulename['target_name'],
'productName': modulename['name'], 'productName': modulename['name'],
'passBuildSettingsEnvironment': 1} 'passBuildSettingsEnvironment': 1}
return result
def generate_configuration_debug(self, modulename):
result = {'isa': 'XCBuildConfiguration',
'buildSettings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'CLANG_ANALYZER_NONNULL': 'YES',
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',
'CLANG_CXX_LIBRARY': 'libc++',
'CLANG_ENABLE_MODULES': 'YES',
'CLANG_ENABLE_OBJC_ARC': 'YES',
'CLANG_WARN_BOOL_CONVERSION': 'YES',
'CLANG_WARN_CONSTANT_CONVERSION': 'YES',
'CLANG_WARN_DIRECT_OBJC_ISA_USAGE': 'YES_ERROR',
'CLANG_WARN_DOCUMENTATION_COMMENTS': 'YES',
'CLANG_WARN_EMPTY_BODY': 'YES',
'CLANG_WARN_ENUM_CONVERSION': 'YES',
'CLANG_WARN_INFINITE_RECURSION': 'YES',
'CLANG_WARN_INT_CONVERSION': 'YES',
'CLANG_WARN_OBJC_ROOT_CLASS': 'YES_ERROR',
'CLANG_WARN_SUSPICIOUS_MOVE': 'YES',
'CLANG_WARN_UNREACHABLE_CODE': 'YES',
'CLANG_WARN__DUPLICATE_METHOD_MATCH': 'YES',
'CODE_SIGN_IDENTITY': '-',
'COPY_PHASE_STRIP': 'NO',
'DEBUG_INFORMATION_FORMAT': 'dwarf',
'ENABLE_STRICT_OBJC_MSGSEND': 'YES',
'ENABLE_TESTABILITY': 'YES',
'GCC_C_LANGUAGE_STANDARD': 'gnu99',
'GCC_DYNAMIC_NO_PIC': 'NO',
'GCC_NO_COMMON_BLOCKS': 'YES',
'GCC_OPTIMIZATION_LEVEL': 0,
'GCC_PREPROCESSOR_DEFINITIONS': [
'DEBUG=1',
'$(inherited)'],
'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
'GCC_WARN_ABOUT_RETURN_TYPE': 'YES_ERROR',
'GCC_WARN_UNDECLARED_SELECTOR': 'YES',
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE',
'GCC_WARN_UNUSED_FUNCTION': 'YES',
'GCC_WARN_UNUSED_VARIABLE': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.12',
'MTL_ENABLE_DEBUG_INFO': 'YES',
'ONLY_ACTIVE_ARCH': 'YES',
'PRODUCT_NAME': '$(TARGET_NAME)',
'SDKROOT': 'macosx',
'HEADER_SEARCH_PATHS': modulename['include']},
'name': 'Debug'}
return result
def generate_configuration_list(self, modulename): def generate_XCBuildConfiguration(self, modulename, configurationDebugId, debug=False):
result = {'isa': 'XCConfigurationList', if debug:
'buildConfigurations': [self.configurationDebugId], result = {'isa': 'XCBuildConfiguration',
'defaultConfigurationIsVisible': 0, 'buildSettings': {
'defaultConfigurationName': 'Debug'} 'ALWAYS_SEARCH_USER_PATHS': 'NO',
'CLANG_ANALYZER_NONNULL': 'YES',
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',
'CLANG_CXX_LIBRARY': 'libc++',
'CLANG_ENABLE_MODULES': 'YES',
'CLANG_ENABLE_OBJC_ARC': 'YES',
'CLANG_WARN_BOOL_CONVERSION': 'YES',
'CLANG_WARN_CONSTANT_CONVERSION': 'YES',
'CLANG_WARN_DIRECT_OBJC_ISA_USAGE': 'YES_ERROR',
'CLANG_WARN_DOCUMENTATION_COMMENTS': 'YES',
'CLANG_WARN_EMPTY_BODY': 'YES',
'CLANG_WARN_ENUM_CONVERSION': 'YES',
'CLANG_WARN_INFINITE_RECURSION': 'YES',
'CLANG_WARN_INT_CONVERSION': 'YES',
'CLANG_WARN_OBJC_ROOT_CLASS': 'YES_ERROR',
'CLANG_WARN_SUSPICIOUS_MOVE': 'YES',
'CLANG_WARN_UNREACHABLE_CODE': 'YES',
'CLANG_WARN__DUPLICATE_METHOD_MATCH': 'YES',
'CODE_SIGN_IDENTITY': '-',
'COPY_PHASE_STRIP': 'NO',
'DEBUG_INFORMATION_FORMAT': 'dwarf',
'ENABLE_STRICT_OBJC_MSGSEND': 'YES',
'ENABLE_TESTABILITY': 'YES',
'GCC_C_LANGUAGE_STANDARD': 'gnu99',
'GCC_DYNAMIC_NO_PIC': 'NO',
'GCC_NO_COMMON_BLOCKS': 'YES',
'GCC_OPTIMIZATION_LEVEL': 0,
'GCC_PREPROCESSOR_DEFINITIONS': ['DEBUG=1', '$(inherited)'],
'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
'GCC_WARN_ABOUT_RETURN_TYPE': 'YES_ERROR',
'GCC_WARN_UNDECLARED_SELECTOR': 'YES',
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE',
'GCC_WARN_UNUSED_FUNCTION': 'YES',
'GCC_WARN_UNUSED_VARIABLE': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.12',
'MTL_ENABLE_DEBUG_INFO': 'YES',
'ONLY_ACTIVE_ARCH': 'YES',
'PRODUCT_NAME': '$(TARGET_NAME)',
'SDKROOT': 'macosx',
'HEADER_SEARCH_PATHS': modulename['include']},
'name': 'Debug'}
else:
result = {'isa': 'XCConfigurationList',
'buildConfigurations': [configurationDebugId],
'defaultConfigurationIsVisible': 0,
'defaultConfigurationName': 'Debug'}
return result return result
def generate_PBXFileReference(self, module, filepath, explicit=None):
def generate_PBXFileReference(self, module, filepath): obj = {'isa': 'PBXFileReference',
return {'isa': 'PBXFileReference',
'path': module + '/' + filepath, 'path': module + '/' + filepath,
'name': filepath, 'name': filepath,
'fileEncoding': 4, 'fileEncoding': 4,
'sourceTree': '<group>'} 'sourceTree': '<group>'}
if not explicit is None:
if explicit == 'Library':
def generate_project(self, target, module, sourceObj): obj['explicitFileType'] = 'compiled.mach-o.dylib'
self.targetId = self.generate_id() else:
self.configurationListId = self.generate_id() obj['explicitFileType'] = 'compiled.executable'
self.configurationDebugId = self.generate_id() obj['path'] = filepath
self.productReferenceId = self.generate_id() else:
self.productGroupId = self.generate_id() obj['path'] = module + '/' + filepath
self.rootObj['attributes']['TargetAttributes'].update({ return obj
self.targetId: {'CreatedOnToolsVersion': '8.2',
'ProvisioningStyle': 'Automatic'}})
self.rootObj['buildConfigurationList'] = self.configurationListId
self.rootObj['targets'].append(self.targetId)
objects = {self.targetId: self.generate_target(target),
self.configurationListId: self.generate_configuration_list(target),
self.configurationDebugId: self.generate_configuration_debug(target)
}
return objects
......
//
// janTestLib.h
// janTestLib
//
// Created by Jan Iversen on 29/01/2017.
// Copyright © 2017 Jan Iversen. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface janTestLib : NSObject
@end
//
// janTestLib.m
// janTestLib
//
// Created by Jan Iversen on 29/01/2017.
// Copyright © 2017 Jan Iversen. All rights reserved.
//
#import "janTestLib.h"
@implementation janTestLib
@end
//
// main.cpp
// jantest
//
// Created by Jan Iversen on 29/01/2017.
// Copyright © 2017 Jan Iversen. All rights reserved.
//
#include <iostream>
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
//
// main.cpp
// jantest
//
// Created by Jan Iversen on 29/01/2017.
// Copyright © 2017 Jan Iversen. All rights reserved.
//
#include <iostream>
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
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