diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ef69108 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required (VERSION 2.6) +project (SQLiteCpp) +add_definitions(-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Weffc++ -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn) +add_library(SQLiteCpp + src/Column.cpp + src/Database.cpp + src/Statement.cpp + src/Transaction.cpp +) +add_executable(example1 examples/example1/main.cpp) +target_link_libraries (example1 SQLiteCpp sqlite3) + diff --git a/Makefile b/Makefile index 00ee98e..89f8be6 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ $(BUILD): $(BUILD)/ $(BUILD)/example1: $(SQLITE_EXAMPLE1_OBJECTS) - $(CXX) -o $@ $(SQLITE_EXAMPLE1_OBJECTS) $(LINK_FLAGS) -lsqlite3 -lpthread + $(CXX) -o $@ $(SQLITE_EXAMPLE1_OBJECTS) $(LINK_FLAGS) -lsqlite3 $(BUILD)/main.o: examples/example1/main.cpp diff --git a/README.md b/README.md index ebc92c3..c77d43e 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,25 @@ in a custom shared pointer (See the inner class "Statement::Ptr"). To use this wrappers, you need to add the 10 SQLiteC++ source files from the src/ directory in your project code base, and compile/link against the sqlite library. +### Buildng the examples: + +A basic Makefile is provided, tested under Linux/Ubuntu 12.10, requiring the sqlite3 static library (sqlite3-dev Debian/Ubuntu package) +Solutions for Visual Studio 2008 and 2010 are provided in the "msvc/" directory, directly using the sqlite3.c source code for ease of use. + +#### CMake +A CMake configuration file is also provided for other platform support. +Generating the Linux Makefile and building in Debug: +mkdir Debug +cd Debug +cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug +make -j + +And for the Release version: +mkdir Release +cd Release +cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release +make -j + ### License Copyright (c) 2012-2013 Sébastien Rombauts (sebastien.rombauts@gmail.com)