Skip to content

Commit

Permalink
Merge pull request #24 from satoren/luarocks
Browse files Browse the repository at this point in the history
fix: Build error with luarocks
  • Loading branch information
satoren authored Jan 2, 2021
2 parents 5609326 + fb76c63 commit da014ab
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 27 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/luarocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: luarocks

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
strategy:
fail-fast: false
matrix:
luaVersion: ["5.1", "5.2", "5.3", "luajit"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: leafo/[email protected]
with:
luaVersion: ${{ matrix.luaVersion }}
- uses: leafo/[email protected]
- run: luarocks make
14 changes: 12 additions & 2 deletions lrdb-0.2.4-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ description = {
license = "Boost"
}
dependencies = {
"lua >= 5.1, < 5.4"
"lua >= 5.1"
}

build = {
type = "cmake",
cmake = 'cmake_minimum_required(VERSION 2.8)\n include(luarocks_cmake.txt)',
variables ={LUA_LIBRARY_DIRS="$(LUA_LIBDIR)",LUA_INCLUDE_DIRS="$(LUA_INCDIR)",LUA_LIBRARIES="$(LUALIB)",INSTALL_LIBDIR="$(LIBDIR)"}
variables ={CFLAGS="$(CFLAGS)",
LIBFLAG="$(LIBFLAG)",
LUA="$(LUA)",
LUALIB="$(LUALIB)",
LUA_BINDIR="$(LUA_BINDIR)",
LUADIR="$(LUADIR)",
LUA_LIBDIR="$(LUA_LIBDIR)",
LIBDIR="$(LIBDIR)",
LUA_INCDIR="$(LUA_INCDIR)",
CMAKE_INSTALL_PREFIX="$(PREFIX)"}
}
34 changes: 12 additions & 22 deletions luarocks_cmake.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@


include_directories(SYSTEM ${LUA_INCLUDE_DIRS})
link_directories(${LUA_LIBRARY_DIRS})
include_directories("${LUA_INCDIR}")
LINK_DIRECTORIES("${LUA_LIBDIR}")

if(NOT LUA_LIBRARIES)
set(LUA_LIBRARIES "lua")
endif()

if(LRDB_USE_BOOST_ASIO)
add_definitions(-DLRDB_USE_BOOST_ASIO)
else(LRDB_USE_BOOST_ASIO)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/asio/asio/include")
endif(LRDB_USE_BOOST_ASIO)

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/picojson")


if(ADDITIONAL_INCLUDE_PATH)
include_directories(SYSTEM ${ADDITIONAL_INCLUDE_PATH})
endif()

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")

if(NOT MSVC)#-Wall nonsense on MSVC
add_definitions("-std=c++11")
endif(NOT MSVC)

add_library(lrdb_server SHARED src/debug_server_module.cpp ${HEADER_FILE})
target_link_libraries(lrdb_server ${LUA_LIBRARIES})
set_target_properties(lrdb_server PROPERTIES OUTPUT_NAME lrdb_server)
set_target_properties(lrdb_server PROPERTIES PREFIX "")
add_library(lrdb_server MODULE src/debug_server_module.cpp)
IF(LUALIB)
TARGET_LINK_LIBRARIES(lrdb_server ${LUALIB})
ENDIF()

set(CMAKE_MODULE_LINKER_FLAGS ${LIBFLAG})


set(CMAKE_INSTALL_PREFIX "")
install(TARGETS lrdb_server LIBRARY DESTINATION ${INSTALL_LIBDIR})
if (CMAKE_INSTALL_PREFIX)
install(TARGETS lrdb_server DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
endif(CMAKE_INSTALL_PREFIX)
3 changes: 0 additions & 3 deletions src/debug_server_module.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#ifdef EMSCRIPTEN
#include <emscripten.h>
#endif
#include <iostream>

#include "lrdb/server.hpp"
Expand Down

0 comments on commit da014ab

Please sign in to comment.