]> git.zarvox.org Git - libtouchmouse.git/commitdiff
Windows is annoying.
authorDrew Fisher <drew.m.fisher@gmail.com>
Sat, 29 Oct 2011 20:14:03 +0000 (13:14 -0700)
committerDrew Fisher <drew.m.fisher@gmail.com>
Sat, 29 Oct 2011 20:14:45 +0000 (13:14 -0700)
Declare all the things in libtouchmouse.h with dllexport.
Also put output library in a lib folder

Signed-off-by: Drew Fisher <drew.m.fisher@gmail.com>
CMakeLists.txt
libtouchmouse/libtouchmouse.h

index d1ff3736af84be23ba178e615b4698601f2bd4e8..28df86daac16a6e2a926c01f36a4b23530d90468 100644 (file)
@@ -4,8 +4,9 @@ cmake_minimum_required(VERSION 2.6)
 
 project(libtouchmouse)
 
-# Set up output folder
+# Set up output folders
 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
+set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
 
 # Add include path to hidapi.h
 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/hidapi/hidapi ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR})
@@ -36,6 +37,7 @@ add_library(touchmouse SHARED ${LIBSRC})
 # Build demo
 add_executable(consoledemo examples/consoledemo.c)
 if(WIN32)
+       target_link_libraries(touchmouse setupapi)
        target_link_libraries(consoledemo touchmouse setupapi)
 elseif(NOT APPLE)
        target_link_libraries(consoledemo touchmouse usb-1.0 pthread rt)
index dc57fcfed75c725d930ff01653aea6f9f99e99f0..1d38ea17600c6663b2cd81cc99d790cbda483924 100644 (file)
@@ -2,6 +2,17 @@
 #define __LIBTOUCHMOUSE_H__
 #include <stdint.h>
 
+// Win32 needs symbols exported.
+#ifndef _WIN32
+       #define TOUCHMOUSEAPI
+#else
+       #ifdef __cplusplus
+               #define TOUCHMOUSEAPI extern "C" __declspec(dllexport)
+       #else
+               #define TOUCHMOUSEAPI __declspec(dllexport)
+       #endif
+#endif
+
 // Types:
 struct touchmouse_device_;
 typedef struct touchmouse_device_ touchmouse_device;
@@ -30,28 +41,28 @@ typedef enum {
 } touchmouse_mode;
 
 // Library initialization/destruction
-int touchmouse_init(void);
-int touchmouse_shutdown(void);
+TOUCHMOUSEAPI int touchmouse_init(void);
+TOUCHMOUSEAPI int touchmouse_shutdown(void);
 
 // Device enumeration/open/close/free
-touchmouse_device_info* touchmouse_enumerate_devices(void);
-void touchmouse_free_enumeration(touchmouse_device_info *devs);
-int touchmouse_open(touchmouse_device **dev, touchmouse_device_info *dev_info);
-int touchmouse_close(touchmouse_device *dev);
+TOUCHMOUSEAPI touchmouse_device_info* touchmouse_enumerate_devices(void);
+TOUCHMOUSEAPI void touchmouse_free_enumeration(touchmouse_device_info *devs);
+TOUCHMOUSEAPI int touchmouse_open(touchmouse_device **dev, touchmouse_device_info *dev_info);
+TOUCHMOUSEAPI int touchmouse_close(touchmouse_device *dev);
 
 // Set mouse mode.
-int touchmouse_set_device_mode(touchmouse_device *dev, touchmouse_mode mode);
+TOUCHMOUSEAPI int touchmouse_set_device_mode(touchmouse_device *dev, touchmouse_mode mode);
 
 // Register callback for touch image updates
-int touchmouse_set_image_update_callback(touchmouse_device *dev, touchmouse_image_callback callback);
+TOUCHMOUSEAPI int touchmouse_set_image_update_callback(touchmouse_device *dev, touchmouse_image_callback callback);
 
 // Allow for setting a piece of user-defined data to be provided in the callback.
-int touchmouse_set_device_userdata(touchmouse_device *dev, void *userdata);
+TOUCHMOUSEAPI int touchmouse_set_device_userdata(touchmouse_device *dev, void *userdata);
 
 // Process events for a device.
 // milliseconds < 0 means "block until you have new data and trigger the callback, then return."
 // milliseconds = 0 means "trigger the callback if you have the data waiting, otherwise request data async and return immediately"
 // milliseconds > 0 means "fetch data.  Trigger a callback if the data arrives within <arg> milliseconds, otherwise return."
-int touchmouse_process_events_timeout(touchmouse_device *dev, int milliseconds);
+TOUCHMOUSEAPI int touchmouse_process_events_timeout(touchmouse_device *dev, int milliseconds);
 
 #endif /* __LIBTOUCHMOUSE_H__ */