diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-02-19 00:06:20 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-02-19 00:06:20 +0100 |
commit | 876d6f498bbf358a23b47edaf8b0d967724b1b94 (patch) | |
tree | 01f50dcb0fc680bbad756f6d4d2bf8a9e791530e | |
parent | 9bfdbb1d569eea229fd9f10823891234c8676145 (diff) | |
download | k8055-876d6f498bbf358a23b47edaf8b0d967724b1b94.zip k8055-876d6f498bbf358a23b47edaf8b0d967724b1b94.tar.gz |
libk8055 uses cmake
-rw-r--r-- | CMakeLists.txt | 37 | ||||
-rw-r--r-- | Makefile | 72 | ||||
-rw-r--r-- | libk8055/CMakeLists.txt | 24 | ||||
-rw-r--r-- | libk8055/k8055.1.gz (renamed from man/k8055.1.gz) | bin | 1843 -> 1843 bytes | |||
-rw-r--r-- | libk8055/k8055.h (renamed from k8055.h) | 0 | ||||
-rw-r--r-- | libk8055/libk8055.c (renamed from libk8055.c) | 0 | ||||
-rw-r--r-- | libk8055/main.c (renamed from main.c) | 0 | ||||
-rwxr-xr-x | libk8055/test | 4 |
8 files changed, 65 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d64eeca --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,37 @@ +# +# CMAKE SETUP +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +# +# PROJECT INFO +# +PROJECT(libk8055) +SET(VERSION_MAJOR "0") +SET(VERSION_MINOR "4") +SET(VERSION_PATCH "2") +SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") +ADD_DEFINITIONS(-DVERSION="${VERSION}") +# +# CONFIG OPTIONS +# +OPTION(WANT_DEBUG "build with debug information" OFF) +IF(WANT_DEBUG) + SET(CMAKE_BUILD_TYPE Debug) +ELSE() + SET(CMAKE_BUILD_TYPE Release) +ENDIF() +SET(CMAKE_CXX_FLAGS "-O2 -fno-implement-inlines") +SET(CMAKE_CXX_FLAGS_RELEASE "") +SET(CMAKE_CXX_FLAGS_DEBUG "-g ") +# +# HEADER LIBRARY FUNCTIONS +# +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) +CHECK_INCLUDE_FILES(usb.h HAVE_USB_H) +CHECK_INCLUDE_FILES(string.h HAVE_STRING_H) +CHECK_INCLUDE_FILES(stdio.h HAVE_STDIO_H) +CHECK_INCLUDE_FILES(assert.h HAVE_ASSERT_H) +CHECK_INCLUDE_FILES(math.h HAVE_MATH_H) +ADD_SUBDIRECTORY(libk8055) +# diff --git a/Makefile b/Makefile deleted file mode 100644 index e647ae1..0000000 --- a/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# $Id: Makefile,v 1.5 2008/05/21 20:22:44 mr_brain Exp $ -# -# Simple makefile for the libk8055 library -# -# change this to your distribution default -# usually /usr/local or /usr -PREFIX = ?/usr/local -CC = gcc -EXEC = k8055 -VERSION =0.4.1 -BINDIR = $(PREFIX)/bin -LIBDIR = $(PREFIX)/lib -PYLIBDIR = pyk8055 -INCLUDEDIR = $(PREFIX)/include -MANDIR = $(PREFIX)/man/man1 -OBJS = main.o libk8055.o -CFLAGS = -O2 -DDAEMON -DVERSION='"$(VERSION)"' -Wall -LIBS = -lusb -L/usr/lib -lm -LINK = ln - -libk8055.so.$(VERSION): libk8055.o - $(CC) -o libk8055.so.${VERSION} $(LIBS) -shared libk8055.o - -$(LINK) -sf libk8055.so.${VERSION} libk8055.so - -libk8055.o: libk8055.c - $(CC) $(CFLAGS) -c -g -fPIC libk8055.c - -libk8055.a: libk8055.o - ar rvs libk8055.a libk8055.o - -libk8055.c: k8055.h - -all: k8055_prog libk8055.so.${VERSION} libk8055.a - -.PHONY: k8055_prog - -k8055_prog: $(OBJS) - $(CC) $(OBJS) -o $(EXEC) $(LIBS) - # strip $(EXEC) - -pylib: $(PYLIBDIR)/libk8055.i libk8055.c - export VERSION=$(VERSION); $(MAKE) -C $(PYLIBDIR) - -clean: - rm -f *.o libk8055.so libk8055.so.$(VERSION) $(EXEC) libk8055.a - @$(MAKE) -C $(PYLIBDIR) clean - -install: k8055_prog libk8055.so.$(VERSION) - cp -f $(EXEC) $(BINDIR)/ - if !(test -d $(LIBDIR)); then \ - mkdir -p $(LIBDIR); \ - fi - if !(test -d $(INCLUDEDIR)); then \ - mkdir -p $(INCLUDEDIR); \ - fi - rm -f $(LIBDIR)/libk8055* - cp -Pf lib* $(LIBDIR) - cp -f k8055.h $(INCLUDEDIR) - if !(test -d $(MANDIR)); then \ - mkdir -p $(MANDIR); \ - fi - cp -f man/k8055.1.gz $(MANDIR)/ - -pyinstall: $(PYLIBDIR)/libk8055.i - @$(MAKE) -C $(PYLIBDIR) install - -uninstall: - rm -f $(BINDIR)/$(EXEC) $(LIBDIR)/libk8055* $(INCLUDEDIR)/k8055.h - -test: k8055_prog - -@killall $(EXEC) - ./$(EXEC) diff --git a/libk8055/CMakeLists.txt b/libk8055/CMakeLists.txt new file mode 100644 index 0000000..62398ff --- /dev/null +++ b/libk8055/CMakeLists.txt @@ -0,0 +1,24 @@ + +ADD_LIBRARY( k8055-${VERSION} SHARED libk8055.c ) +ADD_LIBRARY( k8055-static-${VERSION} STATIC libk8055.c ) +INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ) +TARGET_LINK_LIBRARIES( k8055-${VERSION} + usb + m +) +SET_TARGET_PROPERTIES(k8055-${VERSION} PROPERTIES PUBLIC_HEADER k8055.h ) + +INSTALL(TARGETS k8055-${VERSION} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include +) + +ADD_EXECUTABLE(k8055 WIN32 MACOSX_BUNDLE main.c ) +TARGET_LINK_LIBRARIES(k8055 + k8055-${VERSION} +) +ADD_DEPENDENCIES(k8055 k8055-${VERSION}) + +INSTALL(TARGETS k8055 RUNTIME DESTINATION bin BUNDLE DESTINATION bin ) +INSTALL(FILES k8055.1.gz DESTINATION man/man1/ ) diff --git a/man/k8055.1.gz b/libk8055/k8055.1.gz Binary files differindex 042fdf4..042fdf4 100644 --- a/man/k8055.1.gz +++ b/libk8055/k8055.1.gz diff --git a/k8055.h b/libk8055/k8055.h index 4d5ae81..4d5ae81 100644 --- a/k8055.h +++ b/libk8055/k8055.h diff --git a/libk8055.c b/libk8055/libk8055.c index 9556294..9556294 100644 --- a/libk8055.c +++ b/libk8055/libk8055.c diff --git a/libk8055/test b/libk8055/test new file mode 100755 index 0000000..bb46807 --- /dev/null +++ b/libk8055/test @@ -0,0 +1,4 @@ +#! /bin/bash +cpt=0 +while [ $cpt -lt 256 ]; do ./build/libk8055/k8055 -d:$cpt -a1:$cpt -a2:$cpt; ((cpt=cpt+1)); done +./build/libk8055/k8055 -d:0 -a1:0 -a2:0 |