Skip to content

Instantly share code, notes, and snippets.

@Mic92
Created November 15, 2011 23:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Mic92/1368670 to your computer and use it in GitHub Desktop.
LuaBind Gist
cmake_minimum_required(VERSION 2.8)
project(LuaPulse)
include(FindPkgConfig)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(Luabind REQUIRED)
find_package(Lua51 REQUIRED)
find_package(Boost COMPONENTS system REQUIRED)
pkg_check_modules(PULSE libpulse>=0.9.10)
add_definitions(-Wall -shared)
set(src "src/luapulse.cc")
#add_library(LuaPulse)
include_directories(LuaPulse
${PULSE_INCLUDE_DIRS}
${LUA_INCLUDE_DIR}
${LUABIND_INCLUDE_DIR}
)
add_library(LuaPulse Shared ${src})
target_link_libraries(LuaPulse
${PULSE_LIBRARIES}
${LUA_LIBRARY}
${LUABIND_LIBRARY}
${Boost_SYSTEM_LIBRARY}
)
#include <iostream>
#include <luabind/luabind.hpp>
void greet()
{
std::cout << "hello world!\n";
}
extern "C" int init(lua_State* L)
{
using namespace luabind;
open(L);
module(L)
[
def("greet", &greet)
];
return 0;
}
@Mic92
Copy link
Author

Mic92 commented Nov 15, 2011

Ich bekomme folgende Ausgabe:
╭─[~/luapulse]─[joerg@turing-machine]─[0]─[2268]
╰─[:)] % make
[100%] Building CXX object CMakeFiles/LuaPulse.dir/src/luapulse.cc.o
Linking CXX executable LuaPulse
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../lib/crt1.o: In function _start': (.text+0x20): undefined reference tomain'
collect2: ld gab 1 als Ende-Status zurück
make[2]: *** [LuaPulse] Fehler 1
make[1]: *** [CMakeFiles/LuaPulse.dir/all] Fehler 2
make: *** [all] Fehler 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment