Introduce nnkit_add_action and nnkit_add_backend (#238)
author박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 23 May 2018 06:45:41 +0000 (15:45 +0900)
committer오형석/동작제어Lab(SR)/Senior Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 23 May 2018 06:45:41 +0000 (15:45 +0900)
This commit introduces nnkit_add_action and nnkit_add_backend macros
which passes --whole-archive linker option to permit self-registration.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/nnkit/CMakeLists.txt

index f7c6b56..d470150 100644 (file)
@@ -1 +1,12 @@
+# Pass --whole-archive to linker in order to permit self-registration
+macro(nnkit_add_action PREFIX)
+  add_library(${PREFIX} ${ARGN})
+  set_property(TARGET ${PREFIX} PROPERTY INTERFACE_LINK_LIBRARIES -Wl,--whole-archive,$<TARGET_FILE:${PREFIX}>,--no-whole-archive)
+endmacro(nnkit_add_action)
+
+macro(nnkit_add_backend PREFIX)
+  add_library(${PREFIX} ${ARGN})
+  set_property(TARGET ${PREFIX} PROPERTY INTERFACE_LINK_LIBRARIES -Wl,--whole-archive,$<TARGET_FILE:${PREFIX}>,--no-whole-archive)
+endmacro(nnkit_add_backend)
+
 add_subdirectory(tools)