# HG changeset patch # User Myhailo Danylenko # Date 1234177242 -7200 # Node ID 34b6fedde9eb8a6a9bf917c1bd20236cad4badca # Parent 64a857d6b81b2673935218866cc2bd832c9caffe Switch to cmake diff -r 64a857d6b81b -r 34b6fedde9eb .gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Mon Feb 09 13:00:42 2009 +0200 @@ -0,0 +1,15 @@ +# ignore generated by libtool files +*.a +*.o +*.lo +*.la +*.so +*.lai +*.so.* +# ignore backup files +*~ +# ignore docs: they are not important and apiref is generated on the fly +*.html +Makefile +*.cmake +CMake* diff -r 64a857d6b81b -r 34b6fedde9eb .libs/lm.lua --- a/.libs/lm.lua Mon Feb 02 13:55:39 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -../lm.lua \ No newline at end of file diff -r 64a857d6b81b -r 34b6fedde9eb CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Mon Feb 09 13:00:42 2009 +0200 @@ -0,0 +1,22 @@ + +cmake_minimum_required(VERSION 2.6) + +# Define targets +add_library(loudmouth MODULE util.c lm_types.c lm_proxy.c lm_ssl.c lm_connection.c lm_message.c lm_message_node.c lm_message_handler.c lm.c) +add_library(glib MODULE glib.c glib_types.c glib_main_context.c glib_source.c glib_timeout.c util.c) + +# Check for dependencies +find_package(ZLIB REQUIRED) + +find_package(Lua51 REQUIRED) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(LM REQUIRED loudmouth-1.0) +pkg_check_modules(GLIB REQUIRED glib-2.0) + +# Set building options +include_directories(SYSTEM ${LUA_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS} ${LM_INCLUDE_DIRS}) +target_link_libraries(loudmouth ${LUA_LIBRARIES} ${GLIB_LIBRARIES} ${LM_LIBRARIES}) +target_link_libraries(glib ${LUA_LIBRARIES} ${GLIB_LIBRARIES}) +set_target_properties(loudmouth glib PROPERTIES PREFIX "") + diff -r 64a857d6b81b -r 34b6fedde9eb Makefile --- a/Makefile Mon Feb 02 13:55:39 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ - -# TODO: -# clarify situation with references. should we really reference objects, passed as args to callbacks? if someone will store that object in a global environment and use later? -# autotools -# switch to common object struct? -# tests? -# more examples -# llm should use lua/stdlib, no dependency on glib? though it still needs glib headers... maybe, indirectly :/ -# separate lm and glib, now it is completely different projects // and one, probably, will die... :( - -PREFIX=${PWD}/inst -DOCDIR=$(PREFIX)/share/doc/liblua-loudmouth -SOLIBDIR=$(PREFIX)/lib/lua/5.1 -LUALIBDIR=$(PREFIX)/share/lua/5.1 - - -CC=gcc -LD=gcc -LIBTOOL=libtool -INSTALL=install - -CFLAGS=-g -O0 -Wall -LDFLAGS=-g -O0 -LTFLAGS= -TARGETS=loudmouth.la glib.la - -LMCFLAGS=`pkg-config --cflags lua5.1 loudmouth-1.0 glib-2.0` -GLIBCFLAGS=`pkg-config --cflags lua5.1 glib-2.0` - -# add this flag to cflags, if your loudmouth have lm_connection_get_keep_alive_rate () -#LMCFLAGS += -DHAVE_LM_CONNECTION_GET_KEEP_ALIVE_RATE - -LMLIBS=`pkg-config --libs lua5.1 loudmouth-1.0 glib-2.0` -GLIBLIBS=`pkg-config --libs lua5.1 glib-2.0` - -LMSOURCES=util.c lm_types.c lm_proxy.c lm_ssl.c lm_connection.c lm_message.c lm_message_node.c lm_message_handler.c lm.c -GLIBSOURCES=glib.c glib_types.c glib_main_context.c glib_source.c glib_timeout.c util.c - -LMOBJECTS=$(LMSOURCES:.c=.lo) -GLIBOBJECTS=$(GLIBSOURCES:.c=.lo) - -DOCS=$(TARGETS:.la=.html) - -all: $(TARGETS) - -loudmouth.la: $(LMOBJECTS) - $(LIBTOOL) $(LTFLAGS) --mode=link $(LD) $(LDFLAGS) -module -rpath $(SOLIBDIR) -o $@ $^ $(LMLIBS) - -glib.la: $(GLIBOBJECTS) - $(LIBTOOL) $(LTFLAGS) --mode=link $(LD) $(LDFLAGS) -module -rpath $(SOLIBDIR) -o $@ $^ $(GLIBLIBS) - -# FIXME: CFLAGS... -%.lo: %.c - $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) $(LMCFLAGS) -c $^ - -test: loudmouth.la glib.la - cd .libs && lua ../test.lua - -test2: glib.la - cd .libs && lua ../test2.lua - -doc: $(DOCS) - -loudmouth.html: docgen.pl $(LMSOURCES) - ./docgen.pl $(LMSOURCES) > $@ - -glib.html: docgen.pl $(GLIBSOURCES) - ./docgen.pl $(GLIBSOURCES) > $@ - -install: $(TARGETS) $(SOLIBDIR) $(LUALIBDIR) - $(LIBTOOL) $(LTFLAGS) --mode=install $(INSTALL) loudmouth.la $(SOLIBDIR)/loudmouth.la - $(INSTALL) -m 644 lm.lua $(LUALIBDIR)/lm.lua - $(LIBTOOL) $(LTFLAGS) --mode=install $(INSTALL) glib.la $(SOLIBDIR)/glib.la - $(LIBTOOL) $(LTFLAGS) --mode=finish $(SOLIBDIR) - -install-doc: doc test.lua $(DOCDIR) - $(INSTALL) -m 644 -t $(DOCDIR) $(DOCS) - $(INSTALL) -d $(DOCDIR)/examples - $(INSTALL) -m 644 -t $(DOCDIR)/examples test.lua - -$(PREFIX): - $(INSTALL) -D -d $@ - -$(DOCDIR): $(PREFIX) - $(INSTALL) -D -d $@ - -$(SOLIBDIR): $(PREFIX) - $(INSTALL) -D -d $@ - -$(LUALIBDIR): $(PREFIX) - $(INSTALL) -D -d $@ - -uninstall: - $(LIBTOOL) $(LTFLAGS) --mode=uninstall rm -f $(SOLIBDIR)/loudmouth.la - $(LIBTOOL) $(LTFLAGS) --mode=uninstall rm -f $(SOLIBDIR)/glib.la - rm -f $(LUALIBDIR)/lm.lua - -clean: - $(LIBTOOL) $(LTFLAGS) --mode=clean rm -f $(TARGETS) $(LMOBJECTS) $(GLIBOBJECTS) $(DOCS) -