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