diff --git a/drivers/linux-gv/Kbuild b/drivers/linux-gv/Kbuild new file mode 100644 index 000000000..9f4bb5e38 --- /dev/null +++ b/drivers/linux-gv/Kbuild @@ -0,0 +1,3 @@ +ccflags-y := $(MODULE_CFLAGS) +obj-m := aravis_gv.o +aravis_gv-y := $(patsubst $(src)/%.c,%.o,$(wildcard $(src)/*.c)) diff --git a/module/aravis-module.c b/drivers/linux-gv/arvgvkmod.c similarity index 100% rename from module/aravis-module.c rename to drivers/linux-gv/arvgvkmod.c diff --git a/drivers/linux-gv/meson.build b/drivers/linux-gv/meson.build new file mode 100644 index 000000000..c6eec3bc6 --- /dev/null +++ b/drivers/linux-gv/meson.build @@ -0,0 +1,13 @@ +gv_mkfile = custom_target('gv_makefile', output:'Makefile', command:['touch', '@OUTPUT@']) + +gv_sources = files([ + 'arvgvkmod.c' +]) + +custom_target ('gv_kmod',input: gv_sources, output: 'aravis_gv.ko', command:[ + 'make', '-j4', '-C', kernel_build_dir, + 'M='+join_paths(meson.current_build_dir()), + 'src='+join_paths(meson.current_source_dir()), + 'MODULE_CFLAGS=-I'+meson.current_source_dir(), + 'modules'], depends:gv_mkfile, build_by_default:true) + diff --git a/drivers/meson.build b/drivers/meson.build new file mode 100644 index 000000000..6256386c1 --- /dev/null +++ b/drivers/meson.build @@ -0,0 +1,12 @@ +if host_machine.system()=='linux' + kernel_version = run_command('uname', '-r').stdout().strip() + kernel_build_dir = join_paths('/', 'lib', 'modules', kernel_version, 'build') + + # test running make in kernel directory, using "make kernelversion" + make_returncode = run_command('make', '-sC', kernel_build_dir, 'kernelversion').returncode() + if make_returncode != 0 + error('Cannot compile kernel modules as requested - are kernel headers installed?') + endif + + subdir('linux-gv') +endif diff --git a/meson.build b/meson.build index 1672167e9..433993026 100644 --- a/meson.build +++ b/meson.build @@ -110,6 +110,10 @@ viewer_deps = aravis_dependencies + [dependency ('gtk+-3.0', version: '>=3.12', subdir ('po', if_found: viewer_deps) subdir ('viewer', if_found: viewer_deps) +if get_option('drivers') + subdir('drivers') +endif + gst_enabled = false gst_option = get_option ('gst-plugin') gst_deps = aravis_dependencies + [dependency ('gstreamer-base-1.0', required: gst_option), diff --git a/meson_options.txt b/meson_options.txt index eba1b30ae..61b94ee8e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -8,6 +8,8 @@ option('packet-socket', type: 'feature', value: 'auto', description : 'Enable pa option('tests', type: 'boolean', value: true, description: 'Build tests') option('fast-heartbeat', type: 'boolean', value: false, description: 'Enable faster heartbeat rate') +option('drivers', type: 'boolean', value: false, description: 'Build linux driver') + # Parameters option('gv-n-buffers', type: 'integer', min: 1, value: 16, description: 'Number of buffers used to receive GVSP packets') diff --git a/module/Makefile b/module/Makefile deleted file mode 100644 index 8553a66d3..000000000 --- a/module/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -ifneq ($(KERNELRELEASE),) - -obj-m := aravis-module.o - -else - -ifeq ($(PREFIX),) -PREFIX := /usr/local -endif - -MODULE := aravis-module -KDIR := /lib/modules/$(shell uname -r)/build -INCLUDE := -isystem $(KDIR)/include -MODCFLAGS := -DMODULE -D__KERNEL__ -Wall $(INCLUDE) - -KMAKE := $(MAKE) -C $(KDIR) SUBDIRS=$$PWD - -modules: $(MODULE).o - -insert_module: install - modprobe -r aravis-module - modprobe aravis-module - -ifneq ($(shell (uname -r | grep 2.6) > /dev/null ; echo -n $$?),0) - echo A 2.6 kernel is required; exit 1 -endif - -# build module - -$(MODULE).o: $(MODULE).c $(MODULE).h - $(KMAKE) modules - - -# Automake rules, as per "Third-Party Makefiles" in the automake manual - -all: $(MODULE).o - -distdir: - cp aravis-module.c $(distdir) - cp aravis-module.h $(distdir) - cp Makefile $(distdir) - -install: - $(KMAKE) modules_install - [ -e /sbin/depmod ] && /sbin/depmod - -install-data: -install-exec: -uninstall: - -install-info: -installdirs: -check: -installcheck: -mostlyclean: -clean: - rm -f aravis-module.ko - rm -f aravis-module.o - rm -f aravis-module.mod.o - rm -f aravis-module.mod.c - rm -f modules.order - rm -f Module.symvers -distclean: clean -maintainer-clean: -dvi: -pdf: -info: -html: -tags: -ctags: - -endif - diff --git a/module/aravis-module.h b/module/aravis-module.h deleted file mode 100644 index e69de29bb..000000000