I’d like to use CMake to generate my Lua wrapper. I used this before to produce python wrapper. I can generate my wrapper.c by running Everything works fine, but I don’t get my wrapper.c. I use the following code:
cmake_minimum_required (VERSION 3.1)
project(lbus_bindings)
#set prefix
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
set (CMAKE_INSTALL_PREFIX "/usr/local")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
set (CMAKE_INSTALL_PREFIX "/opt")
else ()
set (CMAKE_INSTALL_PREFIX "/usr/local")
endif ()
FIND_PACKAGE(SWIG REQUIRED)
find_package(Lua 5.3)
INCLUDE(${SWIG_USE_FILE})
if (LUA_FOUND)
include_directories("${LUA_INCLUDE_DIR}")
endif ()
#configure the compiler
set(CMAKE_C_FLAGS "-Wall -Wextra")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O2")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_SWIG_FLAGS "")
SWIG_ADD_LIBRARY(lbus LANGUAGE lua SOURCES lbus.i sensor_bind.c circ_buff.c lproto_l1_tty.c
serial.c lproto_debug.c lproto_l2.c debug.c lproto_sensors_common.c lib_crc.c)
SWIG_LINK_LIBRARIES(lbus ${LUA_LIBRARIES})