summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--CMakeLists.txt10
-rw-r--r--Makefile29
-rw-r--r--include/uvcgadget/configfs.h (renamed from configfs.h)0
-rw-r--r--include/uvcgadget/events.h (renamed from events.h)0
-rw-r--r--include/uvcgadget/list.h (renamed from list.h)0
-rw-r--r--include/uvcgadget/stream.h (renamed from stream.h)0
-rw-r--r--include/uvcgadget/v4l2-source.h (renamed from v4l2-source.h)0
-rw-r--r--include/uvcgadget/video-source.h (renamed from video-source.h)0
-rw-r--r--lib/CMakeLists.txt17
-rw-r--r--lib/configfs.c (renamed from configfs.c)0
-rw-r--r--lib/events.c (renamed from events.c)0
-rw-r--r--lib/stream.c (renamed from stream.c)0
-rw-r--r--lib/tools.h (renamed from tools.h)0
-rw-r--r--lib/uvc.c (renamed from uvc.c)0
-rw-r--r--lib/uvc.h (renamed from uvc.h)0
-rw-r--r--lib/v4l2-source.c (renamed from v4l2-source.c)0
-rw-r--r--lib/v4l2.c (renamed from v4l2.c)0
-rw-r--r--lib/v4l2.h (renamed from v4l2.h)0
-rw-r--r--lib/video-buffers.c (renamed from video-buffers.c)0
-rw-r--r--lib/video-buffers.h (renamed from video-buffers.h)0
-rw-r--r--lib/video-source.c (renamed from video-source.c)0
22 files changed, 32 insertions, 29 deletions
diff --git a/.gitignore b/.gitignore
index 8f9d710..2a36808 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,7 @@
+*.a
*.o
+CMakeCache.txt
+CMakeFiles
+Makefile
+cmake_install.cmake
uvc-gadget
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..79b78c4
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.0)
+project(uvc-gadget)
+set(CMAKE_BUILD_TYPE Release)
+
+#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -Werror")
+
+add_subdirectory(lib)
+add_executable(uvc-gadget main.c)
+target_link_libraries(uvc-gadget uvcgadget)
+install(TARGETS uvc-gadget DESTINATION bin)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c3db9d3..0000000
--- a/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-CROSS_COMPILE ?=
-ARCH ?= x86
-KERNEL_DIR ?= /usr/src/linux
-
-CC := $(CROSS_COMPILE)gcc
-KERNEL_INCLUDE := -I$(KERNEL_DIR)/include -I$(KERNEL_DIR)/arch/$(ARCH)/include
-CFLAGS := -W -Wall -Wno-unused-parameter -g $(KERNEL_INCLUDE)
-LDFLAGS := -g
-
-OBJS := \
- configfs.o \
- events.o \
- main.o \
- stream.o \
- uvc.o \
- v4l2.o \
- v4l2-source.o \
- video-buffers.o \
- video-source.o
-
-all: uvc-gadget
-
-uvc-gadget: $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $^
-
-clean:
- rm -f *.o
- rm -f uvc-gadget
-
diff --git a/configfs.h b/include/uvcgadget/configfs.h
index e5a7efa..e5a7efa 100644
--- a/configfs.h
+++ b/include/uvcgadget/configfs.h
diff --git a/events.h b/include/uvcgadget/events.h
index b0b8fa8..b0b8fa8 100644
--- a/events.h
+++ b/include/uvcgadget/events.h
diff --git a/list.h b/include/uvcgadget/list.h
index 8854c6e..8854c6e 100644
--- a/list.h
+++ b/include/uvcgadget/list.h
diff --git a/stream.h b/include/uvcgadget/stream.h
index 13779d3..13779d3 100644
--- a/stream.h
+++ b/include/uvcgadget/stream.h
diff --git a/v4l2-source.h b/include/uvcgadget/v4l2-source.h
index 53e28d6..53e28d6 100644
--- a/v4l2-source.h
+++ b/include/uvcgadget/v4l2-source.h
diff --git a/video-source.h b/include/uvcgadget/video-source.h
index fffcba3..fffcba3 100644
--- a/video-source.h
+++ b/include/uvcgadget/video-source.h
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644
index 0000000..c798d3b
--- /dev/null
+++ b/lib/CMakeLists.txt
@@ -0,0 +1,17 @@
+file(GLOB SOURCES "*.c" "*.h")
+file(GLOB HEADERS "../include/uvcgadget/*.h")
+
+add_library(uvcgadget ${SOURCES})
+
+set_target_properties(uvcgadget PROPERTIES PUBLIC_HEADER "${HEADERS}")
+target_include_directories(uvcgadget
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/uvcgadget>
+ $<INSTALL_INTERFACE:include>
+ PRIVATE
+ ${KERNEL_INCLUDE_DIR})
+
+install(TARGETS uvcgadget
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ PUBLIC_HEADER DESTINATION include/uvcgadget)
diff --git a/configfs.c b/lib/configfs.c
index 1dfde95..1dfde95 100644
--- a/configfs.c
+++ b/lib/configfs.c
diff --git a/events.c b/lib/events.c
index 6840c19..6840c19 100644
--- a/events.c
+++ b/lib/events.c
diff --git a/stream.c b/lib/stream.c
index 57745aa..57745aa 100644
--- a/stream.c
+++ b/lib/stream.c
diff --git a/tools.h b/lib/tools.h
index ff2f908..ff2f908 100644
--- a/tools.h
+++ b/lib/tools.h
diff --git a/uvc.c b/lib/uvc.c
index 81d1760..81d1760 100644
--- a/uvc.c
+++ b/lib/uvc.c
diff --git a/uvc.h b/lib/uvc.h
index f73dbff..f73dbff 100644
--- a/uvc.h
+++ b/lib/uvc.h
diff --git a/v4l2-source.c b/lib/v4l2-source.c
index 7eced6a..7eced6a 100644
--- a/v4l2-source.c
+++ b/lib/v4l2-source.c
diff --git a/v4l2.c b/lib/v4l2.c
index 9030270..9030270 100644
--- a/v4l2.c
+++ b/lib/v4l2.c
diff --git a/v4l2.h b/lib/v4l2.h
index 8d7b3c5..8d7b3c5 100644
--- a/v4l2.h
+++ b/lib/v4l2.h
diff --git a/video-buffers.c b/lib/video-buffers.c
index f5dc6ec..f5dc6ec 100644
--- a/video-buffers.c
+++ b/lib/video-buffers.c
diff --git a/video-buffers.h b/lib/video-buffers.h
index 001f75e..001f75e 100644
--- a/video-buffers.h
+++ b/lib/video-buffers.h
diff --git a/video-source.c b/lib/video-source.c
index 06092f5..06092f5 100644
--- a/video-source.c
+++ b/lib/video-source.c