Merge 1.4.2 r630:639 into trunk

This commit is contained in:
Nick Bolton 2010-06-20 02:30:45 +00:00
parent 774e8fa112
commit 9a0a7d42bd
4 changed files with 115 additions and 30 deletions

View File

@ -5,22 +5,25 @@ import sys, os, ConfigParser, subprocess, shutil, re
class InternalCommands: class InternalCommands:
project = 'synergy-plus' project = 'synergy-plus'
setup_version = 3 setup_version = 4 # increment to force setup/config
website_url = 'http://code.google.com/p/synergy-plus' website_url = 'http://code.google.com/p/synergy-plus'
this_cmd = 'hm' this_cmd = 'hm'
cmake_cmd = 'cmake' cmake_cmd = 'cmake'
qmake_cmd = 'qmake'
make_cmd = 'make' make_cmd = 'make'
xcodebuild_cmd = 'xcodebuild' xcodebuild_cmd = 'xcodebuild'
w32_make_cmd = 'mingw32-make'
source_dir = '..' # Source, relative to build. source_dir = '..' # Source, relative to build.
cmake_dir = 'cmake' cmake_dir = 'cmake'
bin_dir = 'bin' bin_dir = 'bin'
gui_dir = 'gui'
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 config_filename = '%s.cfg' % this_cmd
qtpro_filename = 'qsynergy.pro'
# try_chdir(...) and restore_chdir() will use this # try_chdir(...) and restore_chdir() will use this
prevdir = '' prevdir = ''
@ -31,6 +34,9 @@ class InternalCommands:
# by default, prompt user for input # by default, prompt user for input
no_prompts = False no_prompts = False
# by default, don't compile the gui
enable_make_gui = False
win32_generators = { win32_generators = {
'1' : 'Visual Studio 10', '1' : 'Visual Studio 10',
'2' : 'Visual Studio 10 Win64', '2' : 'Visual Studio 10 Win64',
@ -138,6 +144,20 @@ class InternalCommands:
if err != 0: if err != 0:
raise Exception('CMake encountered error: ' + str(err)) raise Exception('CMake encountered error: ' + str(err))
# allow user to skip qui compile
if self.enable_make_gui:
qmake_cmd_string = self.qmake_cmd + ' ' + self.qtpro_filename
print "Configuring with QMake (%s)..." % qmake_cmd_string
# run qmake from the gui dir
self.try_chdir(self.gui_dir)
err = os.system(qmake_cmd_string)
self.restore_chdir()
if err != 0:
raise Exception('QMake encountered error: ' + str(err))
self.set_conf_run() self.set_conf_run()
def persist_cmake(self): def persist_cmake(self):
@ -189,7 +209,11 @@ class InternalCommands:
else: else:
return self.cmake_cmd return self.cmake_cmd
def build(self, mode = None): def build(self, targets=[]):
# if no mode specified, default to debug
if len(targets) == 0:
targets += ['debug',]
self.ensure_setup_latest() self.ensure_setup_latest()
@ -210,7 +234,8 @@ class InternalCommands:
elif generator.startswith('Visual Studio'): elif generator.startswith('Visual Studio'):
self.run_vcbuild(generator, mode) for target in targets:
self.run_vcbuild(generator, target)
elif generator == 'Xcode': elif generator == 'Xcode':
@ -220,12 +245,20 @@ class InternalCommands:
self.restore_chdir() self.restore_chdir()
if err != 0: if err != 0:
raise Exception('Xcode failed:', err) raise Exception('Xcode failed: ' + str(err))
else: else:
raise Exception('Not supported with generator: ' + generator) raise Exception('Not supported with generator: ' + generator)
def clean(self, mode = None): # allow user to skip qui compile
if self.enable_make_gui:
self.make_gui(targets)
def clean(self, targets=[]):
# if no mode specified, default to debug
if len(targets) == 0:
targets += ['debug',]
generator = self.get_generator_from_config() generator = self.get_generator_from_config()
@ -242,12 +275,14 @@ class InternalCommands:
# special case for version 10, use new /target:clean # special case for version 10, use new /target:clean
elif generator.startswith('Visual Studio 10'): elif generator.startswith('Visual Studio 10'):
self.run_vcbuild(generator, mode, '/target:clean') for target in targets:
self.run_vcbuild(generator, target, '/target:clean')
# any other version of visual studio, use /clean # any other version of visual studio, use /clean
elif generator.startswith('Visual Studio'): elif generator.startswith('Visual Studio'):
self.run_vcbuild(generator, mode, '/clean') for target in targets:
self.run_vcbuild(generator, target, '/clean')
elif generator == 'Xcode': elif generator == 'Xcode':
@ -257,11 +292,51 @@ class InternalCommands:
self.restore_chdir() self.restore_chdir()
if err != 0: if err != 0:
raise Exception('Xcode failed:', err) raise Exception('Xcode failed: ' + str(err))
else: else:
raise Exception('Not supported with generator: ' + generator) raise Exception('Not supported with generator: ' + generator)
# allow user to skip qui compile
clean_targets = []
if self.enable_make_gui:
for target in targets:
clean_targets.append(target + '-clean')
self.make_gui(clean_targets)
def make_gui(self, targets):
if sys.platform == 'win32':
gui_make_cmd = self.w32_make_cmd
elif sys.platform in ['linux2', 'sunos5', 'freebsd7']:
gui_make_cmd = self.make_cmd
elif sys.platform == 'darwin':
gui_make_cmd = self.xcodebuild_cmd
else:
raise Exception('Unsupported platform: ' + sys.platform)
print 'Running %s...' % gui_make_cmd
# HACK: don't know how to build in either debug or release on unix;
# always builds release!
if sys.platform == 'win32':
for target in targets:
self.try_chdir(self.gui_dir)
err = os.system(gui_make_cmd + ' ' + target)
self.restore_chdir()
if err != 0:
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
else:
if sys.platform == 'darwin':
make_dir = self.gui_dir + '/QSynergy.xcodeproj'
else:
make_dir = self.gui_dir
self.try_chdir(make_dir)
err = os.system(gui_make_cmd)
self.restore_chdir()
def open(self): def open(self):
generator = self.get_generator_from_config() generator = self.get_generator_from_config()
if generator.startswith('Visual Studio'): if generator.startswith('Visual Studio'):
@ -627,6 +702,7 @@ class InternalCommands:
# commands class. # commands class.
class CommandHandler: class CommandHandler:
ic = InternalCommands() ic = InternalCommands()
build_targets = []
def __init__(self, argv, opts, args): def __init__(self, argv, opts, args):
@ -638,15 +714,12 @@ class CommandHandler:
self.ic.no_prompts = True self.ic.no_prompts = True
elif o in ('-g', '--generator'): elif o in ('-g', '--generator'):
self.ic.generator_id = a self.ic.generator_id = a
elif o == '--make-gui':
def get_build_mode(self): self.ic.enable_make_gui = True
mode = None elif o in ('-d', '--debug'):
for o, a in self.opts: self.build_targets += ['debug',]
if o in ('-d', '--debug'):
mode = 'debug'
elif o in ('-r', '--release'): elif o in ('-r', '--release'):
mode = 'release' self.build_targets += ['release',]
return mode
def about(self): def about(self):
self.ic.about() self.ic.about()
@ -658,10 +731,10 @@ class CommandHandler:
self.ic.configure() self.ic.configure()
def build(self): def build(self):
self.ic.build(self.get_build_mode()) self.ic.build(self.build_targets)
def clean(self): def clean(self):
self.ic.clean(self.get_build_mode()) self.ic.clean(self.build_targets)
def update(self): def update(self):
self.ic.update() self.ic.update()

View File

@ -20,13 +20,21 @@ INSTALL(
IF(WIN32) IF(WIN32)
INSTALL( INSTALL(
FILES FILES
bin/Release/QtNetwork4.dll
bin/Release/QtGui4.dll
bin/Release/QtCore4.dll
bin/Release/qsynergy.exe bin/Release/qsynergy.exe
bin/Release/mingwm10.dll
bin/Release/libgcc_s_dw2-1.dll
DESTINATION bin) DESTINATION bin)
ELSE(WIN32)
IF(APPLE)
# TODO: how the hell do we distribute mac apps?
#INSTALL(
# MACOSX_BUNDLE
# bin/QSynergy.app
# DESTINATION bin)
ELSE(APPLE)
INSTALL(
FILES
bin/qsynergy
DESTINATION bin)
ENDIF(APPLE)
ENDIF(WIN32) ENDIF(WIN32)
# The default CPack behaviour is not to append the system processor # The default CPack behaviour is not to append the system processor

View File

@ -79,5 +79,9 @@ release {
MOC_DIR = tmp/release MOC_DIR = tmp/release
RCC_DIR = tmp/release RCC_DIR = tmp/release
} }
win32 {
Debug:DESTDIR = ../bin/Debug Debug:DESTDIR = ../bin/Debug
Release:DESTDIR = ../bin/Release Release:DESTDIR = ../bin/Release
} else {
DESTDIR = ../bin
}

2
hm.py
View File

@ -20,7 +20,7 @@ from getopt import getopt
# options used by all commands # options used by all commands
global_options = 'g:v' global_options = 'g:v'
global_options_long = ['no-prompts', 'generator=', 'verbose'] global_options_long = ['no-prompts', 'generator=', 'verbose', 'make-gui']
# options used by build related commands # options used by build related commands
build_options = 'dr' build_options = 'dr'