Git Product home page Git Product logo

ffi-experiments's Introduction

FFI Experiments

C++ + luajit FFI = horrible cross-platform messes.

BadMutex

A global mutex.

PreciseTimer

Measure times down to the nanosecond. Except not really.

DownloadManager

Download things with libcurl without blocking Lua.

requireffi

Load C libraries using package.path.

Building

The preferred build system is meson, but a basic makefile is also provided for those who do not wish to install it.

You will need:

  • A recent version of meson.
  • A working c99 compiler.
  • A working c++11 compiler.
  • libcurl installed in some place meson/your linker will think to look for it.

Building on OSX and Linux should be as simple as running the following:

cd /path/to/ffi-experiments
meson build
cd build
ninja

Should you wish to statically link dependencies, simply include -Dstatic_deps=true with the meson build command.

If you are on an operating system managed by a hulking corporate abomination, things are a little bit more complicated. The following instructions are for building with a recent version of Visual Studio.

You'll need a directory containing two subdirectories, include and lib, containing the header files and a statically built libcurl respectively. libcurl should be built with the same settings you intend to use for DownloadManager.

Launch the relevant VS native tools command prompt. Be sure that if you want a 64-bit built, you're using the one labeled x64. Then run the following:

powershell
cd C:\Path\To\ffi-experiments
meson -Dlibcurl_path="C:\Path\To\libcurl" build
cd build
ninja

You can then launch the solution, pick a god and pray, and then attempt to build the three projects.

The companion lua scripts are not built by default, for two reasons. The first reason is that the generated lua scripts are platform independent, so you can just download the release versions like everyone else. The second reason is that the lua build process assumes it is running in a Posix environment with the programs bash, cpp, perl, moonc, and true all being available to the user. If in an appropriate environment, the lua scripts can be generated by additionally running ninja lua (if using meson) or make lua (if using the makefile). These targets will not be available on Windows.

ffi-experiments's People

Contributors

coffeeflux avatar line0 avatar torque avatar

Watchers

 avatar

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.