Created
November 15, 2011 23:07
-
-
Save Mic92/1368670 to your computer and use it in GitHub Desktop.
LuaBind Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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} | |
| ) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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