merged 1.3 r1013:1016 into 1.4 and trunk

This commit is contained in:
Nick Bolton 2011-05-21 17:31:27 +00:00
parent fce1e60ab2
commit 7f4138a376
1 changed files with 28 additions and 34 deletions

View File

@ -42,7 +42,8 @@ class InternalCommands:
sln_filename = '%s.sln' % project sln_filename = '%s.sln' % project
xcodeproj_filename = '%s.xcodeproj' % project xcodeproj_filename = '%s.xcodeproj' % project
config_filename = '%s.cfg' % this_cmd configDir = 'build'
configFilename = '%s/%s.cfg' % (configDir, this_cmd)
qtpro_filename = 'qsynergy.pro' qtpro_filename = 'qsynergy.pro'
doxygen_filename = 'doxygen.cfg' doxygen_filename = 'doxygen.cfg'
@ -93,9 +94,6 @@ class InternalCommands:
def getBinDir(self, target=''): def getBinDir(self, target=''):
return self.getGenerator().getBinDir(target) return self.getGenerator().getBinDir(target)
def getConfigDir(self):
return self.config_filename
def sln_filepath(self): def sln_filepath(self):
return '%s\%s' % (self.getBuildDir(), self.sln_filename) return '%s\%s' % (self.getBuildDir(), self.sln_filename)
@ -278,39 +276,34 @@ class InternalCommands:
generator = self.getGeneratorFromConfig().cmakeName generator = self.getGeneratorFromConfig().cmakeName
if generator.startswith('Visual Studio'): if generator.find('Unix Makefiles') != -1:
self.ensureConfHasRun('all', skipConfig)
for target in targets:
self.run_vcbuild(generator, target)
else:
for target in targets: for target in targets:
self.ensureConfHasRun(target, skipConfig) self.ensureConfHasRun(target, skipConfig)
self.runBuildCommand(self.make_cmd, target)
cmd = '' else:
if generator.find("Unix Makefiles") != -1: self.ensureConfHasRun('all', skipConfig)
print 'Building with GNU Make...' for target in targets:
cmd = self.make_cmd if generator.startswith('Visual Studio'):
self.run_vcbuild(generator, target)
elif generator == 'Xcode': elif generator == 'Xcode':
print 'Building with Xcode...'
cmd = self.xcodebuild_cmd + ' -configuration ' + target.capitalize() cmd = self.xcodebuild_cmd + ' -configuration ' + target.capitalize()
self.runBuildCommand(cmd, target)
else: else:
raise Exception('Build command not supported with generator: ' + generator) raise Exception('Build command not supported with generator: ' + generator)
self.try_chdir(self.getBuildDir(target))
err = os.system(cmd)
self.restore_chdir()
if err != 0:
raise Exception(cmd + ' failed: ' + str(err))
# allow user to skip qui compile # allow user to skip qui compile
if self.enable_make_gui: if self.enable_make_gui:
self.make_gui(targets) self.make_gui(targets)
def runBuildCommand(self, cmd, target):
self.try_chdir(self.getBuildDir(target))
err = os.system(cmd)
self.restore_chdir()
if err != 0:
raise Exception(cmd + ' failed: ' + str(err))
def clean(self, targets=[]): def clean(self, targets=[]):
# if no mode specified, use default # if no mode specified, use default
@ -741,7 +734,6 @@ class InternalCommands:
'For help, run: %s help') % (self.website_url, self.this_cmd) 'For help, run: %s help') % (self.website_url, self.this_cmd)
def try_chdir(self, dir): def try_chdir(self, dir):
global prevdir global prevdir
if dir == '': if dir == '':
@ -800,9 +792,9 @@ class InternalCommands:
# running setup # running setup
generator = self.get_generator_from_prompt() generator = self.get_generator_from_prompt()
if os.path.exists(self.getConfigDir()): if os.path.exists(self.configFilename):
config = ConfigParser.ConfigParser() config = ConfigParser.ConfigParser()
config.read(self.getConfigDir()) config.read(self.configFilename)
else: else:
config = ConfigParser.ConfigParser() config = ConfigParser.ConfigParser()
@ -827,7 +819,9 @@ class InternalCommands:
print "Setup complete." print "Setup complete."
def write_config(self, config, target=''): def write_config(self, config, target=''):
configfile = open(self.getConfigDir(), 'wb') if not os.path.isdir(self.configDir):
os.mkdir(self.configDir)
configfile = open(self.configFilename, 'wb')
config.write(configfile) config.write(configfile)
def getGeneratorFromConfig(self): def getGeneratorFromConfig(self):
@ -839,7 +833,7 @@ class InternalCommands:
def findGeneratorFromConfig(self): def findGeneratorFromConfig(self):
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser()
config.read(self.getConfigDir()) config.read(self.configFilename)
if not config.has_section('cmake'): if not config.has_section('cmake'):
return None return None
@ -856,9 +850,9 @@ class InternalCommands:
return None return None
def min_setup_version(self, version): def min_setup_version(self, version):
if os.path.exists(self.getConfigDir()): if os.path.exists(self.configFilename):
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser()
config.read(self.getConfigDir()) config.read(self.configFilename)
try: try:
return config.getint('hm', 'setup_version') >= version return config.getint('hm', 'setup_version') >= version
@ -870,7 +864,7 @@ class InternalCommands:
def hasConfRun(self, target): def hasConfRun(self, target):
if self.min_setup_version(2): if self.min_setup_version(2):
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser()
config.read(self.getConfigDir()) config.read(self.configFilename)
try: try:
return config.getboolean('hm', 'conf_done_' + target) return config.getboolean('hm', 'conf_done_' + target)
except: except:
@ -881,7 +875,7 @@ class InternalCommands:
def setConfRun(self, target, hasRun=True): def setConfRun(self, target, hasRun=True):
if self.min_setup_version(3): if self.min_setup_version(3):
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser()
config.read(self.getConfigDir()) config.read(self.configFilename)
config.set('hm', 'conf_done_' + target, hasRun) config.set('hm', 'conf_done_' + target, hasRun)
self.write_config(config) self.write_config(config)
else: else: