From 602971408ba8c2c1490bd87d2987ab65900a5297 Mon Sep 17 00:00:00 2001 From: frsyuki Date: Sun, 30 May 2010 03:02:40 +0900 Subject: [PATCH] cpp: move source files into src/ directory --- cpp/Makefile.am | 88 +------------------ cpp/configure.in | 19 +++- cpp/preprocess | 16 ++-- cpp/src/Makefile.am | 75 ++++++++++++++++ cpp/{ => src}/msgpack.h | 0 cpp/{ => src}/msgpack.hpp | 0 cpp/{ => src}/msgpack/object.h | 0 cpp/{ => src}/msgpack/object.hpp | 0 cpp/{ => src}/msgpack/pack.h | 0 cpp/{ => src}/msgpack/pack.hpp | 0 cpp/{ => src}/msgpack/sbuffer.h | 0 cpp/{ => src}/msgpack/sbuffer.hpp | 0 cpp/{ => src}/msgpack/type.hpp | 0 cpp/{ => src}/msgpack/type/bool.hpp | 0 cpp/{ => src}/msgpack/type/define.hpp.erb | 0 cpp/{ => src}/msgpack/type/deque.hpp | 0 cpp/{ => src}/msgpack/type/float.hpp | 0 cpp/{ => src}/msgpack/type/int.hpp | 0 cpp/{ => src}/msgpack/type/list.hpp | 0 cpp/{ => src}/msgpack/type/map.hpp | 0 cpp/{ => src}/msgpack/type/nil.hpp | 0 cpp/{ => src}/msgpack/type/pair.hpp | 0 cpp/{ => src}/msgpack/type/raw.hpp | 0 cpp/{ => src}/msgpack/type/set.hpp | 0 cpp/{ => src}/msgpack/type/string.hpp | 0 .../msgpack/type/tr1/unordered_map.hpp | 0 .../msgpack/type/tr1/unordered_set.hpp | 0 cpp/{ => src}/msgpack/type/tuple.hpp.erb | 0 cpp/{ => src}/msgpack/type/vector.hpp | 0 cpp/{ => src}/msgpack/unpack.h | 0 cpp/{ => src}/msgpack/unpack.hpp | 0 cpp/{ => src}/msgpack/vrefbuffer.h | 0 cpp/{ => src}/msgpack/vrefbuffer.hpp | 0 cpp/{ => src}/msgpack/zbuffer.h | 0 cpp/{ => src}/msgpack/zbuffer.hpp | 0 cpp/{ => src}/msgpack/zone.h | 0 cpp/{ => src}/msgpack/zone.hpp.erb | 0 cpp/{ => src}/object.cpp | 0 cpp/{ => src}/objectc.c | 0 cpp/{ => src}/unpack.c | 0 cpp/{ => src}/vrefbuffer.c | 0 cpp/{ => src}/zone.c | 0 cpp/test.mk | 9 -- cpp/test/Makefile.am | 14 ++- cpp/{ => test}/msgpack_test.cpp | 0 cpp/{ => test}/msgpackc_test.cpp | 0 46 files changed, 114 insertions(+), 107 deletions(-) create mode 100644 cpp/src/Makefile.am rename cpp/{ => src}/msgpack.h (100%) rename cpp/{ => src}/msgpack.hpp (100%) rename cpp/{ => src}/msgpack/object.h (100%) rename cpp/{ => src}/msgpack/object.hpp (100%) rename cpp/{ => src}/msgpack/pack.h (100%) rename cpp/{ => src}/msgpack/pack.hpp (100%) rename cpp/{ => src}/msgpack/sbuffer.h (100%) rename cpp/{ => src}/msgpack/sbuffer.hpp (100%) rename cpp/{ => src}/msgpack/type.hpp (100%) rename cpp/{ => src}/msgpack/type/bool.hpp (100%) rename cpp/{ => src}/msgpack/type/define.hpp.erb (100%) rename cpp/{ => src}/msgpack/type/deque.hpp (100%) rename cpp/{ => src}/msgpack/type/float.hpp (100%) rename cpp/{ => src}/msgpack/type/int.hpp (100%) rename cpp/{ => src}/msgpack/type/list.hpp (100%) rename cpp/{ => src}/msgpack/type/map.hpp (100%) rename cpp/{ => src}/msgpack/type/nil.hpp (100%) rename cpp/{ => src}/msgpack/type/pair.hpp (100%) rename cpp/{ => src}/msgpack/type/raw.hpp (100%) rename cpp/{ => src}/msgpack/type/set.hpp (100%) rename cpp/{ => src}/msgpack/type/string.hpp (100%) rename cpp/{ => src}/msgpack/type/tr1/unordered_map.hpp (100%) rename cpp/{ => src}/msgpack/type/tr1/unordered_set.hpp (100%) rename cpp/{ => src}/msgpack/type/tuple.hpp.erb (100%) rename cpp/{ => src}/msgpack/type/vector.hpp (100%) rename cpp/{ => src}/msgpack/unpack.h (100%) rename cpp/{ => src}/msgpack/unpack.hpp (100%) rename cpp/{ => src}/msgpack/vrefbuffer.h (100%) rename cpp/{ => src}/msgpack/vrefbuffer.hpp (100%) rename cpp/{ => src}/msgpack/zbuffer.h (100%) rename cpp/{ => src}/msgpack/zbuffer.hpp (100%) rename cpp/{ => src}/msgpack/zone.h (100%) rename cpp/{ => src}/msgpack/zone.hpp.erb (100%) rename cpp/{ => src}/object.cpp (100%) rename cpp/{ => src}/objectc.c (100%) rename cpp/{ => src}/unpack.c (100%) rename cpp/{ => src}/vrefbuffer.c (100%) rename cpp/{ => src}/zone.c (100%) delete mode 100644 cpp/test.mk rename cpp/{ => test}/msgpack_test.cpp (100%) rename cpp/{ => test}/msgpackc_test.cpp (100%) diff --git a/cpp/Makefile.am b/cpp/Makefile.am index 08eb7a5..6b37803 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -1,75 +1,6 @@ +SUBDIRS = src test -lib_LTLIBRARIES = libmsgpack.la - -libmsgpack_la_SOURCES = \ - unpack.c \ - objectc.c \ - vrefbuffer.c \ - zone.c \ - object.cpp - -# -version-info CURRENT:REVISION:AGE -libmsgpack_la_LDFLAGS = -version-info 3:0:0 - - -# backward compatibility -lib_LTLIBRARIES += libmsgpackc.la - -libmsgpackc_la_SOURCES = \ - unpack.c \ - objectc.c \ - vrefbuffer.c \ - zone.c - -libmsgpackc_la_LDFLAGS = -version-info 2:0:0 - -# work around for duplicated file name -kumo_manager_CFLAGS = $(AM_CFLAGS) -kumo_manager_CXXFLAGS = $(AM_CXXFLAGS) - - -nobase_include_HEADERS = \ - msgpack/pack_define.h \ - msgpack/pack_template.h \ - msgpack/unpack_define.h \ - msgpack/unpack_template.h \ - msgpack/sysdep.h \ - msgpack.h \ - msgpack/sbuffer.h \ - msgpack/vrefbuffer.h \ - msgpack/zbuffer.h \ - msgpack/pack.h \ - msgpack/unpack.h \ - msgpack/object.h \ - msgpack/zone.h \ - msgpack.hpp \ - msgpack/sbuffer.hpp \ - msgpack/vrefbuffer.hpp \ - msgpack/zbuffer.hpp \ - msgpack/pack.hpp \ - msgpack/unpack.hpp \ - msgpack/object.hpp \ - msgpack/zone.hpp \ - msgpack/type.hpp \ - msgpack/type/bool.hpp \ - msgpack/type/float.hpp \ - msgpack/type/int.hpp \ - msgpack/type/list.hpp \ - msgpack/type/deque.hpp \ - msgpack/type/map.hpp \ - msgpack/type/nil.hpp \ - msgpack/type/pair.hpp \ - msgpack/type/raw.hpp \ - msgpack/type/set.hpp \ - msgpack/type/string.hpp \ - msgpack/type/vector.hpp \ - msgpack/type/tuple.hpp \ - msgpack/type/define.hpp \ - msgpack/type/tr1/unordered_map.hpp \ - msgpack/type/tr1/unordered_set.hpp - - -EXTRA_DIST = \ +DOC_FILES = \ README.md \ LICENSE \ NOTICE \ @@ -77,17 +8,6 @@ EXTRA_DIST = \ msgpack_vc8.sln \ msgpack_vc8.postbuild.bat -SUBDIRS = test - -check_PROGRAMS = \ - msgpackc_test \ - msgpack_test - -msgpackc_test_SOURCES = msgpackc_test.cpp -msgpackc_test_LDADD = libmsgpack.la -lgtest_main - -msgpack_test_SOURCES = msgpack_test.cpp -msgpack_test_LDADD = libmsgpack.la -lgtest_main - -TESTS = $(check_PROGRAMS) +EXTRA_DIST = \ + $(DOC_FILES) diff --git a/cpp/configure.in b/cpp/configure.in index 61fde4f..0895be4 100644 --- a/cpp/configure.in +++ b/cpp/configure.in @@ -1,4 +1,4 @@ -AC_INIT(object.cpp) +AC_INIT(src/object.cpp) AC_CONFIG_AUX_DIR(ac) AM_INIT_AUTOMAKE(msgpack, 0.5.0) AC_CONFIG_HEADER(config.h) @@ -21,6 +21,21 @@ AC_CHECK_HEADERS(tr1/unordered_map) AC_CHECK_HEADERS(tr1/unordered_set) AC_LANG_POP([C++]) + +AC_MSG_CHECKING([if debug option is enabled]) +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--disable-debug], + [disable assert macros and omit -g option.]) ) +if test "$enable_debug" != "no"; then + CXXFLAGS="$CXXFLAGS -g" + CFLAGS="$CFLAGS -g" +else + CXXFLAGS="$CXXFLAGS -DNDEBUG" + CFLAGS="$CFLAGS -DNDEBUG" +fi +AC_MSG_RESULT($enable_debug) + + AC_CACHE_CHECK([for __sync_* atomic operations], msgpack_cv_atomic_ops, [ AC_TRY_LINK([ int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); } @@ -39,5 +54,5 @@ add CFLAGS="--march=i686" and CXXFLAGS="-march=i686" options to ./configure as f ]) fi -AC_OUTPUT([Makefile test/Makefile]) +AC_OUTPUT([Makefile src/Makefile test/Makefile]) diff --git a/cpp/preprocess b/cpp/preprocess index 80a8357..452006a 100755 --- a/cpp/preprocess +++ b/cpp/preprocess @@ -11,12 +11,12 @@ preprocess() { fi } -preprocess msgpack/type/tuple.hpp -preprocess msgpack/type/define.hpp -preprocess msgpack/zone.hpp -cp -f ../msgpack/sysdep.h msgpack/ -cp -f ../msgpack/pack_define.h msgpack/ -cp -f ../msgpack/pack_template.h msgpack/ -cp -f ../msgpack/unpack_define.h msgpack/ -cp -f ../msgpack/unpack_template.h msgpack/ +preprocess src/msgpack/type/tuple.hpp +preprocess src/msgpack/type/define.hpp +preprocess src/msgpack/zone.hpp +cp -f ../msgpack/sysdep.h src/msgpack/ +cp -f ../msgpack/pack_define.h src/msgpack/ +cp -f ../msgpack/pack_template.h src/msgpack/ +cp -f ../msgpack/unpack_define.h src/msgpack/ +cp -f ../msgpack/unpack_template.h src/msgpack/ diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am new file mode 100644 index 0000000..4cfa87e --- /dev/null +++ b/cpp/src/Makefile.am @@ -0,0 +1,75 @@ + +lib_LTLIBRARIES = libmsgpack.la + +libmsgpack_la_SOURCES = \ + unpack.c \ + objectc.c \ + vrefbuffer.c \ + zone.c \ + object.cpp + +# -version-info CURRENT:REVISION:AGE +libmsgpack_la_LDFLAGS = -version-info 3:0:0 + + +# backward compatibility +lib_LTLIBRARIES += libmsgpackc.la + +libmsgpackc_la_SOURCES = \ + unpack.c \ + objectc.c \ + vrefbuffer.c \ + zone.c + +libmsgpackc_la_LDFLAGS = -version-info 2:0:0 + +# work around for duplicated file name +kumo_manager_CFLAGS = $(AM_CFLAGS) +kumo_manager_CXXFLAGS = $(AM_CXXFLAGS) + + +nobase_include_HEADERS = \ + msgpack/pack_define.h \ + msgpack/pack_template.h \ + msgpack/unpack_define.h \ + msgpack/unpack_template.h \ + msgpack/sysdep.h \ + msgpack.h \ + msgpack/sbuffer.h \ + msgpack/vrefbuffer.h \ + msgpack/zbuffer.h \ + msgpack/pack.h \ + msgpack/unpack.h \ + msgpack/object.h \ + msgpack/zone.h \ + msgpack.hpp \ + msgpack/sbuffer.hpp \ + msgpack/vrefbuffer.hpp \ + msgpack/zbuffer.hpp \ + msgpack/pack.hpp \ + msgpack/unpack.hpp \ + msgpack/object.hpp \ + msgpack/zone.hpp \ + msgpack/type.hpp \ + msgpack/type/bool.hpp \ + msgpack/type/float.hpp \ + msgpack/type/int.hpp \ + msgpack/type/list.hpp \ + msgpack/type/deque.hpp \ + msgpack/type/map.hpp \ + msgpack/type/nil.hpp \ + msgpack/type/pair.hpp \ + msgpack/type/raw.hpp \ + msgpack/type/set.hpp \ + msgpack/type/string.hpp \ + msgpack/type/vector.hpp \ + msgpack/type/tuple.hpp \ + msgpack/type/define.hpp \ + msgpack/type/tr1/unordered_map.hpp \ + msgpack/type/tr1/unordered_set.hpp + +EXTRA_DIST = \ + msgpack/zone.hpp.erb \ + msgpack/type/define.hpp.erb \ + msgpack/type/tuple.hpp.erb + diff --git a/cpp/msgpack.h b/cpp/src/msgpack.h similarity index 100% rename from cpp/msgpack.h rename to cpp/src/msgpack.h diff --git a/cpp/msgpack.hpp b/cpp/src/msgpack.hpp similarity index 100% rename from cpp/msgpack.hpp rename to cpp/src/msgpack.hpp diff --git a/cpp/msgpack/object.h b/cpp/src/msgpack/object.h similarity index 100% rename from cpp/msgpack/object.h rename to cpp/src/msgpack/object.h diff --git a/cpp/msgpack/object.hpp b/cpp/src/msgpack/object.hpp similarity index 100% rename from cpp/msgpack/object.hpp rename to cpp/src/msgpack/object.hpp diff --git a/cpp/msgpack/pack.h b/cpp/src/msgpack/pack.h similarity index 100% rename from cpp/msgpack/pack.h rename to cpp/src/msgpack/pack.h diff --git a/cpp/msgpack/pack.hpp b/cpp/src/msgpack/pack.hpp similarity index 100% rename from cpp/msgpack/pack.hpp rename to cpp/src/msgpack/pack.hpp diff --git a/cpp/msgpack/sbuffer.h b/cpp/src/msgpack/sbuffer.h similarity index 100% rename from cpp/msgpack/sbuffer.h rename to cpp/src/msgpack/sbuffer.h diff --git a/cpp/msgpack/sbuffer.hpp b/cpp/src/msgpack/sbuffer.hpp similarity index 100% rename from cpp/msgpack/sbuffer.hpp rename to cpp/src/msgpack/sbuffer.hpp diff --git a/cpp/msgpack/type.hpp b/cpp/src/msgpack/type.hpp similarity index 100% rename from cpp/msgpack/type.hpp rename to cpp/src/msgpack/type.hpp diff --git a/cpp/msgpack/type/bool.hpp b/cpp/src/msgpack/type/bool.hpp similarity index 100% rename from cpp/msgpack/type/bool.hpp rename to cpp/src/msgpack/type/bool.hpp diff --git a/cpp/msgpack/type/define.hpp.erb b/cpp/src/msgpack/type/define.hpp.erb similarity index 100% rename from cpp/msgpack/type/define.hpp.erb rename to cpp/src/msgpack/type/define.hpp.erb diff --git a/cpp/msgpack/type/deque.hpp b/cpp/src/msgpack/type/deque.hpp similarity index 100% rename from cpp/msgpack/type/deque.hpp rename to cpp/src/msgpack/type/deque.hpp diff --git a/cpp/msgpack/type/float.hpp b/cpp/src/msgpack/type/float.hpp similarity index 100% rename from cpp/msgpack/type/float.hpp rename to cpp/src/msgpack/type/float.hpp diff --git a/cpp/msgpack/type/int.hpp b/cpp/src/msgpack/type/int.hpp similarity index 100% rename from cpp/msgpack/type/int.hpp rename to cpp/src/msgpack/type/int.hpp diff --git a/cpp/msgpack/type/list.hpp b/cpp/src/msgpack/type/list.hpp similarity index 100% rename from cpp/msgpack/type/list.hpp rename to cpp/src/msgpack/type/list.hpp diff --git a/cpp/msgpack/type/map.hpp b/cpp/src/msgpack/type/map.hpp similarity index 100% rename from cpp/msgpack/type/map.hpp rename to cpp/src/msgpack/type/map.hpp diff --git a/cpp/msgpack/type/nil.hpp b/cpp/src/msgpack/type/nil.hpp similarity index 100% rename from cpp/msgpack/type/nil.hpp rename to cpp/src/msgpack/type/nil.hpp diff --git a/cpp/msgpack/type/pair.hpp b/cpp/src/msgpack/type/pair.hpp similarity index 100% rename from cpp/msgpack/type/pair.hpp rename to cpp/src/msgpack/type/pair.hpp diff --git a/cpp/msgpack/type/raw.hpp b/cpp/src/msgpack/type/raw.hpp similarity index 100% rename from cpp/msgpack/type/raw.hpp rename to cpp/src/msgpack/type/raw.hpp diff --git a/cpp/msgpack/type/set.hpp b/cpp/src/msgpack/type/set.hpp similarity index 100% rename from cpp/msgpack/type/set.hpp rename to cpp/src/msgpack/type/set.hpp diff --git a/cpp/msgpack/type/string.hpp b/cpp/src/msgpack/type/string.hpp similarity index 100% rename from cpp/msgpack/type/string.hpp rename to cpp/src/msgpack/type/string.hpp diff --git a/cpp/msgpack/type/tr1/unordered_map.hpp b/cpp/src/msgpack/type/tr1/unordered_map.hpp similarity index 100% rename from cpp/msgpack/type/tr1/unordered_map.hpp rename to cpp/src/msgpack/type/tr1/unordered_map.hpp diff --git a/cpp/msgpack/type/tr1/unordered_set.hpp b/cpp/src/msgpack/type/tr1/unordered_set.hpp similarity index 100% rename from cpp/msgpack/type/tr1/unordered_set.hpp rename to cpp/src/msgpack/type/tr1/unordered_set.hpp diff --git a/cpp/msgpack/type/tuple.hpp.erb b/cpp/src/msgpack/type/tuple.hpp.erb similarity index 100% rename from cpp/msgpack/type/tuple.hpp.erb rename to cpp/src/msgpack/type/tuple.hpp.erb diff --git a/cpp/msgpack/type/vector.hpp b/cpp/src/msgpack/type/vector.hpp similarity index 100% rename from cpp/msgpack/type/vector.hpp rename to cpp/src/msgpack/type/vector.hpp diff --git a/cpp/msgpack/unpack.h b/cpp/src/msgpack/unpack.h similarity index 100% rename from cpp/msgpack/unpack.h rename to cpp/src/msgpack/unpack.h diff --git a/cpp/msgpack/unpack.hpp b/cpp/src/msgpack/unpack.hpp similarity index 100% rename from cpp/msgpack/unpack.hpp rename to cpp/src/msgpack/unpack.hpp diff --git a/cpp/msgpack/vrefbuffer.h b/cpp/src/msgpack/vrefbuffer.h similarity index 100% rename from cpp/msgpack/vrefbuffer.h rename to cpp/src/msgpack/vrefbuffer.h diff --git a/cpp/msgpack/vrefbuffer.hpp b/cpp/src/msgpack/vrefbuffer.hpp similarity index 100% rename from cpp/msgpack/vrefbuffer.hpp rename to cpp/src/msgpack/vrefbuffer.hpp diff --git a/cpp/msgpack/zbuffer.h b/cpp/src/msgpack/zbuffer.h similarity index 100% rename from cpp/msgpack/zbuffer.h rename to cpp/src/msgpack/zbuffer.h diff --git a/cpp/msgpack/zbuffer.hpp b/cpp/src/msgpack/zbuffer.hpp similarity index 100% rename from cpp/msgpack/zbuffer.hpp rename to cpp/src/msgpack/zbuffer.hpp diff --git a/cpp/msgpack/zone.h b/cpp/src/msgpack/zone.h similarity index 100% rename from cpp/msgpack/zone.h rename to cpp/src/msgpack/zone.h diff --git a/cpp/msgpack/zone.hpp.erb b/cpp/src/msgpack/zone.hpp.erb similarity index 100% rename from cpp/msgpack/zone.hpp.erb rename to cpp/src/msgpack/zone.hpp.erb diff --git a/cpp/object.cpp b/cpp/src/object.cpp similarity index 100% rename from cpp/object.cpp rename to cpp/src/object.cpp diff --git a/cpp/objectc.c b/cpp/src/objectc.c similarity index 100% rename from cpp/objectc.c rename to cpp/src/objectc.c diff --git a/cpp/unpack.c b/cpp/src/unpack.c similarity index 100% rename from cpp/unpack.c rename to cpp/src/unpack.c diff --git a/cpp/vrefbuffer.c b/cpp/src/vrefbuffer.c similarity index 100% rename from cpp/vrefbuffer.c rename to cpp/src/vrefbuffer.c diff --git a/cpp/zone.c b/cpp/src/zone.c similarity index 100% rename from cpp/zone.c rename to cpp/src/zone.c diff --git a/cpp/test.mk b/cpp/test.mk deleted file mode 100644 index f1beac5..0000000 --- a/cpp/test.mk +++ /dev/null @@ -1,9 +0,0 @@ - -CXXFLAGS += -Wall -g -I. -I.. -O4 -LDFLAGS += - -all: test - -test: test.o unpack.o zone.o object.o pack.hpp unpack.hpp zone.hpp object.hpp - $(CXX) test.o unpack.o zone.o object.o $(CXXFLAGS) $(LDFLAGS) -o $@ - diff --git a/cpp/test/Makefile.am b/cpp/test/Makefile.am index 2b96669..3670d7f 100644 --- a/cpp/test/Makefile.am +++ b/cpp/test/Makefile.am @@ -1,7 +1,7 @@ -AM_CPPFLAGS = -I.. -AM_C_CPPFLAGS = -I.. -AM_LDFLAGS = ../libmsgpack.la -lgtest_main +AM_CPPFLAGS = -I../src +AM_C_CPPFLAGS = -I../src +AM_LDFLAGS = ../src/libmsgpack.la -lgtest_main check_PROGRAMS = \ zone \ @@ -9,7 +9,9 @@ check_PROGRAMS = \ streaming \ object \ convert \ - buffer + buffer \ + msgpackc_test \ + msgpack_test TESTS = $(check_PROGRAMS) @@ -26,3 +28,7 @@ convert_SOURCES = convert.cc buffer_SOURCES = buffer.cc buffer_LDADD = -lz +msgpackc_test_SOURCES = msgpackc_test.cpp + +msgpack_test_SOURCES = msgpack_test.cpp + diff --git a/cpp/msgpack_test.cpp b/cpp/test/msgpack_test.cpp similarity index 100% rename from cpp/msgpack_test.cpp rename to cpp/test/msgpack_test.cpp diff --git a/cpp/msgpackc_test.cpp b/cpp/test/msgpackc_test.cpp similarity index 100% rename from cpp/msgpackc_test.cpp rename to cpp/test/msgpackc_test.cpp