Added build system and empty Client class.

This commit is contained in:
Nathan Osman 2013-06-29 11:34:10 -07:00
parent 0e864955bb
commit 5f3d906702
5 changed files with 113 additions and 3 deletions

47
CMakeLists.txt Normal file
View File

@ -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)

View File

@ -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

21
include/qredis/client.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef QREDIS_CLIENT_H
#define QREDIS_CLIENT_H
#include <QObject>
#include "qredis_export.h"
namespace QRedis
{
class QREDIS_EXPORT Client : public QObject
{
Q_OBJECT
public:
Client();
virtual ~Client();
};
}
#endif // QREDIS_CLIENT_H

View File

@ -0,0 +1,12 @@
#ifndef QREDIS_EXPORT_H
#define QREDIS_EXPORT_H
#include <QtCore/qglobal.h>
#if defined(qredis_EXPORTS)
#define QREDIS_EXPORT Q_DECL_EXPORT
#else
#define QREDIS_EXPORT Q_DECL_IMPORT
#endif
#endif // QREDIS_EXPORT_H

11
src/client.cpp Normal file
View File

@ -0,0 +1,11 @@
#include <qredis/client.h>
using namespace QRedis;
Client::Client()
{
}
Client::~Client()
{
}