Commits

Alexey Petruchik committed f11a45f

name xcode targets after buildtargets

Comments (0)

Files changed (1)

src/engine/SCons/Tool/xcode.py

     def __init__(self, context, description, project_name, buildSettings):
         XcodeNode.__init__(self, context, description)
 
-        self.targets = [PBXLegacyTarget(context, project_name, buildSettings)]
-        if context.generate_codenav_targets:
-            self.targets.append(PBXNativeTarget(context, project_name + '-codenav', buildSettings))
-
+        self.targets = []
         self.buildConfigurationList = XCConfigurationList(context, 'Build configuration list for PBXProject "%s.xcodeproj"' % project_name, buildSettings)
         self.compatibilityVersion = '"Xcode 3.2"'
         self.projectDirPath = '""';
 
 def XcodeProjectAction(target, source, env):
     project_filename = str(target[0].srcnode())
-    project_name = os.path.basename(project_filename).split('.')[0]
 
     print 'Generating Xcode project \"%s\"' % project_filename
 
 
         return result
 
+    project_name = os.path.basename(project_filename).split('.')[0]
+
     configuration = get_param(env, 'configuration', 'Default')
-    buildtarget = get_param(env, 'buildtarget', '')
+    buildtarget = get_param(env, 'buildtarget', project_name)
     runfile = get_param(env, 'runfile', '')
 
     # Validation
     print 'runfile:', runfile
 
     # Create project
-    project = PBXProject(context, 'Project object', project_name,configurationBuildSettings)# buildSettings)
+    project = PBXProject(context, 'Project object', project_name, configurationBuildSettings)
+
+    # Add targets to project
+    project.targets.append(PBXLegacyTarget(context, buildtarget[0], configurationBuildSettings))
+    if context.generate_codenav_targets:
+        project.targets.append(PBXNativeTarget(context, buildtarget[0] + '-codenav', configurationBuildSettings))
+
+    # Add all source files to project's source group
     sourcesGroup = project.mainGroup.subgroup_by_name(project_name)
     
-    # Add all source files to project's source group
     files = env['srcs'] = env['srcs'] + env.get('incs', [])
     cp = os.path.commonprefix(files)
     for i in files: