在win10和centos7上编译synergy

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xj178926426/article/details/83005315

在win10和centos7上编译synergy

Synergy功能简介

同一局域网中多台机器共享一套键盘鼠标,支持Windows、Linux、MAC设备,鼠标键盘物理连接的机器做服务器端,其他机器做客户端程序,在服务器端对各台机器进行简单配置,在客户端输入服务器端IP地址或网络名,即可体验其强大功能。

准备工作

1,获取Synergy源码

git clone https://github.com/symless/synergy-core.git

2,安装win10上需要的工具

1, Install Git for Windows
2, Install Visual Studio Professional 2015 with Updates
a, Select Custom
b, Deselect all
c, Within Programming Languages, select Visual C++
d, Git for Windows should already be installed
3, Download the Windows 10 SDK Web Installer
a, Click Download the installer(not the iso)
b, Use default options for first 2 screens
c, On the feature screen, untick everything except Debugging Tools for Windows
4, Install Bonjour
a, Download: Bonjour SDK for Windows v3.0
5, Install Qt
a, Install to C:\Qt
b, Select Qt 5.9.5
6, Add ‘C:\Qt\Tools\QtCreator\bin’ to the system PATH
7, Install CMake
a, Add CMake to PATH for all users
8, Restart Qt
9, Set CMAKE_PREFIX_PATHenvironment variable to \path\to\qt\qt_version\msvc2015_64
10, Now follow the compile steps below

3,安装cento7上需要的工具

sudo yum groupinstall "Development Tools"
sudo yum -y install epel-release cmake3 boost-static git libXtst-devel qt5-qtbase-devel qt5-qtdeclarative-devel libcurl-devel openssl-devel

编译

1, win10 上编译

1,将源码位置配置到CMake中:配置源码目录和编译目录,一般都是在源码目录下新建一个build目录来进行编译。
在这里插入图片描述
2,执行Configure,选择合适的编译器,然后点Finish。
在这里插入图片描述
之后会进行配置,完成之后会出现如下界面:
在这里插入图片描述
3,点击Generate,生成项目文件
在这里插入图片描述
4,在上面我们配置的编译目录E:\synergy-core\build就会看到已经生成vs2015的工程文件:
在这里插入图片描述
直接双击打开synergy-core.sln文件进行编译,不出意外一般都会成功:
在这里插入图片描述

2,centos7上编译

cd Projects/synergy
mkdir build
cd build
cmake ..
make

配置使用

synergy配置很简单,其说明文档也比较清楚,我只有两台电脑,一个笔记本win10,一个台式机centos7,台式机公用笔记本的键盘鼠标,我的配置文件如下:

# sample synergy configuration file
#
# comments begin with the # character and continue to the end of
# line.  comments may appear anywhere the syntax permits.

section: screens
	# three hosts, named "moe", "larry", and "curly"
	laptop:
	centos:
end

section: links
	# for moe, larry is to the right and curly is above.
	laptop:
		right = centos

	# for larry, moe is to the left and curly is also above.
	# note that curly is above both moe and larry
	# and that the connection between moe and larry is symmetric
	# (i.e. they're in opposite directions of each other).
	centos:
		left = laptop

end

section: aliases
	# curly is also known as shemp
	laptop:
		james-laptop
	centos:
		james-centos
end

在win10上以管理员身份运行cmd,进入到编译环境下执行:

synergy-core.exe --server --config synergy.conf

在centos7上以root身份运行如下命令即可:

sudo ./synergy-core --client 192.168.10.104 

其中192.168.10.104为win10的ip地址。然后就可以通过一个键盘一个鼠标控制两个电脑了。
我是在win10上写了一个简单的批处理来直接双击打开可以参考:

@ echo off
echo 正在启用超级管理员权限... 
%1 %2
ver|find "5.">nul&&goto :st
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",1)(window.close)&goto :eof
 
:st
copy "%~0" "%windir%\system32\"
echo 启用超级管理员权限成功 

cd /d D:\Program Files\synergy

"synergy-core.exe" --server --config synergy.conf

猜你喜欢

转载自blog.csdn.net/xj178926426/article/details/83005315