added windows cmake building
This commit is contained in:
parent
384ad886e4
commit
7d3feb72bb
|
@ -16,5 +16,5 @@
|
|||
#*.pro
|
||||
*.user
|
||||
*.directory
|
||||
build-*
|
||||
*build-*
|
||||
build*
|
||||
*build*
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
cmake_minimum_required(VERSION 2.8.4)
|
||||
project(XInputSimulator)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
set(SOURCE_FILES
|
||||
main.cpp
|
||||
notimplementedexception.cpp
|
||||
|
@ -23,15 +21,23 @@ set(SOURCE_FILES
|
|||
find_library(X_11 X11)
|
||||
find_library(X_TST Xtst)
|
||||
set(EXTRA_LIBS ${X_11} ${X_TST})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
# Apple
|
||||
if(APPLE)
|
||||
find_library(APP_SERVICES ApplicationServices)
|
||||
find_library(CARBON Carbon)
|
||||
find_library(CORE_FOUNDATION CoreFoundation )
|
||||
find_library(CORE_FOUNDATION CoreFoundation)
|
||||
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY} ${CARBON} ${CORE_FOUNDATION})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif(APPLE)
|
||||
|
||||
# Windows
|
||||
if(WIN32)
|
||||
#find_library(USER_32 User32.Lib)
|
||||
#set(EXTRA_LIBS ${USER_32})
|
||||
endif(WIN32)
|
||||
|
||||
add_executable(XInputSimulator ${SOURCE_FILES})
|
||||
target_link_libraries(XInputSimulator ${EXTRA_LIBS} )
|
|
@ -18,7 +18,16 @@
|
|||
#include <iostream>
|
||||
#include "xinputsimulator.h"
|
||||
|
||||
#ifdef __linux__
|
||||
//sleep
|
||||
#include <unistd.h>
|
||||
#elif __APPLE__
|
||||
//sleep
|
||||
#include <unistd.h>
|
||||
#elif _WIN32
|
||||
//sleep
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -51,7 +60,8 @@ int main()
|
|||
waitABit();
|
||||
sim.mouseScrollX(-10);
|
||||
|
||||
char anA = 'a';
|
||||
#ifdef __linux__ || __APPLE__
|
||||
char anA = 'a';
|
||||
cout << "a: " << (int)anA << " " << sim.charToKeyCode(anA) << endl;
|
||||
std::cout << std::endl;
|
||||
waitABit();
|
||||
|
@ -59,15 +69,24 @@ int main()
|
|||
std::cout << std::endl;
|
||||
waitABit();
|
||||
sim.keySequence(" Simple sentence Here 123 ");
|
||||
#elif _WIN32
|
||||
//not implemented
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//waitABit();
|
||||
waitABit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void waitABit()
|
||||
{
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
sleep(1);
|
||||
#ifdef __linux__
|
||||
sleep(1);
|
||||
#elif __APPLE__
|
||||
sleep(1);
|
||||
#elif _WIN32
|
||||
Sleep(1000);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue