lua-users home
lua-l archive

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


I used this makefile to compile it on osx 10.6:

# makefile for lua-cjson library for Lua

# change these to reflect your Lua installation
LUA=  /Users/veleno/workspace/lua-5.1.4
LUAINC= $(LUA)/src
LUALIB= $(LUA)/src
LUABIN= $(LUA)/src

# these will probably work if Lua has been installed globally
#LUA= /usr/local
#LUAINC= $(LUA)/include
#LUALIB= $(LUA)/lib
#LUABIN= $(LUA)/bin

# probably no need to change anything below here
CC= gcc
CFLAGS= $(INCS) $(WARN) -O2 $G
WARN= -ansi -pedantic -Wall
INCS= -I$(LUAINC) -I.
#MAKESO= $(CC) -shared
MAKESO= env MACOSX_DEPLOYMENT_TARGET=10.3 $(CC) -bundle -undefined dynamic_lookup

MYNAME= cjson
MYLIB= lua_$(MYNAME)
T= $(MYNAME).so
OBJS= $(MYLIB).o strbuf.o
TEST= tests/test.lua

o: $(MYLIB).o

so: $T

$T: $(OBJS)
$(MAKESO) -o $@ $(OBJS)

test: $T
$(LUABIN)/lua $(TEST)

clean:
rm -f $(OBJS) $T *.so

doc:
@echo "$(MYNAME) library:"
@fgrep '/**' $(MYLIB).c | cut -f2 -d/ | tr -d '*' | sort | column

# eof




On Mon, May 9, 2011 at 4:09 PM, liam mail <liam.list@googlemail.com> wrote:


On 9 May 2011 14:42, Louis-Philippe <default@spiralix.org> wrote:
Under OSX,
doesn't seem to compile, I get:

anybody had success with Mac 10.6?

thanks!

L-P


2011/5/9 Mark Pulford <mark@kyne.com.au>
Hi,

On Sun, May 08, 2011 at 09:10:55PM -0700, Gu Di wrote:
> Cool! How does your library compare to lua-yajl?
> https://github.com/brimworks/lua-yajl

I mostly wrote CJSON as part of another project last year when the
JSON options appeared to be a bit more limited. Hence I haven't
specifically tested Lua YAJL.

However, an unfair extrapolation of the JsonModules wiki suggests:
- CJSON should provide 2x decoding, 5x encoding performance.
- Lua YAJL has a streaming interface (CJSON doesn't).
- CJSON has options to handle sparse arrays safely.
- CJSON doesn't have any external dependencies other than Lua.

I'm sure there is more to it than that - I'd recommend testing them
yourself to be sure. JSON performance can vary widely based depending
on the input and the implementation.

Regards,
Mark


It does not link Lua, it simply requires adding "-llua" to the LDFLAGS.

Liam