summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt17
1 files changed, 16 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8dd34a..9c2aead 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,7 @@ IF(NOT COMPILE_SUPPORT)
ADD_DEFINITIONS(-DNO_COMPILE)
ENDIF()
+OPTION(DEBUG_SUPPORT "Debug plugin support" ON)
OPTION(FS_SUPPORT "Filesystem plugin support" ON)
OPTION(MATH_SUPPORT "Math plugin support" ON)
OPTION(UBUS_SUPPORT "Ubus plugin support" ON)
@@ -50,7 +51,7 @@ INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(JSONC REQUIRED json-c)
INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
-SET(UCODE_SOURCES lexer.c lib.c vm.c chunk.c vallist.c compiler.c source.c types.c program.c)
+SET(UCODE_SOURCES lexer.c lib.c vm.c chunk.c vallist.c compiler.c source.c types.c program.c platform.c)
ADD_LIBRARY(libucode SHARED ${UCODE_SOURCES})
SET(SOVERSION 0 CACHE STRING "Override ucode library version")
SET_TARGET_PROPERTIES(libucode PROPERTIES OUTPUT_NAME ucode SOVERSION ${SOVERSION})
@@ -89,6 +90,20 @@ UNSET(CMAKE_REQUIRED_LIBRARIES)
SET(LIBRARIES "")
+IF(DEBUG_SUPPORT)
+ SET(LIBRARIES ${LIBRARIES} debug_lib)
+ ADD_LIBRARY(debug_lib MODULE lib/debug.c)
+ SET_TARGET_PROPERTIES(debug_lib PROPERTIES OUTPUT_NAME debug PREFIX "")
+ TARGET_LINK_OPTIONS(debug_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS})
+ FIND_LIBRARY(ubox NAMES ubox)
+ IF(ubox)
+ FIND_PATH(uloop_include_dir NAMES libubox/uloop.h)
+ INCLUDE_DIRECTORIES(${uloop_include_dir})
+ TARGET_LINK_LIBRARIES(debug_lib ${ubox} ${libucode})
+ SET_TARGET_PROPERTIES(debug_lib PROPERTIES COMPILE_DEFINITIONS HAVE_ULOOP)
+ ENDIF()
+ENDIF()
+
IF(FS_SUPPORT)
SET(LIBRARIES ${LIBRARIES} fs_lib)
ADD_LIBRARY(fs_lib MODULE lib/fs.c)