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
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' : ['', []],

View File

@ -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

View File

@ -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);

View File

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

View File

@ -29,7 +29,7 @@ class IpcClient : public QObject
Q_OBJECT
public:
IpcClient();
IpcClient();
virtual ~IpcClient();
void sendHello();

View File

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

View File

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

View File

@ -30,6 +30,10 @@
#include <QtGui>
#include <QtNetwork>
#include <QNetworkAccessManager>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QFileDialog>
#if defined(Q_OS_MAC)
#include <ApplicationServices/ApplicationServices.h>
@ -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);

View File

@ -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; }

View File

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

View File

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

View File

@ -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();

View File

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

View File

@ -27,6 +27,7 @@
#include <QtCore>
#include <QtGui>
#include <QSettings>
#include <QMessageBox>
#if defined(Q_OS_MAC)
#include <Carbon/Carbon.h>
@ -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

View File

@ -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):

View File

@ -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 <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
_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 <version>");
# 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'):