GithubHelp home page GithubHelp logo

lubyk / dub Goto Github PK

View Code? Open in Web Editor NEW
82.0 82.0 34.0 6.56 MB

A Lua bindings generator that uses Doxygen to parse C/C++ headers.

Home Page: doc.lubyk.org/dub.html

License: Other

Lua 85.02% C 1.51% C++ 13.13% CMake 0.35%

dub's Introduction

Lubyk

Lubyk is an open source tool written in C++/Lua for real time signal processing. This tool uses zeromq to communicate between processes and with the graphical interfaces.

website: lubyk.org

license: MIT

author: Gaspard Bucher - Buma (feature-space.com)

See the “CREDITS” file for the list of included open source projects.

Installation

Lubyk is currently alpha software.

Minimal installation

If you just need the core parts (to use dub for example), you can install with:

...> git clone git://github.com/lubyk/lubyk.git
...> cd lubyk
...> mkdir build
...> cd build
...> cmake ..
...> make install

Mac OS X

In order to build everything, you need to have Qt SDK 4.8 and CMake installed:

...> brew install cmake
...> brew install qt

...> git clone git://github.com/lubyk/lubyk.git
...> git submodule init
...> git submodule update
...> mkdir build
...> cd build
.../build> cmake ..
.../build> make -j4
.../build> make install

The install script installs a single lua file in ‘/usr/local/lib/lua/5.1/lubyk.lua’.

Linux

Packages require to build and install lubyk:

build-essential cmake uuid uuid-dev libssl-dev libqt4-dev libglc-dev freeglut3-dev libxmu-dev libxi-dev libavahi-client-dev  libasound2-dev

Will not be needed once we remove legacy gl:

libglc-dev freeglut3-dev libxmu-dev libxi-dev

Settings files

If ‘~/.lubyk/lk.lua’ file that informs lubyk where to search for extra libraries. Default location for libraries is in /Applications/Lubyk.app on Mac OS X.

return {
  paths = {
    -- Example of extra paths to store lua libraries and run them without
    -- installing.
    '/Users/gaspard/git/lubyk/modules/seq/lib',
  }
}

dub's People

Contributors

gaspard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dub's Issues

Can't generate bindings for all files in a folder

Hi,

I'm opening an issue here because the forums at http://forum.lubyk.org/ seem to be inaccessible.

I'm trying to make dub generate bindings for classes and functions found in all files starting in a folder. In my tests I have:

  • include
    • subdir
      • Test4.h: Contains the mc2::Test4 class
    • Test.h: Contains the mc::Test2 and the mc::Test3 classes, and the mc::doStuffWithTest function

My dub script is:

local lub = require 'lub'
local dub = require 'dub'

local inspector = dub.Inspector {
  INPUT    = {
    lub.path '|include/',
  },
  RECURSIVE = 'YES',
  GENERATE_HTML = 'YES',
  doc_dir = lub.path '|doc',
  keep_xml = true,
}

local binder = dub.LuaBinder()

binder:bind(inspector, {
  lib_name = '_',

  single_lib = 'miniclip',

  output_directory = lub.path '|src',

  header_base = lub.path '|include',

  luaopen    = 'cppbindings',
})

When I run the dub script only things in Test.h end up having Lua bindings. Examining doxygen's output, I can see that it's not catching the mc::Test4 class, which I believe is the reason why dub is not generating its binding.

dub's version is 2.2.4, and doxygen's is 1.8.11.

Am I doing something wrong?

Thanks in advance,

Andre

Usage?

Is it possible to use dub without installing lubyk? If so, can you please add a small note on usage to the README?

header_base does not work for directories with special characters

it took some effort to find out why 'header_base' did not work for me:

I have a directory in my path with a '-' (e.g. 'git-test'), for those the string matching in: https://github.com/lubyk/dub/blob/master/dub/LuaBinder.lua#L598 does not match as the '-' is interpreted as pattern, in order to match literally it needs to be escaped: '-' -> '%-'

I can make a workaround for it in my binding script but the right way would be to fix it in LuaBinder.lua

Problems installing dub via luarocks

I tried to luarocks install dub as suggested in the docs, but it's not found:

Error: No results matching query were found.

Then, when installing from a local copy with luarocks make, it looks like the correct version of yaml is not available:

Error: Could not satisfy dependency: yaml ~> 1.0

If I remove the version requirements from the .rockspec dub will install, but then when running a script with require 'lub', it cannot find the lub.plat module:

/usr/local/share/lua/5.1/lub/Autoload.lua:28: module 'lub.plat' not found:
    no field package.preload['lub.plat']
    no file './lub/plat.lua'
    no file '/usr/local/share/lua/5.1/lub/plat.lua'
    no file '/usr/local/share/lua/5.1/lub/plat/init.lua'
    no file '/usr/local/lib/lua/5.1/lub/plat.lua'
    no file '/usr/local/lib/lua/5.1/lub/plat/init.lua'
    no file './lub/plat.so'
    no file '/usr/local/lib/lua/5.1/lub/plat.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file './lub.so'
    no file '/usr/local/lib/lua/5.1/lub.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'

C++11 shared pointers?

Hi, I am looking for a Lua binding library with support for C++11 shared pointers for Leadwerks Game Engine 5. Previously, we used ToLua++. Does Dub support this?

CMake error

I also had to place cmake_minimum_required(VERSION 2.4) at the top of CMakeLists.txt.

kobra@pc:~/.builds/dub/build$ cmake ..
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:14 (install):
  install DIRECTORY given no DESTINATION!


-- Configuring incomplete, errors occurred!
See also "/home/kobra/.builds/dub/build/CMakeFiles/CMakeOutput.log".
kobra@pc:~/.builds/dub/build$ cmake --version
cmake version 2.8.12.1

Variables with the name L.

In the FLTK library some functions have a parameter with the variable name L. This is problematic because L is already used in the automatically generated code. This can easily be solved via means of suffixing for example add the word Lua to the end of the variable name.

Headers with an uppercase extension.

I have noticed that dub appears to not be able to handle headers with an uppercase extension even when I add *.H to the Doxyfile patterns. I know this because I wrote a python script that would rename all headers to have a lowercase extension and then search all the headers in order to fix the include statements to account for this. After doing so the code for that should have been generated is now being generated by dub. If you are thinking: just edit your project. That is not the answer because I am trying to generate a binding to the library FLTK and that library uses headers with an uppercase extension.

error occurred while generating binding for opencv

hi,

I got the following error when trying to generate a binding for opencv:

lua: /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:727: attempt to index a nil value (field 'ctype')
stack traceback:
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:727: in local 'func'
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:635: in local 'func'
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:489: in field 'children'
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:607: in local 'func'
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:489: in field 'children'
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:470: in field 'header'
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:406: in field 'parseAll'
    /home/sean/.luarocks/share/lua/5.3/dub/MemoryStorage.lua:61: in function 'dub.MemoryStorage.parse'
    /home/sean/.luarocks/share/lua/5.3/dub/Inspector.lua:68: in field 'parseXml'
    /home/sean/.luarocks/share/lua/5.3/dub/Inspector.lua:121: in field 'parse'
    /home/sean/.luarocks/share/lua/5.3/dub/Inspector.lua:32: in function 'dub.Inspector.new'
    (...tail calls...)
    opencv.lua:7: in main chunk
    [C]: in ?

Here is what I did.

I was using Arch linux and opencv 2.4.10-3.
First I copied the include file to the working directory:

[sean@ArchHp dubgenerators]$ cp /usr/include/opencv2/ include/ -r

then run the following script
opencv.lua:

package.path='/home/sean/.luarocks/share/lua/5.3/?.lua;/home/sean/.luarocks/share/lua/5.3/?/init.lua;/usr/share/lua/5.3/?.lua;/usr/share/lua/5.3/?/init.lua;/usr/lib/lua/5.3/?.lua;/usr/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua'
package.cpath='/home/sean/.luarocks/lib/lua/5.3/?.so;/usr/lib/lua/5.3/?.so;/usr/lib/lua/5.3/loadall.so;./?.so'

local lub = require 'lub'
local dub = require 'dub'

local inspector = dub.Inspector {
  INPUT    = {
    lub.path '|include/opencv2',
    lub.path '|include/opencv2/core',
  },
}

local binder = dub.LuaBinder()

binder:bind(inspector, {
  -- Mandatory library name. This is used as prefix for class types.
  lib_name = 'cv',

  output_directory = lub.path '|src/bind',

  -- Remove this part in included headers
  header_base = lub.path '|include',

  -- Open the library with require 'xml.core' (not 'xml') because
  -- we want to add some more Lua methods inside 'xml.lua'.
  luaopen    = 'cv_core',
})

./dub-tmp/xml had been generated with some xml files under it.
Then I got the error.

Is there anything wrong I did in this process?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.