You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

366 lines
9.8 KiB

  1. #
  2. # Copyright (C) 2015-2018 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=libupm
  9. PKG_VERSION:=2.0.0
  10. PKG_RELEASE:=5
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://codeload.github.com/intel-iot-devkit/upm/tar.gz/v$(PKG_VERSION)?
  13. PKG_HASH:=7dd2f4165b71e071d100b58d6a392f3cf57b0f257c82ffabf49e931b5ed6bc23
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/upm-$(PKG_VERSION)
  15. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>, Hirokazu MORIKAWA <morikw2@gmail.com>
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=LICENSE
  18. CMAKE_INSTALL:=1
  19. CMAKE_BINARY_SUBDIR:=build
  20. PKG_USE_MIPS16:=0
  21. PYTHON3_PKG_BUILD:=0
  22. include $(INCLUDE_DIR)/package.mk
  23. include ../../devel/ninja/ninja-cmake.mk
  24. include ../../lang/python/python3-package.mk
  25. UPM_MODULES:= \
  26. a110x abp ad8232 adafruitms1438 adafruitss adc121c021 adis16448 ads1x15 adxl335 adxl345 \
  27. adxrs610 am2315 apa102 apds9002 apds9930 at42qt1070 bh1749 bh1750 bh1792 biss0001 bma220 \
  28. bma250e bmg160 bmi160 bmm150 bmp280 bmpx8x bmx055 bno055 button buzzer cjq4435 collision \
  29. cwlsxxa dfrec dfrorp dfrph ds1307 ds1808lc ds18b20 ds2413 ecezo ecs1030 \
  30. ehr eldriver electromagnet emg enc03r flex gas gp2y0a gprs \
  31. gsr guvas12d h3lis331dl hcsr04 hdc1000 hdxxvxta hka5 hlg150h hm11 hmc5883l hmtrp hp20x \
  32. ht9170 htu21d hx711 ili9341 ims ina132 interfaces isd1820 itg3200 jhd1313m1 joystick12 kx122 \
  33. kxcjk1013 kxtj3 l298 l3gd20 lcd lcdks lcm1602 ldt0028 led lidarlitev3 light linefinder lis2ds12 \
  34. lis3dh lm35 lol loudness lp8860 lpd8806 lsm303agr lsm303d lsm303dlh lsm6ds3h lsm6dsl lsm9ds0 \
  35. m24lr64e mag3110 max30100 max31723 max31855 max44000 max44009 max5487 maxds3231m maxsonarez \
  36. mb704x mcp2515 mcp9808 md mg811 mhz16 mic micsv89 mlx90614 mma7361 mma7455 mma7660 mma8x5x \
  37. mmc35240 moisture mpl3115a2 mpr121 mpu9150 mq303a ms5611 ms5803 my9221 nlgpio16 nmea_gps \
  38. nrf24l01 nrf8001 nunchuck o2 otp538u p9813 pca9685 pn532 ppd42ns pulsensor relay rf22 \
  39. rfr359f rgbringcoder rhusb rn2903 rotary rotaryencoder rpr220 rsc scam sensortemplate \
  40. servo sht1x si1132 si114x si7005 slide sm130 smartdrive speaker ssd1351 st7735 stepmotor \
  41. sx1276 sx6119 t6713 ta12200 tca9548a tcs3414cs tcs37727 teams temperature \
  42. tex00 th02 tm1637 tmp006 tsl2561 ttp223 uartat uln200xa ultrasonic urm37 utilities vdiv \
  43. veml6070 water waterlevel wfs wheelencoder wt5001 xbee yg1006 zfm20 \
  44. vcap t3311 hwxpxx h803x ozw curieimu
  45. # (require libbacnet) tb7300 t8100 e50hx bacnetmstp
  46. # (require libtinyb) 2jciebu01_ble 2jciebu01_usb
  47. CMAKE_OPTIONS += \
  48. -DBUILDSWIGNODE=OFF \
  49. -DPYTHON2LIBS_FOUND=FALSE \
  50. -DPYTHON2INTERP_FOUND=FALSE \
  51. define Package/libupm/Default
  52. SECTION:=libs
  53. CATEGORY:=Libraries
  54. SUBMENU:=IoT
  55. URL:=https://github.com/intel-iot-devkit/upm
  56. DEPENDS:=+libmraa +librt
  57. endef
  58. define Package/libupm/Default/description
  59. UPM is a high level repository that provides software drivers for a wide variety
  60. of commonly used sensors and actuators. These software drivers interact with the
  61. underlying hardware platform through calls to MRAA APIs.
  62. MRAA that allows you to use various sensors on platforms such as the Intel Galileo,
  63. Intel Edison, Minnowboard MAX and others.
  64. endef
  65. define Package/libupm
  66. $(call Package/libupm/Default)
  67. TITLE:=Intel IoT sensor library - Full
  68. DEPENDS+=+libjpeg +libmodbus +openzwave
  69. DEPENDS+= $(foreach module, $(UPM_MODULES), +libupm-$(module))
  70. DEPENDS+= $(foreach module, $(UPM_MODULES), +libupm-$(module)-python3)
  71. endef
  72. define Package/libupm/description
  73. $(call Package/libupm/Default/description)
  74. This package contains sensor libraries
  75. endef
  76. define Package/libupm/install/Default
  77. $(INSTALL_DIR) $(1)/usr/lib/
  78. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libupm*-$(2).so* $(1)/usr/lib/ ;
  79. endef
  80. define Package/libupm/install/Default-python3
  81. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm
  82. $(CP) $(CMAKE_BINARY_DIR)/$(if $(filter interfaces, $(2)),,src/)$(2)/python$(PYTHON3_VERSION)/pyupm_$(2).py \
  83. $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm/
  84. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm/_pyupm_$(2).so \
  85. $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm/ ;
  86. endef
  87. define Package/libupm/install
  88. $(foreach module, $(UPM_MODULES), \
  89. $(call Package/libupm/install/Default,$(1),$(module)) \
  90. $(call Package/libupm/install/Default-python3,$(1),$(module)))
  91. endef
  92. define UpmPackage
  93. define UpmPackage/depends
  94. ifeq ($$(1),adafruitms1438)
  95. DEPENDS+=+libupm-pca9685
  96. endif
  97. ifeq ($$(1),ads1x15)
  98. DEPENDS+=+libupm-interfaces
  99. endif
  100. ifeq ($$(1),apa102)
  101. DEPENDS+=+libupm-utilities
  102. endif
  103. ifeq ($(1),bh1749)
  104. DEPENDS+=+libupm-utilities
  105. endif
  106. ifeq ($$(1),bh1750)
  107. DEPENDS+=+libupm-utilities
  108. endif
  109. ifeq ($(1),bh1792)
  110. DEPENDS+=+libupm-utilities
  111. endif
  112. ifeq ($$(1),bma250e)
  113. DEPENDS+=+libupm-utilities
  114. endif
  115. ifeq ($$(1),bmg160)
  116. DEPENDS+=+libupm-utilities
  117. endif
  118. ifeq ($$(1),bmi160)
  119. DEPENDS+=+libupm-utilities
  120. endif
  121. ifeq ($$(1),bmm150)
  122. DEPENDS+=+libupm-utilities
  123. endif
  124. ifeq ($$(1),bmp280)
  125. DEPENDS+=+libupm-interfaces +libupm-utilities
  126. endif
  127. ifeq ($$(1),bmpx8x)
  128. DEPENDS+=+libupm-interfaces +libupm-utilities
  129. endif
  130. ifeq ($$(1),bmx055)
  131. DEPENDS+=+libupm-utilities +libupm-bma250e +libupm-bmg160 +libupm-bmm150
  132. endif
  133. ifeq ($$(1),bno055)
  134. DEPENDS+=+libupm-utilities
  135. endif
  136. ifeq ($$(1),buzzer)
  137. DEPENDS+=+libupm-utilities
  138. endif
  139. ifeq ($$(1),cjq4435)
  140. DEPENDS+=+libupm-utilities
  141. endif
  142. ifeq ($$(1),dfrec)
  143. DEPENDS+=+libupm-utilities +libupm-ds18b20
  144. endif
  145. ifeq ($$(1),ds18b20)
  146. DEPENDS+=+libupm-utilities
  147. endif
  148. ifeq ($$(1),dfrorp)
  149. DEPENDS+=+libupm-utilities
  150. endif
  151. ifeq ($$(1),ds1808lc)
  152. DEPENDS+=+libupm-interfaces
  153. endif
  154. ifeq ($$(1),ecezo)
  155. DEPENDS+=+libupm-utilities
  156. endif
  157. ifeq ($$(1),enc03r)
  158. DEPENDS+=+libupm-utilities
  159. endif
  160. ifeq ($$(1),guvas12d)
  161. DEPENDS+=+libupm-utilities
  162. endif
  163. ifeq ($$(1),hcsr04)
  164. DEPENDS+=+libupm-utilities
  165. endif
  166. ifeq ($$(1),hka5)
  167. DEPENDS+=+libupm-utilities
  168. endif
  169. ifeq ($$(1),hlg150h)
  170. DEPENDS+=+libupm-interfaces
  171. endif
  172. ifeq ($$(1),ims)
  173. DEPENDS+=+libupm-utilities
  174. endif
  175. ifeq ($$(1),jhd1313m1)
  176. DEPENDS+=+libupm-utilities +libupm-lcm1602
  177. endif
  178. ifeq ($$(1),kxtj3)
  179. DEPENDS+=+libupm-utilities
  180. endif
  181. ifeq ($$(1),lcm1602)
  182. DEPENDS+=+libupm-utilities
  183. endif
  184. ifeq ($$(1),lcdks)
  185. DEPENDS+=+libupm-utilities +libupm-lcm1602
  186. endif
  187. ifeq ($$(1),lis2ds12)
  188. DEPENDS+=+libupm-utilities
  189. endif
  190. ifeq ($$(1),lis3dh)
  191. DEPENDS+=+libupm-utilities
  192. endif
  193. ifeq ($$(1),lp8860)
  194. DEPENDS+=+libupm-interfaces
  195. endif
  196. ifeq ($$(1),lsm303agr)
  197. DEPENDS+=+libupm-utilities
  198. endif
  199. ifeq ($$(1),lsm303d)
  200. DEPENDS+=+libupm-utilities
  201. endif
  202. ifeq ($$(1),lsm6ds3h)
  203. DEPENDS+=+libupm-utilities
  204. endif
  205. ifeq ($$(1),lsm6dsl)
  206. DEPENDS+=+libupm-utilities
  207. endif
  208. ifeq ($$(1),m24lr64e)
  209. DEPENDS+=+libupm-utilities
  210. endif
  211. ifeq ($$(1),max30100)
  212. DEPENDS+=+libupm-utilities
  213. endif
  214. ifeq ($$(1),max44009)
  215. DEPENDS+=+libupm-interfaces
  216. endif
  217. ifeq ($$(1),mb704x)
  218. DEPENDS+=+libupm-utilities
  219. endif
  220. ifeq ($$(1),mcp2515)
  221. DEPENDS+=+libupm-utilities
  222. endif
  223. ifeq ($$(1),md)
  224. DEPENDS+=+libupm-utilities
  225. endif
  226. ifeq ($$(1),mma7361)
  227. DEPENDS+=+libupm-utilities
  228. endif
  229. ifeq ($$(1),ms5611)
  230. DEPENDS+=+libupm-interfaces
  231. endif
  232. ifeq ($$(1),ms5803)
  233. DEPENDS+=+libupm-utilities
  234. endif
  235. ifeq ($$(1),my9221)
  236. DEPENDS+=+libupm-utilities
  237. endif
  238. ifeq ($$(1),nmea_gps)
  239. DEPENDS+=+libupm-utilities +libatomic
  240. endif
  241. ifeq ($$(1),nunchuck)
  242. DEPENDS+=+libupm-utilities
  243. endif
  244. ifeq ($$(1),otp538u)
  245. DEPENDS+=+libupm-utilities
  246. endif
  247. ifeq ($$(1),p9813)
  248. DEPENDS+=+libupm-utilities
  249. endif
  250. ifeq ($$(1),ppd42ns)
  251. DEPENDS+=+libupm-utilities
  252. endif
  253. ifeq ($$(1),rn2903)
  254. DEPENDS+=+libupm-utilities
  255. endif
  256. ifeq ($$(1),rsc)
  257. DEPENDS+=+libupm-utilities
  258. endif
  259. ifeq ($$(1),servo)
  260. DEPENDS+=+libupm-utilities
  261. endif
  262. ifeq ($$(1),sht1x)
  263. DEPENDS+=+libupm-utilities
  264. endif
  265. ifeq ($$(1),si1132)
  266. DEPENDS+=+libupm-interfaces
  267. endif
  268. ifeq ($$(1),si7005)
  269. DEPENDS+=+libupm-interfaces
  270. endif
  271. ifeq ($$(1),speaker)
  272. DEPENDS+=+libupm-utilities
  273. endif
  274. ifeq ($$(1),t6713)
  275. DEPENDS+=+libupm-interfaces
  276. endif
  277. ifeq ($$(1),tsl2561)
  278. DEPENDS+=+libupm-utilities
  279. endif
  280. ifeq ($$(1),uartat)
  281. DEPENDS+=+libupm-utilities
  282. endif
  283. ifeq ($$(1),uln200xa)
  284. DEPENDS+=+libupm-utilities
  285. endif
  286. ifeq ($$(1),urm37)
  287. DEPENDS+=+libupm-utilities
  288. endif
  289. ifeq ($$(1),wfs)
  290. DEPENDS+=+libupm-utilities
  291. endif
  292. ifeq ($$(1),zfm20)
  293. DEPENDS+=+libupm-utilities
  294. endif
  295. ifeq ($$(1),vcap)
  296. DEPENDS+=+libjpeg
  297. endif
  298. ifeq ($$(1),t3311)
  299. DEPENDS+=+libmodbus
  300. endif
  301. ifeq ($$(1),ozw)
  302. DEPENDS+=+openzwave
  303. endif
  304. ifeq ($$(1),hwxpxx)
  305. DEPENDS+=+libmodbus
  306. endif
  307. ifeq ($$(1),h803x)
  308. DEPENDS+=+libmodbus
  309. endif
  310. endef
  311. define Package/libupm-$(1)
  312. $(call Package/libupm/Default)
  313. $(call UpmPackage/depends,$(1))
  314. TITLE:=$(1) C/C++ library
  315. endef
  316. define Package/libupm-$(1)/description
  317. $(call Package/libupm/Default/description)
  318. This package contains $(1) sensor C/C++ library
  319. endef
  320. define Package/libupm-$(1)-python3
  321. $(call Package/libupm/Default)
  322. $(call UpmPackage/depends,$(1))
  323. TITLE:=$(1) Python3 library
  324. DEPENDS+=+libupm-$(1) +libmraa-python3 +python3-light
  325. endef
  326. define Package/libupm-$(1)-python3/description
  327. $(call Package/libupm/Default/description)
  328. This package contains $(1) sensor Python3 library
  329. endef
  330. define Package/libupm-$(1)/install
  331. $(call Package/libupm/install/Default,$$(1),$(1))
  332. endef
  333. define Package/libupm-$(1)-python3/install
  334. $(call Package/libupm/install/Default-python3,$$(1),$(1))
  335. endef
  336. endef
  337. $(eval $(call BuildPackage,libupm))
  338. $(foreach module, $(UPM_MODULES), \
  339. $(eval $(call UpmPackage,$(module))) \
  340. $(eval $(call BuildPackage,libupm-$(module))) \
  341. $(eval $(call BuildPackage,libupm-$(module)-python3)))