lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Oct 1, 2009 at 11:06 PM, Robert G. Jakabosky wrote:
> Attached is a patch to add CMake build files to Lua 5.1.  I have only tested
> them on Linux, but they should work for atleast Macs & Windows systems.  Also
> some of the LUA_USE_* CMake options don't do anything right now, but they can
> still be changed in src/luaconf.h

With some further adjustments, I would also suggest considering adding
this to the Lua 5.1 distributions because it handles most platforms
relatively painlessly, including shared library builds which are
partially lacking in the existing build files.

A few comments:

BUILD_STATIC had to be forced to OFF when applying the flag
-DLUA_BUILD_AS_DLL to avoid "undefined reference to
`__imp__lua_sethook'" linker errors.

In the CMAKE_SYSTEM_NAME, swap the UNIX and WIN32 tests, I think.
Cygwin is both UNIX and WIN32, but its more UNIX.  At least that was
required to load a lfs.so shared library module built from LuaDist.

Under gcc 3.4.6/Linux I got an 'error: unrecognized command line
option "-fgnu89-inline"'  This had warnings though.

For comparison, see our CMakeLists.txt [1] for Lua 5.1.4 used in
LuaDist [2], which has been tested on Linux, Cygwin, MinGW, MSVC, Mac,
and maybe others.  Ours is a single file and simpler, but it's
currently less configurable and doesn't yet handle CPack.  Maybe we
can converge to a single version of the CMakeLists.txt.

[1] http://luadist.svn.sourceforge.net/viewvc/luadist/trunk/dists/lua-5.1.4/CMakeLists.txt?view=log
[2] http://lua-users.org/wiki/LuaDist