added new ns plugin #4313

This commit is contained in:
XinyuHou 2015-01-06 13:52:11 +00:00
parent 1f41b92693
commit a0f2261931
4 changed files with 115 additions and 0 deletions

View File

@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(ns)
if (WIN32)
add_subdirectory(winmmjoy)
endif()

View File

@ -0,0 +1,41 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2015 Synergy Si Ltd.
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file COPYING that should have accompanied this file.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(ns SHARED ${sources})
if (WIN32)
add_custom_command(
TARGET ns
POST_BUILD
COMMAND xcopy /Y /Q
..\\..\\..\\..\\lib\\${CMAKE_CFG_INTDIR}\\ns.dll
..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}\\plugins\\
)
else()
add_custom_command(
TARGET ns
POST_BUILD
COMMAND cp
..\\..\\..\\..\\lib\\${CMAKE_CFG_INTDIR}\\ns.so
..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}\\plugins\\
)
endif()

38
src/plugin/ns/ns.cpp Normal file
View File

@ -0,0 +1,38 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ns.h"
#include <iostream>
extern "C" {
int
init(void (*sendEvent)(const char*, void*), void (*log)(const char*))
{
std::cout << "hello world" << std::endl;
return 0;
}
int
cleanup()
{
std::cout << "goodbye world" << std::endl;
return 0;
}
}

34
src/plugin/ns/ns.h Normal file
View File

@ -0,0 +1,34 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#if defined(ns_EXPORTS)
#define NS_API __declspec(dllexport)
#else
#define NS_API __declspec(dllimport)
#endif
extern "C" {
NS_API int init(void (*sendEvent)(const char*, void*), void (*log)(const char*));
NS_API int cleanup();
}