From 42fb6a9474cb189d62d895bbc65185d7223ca564 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 06:26:27 -0400 Subject: Remove old Makefile --- Makefile | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 594d5ee..0000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CFLAGS=-O2 -CFLAGS+=-g -Wall -Werror -# -# Detect if we're on windows or linux: -# -ifeq ($(OS),Windows_NT) - CC=g++ - CFLAGS+= - LIBS+=-static-libgcc -lsetupapi - EXE=.exe -else - CC=gcc - CFLAGS+=`pkg-config --cflags libudev` - LIBS+=`pkg-config --libs libudev` - EXE= -endif - -all: - ${CC} ${CFLAGS} test/test.c libusbhp/libusbhp.c -o detect${EXE} ${LIBS} -- cgit v1.2.3 From 3f8cf55f143828a4ada0b2446ea6fcdcf595ed60 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 06:40:17 -0400 Subject: Fixed compilation with autotools. --- .gitignore | 37 ++++++++++++++++++++++++++++++------- configure.in | 2 +- libusbhp/libusbhp.cc | 15 ++++++++++++--- libusbhp/libusbhp.h | 8 ++++++++ test/Makefile.am | 3 ++- 5 files changed, 53 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 8ab65e4..1ddc311 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,30 @@ -Debug -test/Debug -libusbhp/Debug -libusbhp.sdf -libusbhp.v11.suo -*~ -*.o \ No newline at end of file +Debug +test/Debug +libusbhp/Debug +libusbhp.sdf +libusbhp.v11.suo +*~ +*.o +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +depcomp +install-sh +libtool +libusbhp.pc +.deps +.libs +*.la +*.lo +ltmain.sh +missing +stamp-h1 +test/test \ No newline at end of file diff --git a/configure.in b/configure.in index 1eb7256..45bd8ef 100644 --- a/configure.in +++ b/configure.in @@ -25,7 +25,7 @@ fi dnl ====================== dnl Check for udev library dnl ====================== -PKG_CHECK_MODULES(UDEV, udev >= 147) +PKG_CHECK_MODULES(UDEV, libudev >= 147) AC_PROG_CXX diff --git a/libusbhp/libusbhp.cc b/libusbhp/libusbhp.cc index 9e79220..4058c10 100644 --- a/libusbhp/libusbhp.cc +++ b/libusbhp/libusbhp.cc @@ -28,7 +28,6 @@ #ifdef __linux__ #include -#include #include #include #include @@ -53,7 +52,13 @@ #endif/*_WIN32*/ +#ifdef __cplusplus +extern "C" { +#endif + #ifdef __linux__ +#include + struct dev_list_t { char *path; unsigned short vid; @@ -105,13 +110,13 @@ static void dev_list_add(struct libusbhp_t *h, const char *path, static int dev_list_remove(struct libusbhp_t *h, const char *path) { struct dev_list_t *p = h->devlist; - if(!p) return; + if(!p) return 1; if(!strcmp(p->path, path)) { h->devlist = p->next; free(p->path); free(p); - return; + return 0; } while(p->next) { @@ -438,3 +443,7 @@ void libusbhp_register_hotplug_listeners(struct libusbhp_t *handle, handle->detach = disconnected_cb; handle->user_data = user_data; } + +#ifdef __cplusplus +} +#endif diff --git a/libusbhp/libusbhp.h b/libusbhp/libusbhp.h index ccf7125..7622576 100644 --- a/libusbhp/libusbhp.h +++ b/libusbhp/libusbhp.h @@ -41,6 +41,11 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct libusbhp_t; struct libusbhp_device_t { @@ -66,6 +71,9 @@ EXPORT libusbhp_hotplug_cb_fn disconnected_cb, void *user_data); +#ifdef __cplusplus +} +#endif /*** // Libusbx implementation: diff --git a/test/Makefile.am b/test/Makefile.am index 00229f7..43ad6b4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,7 @@ bin_PROGRAMS = test -test_LDADD = ../libusbhp/libusbhp.la +test_LDADD = $(UDEV_LIBS) ../libusbhp/libusbhp.la +test_CXXFLAGS = -I../libusbhp $(UDEV_CFLAGS) test_SOURCES = \ test.cc -- cgit v1.2.3 From 0ec3859e17e1b61498ddc6c4d3999e4dbb93b83b Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 06:40:53 -0400 Subject: Version bump --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 45bd8ef..46627f0 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ AC_INIT(libusbhp/libusbhp.cc) -AM_INIT_AUTOMAKE( libusbhp, 1.0 ) +AM_INIT_AUTOMAKE( libusbhp, 1.0.1 ) dnl ====================== dnl Init pkg-config -- cgit v1.2.3 From e67e496e7a2a4f757dac328f04a05b53c0653da5 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 07:51:17 -0400 Subject: Rename test file to avoid name collision. --- test/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index 43ad6b4..4642f7d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,8 +1,8 @@ -bin_PROGRAMS = test +bin_PROGRAMS = hptest -test_LDADD = $(UDEV_LIBS) ../libusbhp/libusbhp.la -test_CXXFLAGS = -I../libusbhp $(UDEV_CFLAGS) -test_SOURCES = \ +hptest_LDADD = $(UDEV_LIBS) ../libusbhp/libusbhp.la +hptest_CXXFLAGS = -I../libusbhp $(UDEV_CFLAGS) +hptest_SOURCES = \ test.cc include_HEADERS = -- cgit v1.2.3 From 0035e5cc347a07827808ee99a1ecbd4640a4b37c Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 13:16:45 +0100 Subject: Fix release build in visual studio. --- .gitignore | 3 +-- libusbhp/libusbhp.vcxproj | 3 ++- test/test.vcxproj | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1ddc311..96ed07b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ +Release Debug -test/Debug -libusbhp/Debug libusbhp.sdf libusbhp.v11.suo *~ diff --git a/libusbhp/libusbhp.vcxproj b/libusbhp/libusbhp.vcxproj index fd5527c..6dca199 100644 --- a/libusbhp/libusbhp.vcxproj +++ b/libusbhp/libusbhp.vcxproj @@ -73,13 +73,14 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUSBHOTPLUG_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUSBHOTPLUG_EXPORTS;BUILD_DLL;%(PreprocessorDefinitions) Windows true true true + setupapi.lib;%(AdditionalDependencies) diff --git a/test/test.vcxproj b/test/test.vcxproj index be61eef..db858cd 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -52,6 +52,7 @@ false + ../libusbhp;$(IncludePath) -- cgit v1.2.3 From b8c9e442a9313f27670dcae97757b3c416ac263d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 08:21:05 -0400 Subject: Added visual studio project files to dist. --- Makefile.am | 2 +- libusbhp/Makefile.am | 2 ++ test/Makefile.am | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 595ab88..80c40a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = gnu SUBDIRS = libusbhp test DISTDIRS = libusbhp test -EXTRA_DIST = libusbhp.pc.in +EXTRA_DIST = libusbhp.pc.in libusbhp.sln pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libusbhp.pc diff --git a/libusbhp/Makefile.am b/libusbhp/Makefile.am index 785a34d..e24a51f 100644 --- a/libusbhp/Makefile.am +++ b/libusbhp/Makefile.am @@ -8,3 +8,5 @@ libusbhp_la_SOURCES = \ include_HEADERS = \ libusbhp.h + +EXTRA_DIST = libusbhp.vcxproj \ No newline at end of file diff --git a/test/Makefile.am b/test/Makefile.am index 4642f7d..5725160 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -6,3 +6,5 @@ hptest_SOURCES = \ test.cc include_HEADERS = + +EXTRA_DIST = test.vcxproj -- cgit v1.2.3