[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: autotools and Lua modules
- From: Peter Drahos <drahosp@...>
- Date: Sat, 19 Jun 2010 14:52:41 +0200
On Jun 19, 2010, at 1:38 PM, Wesley Smith wrote:
> Anyone know how to write a Makefile.am in order to generate a .so Lua
> module? Here's what I've got so far:
> INCLUDES = -I$(srcdir)/include -I/usr/include/lua5.1
> LIBS = -shared
> lib_LTLIBRARIES = libtest.la
> libtest_la_SOURCES = src/test.cpp
> While it does produces the shared library, it's less than desirable.
> It builds a libtest.la and a libtest.so.0.0.0 with libtest.so as a
> symlink. Ideally, I'd actually have just test.so, but autotools
> complains bitterly since such a name doesn't have "lib" or ".la" in
> the name. I'm wondering if anyone else has tried this.
You might also try CMake as alternative to autotools.
This works for most OSes, compilers and architectures.
// Find Lua and set up LUA_ variables
// Build module
ADD_LIBRARY(myModule MODULE mySource.c myOtherSource.c)
// Remove any prefix from the module such as "lib" or "cyg" depending on platform
SET_TARGET_PROPERTIES(myModule PROPERTIES PREFIX "")