3 cmake_minimum_required(VERSION 2.6)
7 # Set up output folders
8 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
9 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
11 # Add include path to hidapi.h
12 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/hidapi/hidapi ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR})
16 # Win32-specific options go here.
17 message(STATUS "Detected Win32 system")
18 list(APPEND LIBSRC hidapi/windows/hid.c)
19 list(APPEND PLATFORM_LIBS setupapi)
21 # Apple-specific options go here.
22 message(STATUS "Detected Apple system")
23 list(APPEND LIBSRC hidapi/mac/hid.c)
24 set(CMAKE_SHARED_LINKER_FLAGS "-framework IOKit -framework CoreFoundation")
25 set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation")
27 # Linux-specific options go here.
28 message(STATUS "Detected non-windows, non-apple system; assuming some Linux variant")
29 include_directories(/usr/include/libusb-1.0)
30 list(APPEND LIBSRC hidapi/linux/hid-libusb.c)
31 list(APPEND PLATFORM_LIBS usb-1.0 pthread rt)
33 list(APPEND LIBSRC src/touchmouse.c src/mono_timer.c)
35 set(CMAKE_C_FLAGS "-Wall -ggdb")
38 add_library(touchmouse SHARED ${LIBSRC})
41 target_link_libraries(touchmouse ${PLATFORM_LIBS})
45 add_subdirectory(examples)