lua-users home
lua-l archive

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


Also, I noticed your note to "Don't use 0.3"... is there a way to get
the source for the 0.4 system? Or is this binary a universal one? One
thing that I have to deal with, having an older system is that almost
EVERYONE only releases code for Intel Macs. I still have an old PPC
machine, and can't use the Intel binaries... Do I need to wait for the
official release?

Thanks,

Mike

On Thu, Dec 16, 2010 at 10:12 AM, Joshua Jensen <josh.jjensen@gmail.com> wrote:
> ----- Original Message -----
> From: Eric Wing
> Date: 12/15/2010 4:58 PM
>>
>> I use CMake to avoid build-system porting hassles. This page has links
>> to a Lua repo with CMake description.
>> http://playcontrol.net/ewing/jibberjabber/git_superproject_and_submod.html
>
> As long as we're throwing out build systems, LuaPlus is built using the
> Perforce Jam-derived JamPlus.  JamPlus builds around 50 Lua modules out of
> box in the LuaPlus distribution for Windows, Mac OS X, and Linux and for a
> variety of compilers.  It also kicks out Visual Studio and Xcode projects.
>
> When I want to link against the Lua DLL, I add the following to my Jamfile:
>
>    C.IncludeDirectories MyApp : $(LUA_ROOT)/src ;
>    C.LinkPrebuiltLibraries $(TARGET) : lua5.1 ;
>
> When I want to build a Lua C module within another project, I call a Jam
> rule that looks like this:
>
> Lua.CModule ImageSplitterAlpha : imagesplitteralpha :
> ImageSplitterAlphaLua.cpp ;
>
> # This is what Lua.CModule does.
> if $(OS) = NT {
>    LUA_CDIR = $(LUA_OUTPUT_DIRECTORY)/modules ;
>    LUA_LDIR = $(LUA_OUTPUT_DIRECTORY)/lua ;
> } else {
>    LUA_CDIR = $(LUA_OUTPUT_DIRECTORY)/lib/lua/5.1 ;
>    LUA_LDIR = $(LUA_OUTPUT_DIRECTORY)/share/lua/5.1 ;
> }
>
> rule Lua.CModule TARGET : OUTPUT_NAME : SOURCES : MODULES_SUBDIR {
>    # Let the user pass in an empty TARGET and use what they've set as the
> ActiveProject.
>    TARGET = [ RetrieveActiveTarget $(TARGET) ] ;
>
>    # For some reason, this #define doesn't get automatically set in
> luaconf.h.
>    if $(OS) = LINUX {
>        C.Defines $(TARGET) : LUA_USE_LINUX ;
>    }
>
>    C.IncludeDirectories $(TARGET) : $(LUA_ROOT)/src ;
>
>    if $(OS) != MACOSX &&  $(OS) != LINUX {
>        C.LinkDirectories $(TARGET) : $(LUA_ROOT)/bin.vs2010.win32 ;
>        C.LinkPrebuiltLibraries $(TARGET) : lua5.1 ;
>    }
>
>    # Default the OUTPUT_NAME to the TARGET name, if not specified.
>    OUTPUT_NAME ?= $(TARGET) ;
>
>    # By default, the module goes straight into the LUA_CDIR directory.  This
> allows OUTPUT_NAME[2] to override it.
>    local MODULES_SUBDIR = $(OUTPUT_NAME[1]:D) ;
>    OUTPUT_NAME = $(OUTPUT_NAME[1]:D=) $(OUTPUT_NAME[2]) ;
>
>    # Automatically generate a proper luaopen_modulename export.  This
> eliminates the need for a .def file.
>    if $(MSVCNT) {
>        local EXPORT_NAME = $(OUTPUT_NAME[2]:E=$(OUTPUT_NAME[1])) ;
>        local exportName = [ Subst $(EXPORT_NAME) : %. : _ ] ;
>        local exportPath = [ Subst $(MODULES_SUBDIR:E="") : / : _ ] ;
>        if $(exportPath) != "" {
>            exportPath = $(exportPath)_ ;
>        }
>        C.LinkFlags $(TARGET) : /EXPORT:luaopen_$(exportPath)$(exportName) ;
>    }
>
>    # Set the output filename of the module.
>    C.OutputName $(TARGET) : $(OUTPUT_NAME[1]) ;
>
>    # In a debug build, make the module name append .debug to the end so
> debug and release builds can
>    # exist in the same directory.
>    C.OutputPostfix $(TARGET) : .debug : debug ;
>
>    # For release, ensure we have no postfix.
>    C.OutputPostfix $(TARGET) : : release ;
>
>    # Set the output path of the module.
>    C.OutputPath $(TARGET) : $(LUA_CDIR)/$(MODULES_SUBDIR:E=) ;
>
>    # Build it.
>    C.Library $(TARGET) : $(SOURCES) : module ;
> }
>
> Anyway, I just thought I'd mention it as an alternative.
>
> Josh
>
>
>