Merge pull request #26220 from 78andyp/blurayfixes
[xbmc.git] / lib / libUPnP / Platinum / Build / Tools / Scripts / XCodeMake.py
blob15bce598e10e93ac98541cc0c58c4d89c66dfb1a
1 #! /usr/bin/env python
2 """
4 XCode Build Script
6 $Id: XCodeMake.py 655 2010-09-29 22:40:22Z soothe $
8 """
10 import os
11 import sys
12 import getopt
13 import subprocess
16 # ------------------------------------------------------------
17 # usage
18 # ------------------------------------------------------------
19 def usage(errMsg):
20 try:
21 print 'Error: %s' % (errMsg)
22 except NameError:
23 pass
25 print 'Usage: '
26 print ' %s -p <path to project> -b [Release|Debug|etc.] -t [All|Platinum|PlatinumFramework|etc.] -s [macosx|iphoneos]' % (sys.argv[0])
27 print ''
28 print ' REQUIRED OPTIONS'
29 print '\t-p <project>'
30 print '\t-b <configuration>'
31 print '\t-t <target>'
32 print '\t-s <sdk>'
33 print ''
34 print ' BUILD OPTIONS'
35 print '\t-c\tMake clean'
38 # ------------------------------------------------------------
39 # main
40 # ------------------------------------------------------------
41 try:
42 opts, args = getopt.getopt(sys.argv[1:], "p:b:t:s:c")
43 except getopt.GetoptError, (msg, opt):
44 # print 'Error: invalid argument, %s: %s' % (opt, msg)
45 usage('invalid argument, %s: %s' % (opt, msg))
46 sys.exit(2)
48 # Build options
49 doingBuild = False
50 rebuildAll = False
51 makeClean = False
53 for opt, arg in opts:
54 if opt == '-p':
55 projectFile = arg
56 doingBuild = True
57 elif opt == '-b':
58 buildName = arg
59 doingBuild = True
60 elif opt == '-t':
61 targetName = arg
62 elif opt == '-s':
63 sdk = arg
64 elif opt == '-c':
65 makeClean = True
67 try:
68 buildSwitch = 'build'
69 if makeClean: buildSwitch = 'clean'
71 cmd_list = ['xcodebuild', '-project', '%s' % projectFile, '-target', '%s' % targetName, '-sdk', '%s' % sdk, '-configuration', '%s' % buildName, '%s' % buildSwitch]
72 cmd = " ".join(cmd_list)
73 print 'Executing:'
74 print cmd
75 retVal = subprocess.call(cmd_list)
76 # only the least sig 8 bits are the real return value
77 if retVal != 0:
78 print cmd
79 print '** BUILD FAILURE **'
80 sys.exit(retVal)
81 except NameError, (name):
82 usage('missing argument %s' % (name))
83 sys.exit(2)