mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
eigen: add hello world
Mention openmp on readme
This commit is contained in:
@@ -11,9 +11,14 @@ KERNEL_MODULE_SITE_METHOD = local
|
||||
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
|
||||
KERNEL_MODULE_DEPENDENCIES += openblas
|
||||
endif
|
||||
ifeq ($(BR2_PACKAGE_EIGEN),y)
|
||||
KERNEL_MODULE_DEPENDENCIES += eigen
|
||||
endif
|
||||
|
||||
define KERNEL_MODULE_BUILD_CMDS
|
||||
$(MAKE) -C '$(@D)/user' $(TARGET_CONFIGURE_OPTS) BR2_PACKAGE_OPENBLAS="$(BR2_PACKAGE_OPENBLAS)"
|
||||
$(MAKE) -C '$(@D)/user' $(TARGET_CONFIGURE_OPTS) \
|
||||
BR2_PACKAGE_OPENBLAS="$(BR2_PACKAGE_OPENBLAS)" \
|
||||
BR2_PACKAGE_EIGEN="$(BR2_PACKAGE_EIGEN)"
|
||||
endef
|
||||
|
||||
define KERNEL_MODULE_INSTALL_TARGET_CMDS
|
||||
|
||||
@@ -10,7 +10,13 @@ OUTS := $(foreach IN_EXT,$(IN_EXT_C) $(IN_EXT_CXX),$(addsuffix $(OUT_EXT), $(bas
|
||||
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
|
||||
LIBS += -lopenblas
|
||||
else
|
||||
OUTS := $(filter-out openblas.out,$(OUTS))
|
||||
OUTS := $(filter-out openblas$(OUT_EXT),$(OUTS))
|
||||
endif
|
||||
ifeq ($(BR2_PACKAGE_EIGEN),y)
|
||||
# Header only.
|
||||
#LIBS += -leigen
|
||||
else
|
||||
OUTS := $(filter-out eigen%$(OUT_EXT),$(OUTS))
|
||||
endif
|
||||
|
||||
all: $(OUTS)
|
||||
|
||||
@@ -30,3 +30,7 @@ These programs can also be compiled and used on host.
|
||||
.. link:ioctl.c[]
|
||||
.. link:netlink.c[]
|
||||
.. link:poll.c[]
|
||||
. Buildroot libraries
|
||||
.. link:eigen.cpp[]
|
||||
.. link:openmp.c[]
|
||||
.. link:openblas.c[]
|
||||
|
||||
14
kernel_module/user/eigen.cpp
Normal file
14
kernel_module/user/eigen.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/* Official hello world. */
|
||||
|
||||
#include <iostream>
|
||||
#include <eigen3/Eigen/Dense>
|
||||
using Eigen::MatrixXd;
|
||||
int main()
|
||||
{
|
||||
MatrixXd m(2,2);
|
||||
m(0,0) = 3;
|
||||
m(1,0) = 2.5;
|
||||
m(0,1) = -1;
|
||||
m(1,1) = m(1,0) + m(0,1);
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user