From bf361d153bf1074953646dbb759639264beec227 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Fri, 14 Feb 2014 16:21:02 +0000 Subject: [PATCH] support for qt 5.2 --- doc/QtCodeStyle.xml | 234 +++++++++++++++++++ hm.py | 6 +- src/gui/gui.pro | 3 +- src/gui/src/AboutDialog.cpp | 2 +- src/gui/src/IpcClient.cpp | 3 - src/gui/src/IpcClient.h | 2 +- src/gui/src/KeySequenceWidget.cpp | 1 + src/gui/src/KeySequenceWidget.h | 2 +- src/gui/src/MainWindow.cpp | 24 +- src/gui/src/MainWindow.h | 2 +- src/gui/src/ScreenSettingsDialog.cpp | 1 + src/gui/src/SettingsDialog.cpp | 2 + src/gui/src/SetupWizard.cpp | 4 +- src/gui/src/SynergyLocale.cpp | 2 +- src/gui/src/main.cpp | 5 +- tools/build/generators.py | 10 +- tools/build/toolchain.py | 326 ++++++++++++++++----------- 17 files changed, 471 insertions(+), 158 deletions(-) create mode 100644 doc/QtCodeStyle.xml diff --git a/doc/QtCodeStyle.xml b/doc/QtCodeStyle.xml new file mode 100644 index 00000000..b07d20da --- /dev/null +++ b/doc/QtCodeStyle.xml @@ -0,0 +1,234 @@ + + + + + + CodeStyleData + + false + false + true + false + false + false + true + false + true + false + false + false + true + true + false + true + false + false + false + 4 + true + false + 2 + false + 4 + + + + DisplayName + Synergy + + + + + + + + CodeStyleData + + false + false + true + false + false + false + true + false + true + false + false + false + true + true + false + true + false + false + false + 4 + true + false + 2 + false + 4 + + + + DisplayName + Synergy + + + + + + + + CodeStyleData + + false + false + true + false + false + false + true + false + true + false + false + false + true + true + false + true + false + false + false + 4 + true + false + 2 + false + 4 + + + + DisplayName + Synergy + + + + + + + + CodeStyleData + + false + false + true + false + false + false + true + false + true + false + false + false + true + true + false + true + false + false + false + 4 + true + false + 2 + false + 4 + + + + DisplayName + Synergy + + + + + + + + CodeStyleData + + false + false + true + false + false + false + true + false + true + false + false + false + true + true + false + true + false + false + false + 4 + true + false + 2 + false + 4 + + + + DisplayName + Synergy + + + + + + + + CodeStyleData + + false + false + true + false + false + false + true + false + true + false + false + false + true + true + false + true + false + false + false + 4 + true + false + 2 + false + 4 + + + + DisplayName + Synergy + + diff --git a/hm.py b/hm.py index 98c4031f..e25dda2a 100644 --- a/hm.py +++ b/hm.py @@ -51,14 +51,14 @@ requiredMinor = 6 # options used by all commands globalOptions = 'v' -globalOptionsLong = ['no-prompts', 'generator=', 'verbose', 'make-gui'] +globalOptionsLong = ['no-prompts', 'verbose', 'skip-gui', 'skip-core'] # list of valid commands as keys. the values are optarg strings, but most # are None for now (this is mainly for extensibility) cmd_opt_dict = { 'about' : ['', []], - 'setup' : ['g:', []], - 'configure' : ['g:dr', ['debug', 'release', 'mac-sdk=']], + 'setup' : ['g:', ['generator=']], + 'configure' : ['g:dr', ['generator=', 'debug', 'release', 'mac-sdk=']], 'build' : ['dr', ['debug', 'release']], 'clean' : ['dr', ['debug', 'release']], 'update' : ['', []], diff --git a/src/gui/gui.pro b/src/gui/gui.pro index cedb2f7a..e10bb90b 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -1,4 +1,4 @@ -QT += network +QT += widgets network TEMPLATE = app TARGET = synergy DEPENDPATH += . \ @@ -74,7 +74,6 @@ RESOURCES += res/Synergy.qrc RC_FILE = res/win/Synergy.rc macx { QMAKE_INFO_PLIST = res/mac/Info.plist - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 TARGET = Synergy QSYNERGY_ICON.files = res/mac/Synergy.icns QSYNERGY_ICON.path = Contents/Resources diff --git a/src/gui/src/AboutDialog.cpp b/src/gui/src/AboutDialog.cpp index 4462f522..2d10fe5e 100644 --- a/src/gui/src/AboutDialog.cpp +++ b/src/gui/src/AboutDialog.cpp @@ -31,7 +31,7 @@ AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) : m_versionChecker.setApp(synergyApp); m_pLabelSynergyVersion->setText(m_versionChecker.getVersion()); - // change default size based on os + // change default size based on os #if defined(Q_OS_MAC) QSize size(600, 380); setMaximumSize(size); diff --git a/src/gui/src/IpcClient.cpp b/src/gui/src/IpcClient.cpp index c899e677..c1da9650 100644 --- a/src/gui/src/IpcClient.cpp +++ b/src/gui/src/IpcClient.cpp @@ -42,10 +42,7 @@ IpcClient::~IpcClient() void IpcClient::connected() { - char typeBuf[1]; - typeBuf[0] = kIpcClientGui; sendHello(); - infoMessage("connection established"); } diff --git a/src/gui/src/IpcClient.h b/src/gui/src/IpcClient.h index b417b356..eab982e3 100644 --- a/src/gui/src/IpcClient.h +++ b/src/gui/src/IpcClient.h @@ -29,7 +29,7 @@ class IpcClient : public QObject Q_OBJECT public: - IpcClient(); + IpcClient(); virtual ~IpcClient(); void sendHello(); diff --git a/src/gui/src/KeySequenceWidget.cpp b/src/gui/src/KeySequenceWidget.cpp index ddaf16e1..67723540 100644 --- a/src/gui/src/KeySequenceWidget.cpp +++ b/src/gui/src/KeySequenceWidget.cpp @@ -19,6 +19,7 @@ #include "KeySequenceWidget.h" #include +#include KeySequenceWidget::KeySequenceWidget(QWidget* parent, const KeySequence& seq) : QPushButton(parent), diff --git a/src/gui/src/KeySequenceWidget.h b/src/gui/src/KeySequenceWidget.h index c98e287b..72263c58 100644 --- a/src/gui/src/KeySequenceWidget.h +++ b/src/gui/src/KeySequenceWidget.h @@ -20,7 +20,7 @@ #define KEYSEQUENCEWIDGET__H -#include +#include #include "KeySequence.h" diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index f3520faf..28c357a4 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -30,6 +30,10 @@ #include #include #include +#include +#include +#include +#include #if defined(Q_OS_MAC) #include @@ -97,7 +101,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pElevateCheckBox->hide(); #endif - // change default size based on os + // change default size based on os #if defined(Q_OS_MAC) resize(720, 550); setMinimumSize(size()); @@ -117,7 +121,7 @@ MainWindow::~MainWindow() saveSettings(); } -void MainWindow::start(bool firstRun) +void MainWindow::start() { createTrayIcon(); @@ -226,8 +230,8 @@ void MainWindow::loadSettings() { // the next two must come BEFORE loading groupServerChecked and groupClientChecked or // disabling and/or enabling the right widgets won't automatically work - m_pRadioExternalConfig->setChecked(settings().value("useExternalConfig", false).toBool()); - m_pRadioInternalConfig->setChecked(settings().value("useInternalConfig", true).toBool()); + m_pRadioExternalConfig->setChecked(settings().value("useExternalConfig", false).toBool()); + m_pRadioInternalConfig->setChecked(settings().value("useInternalConfig", true).toBool()); m_pGroupServer->setChecked(settings().value("groupServerChecked", false).toBool()); m_pLineEditConfigFile->setText(settings().value("configFile", QDir::homePath() + "/" + synergyConfigName).toString()); @@ -253,9 +257,9 @@ void MainWindow::saveSettings() { // program settings settings().setValue("groupServerChecked", m_pGroupServer->isChecked()); - settings().setValue("useExternalConfig", m_pRadioExternalConfig->isChecked()); + settings().setValue("useExternalConfig", m_pRadioExternalConfig->isChecked()); settings().setValue("configFile", m_pLineEditConfigFile->text()); - settings().setValue("useInternalConfig", m_pRadioInternalConfig->isChecked()); + settings().setValue("useInternalConfig", m_pRadioInternalConfig->isChecked()); settings().setValue("groupClientChecked", m_pGroupClient->isChecked()); settings().setValue("serverHostname", m_pLineEditHostname->text()); @@ -355,7 +359,7 @@ void MainWindow::updateStateFromLogLine(const QString &line) void MainWindow::clearLog() { - m_pLogOutput->clear(); + m_pLogOutput->clear(); } void MainWindow::startSynergy() @@ -508,7 +512,7 @@ QString MainWindow::configFilename() if (!m_pTempConfigFile->open()) { QMessageBox::critical(this, tr("Cannot write configuration file"), tr("The temporary configuration file required to start synergy can not be written.")); - return false; + return ""; } serverConfig().save(*m_pTempConfigFile); @@ -524,7 +528,7 @@ QString MainWindow::configFilename() tr("You have not filled in a valid configuration file for the synergy server. " "Do you want to browse for the configuration file now?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes || !on_m_pButtonBrowseConfigFile_clicked()) - return false; + return ""; } filename = m_pLineEditConfigFile->text(); @@ -684,7 +688,7 @@ void MainWindow::setVisible(bool visible) m_pActionMinimize->setEnabled(visible); m_pActionRestore->setEnabled(!visible); -#if MAC_OS_X_VERSION_10_7 +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // lion // dock hide only supported on lion :( ProcessSerialNumber psn = { 0, kCurrentProcess }; GetCurrentProcess(&psn); diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 37956bd1..e350ddce 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -88,7 +88,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase QString configFilename(); QString address(); QString appPath(const QString& name); - void start(bool firstRun); + void start(); void clearLog(); VersionChecker& versionChecker() { return m_VersionChecker; } diff --git a/src/gui/src/ScreenSettingsDialog.cpp b/src/gui/src/ScreenSettingsDialog.cpp index 79e45c9f..7ddcb134 100644 --- a/src/gui/src/ScreenSettingsDialog.cpp +++ b/src/gui/src/ScreenSettingsDialog.cpp @@ -21,6 +21,7 @@ #include #include +#include ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp index 9f3de8c0..434dcd74 100644 --- a/src/gui/src/SettingsDialog.cpp +++ b/src/gui/src/SettingsDialog.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index 90deed5d..4c1ea594 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -205,7 +205,7 @@ void SetupWizard::accept() if (m_StartMain) { - m_MainWindow.start(true); + m_MainWindow.start(); } QWizard::accept(); @@ -217,7 +217,7 @@ void SetupWizard::reject() if (m_StartMain) { - m_MainWindow.start(true); + m_MainWindow.start(); } QWizard::reject(); diff --git a/src/gui/src/SynergyLocale.cpp b/src/gui/src/SynergyLocale.cpp index db4e941a..4c794d73 100644 --- a/src/gui/src/SynergyLocale.cpp +++ b/src/gui/src/SynergyLocale.cpp @@ -18,7 +18,7 @@ #include "SynergyLocale.h" #include -#include +#include #include SynergyLocale::SynergyLocale() diff --git a/src/gui/src/main.cpp b/src/gui/src/main.cpp index 8247e8f7..45394623 100644 --- a/src/gui/src/main.cpp +++ b/src/gui/src/main.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #if defined(Q_OS_MAC) #include @@ -93,7 +94,7 @@ int main(int argc, char* argv[]) } else { - mainWindow.start(false); + mainWindow.start(); } return app.exec(); @@ -126,7 +127,7 @@ int waitForTray() #if defined(Q_OS_MAC) bool checkMacAssistiveDevices() { -#if defined(MAC_OS_X_VERSION_10_9) // mavericks +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 // mavericks // new in mavericks, applications are trusted individually // with use of the accessibility api. this call will show a diff --git a/tools/build/generators.py b/tools/build/generators.py index 0c16cd4d..8383370a 100644 --- a/tools/build/generators.py +++ b/tools/build/generators.py @@ -32,7 +32,7 @@ class Generator(object): class MakefilesGenerator(Generator): def __init__(self): - super(MakefilesGenerator, self).__init__('Unix Makefiles', 'build', '..', 'bin') + super(MakefilesGenerator, self).__init__('Unix Makefiles') def getBuildDir(self, target): return super(MakefilesGenerator, self).getBuildDir(target) + '/' + target @@ -48,6 +48,14 @@ class MakefilesGenerator(Generator): def getSourceDir(self): return super(MakefilesGenerator, self).getSourceDir() + '/..' + +class XcodeGenerator(Generator): + def __init__(self): + super(XcodeGenerator, self).__init__('Xcode') + + def getBinDir(self, target=''): + xcodeTarget = target[0].upper() + target[1:] + return super(XcodeGenerator, self).getBinDir(target) + '/' + xcodeTarget class EclipseGenerator(Generator): def __init__(self): diff --git a/tools/build/toolchain.py b/tools/build/toolchain.py index a12d3a5f..ba4e2d0d 100644 --- a/tools/build/toolchain.py +++ b/tools/build/toolchain.py @@ -17,7 +17,7 @@ # TODO: split this file up, it's too long! import sys, os, ConfigParser, shutil, re, ftputil, zipfile -from generators import Generator, EclipseGenerator, MakefilesGenerator +from generators import Generator, EclipseGenerator, XcodeGenerator, MakefilesGenerator if sys.version_info >= (2, 4): import subprocess @@ -60,8 +60,11 @@ class InternalCommands: # by default, prompt user for input no_prompts = False - # by default, don't compile the gui - enable_make_gui = False + # by default, compile the core + enableMakeCore = True + + # by default, compile the gui + enableMakeGui = True # by default, let cmake decide macSdk = None @@ -85,7 +88,7 @@ class InternalCommands: darwin_generators = { 1 : MakefilesGenerator(), - 2 : Generator('Xcode'), + 2 : XcodeGenerator(), 3 : EclipseGenerator(), } @@ -150,16 +153,41 @@ class InternalCommands: zip.extractall(dir) def configure(self, target='', extraArgs=''): - - cmake_args = '' # ensure latest setup and do not ask config for generator (only fall # back to prompt if not specified as arg) self.ensure_setup_latest() + if sys.platform == "darwin": + if self.macSdk: + sdkDir = self.getMacSdkDir() + if not os.path.exists(sdkDir): + raise Exception("Mac SDK not found at: " + sdkDir) + + os.environ["MACOSX_DEPLOYMENT_TARGET"] = self.macSdk + else: + raise Exception("Arg missing: --mac-sdk "); + + # default is release + if target == '': + print 'Defaulting target to: ' + self.defaultTarget + target = self.defaultTarget + + # allow user to skip qui compile + if self.enableMakeCore: + self.configureCore(target, extraArgs) + + # allow user to skip qui compile + if self.enableMakeGui: + self.configureGui(target, extraArgs) + + self.setConfRun(target) + + def configureCore(self, target="", extraArgs=""): + # ensure that we have access to cmake _cmake_cmd = self.persist_cmake() - + # now that we know we've got the latest setup, we can ask the config # file for the generator (but again, we only fall back to this if not # specified as arg). @@ -168,20 +196,16 @@ class InternalCommands: if generator != self.findGeneratorFromConfig(): print('Generator changed, running setup.') self.setup(target) - + + cmake_args = '' if generator.cmakeName != '': cmake_args += ' -G "' + generator.cmakeName + '"' - - # default is release - if target == '': - print 'Defaulting target to: ' + self.defaultTarget - target = self.defaultTarget # for makefiles always specify a build type (debug, release, etc) if generator.cmakeName.find('Unix Makefiles') != -1: cmake_args += ' -DCMAKE_BUILD_TYPE=' + target.capitalize() - - if self.macSdk: + + elif sys.platform == "darwin": path = "/Developer/SDKs/MacOSX" + self.macSdk + ".sdk/" cmake_args += " -DCMAKE_OSX_SYSROOT=" + path cmake_args += " -DCMAKE_OSX_DEPLOYMENT_TARGET=" + self.macSdk @@ -191,9 +215,6 @@ class InternalCommands: config = self.getConfig() config.set('cmake', 'mac_sdk', self.macSdk) self.write_config(config) - elif sys.platform == "darwin": - # seems that this is now needed on 10.8 - raise Exception("Arg missing: --mac-sdk "); # if not visual studio, use parent dir sourceDir = generator.getSourceDir() @@ -219,36 +240,66 @@ class InternalCommands: if err != 0: raise Exception('CMake encountered error: ' + str(err)) + + def configureGui(self, target="", extraArgs=""): + + # make sure we have qmake + self.persist_qmake() - # allow user to skip qui compile - if self.enable_make_gui: - - # make sure we have qmake - self.persist_qmake() - - qmake_cmd_string = self.qmake_cmd + " " + self.qtpro_filename + " -r" + qmake_cmd_string = self.qmake_cmd + " " + self.qtpro_filename + " -r" - if sys.platform == "darwin": - # create makefiles on mac (not xcode). - qmake_cmd_string += " -spec macx-g++" - - (major, minor) = self.getMacVersion() - if major == 10 and minor <= 4: - # 10.4: universal (intel and power pc) - qmake_cmd_string += ' CONFIG+="ppc i386"' - - print "QMake command: " + 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)) + if sys.platform == "darwin": - self.setConfRun(target) + # create makefiles on mac (not xcode). + qmake_cmd_string += " -spec macx-g++" + + (major, minor) = self.getMacVersion() + if major == 10 and minor <= 4: + # 10.4: universal (intel and power pc) + qmake_cmd_string += ' CONFIG+="ppc i386"' + + sdkDir = self.getMacSdkDir() + shortForm = "macosx" + self.macSdk + version = str(major) + "." + str(minor) + + qmake_cmd_string += " QMAKE_MACOSX_DEPLOYMENT_TARGET=" + version + (qMajor, qMinor, qRev) = self.getQmakeVersion() + if qMajor <= 4: + # 4.6: qmake takes full sdk dir. + qmake_cmd_string += " QMAKE_MAC_SDK=" + sdkDir + else: + # 5.2: now we need to use the .path setting. + qmake_cmd_string += " QMAKE_MAC_SDK=" + shortForm + qmake_cmd_string += " QMAKE_MAC_SDK." + shortForm + ".path=" + sdkDir + + print "QMake command: " + 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)) + + def getQmakeVersion(self): + import commands + version = commands.getoutput("qmake --version") + result = re.search('(\d+)\.(\d+)\.(\d)', version) + + if not result: + raise Exception("Could not get qmake version.") + + major = int(result.group(1)) + minor = int(result.group(2)) + rev = int(result.group(3)) + + return (major, minor, rev) + + def getMacSdkDir(self): + return "/Developer/SDKs/MacOSX" + self.macSdk + ".sdk" + # http://tinyurl.com/cs2rxxb def fixCmakeEclipseBug(self): print "Fixing CMake Eclipse bugs..." @@ -334,6 +385,16 @@ class InternalCommands: self.ensure_setup_latest() + # allow user to skip core compile + if self.enableMakeCore: + self.makeCore(targets) + + # allow user to skip qui compile + if self.enableMakeGui: + self.makeGui(targets) + + def makeCore(self, targets): + generator = self.getGeneratorFromConfig().cmakeName config = self.getConfig() @@ -353,10 +414,78 @@ class InternalCommands: self.runBuildCommand(cmd, target) else: raise Exception('Build command not supported with generator: ' + generator) + + def makeGui(self, targets, args=""): + if sys.platform == 'win32': + gui_make_cmd = self.w32_make_cmd + elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: + gui_make_cmd = self.make_cmd + " -w" + else: + raise Exception('Unsupported platform: ' + sys.platform) + + gui_make_cmd += args + + print 'Make GUI command: ' + gui_make_cmd + + 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: + self.try_chdir(self.gui_dir) + err = os.system(gui_make_cmd) + self.restore_chdir() - # allow user to skip qui compile - if self.enable_make_gui: - self.make_gui(targets) + if err != 0: + raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) + + if sys.platform == 'darwin' and not "clean" in args: + for target in targets: + self.macPostMakeGui(target) + + def macPostMakeGui(self, target): + + dir = self.getGenerator().binDir + + if self.enableMakeCore: + # copy core binaries into the bundle, since the gui + # now looks for the binaries in the current app dir. + + targetDir = self.getGenerator().getBinDir(target) + bundleBinDir = dir + "/Synergy.app/Contents/MacOS/" + shutil.copy(targetDir + "/synergyc", bundleBinDir) + shutil.copy(targetDir + "/synergys", bundleBinDir) + shutil.copy(targetDir + "/syntool", bundleBinDir) + + # use qt to copy libs to bundle so no dependencies are needed. do not create a + # dmg at this point, since we need to sign it first, and then create our own + # after signing (so that qt does not affect the signed app bundle). + bin = "macdeployqt Synergy.app -verbose=2" + self.try_chdir(dir) + err = os.system(bin) + self.restore_chdir() + + (qMajor, qMinor, qRev) = self.getQmakeVersion() + if qMajor <= 4: + frameworkRootDir = "/Library/Frameworks" + else: + # TODO: auto-detect, qt can now be installed anywhere. + frameworkRootDir = "/Developer/Qt5.2.1/5.2.1/clang_64/lib" + + # copy the missing Info.plist files for the frameworks. + shutil.copy(frameworkRootDir + "/QtCore.framework/Contents/Info.plist", + dir + "/Synergy.app/Contents/Frameworks/QtCore.framework/Resources/") + shutil.copy(frameworkRootDir + "/QtGui.framework/Contents/Info.plist", + dir + "/Synergy.app/Contents/Frameworks/QtGui.framework/Resources/") + shutil.copy(frameworkRootDir + "/QtNetwork.framework/Contents/Info.plist", + dir + "/Synergy.app/Contents/Frameworks/QtNetwork.framework/Resources/") + + if err != 0: + raise Exception(bin + " failed with error: " + str(err)) def signmac(self, identity): self.try_chdir("bin") @@ -408,6 +537,15 @@ class InternalCommands: if len(targets) == 0: targets += [self.defaultTarget,] + # allow user to skip core clean + if self.enableMakeCore: + self.cleanCore(targets) + + # allow user to skip qui clean + if self.enableMakeGui: + self.cleanGui(targets) + + def cleanCore(self, targets): generator = self.getGeneratorFromConfig().cmakeName if generator.startswith('Visual Studio'): @@ -439,72 +577,9 @@ class InternalCommands: if err != 0: raise Exception('Clean failed: ' + str(err)) - - # 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', 'darwin']: - gui_make_cmd = self.make_cmd + " -w" - else: - raise Exception('Unsupported platform: ' + sys.platform) - - print 'Make GUI command: ' + gui_make_cmd - - 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: - self.try_chdir(self.gui_dir) - err = os.system(gui_make_cmd) - self.restore_chdir() - - if err != 0: - raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) - - if sys.platform == 'darwin': - self.macPostMakeGui() - - def macPostMakeGui(self): - - dir = self.getGenerator().binDir - - # copy synergy[cs] binaries into the bundle, since the gui - # now looks for the binaries in the current app dir. - shutil.copy(dir + "/synergyc", dir + "/Synergy.app/Contents/MacOS/") - shutil.copy(dir + "/synergys", dir + "/Synergy.app/Contents/MacOS/") - shutil.copy(dir + "/syntool", dir + "/Synergy.app/Contents/MacOS/") - - # use qt to copy libs to bundle so no dependencies are needed. do not create a - # dmg at this point, since we need to sign it first, and then create our own - # after signing (so that qt does not affect the signed app bundle). - bin = "macdeployqt Synergy.app -verbose=2" - self.try_chdir(dir) - err = os.system(bin) - self.restore_chdir() - - # copy the missing Info.plist files for the frameworks. - shutil.copy("/Library/Frameworks/QtCore.framework/Contents/Info.plist", - dir + "/Synergy.app/Contents/Frameworks/QtCore.framework/Resources/") - shutil.copy("/Library/Frameworks/QtGui.framework/Contents/Info.plist", - dir + "/Synergy.app/Contents/Frameworks/QtGui.framework/Resources/") - shutil.copy("/Library/Frameworks/QtNetwork.framework/Contents/Info.plist", - dir + "/Synergy.app/Contents/Frameworks/QtNetwork.framework/Resources/") - - if err != 0: - raise Exception(bin + " failed with error: " + str(err)) + def cleanGui(self, targets): + self.makeGui(targets, " clean") def open(self): generator = self.getGeneratorFromConfig().cmakeName @@ -1143,24 +1218,13 @@ class InternalCommands: print str(k) + ': ' + generators[k].cmakeName def getMacVersion(self): - # if we've built with an older sdk, then use that as the - # os version for package names, etc. - config = self.getConfig() - if config.has_option("cmake", "mac_sdk"): - macSdk = config.get("cmake", "mac_sdk") - split = macSdk.split('.') - major = int(split[0]) - minor = int(split[1]) - return (major, minor) - - import commands - versions = commands.getoutput('/usr/bin/sw_vers') - result = re.search('ProductVersion:\t(\d+)\.(\d+)', versions) - + if not self.macSdk: + raise Exception("Mac OS X SDK not set.") + + result = re.search('(\d+)\.(\d+)', self.macSdk) if not result: print versions - raise Exception( - 'Could not find Mac OS X version in sw_vers output.') + raise Exception("Could not find Mac OS X version.") major = int(result.group(1)) minor = int(result.group(2)) @@ -1221,8 +1285,10 @@ class CommandHandler: self.ic.no_prompts = True elif o in ('-g', '--generator'): self.ic.generator_id = a - elif o == '--make-gui': - self.ic.enable_make_gui = True + elif o == '--skip-gui': + self.ic.enableMakeGui = False + elif o == '--skip-core': + self.ic.enableMakeCore = False elif o in ('-d', '--debug'): self.build_targets += ['debug',] elif o in ('-r', '--release'):