Skip to content

Commit

Permalink
Add lua bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Mar 25, 2024
1 parent e87ef60 commit 0d6e498
Show file tree
Hide file tree
Showing 5 changed files with 923 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ OPTION (ENABLE_PERL "Build the perl bindings?" OFF)
OPTION (ENABLE_PYTHON "Build the python bindings?" OFF)
OPTION (ENABLE_RUBY "Build the ruby bindings?" OFF)
OPTION (ENABLE_TCL "Build the Tcl bindings?" OFF)
OPTION (ENABLE_LUA "Build the lua bindings?" OFF)

OPTION (USE_VENDORDIRS "Install the bindings in vendor directories?" OFF)

Expand Down Expand Up @@ -326,6 +327,7 @@ SET (PACKAGE "libsolv")
SET (VERSION "${LIBSOLV_MAJOR}.${LIBSOLV_MINOR}.${LIBSOLV_PATCH}")

ADD_DEFINITIONS (-D_FILE_OFFSET_BITS=64)
#ADD_DEFINITIONS (-D_TIME_BITS=64)
CONFIGURE_FILE (src/solvversion.h.in src/solvversion.h)

SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Package dependency solver library")
Expand Down
3 changes: 3 additions & 0 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ ENDIF (ENABLE_RUBY)
IF (ENABLE_TCL)
ADD_SUBDIRECTORY (tcl)
ENDIF (ENABLE_TCL)
IF (ENABLE_LUA)
ADD_SUBDIRECTORY (lua)
ENDIF (ENABLE_LUA)
21 changes: 21 additions & 0 deletions bindings/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FIND_PACKAGE (Lua)

ADD_CUSTOM_COMMAND (
OUTPUT solv_lua.c
COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} -lua -I${CMAKE_SOURCE_DIR}/src -o solv_lua.c ${CMAKE_SOURCE_DIR}/bindings/solv.i
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_SOURCE_DIR}/bindings/solv.i
)

INCLUDE_DIRECTORIES (${LUA_INCLUDE_DIR})
IF (NOT LUA_INSTALL_DIR)
SET(LUA_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/lua/${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR})
ENDIF (NOT LUA_INSTALL_DIR)

MESSAGE (STATUS "Lua installation dir: ${LUA_INSTALL_DIR}")

ADD_LIBRARY (bindings_lua SHARED solv_lua.c)
SET_TARGET_PROPERTIES (bindings_lua PROPERTIES PREFIX "" OUTPUT_NAME "solv" INSTALL_NAME_DIR "${LUA_INSTALL_DIR}")
TARGET_LINK_LIBRARIES (bindings_lua libsolvext libsolv ${LUA_LIBRARY} ${SYSTEM_LIBRARIES})
INSTALL (TARGETS bindings_lua LIBRARY DESTINATION ${LUA_INSTALL_DIR})

Loading

0 comments on commit 0d6e498

Please sign in to comment.