diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4f1a22a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +# CMake 2.8.9 is required in order to use the new Qt 5 functions. +cmake_minimum_required(VERSION 2.8.9) + +project(qredis) + +# These definitions are used to set the target properties later on. +set(QREDIS_MAJOR 0) +set(QREDIS_MINOR 1) +set(QREDIS_PATCH 0) +set(QREDIS_VERSION "${QREDIS_MAJOR}.${QREDIS_MINOR}.${QREDIS_PATCH}") + +# The QtCore and QtNetwork libraries are both required. +find_package(Qt5Core REQUIRED) +find_package(Qt5Network REQUIRED) + +# TODO: enable C++11 compiler support + +# Specify where QRedis includes are located. +include_directories(include) + +# QRedis source files. +set(QREDIS_SRC + src/client.cpp) + +# QRedis header files requiring MOC. +qt5_wrap_cpp(QREDIS_MOC + include/qredis/client.h) + +# Create the client library. +add_library(qredis SHARED + ${QREDIS_SRC} + ${QREDIS_MOC}) + +# Set the client library's properties. +set_target_properties(qredis PROPERTIES + VERSION ${QREDIS_VERSION} + SOVERSION ${QREDIS_MAJOR}) + +# This causes the appropriate libraries to be included in the link process. +qt5_use_modules(qredis Network) + +# Specify the proper installation paths. +install(TARGETS qredis + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include/qredis) diff --git a/README.md b/README.md index 63b5eb4..6ba811d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,29 @@ ## QRedis -QRedis provides a modern Qt client library for communicating with a Redis server. +QRedis provides a modern Qt client library for communicating with a [Redis server](http://redis.io/). The code uses many new constructs introduced in [C++11](https://en.wikipedia.org/wiki/C%2B%2B11) and compiles exclusively with Qt 5, ensuring years of compatibility down the road. -### Installation +### Building QRedis -[TODO] +QRedis uses [CMake](http://www.cmake.org/) for building the client library, which simplifies the necessary steps across all supported platforms. Assuming you have Qt 5 installed in a location that CMake can find, the client library can be built with the following steps: + +1. Open a terminal and navigate to the directory containing the QRedis source code. + +2. Create a new directory that will contain the object and binary files produced by the build system and change to that directory: + + mkdir build + cd build + +3. Run CMake, which will produce the appropriate Makefile for your platform: + + cmake .. + +4. On Unix-based build systems (including [MSYS](http://www.mingw.org/wiki/MSYS) and [Cygwin](http://www.cygwin.com/)), run: + + make + + For Microsoft Visual C++, run: + + nmake ### Usage diff --git a/include/qredis/client.h b/include/qredis/client.h new file mode 100644 index 0000000..a0b49a0 --- /dev/null +++ b/include/qredis/client.h @@ -0,0 +1,21 @@ +#ifndef QREDIS_CLIENT_H +#define QREDIS_CLIENT_H + +#include + +#include "qredis_export.h" + +namespace QRedis +{ + class QREDIS_EXPORT Client : public QObject + { + Q_OBJECT + + public: + + Client(); + virtual ~Client(); + }; +} + +#endif // QREDIS_CLIENT_H \ No newline at end of file diff --git a/include/qredis/qredis_export.h b/include/qredis/qredis_export.h new file mode 100644 index 0000000..05ddb8f --- /dev/null +++ b/include/qredis/qredis_export.h @@ -0,0 +1,12 @@ +#ifndef QREDIS_EXPORT_H +#define QREDIS_EXPORT_H + +#include + +#if defined(qredis_EXPORTS) + #define QREDIS_EXPORT Q_DECL_EXPORT +#else + #define QREDIS_EXPORT Q_DECL_IMPORT +#endif + +#endif // QREDIS_EXPORT_H diff --git a/src/client.cpp b/src/client.cpp new file mode 100644 index 0000000..88b2e8a --- /dev/null +++ b/src/client.cpp @@ -0,0 +1,11 @@ +#include + +using namespace QRedis; + +Client::Client() +{ +} + +Client::~Client() +{ +} \ No newline at end of file