Permalink
Browse files

added pkg-config file and new macros

  • Loading branch information...
1 parent 816f082 commit 975eb5ba740ba81d81faa28ac0ad1a45bddee582 @bmuller committed Jan 14, 2011
View
1 .gitignore
@@ -1,3 +1,4 @@
+libstactiverecord.pc
acinclude.d/libtool.m4
acinclude.d/ltoptions.m4
acinclude.d/ltsugar.m4
View
3 Makefile.am
@@ -3,6 +3,9 @@ HEADERDIR = stactiverecord
TESTDIR = tests
ACLOCAL_AMFLAGS = -I acinclude.d
+pkgconfigdir=${libdir}/pkgconfig
+pkgconfig_DATA=libstactiverecord.pc
+
nobase_include_HEADERS = $(HEADERDIR)/stactive_record.h $(HEADERDIR)/config.h $(HEADERDIR)/cud_property_register.h \
$(HEADERDIR)/exception.h $(HEADERDIR)/query.h $(HEADERDIR)/record.h $(HEADERDIR)/stactive_record.h \
$(HEADERDIR)/types.h $(HEADERDIR)/utils.h $(HEADERDIR)/storage.h $(HEADERDIR)/where.h $(HEADERDIR)/datetime.h
View
2 configure.ac
@@ -11,6 +11,7 @@ AC_LANG_CPLUSPLUS
AC_CANONICAL_HOST
AC_PROG_INSTALL
AM_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
AC_HEADER_STDC
@@ -37,6 +38,7 @@ AM_CONDITIONAL([POSTGRESQL], [test "$POSTGRESQL_VERSION" != ""])
AC_CONFIG_FILES([
Makefile
+ libstactiverecord.pc
stactiverecord/Makefile
examples/Makefile
tests/Makefile
View
9 examples/many_to_many.cpp
@@ -15,7 +15,7 @@ class Reader;
class Book : public Record<Book> {
public:
- static string classname;
+ SAR_INIT();
string name;
ObjGroup<Reader> readers;
Book() : Record<Book>() { init(); };
@@ -34,11 +34,11 @@ class Book : public Record<Book> {
init();
};
};
-string Book::classname = "book";
+SAR_SET_CLASSNAME(Book, "book");
class Reader : public Record<Reader> {
public:
- static string classname;
+ SAR_INIT();
string name;
ObjGroup<Book> books;
Reader() : Record<Reader>() { init(); };
@@ -57,8 +57,7 @@ class Reader : public Record<Reader> {
init();
};
};
-string Reader::classname = "reader";
-
+SAR_SET_CLASSNAME(Reader, "reader");
int main(int argc, char* argv[]) {
if(argc != 2) {
View
9 examples/one_to_many.cpp
@@ -14,7 +14,7 @@ class SchoolClass;
class Teacher : public Record<Teacher> {
public:
- static string classname;
+ SAR_INIT();
string name;
ObjGroup<SchoolClass> classes;
Teacher() : Record<Teacher>() { init(); };
@@ -33,11 +33,11 @@ class Teacher : public Record<Teacher> {
init();
};
};
-string Teacher::classname = "teacher";
+SAR_SET_CLASSNAME(Teacher, "Teacher");
class SchoolClass : public Record<SchoolClass> {
public:
- static string classname;
+ SAR_INIT();
string name;
Teacher teacher;
SchoolClass() : Record<SchoolClass>() { init(); };
@@ -59,8 +59,7 @@ class SchoolClass : public Record<SchoolClass> {
init();
};
};
-string SchoolClass::classname = "schoolclass";
-
+SAR_SET_CLASSNAME(SchoolClass, "SchoolClass");
int main(int argc, char* argv[]) {
if(argc != 2) {
View
9 examples/one_to_one.cpp
@@ -12,18 +12,17 @@ class Lock : public Record<Lock> {
public:
Lock() : Record<Lock>() {};
Lock(int id) : Record<Lock>(id) {};
- static string classname;
+ SAR_INIT();
};
-string Lock::classname = "lock";
+SAR_SET_CLASSNAME(Lock, "Lock");
class Key : public Record<Key> {
public:
Key() : Record<Key>() {};
Key(int id) : Record<Key>(id) {};
- static string classname;
+ SAR_INIT();
};
-string Key::classname = "key";
-
+SAR_SET_CLASSNAME(Key, "Key");
int main(int argc, char* argv[]) {
if(argc != 2) {
View
4 examples/querying.cpp
@@ -6,11 +6,11 @@ Sar_Dbi * Sar_Dbi::dbi;
// First define a class that we'll be querying on
class Person : public Record<Person> {
public:
- static string classname;
+ SAR_INIT();
Person() : Record<Person>() {};
Person(int id) : Record<Person>(id) {};
};
-string Person::classname = "person";
+SAR_SET_CLASSNAME(Person, "Person");
int main(int argc, char* argv[]) {
if(argc != 2) {
View
4 examples/simple.cpp
@@ -12,7 +12,7 @@ Sar_Dbi * Sar_Dbi::dbi;
class Person : public Record<Person> {
public:
- static string classname;
+ SAR_INIT();
int age;
string fullname;
Person() : Record<Person>() {
@@ -32,7 +32,7 @@ class Person : public Record<Person> {
std::cout << "I'm " << fullname << " and I'm " << age << " years old.\n";
};
};
-string Person::classname = "person";
+SAR_SET_CLASSNAME(Person, "Person");
int main(int argc, char* argv[]) {
if(argc != 2) {
View
11 libstactiverecord.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libstactiverecord
+Description: C++ ORM Database Interface
+Version: @VERSION@
+Requires:
+Cflags: -I${includedir} @SQLITE3_CFLAGS@ @MYSQL_CFLAGS@ @POSTGRESQL_CFLAGS@
+Libs: -L${libdir} -lstactiverecord @SQLITE3_LDFLAGS@ @MYSQL_LDFLAGS@ @POSTGRESQL_LDFLAGS@
View
2 stactiverecord/stactive_record.h
@@ -43,3 +43,5 @@ namespace stactiverecord {
#define VALUE_MAX_SIZE 255
#define VALUE_MAX_SIZE_S "255"
+#define SAR_INIT() static string classname;
+#define SAR_SET_CLASSNAME(c, n) string c::classname = n;

0 comments on commit 975eb5b

Please sign in to comment.