support for qt 5.2

This commit is contained in:
Nick Bolton 2014-02-14 16:21:02 +00:00
parent cfc1aa2569
commit bf361d153b
17 changed files with 471 additions and 158 deletions

234
doc/QtCodeStyle.xml Normal file
View File

@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>

6
hm.py
View File

@ -51,14 +51,14 @@ requiredMinor = 6
# options used by all commands # options used by all commands
globalOptions = 'v' 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 # list of valid commands as keys. the values are optarg strings, but most
# are None for now (this is mainly for extensibility) # are None for now (this is mainly for extensibility)
cmd_opt_dict = { cmd_opt_dict = {
'about' : ['', []], 'about' : ['', []],
'setup' : ['g:', []], 'setup' : ['g:', ['generator=']],
'configure' : ['g:dr', ['debug', 'release', 'mac-sdk=']], 'configure' : ['g:dr', ['generator=', 'debug', 'release', 'mac-sdk=']],
'build' : ['dr', ['debug', 'release']], 'build' : ['dr', ['debug', 'release']],
'clean' : ['dr', ['debug', 'release']], 'clean' : ['dr', ['debug', 'release']],
'update' : ['', []], 'update' : ['', []],

View File

@ -1,4 +1,4 @@
QT += network QT += widgets network
TEMPLATE = app TEMPLATE = app
TARGET = synergy TARGET = synergy
DEPENDPATH += . \ DEPENDPATH += . \
@ -74,7 +74,6 @@ RESOURCES += res/Synergy.qrc
RC_FILE = res/win/Synergy.rc RC_FILE = res/win/Synergy.rc
macx { macx {
QMAKE_INFO_PLIST = res/mac/Info.plist QMAKE_INFO_PLIST = res/mac/Info.plist
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
TARGET = Synergy TARGET = Synergy
QSYNERGY_ICON.files = res/mac/Synergy.icns QSYNERGY_ICON.files = res/mac/Synergy.icns
QSYNERGY_ICON.path = Contents/Resources QSYNERGY_ICON.path = Contents/Resources

View File

@ -42,10 +42,7 @@ IpcClient::~IpcClient()
void IpcClient::connected() void IpcClient::connected()
{ {
char typeBuf[1];
typeBuf[0] = kIpcClientGui;
sendHello(); sendHello();
infoMessage("connection established"); infoMessage("connection established");
} }

View File

@ -19,6 +19,7 @@
#include "KeySequenceWidget.h" #include "KeySequenceWidget.h"
#include <iostream> #include <iostream>
#include <QMouseEvent>
KeySequenceWidget::KeySequenceWidget(QWidget* parent, const KeySequence& seq) : KeySequenceWidget::KeySequenceWidget(QWidget* parent, const KeySequence& seq) :
QPushButton(parent), QPushButton(parent),

View File

@ -20,7 +20,7 @@
#define KEYSEQUENCEWIDGET__H #define KEYSEQUENCEWIDGET__H
#include <QtGui> #include <QPushButton>
#include "KeySequence.h" #include "KeySequence.h"

View File

@ -30,6 +30,10 @@
#include <QtGui> #include <QtGui>
#include <QtNetwork> #include <QtNetwork>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QFileDialog>
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
@ -117,7 +121,7 @@ MainWindow::~MainWindow()
saveSettings(); saveSettings();
} }
void MainWindow::start(bool firstRun) void MainWindow::start()
{ {
createTrayIcon(); createTrayIcon();
@ -508,7 +512,7 @@ QString MainWindow::configFilename()
if (!m_pTempConfigFile->open()) 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.")); 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); 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. " 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 "Do you want to browse for the configuration file now?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes
|| !on_m_pButtonBrowseConfigFile_clicked()) || !on_m_pButtonBrowseConfigFile_clicked())
return false; return "";
} }
filename = m_pLineEditConfigFile->text(); filename = m_pLineEditConfigFile->text();
@ -684,7 +688,7 @@ void MainWindow::setVisible(bool visible)
m_pActionMinimize->setEnabled(visible); m_pActionMinimize->setEnabled(visible);
m_pActionRestore->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 :( // dock hide only supported on lion :(
ProcessSerialNumber psn = { 0, kCurrentProcess }; ProcessSerialNumber psn = { 0, kCurrentProcess };
GetCurrentProcess(&psn); GetCurrentProcess(&psn);

View File

@ -88,7 +88,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QString configFilename(); QString configFilename();
QString address(); QString address();
QString appPath(const QString& name); QString appPath(const QString& name);
void start(bool firstRun); void start();
void clearLog(); void clearLog();
VersionChecker& versionChecker() { return m_VersionChecker; } VersionChecker& versionChecker() { return m_VersionChecker; }

View File

@ -21,6 +21,7 @@
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>
#include <QMessageBox>
ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) : ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),

View File

@ -24,6 +24,8 @@
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>
#include <QMessageBox>
#include <QFileDialog>
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) : SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),

View File

@ -205,7 +205,7 @@ void SetupWizard::accept()
if (m_StartMain) if (m_StartMain)
{ {
m_MainWindow.start(true); m_MainWindow.start();
} }
QWizard::accept(); QWizard::accept();
@ -217,7 +217,7 @@ void SetupWizard::reject()
if (m_StartMain) if (m_StartMain)
{ {
m_MainWindow.start(true); m_MainWindow.start();
} }
QWizard::reject(); QWizard::reject();

View File

@ -18,7 +18,7 @@
#include "SynergyLocale.h" #include "SynergyLocale.h"
#include <QResource> #include <QResource>
#include <QtXml/QXmlStreamReader> #include <QXmlStreamReader>
#include <QDebug> #include <QDebug>
SynergyLocale::SynergyLocale() SynergyLocale::SynergyLocale()

View File

@ -27,6 +27,7 @@
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>
#include <QSettings> #include <QSettings>
#include <QMessageBox>
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
@ -93,7 +94,7 @@ int main(int argc, char* argv[])
} }
else else
{ {
mainWindow.start(false); mainWindow.start();
} }
return app.exec(); return app.exec();
@ -126,7 +127,7 @@ int waitForTray()
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
bool checkMacAssistiveDevices() 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 // new in mavericks, applications are trusted individually
// with use of the accessibility api. this call will show a // with use of the accessibility api. this call will show a

View File

@ -32,7 +32,7 @@ class Generator(object):
class MakefilesGenerator(Generator): class MakefilesGenerator(Generator):
def __init__(self): def __init__(self):
super(MakefilesGenerator, self).__init__('Unix Makefiles', 'build', '..', 'bin') super(MakefilesGenerator, self).__init__('Unix Makefiles')
def getBuildDir(self, target): def getBuildDir(self, target):
return super(MakefilesGenerator, self).getBuildDir(target) + '/' + target return super(MakefilesGenerator, self).getBuildDir(target) + '/' + target
@ -49,6 +49,14 @@ class MakefilesGenerator(Generator):
def getSourceDir(self): def getSourceDir(self):
return super(MakefilesGenerator, self).getSourceDir() + '/..' 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): class EclipseGenerator(Generator):
def __init__(self): def __init__(self):
super(EclipseGenerator, self).__init__('Eclipse CDT4 - Unix Makefiles', '', '') super(EclipseGenerator, self).__init__('Eclipse CDT4 - Unix Makefiles', '', '')

View File

@ -17,7 +17,7 @@
# TODO: split this file up, it's too long! # TODO: split this file up, it's too long!
import sys, os, ConfigParser, shutil, re, ftputil, zipfile 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): if sys.version_info >= (2, 4):
import subprocess import subprocess
@ -60,8 +60,11 @@ 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 # by default, compile the core
enable_make_gui = False enableMakeCore = True
# by default, compile the gui
enableMakeGui = True
# by default, let cmake decide # by default, let cmake decide
macSdk = None macSdk = None
@ -85,7 +88,7 @@ class InternalCommands:
darwin_generators = { darwin_generators = {
1 : MakefilesGenerator(), 1 : MakefilesGenerator(),
2 : Generator('Xcode'), 2 : XcodeGenerator(),
3 : EclipseGenerator(), 3 : EclipseGenerator(),
} }
@ -151,12 +154,37 @@ class InternalCommands:
def configure(self, target='', extraArgs=''): def configure(self, target='', extraArgs=''):
cmake_args = ''
# ensure latest setup and do not ask config for generator (only fall # ensure latest setup and do not ask config for generator (only fall
# back to prompt if not specified as arg) # back to prompt if not specified as arg)
self.ensure_setup_latest() 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 <version>");
# 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 # ensure that we have access to cmake
_cmake_cmd = self.persist_cmake() _cmake_cmd = self.persist_cmake()
@ -169,19 +197,15 @@ class InternalCommands:
print('Generator changed, running setup.') print('Generator changed, running setup.')
self.setup(target) self.setup(target)
cmake_args = ''
if generator.cmakeName != '': if generator.cmakeName != '':
cmake_args += ' -G "' + 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) # for makefiles always specify a build type (debug, release, etc)
if generator.cmakeName.find('Unix Makefiles') != -1: if generator.cmakeName.find('Unix Makefiles') != -1:
cmake_args += ' -DCMAKE_BUILD_TYPE=' + target.capitalize() cmake_args += ' -DCMAKE_BUILD_TYPE=' + target.capitalize()
if self.macSdk: elif sys.platform == "darwin":
path = "/Developer/SDKs/MacOSX" + self.macSdk + ".sdk/" path = "/Developer/SDKs/MacOSX" + self.macSdk + ".sdk/"
cmake_args += " -DCMAKE_OSX_SYSROOT=" + path cmake_args += " -DCMAKE_OSX_SYSROOT=" + path
cmake_args += " -DCMAKE_OSX_DEPLOYMENT_TARGET=" + self.macSdk cmake_args += " -DCMAKE_OSX_DEPLOYMENT_TARGET=" + self.macSdk
@ -191,9 +215,6 @@ class InternalCommands:
config = self.getConfig() config = self.getConfig()
config.set('cmake', 'mac_sdk', self.macSdk) config.set('cmake', 'mac_sdk', self.macSdk)
self.write_config(config) self.write_config(config)
elif sys.platform == "darwin":
# seems that this is now needed on 10.8
raise Exception("Arg missing: --mac-sdk <version>");
# if not visual studio, use parent dir # if not visual studio, use parent dir
sourceDir = generator.getSourceDir() sourceDir = generator.getSourceDir()
@ -220,8 +241,7 @@ 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 def configureGui(self, target="", extraArgs=""):
if self.enable_make_gui:
# make sure we have qmake # make sure we have qmake
self.persist_qmake() self.persist_qmake()
@ -229,6 +249,7 @@ class InternalCommands:
qmake_cmd_string = self.qmake_cmd + " " + self.qtpro_filename + " -r" qmake_cmd_string = self.qmake_cmd + " " + self.qtpro_filename + " -r"
if sys.platform == "darwin": if sys.platform == "darwin":
# create makefiles on mac (not xcode). # create makefiles on mac (not xcode).
qmake_cmd_string += " -spec macx-g++" qmake_cmd_string += " -spec macx-g++"
@ -237,6 +258,21 @@ class InternalCommands:
# 10.4: universal (intel and power pc) # 10.4: universal (intel and power pc)
qmake_cmd_string += ' CONFIG+="ppc i386"' 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 print "QMake command: " + qmake_cmd_string
# run qmake from the gui dir # run qmake from the gui dir
@ -247,7 +283,22 @@ class InternalCommands:
if err != 0: if err != 0:
raise Exception('QMake encountered error: ' + str(err)) raise Exception('QMake encountered error: ' + str(err))
self.setConfRun(target) 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 # http://tinyurl.com/cs2rxxb
def fixCmakeEclipseBug(self): def fixCmakeEclipseBug(self):
@ -334,6 +385,16 @@ class InternalCommands:
self.ensure_setup_latest() 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 generator = self.getGeneratorFromConfig().cmakeName
config = self.getConfig() config = self.getConfig()
@ -354,9 +415,77 @@ class InternalCommands:
else: else:
raise Exception('Build command not supported with generator: ' + generator) raise Exception('Build command not supported with generator: ' + generator)
# allow user to skip qui compile def makeGui(self, targets, args=""):
if self.enable_make_gui: if sys.platform == 'win32':
self.make_gui(targets) 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()
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): def signmac(self, identity):
self.try_chdir("bin") self.try_chdir("bin")
@ -408,6 +537,15 @@ class InternalCommands:
if len(targets) == 0: if len(targets) == 0:
targets += [self.defaultTarget,] 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 generator = self.getGeneratorFromConfig().cmakeName
if generator.startswith('Visual Studio'): if generator.startswith('Visual Studio'):
@ -440,71 +578,8 @@ class InternalCommands:
if err != 0: if err != 0:
raise Exception('Clean failed: ' + str(err)) raise Exception('Clean failed: ' + str(err))
# allow user to skip qui compile def cleanGui(self, targets):
clean_targets = [] self.makeGui(targets, " clean")
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 open(self): def open(self):
generator = self.getGeneratorFromConfig().cmakeName generator = self.getGeneratorFromConfig().cmakeName
@ -1143,24 +1218,13 @@ class InternalCommands:
print str(k) + ': ' + generators[k].cmakeName print str(k) + ': ' + generators[k].cmakeName
def getMacVersion(self): def getMacVersion(self):
# if we've built with an older sdk, then use that as the if not self.macSdk:
# os version for package names, etc. raise Exception("Mac OS X SDK not set.")
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)
result = re.search('(\d+)\.(\d+)', self.macSdk)
if not result: if not result:
print versions print versions
raise Exception( raise Exception("Could not find Mac OS X version.")
'Could not find Mac OS X version in sw_vers output.')
major = int(result.group(1)) major = int(result.group(1))
minor = int(result.group(2)) minor = int(result.group(2))
@ -1221,8 +1285,10 @@ 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': elif o == '--skip-gui':
self.ic.enable_make_gui = True self.ic.enableMakeGui = False
elif o == '--skip-core':
self.ic.enableMakeCore = False
elif o in ('-d', '--debug'): elif o in ('-d', '--debug'):
self.build_targets += ['debug',] self.build_targets += ['debug',]
elif o in ('-r', '--release'): elif o in ('-r', '--release'):