diff --git a/src/plugin/CMakeLists.txt b/src/plugin/CMakeLists.txt index 09b15520..b835ad6a 100644 --- a/src/plugin/CMakeLists.txt +++ b/src/plugin/CMakeLists.txt @@ -14,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +add_subdirectory(ns) + if (WIN32) add_subdirectory(winmmjoy) endif() diff --git a/src/plugin/ns/CMakeLists.txt b/src/plugin/ns/CMakeLists.txt new file mode 100644 index 00000000..50e260c5 --- /dev/null +++ b/src/plugin/ns/CMakeLists.txt @@ -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 . + +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() diff --git a/src/plugin/ns/ns.cpp b/src/plugin/ns/ns.cpp new file mode 100644 index 00000000..6819043a --- /dev/null +++ b/src/plugin/ns/ns.cpp @@ -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 . + */ + +#include "ns.h" + +#include + +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; +} + +} \ No newline at end of file diff --git a/src/plugin/ns/ns.h b/src/plugin/ns/ns.h new file mode 100644 index 00000000..2beeee36 --- /dev/null +++ b/src/plugin/ns/ns.h @@ -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 . + */ + +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include + +#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(); + +}