Compiling
Contents |
Introduction
Before building you will need to install the dependencies. To build, use the hm (or ./hm.sh) script located the root of our project directory. This is just a wrapper for cmake, so you don't need to use it, however we recommend you do. The conf command will generate the projects in the build directory (which can be opened manually and used for compiling).
This guide is for Synergy version 1.3.5 and above. First you need to download the Source Code. To compile 1.3.4 and below, please refer to the legacy compile guide on the old website. Automake will no longer be used, which means, but you can still use the GNU style ./configure; make command sequence (the configure script just calls cmake). CMake is *not* a replacement for make or Visual Studio; it doesn't compile source code, but it does generate project files (like Makefile, Visual Studio, and Xcode) much like the configure command.
The -g1 argument (shown below) will cause the 1st CMake generator to be used; use the hm genlist command to see other generators. You may want to do this if you are building with Eclipse, for example.
With no extra arguments, release build will be compiled. If you need the debug release, use the -d argument.
To build the GUI (requires Qt SDK), use the --make-gui argument with the conf and build commands.
Windows
hm conf -g1 hm build
Unix, Linux, Mac OS X
./hm.sh conf -g1 ./hm.sh build
Manual compiling
After configuring, if you want to build without using the hm script.
Unix Makefiles
cd build make
Visual Studio
- Open the
builddirectory. - Double click:
synergy.sln - Click
Buildfrom the menu, then clickBuild Solution.
Xcode
Run:
./hm.sh conf -g2
to create synergy.xcodeproj, then:
- Open the
builddirectory. - Double click:
synergy.xcodeproj - Click
Buildfrom the menu, then clickBuild.
Tip: To build for a different version of OS X than the one you are on, go to Project, Edit Project Settings, Build. There you can change settings for Intel/PPC, 32/64-bit, and OS X version (scroll down for OS X version). Release builds should be 32-bit Universal, with base SDK 10.5.
Other IDEs
Windows users can download a free version of Visual C++ Express 2008, which can open the Visual Studio 2008 files generated by CMake. Other supported project types are Code::Blocks, Eclipse CDT, and MinGW
For Mac OS X users, although Xcode isn't necessary for compiling on Mac OS X (you can just use Unix Makefiles), it is a neat IDE and very widely used (and it's free). There others, such as Code::Blocks and Eclipse CDT which (apparently) work on Mac OS X.
Building installers
Use the hm package command to build installers. Of course you can only build those that are applicable for your platform.
Dependencies
Windows XP and above
- Visual C++ Express 2008 (or VC++ 6.0 and above)
- CMake
- Python
- Qt SDK 2010.02 (provides qmake)
You may need to add your Python install directory to the end of your PATH environment variable (System > Advanced System Settings > Environment Variables) so that hm can be called from the command prompt.
Using Python 3.x will result in syntax errors as print became a function rather than a statement: What's new in Python 3.0
Windows x64
- All dependencies required for Windows x86
- Visual Studio 2008 (x64) *SP1* or Visual Studio 2005 (x64) *SP1*
- 64-bit compiler extensions installed (you may need to re-run Visual Studio setup)
Mac OS X 10.4 and above
- XCode (*with command line tools)
- Qt SDK 2010.03 (provides qmake)
To install the command line tools, Xcode > Preferences > Downloads and install component named "Command Line Tools".
If you are missing the /Developer directory, you may need to run (assuming the path is correct):
sudo ln -fs /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/ /Developer
Note: For Mac OS X 10.5 and above, Python should already be installed. Otherwise, visit the CMake and Python download pages.
Note: Upgrading Mac OS X may cause the command line tools and Qt libraries to be removed (even on minor upgrades), so you may have to reinstall both each time after doing this.
Using "brew" method
Brew for Mac OS X is an alternative to MacPorts and Fink.
brew install cmake
Using "macports" method
If you already have MacPorts, run:
sudo port install cmake
Ubuntu 9.04 and above
sudo apt-get install cmake make g++ xorg-dev libqt4-dev
Note: In some cases, libXtst-dev may need to be manually installed. However, since it's a dependency of xorg-dev, this shouldn't be the case.
Fedora 10
sudo yum install cmake python gcc-c++ make libX11-devel libXtst-devel libXext-devel libXinerama-devel
Note: In some cases, libXinerama-devel need not be manually installed (since it's not required for minimum build), but this depends on whether the Xinerama headers have been installed previously (which in some cases they have).
OpenSUSE 11.1
su yast2 -i cmake python gcc-c++ xorg-x11-devel
Mandriva One 2009
su urpmi cmake python gcc-c++ make xorg-x11-dev
OpenSolaris 2009.06
su pkg install SUNWPython SUNWcmake SUNWgcc SUNWxorg-headers SUNWxwinc
CentOS 5.6, 6.0
su yum install make gcc-c++ libX11-devel libXext-devel libXtst-devel libXinerama-devel
Install CMake manually (older version in repository doesn't work):
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz tar xfvz cmake-2.8.4.tar.gz ./configure make make install
Unix or other Linux
- CMake
- Python
- GNU Make
- GCC (2.95 and up)
- X11R4 and up (headers and libraries)
- Xtst (e.g. libXtst-devel)
- Qt 2010.03