Skip to content

Commit

Permalink
Switch from qmake to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
tux3 committed Oct 18, 2015
1 parent 8ee8a0e commit 00fbbbf
Show file tree
Hide file tree
Showing 33 changed files with 59 additions and 112 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,11 @@
project(tbak)
cmake_minimum_required(VERSION 3.1)

set (CMAKE_CXX_STANDARD 11)

include_directories(.)
aux_source_directory(. SRC_LIST)
aux_source_directory(net SRC_LIST)
aux_source_directory(util SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} sodium z)
13 changes: 6 additions & 7 deletions README.md
Expand Up @@ -2,10 +2,10 @@
A simple yet somewhat powerful backup tool I made in a weekend after my hard drive crashed.
The main thing I use it for is backing up source code. It supports compression, encryption, and per-backup synchronisation accross several nodes.

There are two important concepts, Folders and Nodes.
There are two concepts, Folders and Nodes.

A folder is a self-contained backup, it can be either a source or an archive.
A source folder contains just some metadata, whereas an archive folder contains metadata plus a compressed and encrypted copy of your file.
A source folder contains just some metadata, whereas an archive folder contains metadata plus a compressed and encrypted copy of your files.

A node is a computer running tbak, when you add a remote node to your own local node, you basically grant that remote node full powers over your own node's backups, so only connect two nodes if you trust both of them.

Expand All @@ -20,16 +20,15 @@ then this is how you would create a new backup and broadcast it to other nodes :
```
tbak folder add-source /some/folder/somewhere
tbak folder push /some/folder/somewhere
tbak folder sync /some/folder/somewhere
```

Then you would just run <code>tbak folder sync /some/folder/somewhere</code> any time you want to synchronise your folder with other nodes, this can for example be done as a cron job.
Then you would just run <code>tbak folder push /some/folder/somewhere</code> any time you want to synchronise your folder with other nodes, this can for example be done as a cron job.

### Compiling

This code is not portable C++, it was written for Linux and uses several advanced non-portable features not available in standard C++ like directories and sockets...

Two libraries are used, zlib for compression and libsodium for encryption.
There is no Makefile, but a Qt .pro file is provived.<br/>
Compiling is done with <code>qmake && make</code>.<br/>
Or, simply passing all source files to g++ while linking <code>-lsodium -lz</code>
The project uses CMake as a build system.
Compiling can be done like this: <code>mkdir build && cd build && cmake .. && make</code>.<br/>
Or, by simply passing all source files to g++ while linking <code>-lsodium -lz</code>
4 changes: 2 additions & 2 deletions archive.cpp
@@ -1,10 +1,10 @@
#include "archive.h"
#include "serialize.h"
#include "settings.h"
#include "filelocker.h"
#include "util/filelocker.h"
#include "crypto.h"
#include "compression.h"
#include "pathtools.h"
#include "util/pathtools.h"
#include <dirent.h>
#include <iostream>
#include <cstring>
Expand Down
4 changes: 2 additions & 2 deletions archivefile.cpp
@@ -1,7 +1,7 @@
#include "archivefile.h"
#include "archive.h"
#include "filelocker.h"
#include "pathtools.h"
#include "util/filelocker.h"
#include "util/pathtools.h"
#include "serialize.h"

using namespace std;
Expand Down
12 changes: 6 additions & 6 deletions commands.cpp
Expand Up @@ -2,16 +2,16 @@
#include "folderdb.h"
#include "nodedb.h"
#include "settings.h"
#include "humanreadable.h"
#include "util/humanreadable.h"
#include "server.h"
#include "netsock.h"
#include "netaddr.h"
#include "net.h"
#include "net/netsock.h"
#include "net/netaddr.h"
#include "net/net.h"
#include "serialize.h"
#include "compression.h"
#include "filetime.h"
#include "pathtools.h"
#include "vt100.h"
#include "util/pathtools.h"
#include "util/vt100.h"
#include <iostream>
#include <memory>
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion crypto.cpp
@@ -1,6 +1,6 @@
#include "crypto.h"
#include "server.h"
#include "netpacket.h"
#include "net/netpacket.h"
#include <unistd.h>
#include <cstdlib>
#include <cstring>
Expand Down
2 changes: 1 addition & 1 deletion folderdb.cpp
@@ -1,6 +1,6 @@
#include "folderdb.h"
#include "serialize.h"
#include "pathtools.h"
#include "util/pathtools.h"
#include "settings.h"
#include <fstream>
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion folderdb.h
Expand Up @@ -5,7 +5,7 @@
#include <string>
#include "archive.h"
#include "source.h"
#include "filelocker.h"
#include "util/filelocker.h"

/// Maintains a database of Folders
class FolderDB
Expand Down
8 changes: 4 additions & 4 deletions main.cpp
Expand Up @@ -8,11 +8,11 @@
#include "nodedb.h"
#include "folderdb.h"
#include "settings.h"
#include "humanreadable.h"
#include "util/humanreadable.h"
#include "server.h"
#include "netpacket.h"
#include "netaddr.h"
#include "net.h"
#include "net/netpacket.h"
#include "net/netaddr.h"
#include "net/net.h"
#include "serialize.h"
#include "compression.h"
#include "sighandlers.h"
Expand Down
4 changes: 2 additions & 2 deletions net.cpp → net/net.cpp
@@ -1,5 +1,5 @@
#include "net.h"
#include "netsock.h"
#include "net/net.h"
#include "net/netsock.h"
#include "server.h"
#include "serialize.h"
#include <algorithm>
Expand Down
4 changes: 2 additions & 2 deletions net.h → net/net.h
Expand Up @@ -2,8 +2,8 @@
#define NET_H

#include "crypto.h"
#include "netpacket.h"
#include "netaddr.h"
#include "net/netpacket.h"
#include "net/netaddr.h"

/// Handles low and high level networking
class Net
Expand Down
2 changes: 1 addition & 1 deletion netaddr.cpp → net/netaddr.cpp
@@ -1,4 +1,4 @@
#include "netaddr.h"
#include "net/netaddr.h"
#include "settings.h"
#include <sys/types.h>
#include <sys/socket.h>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion netpacket.cpp → net/netpacket.cpp
@@ -1,4 +1,4 @@
#include "netpacket.h"
#include "net/netpacket.h"
#include "serialize.h"

NetPacket::NetPacket(Type type)
Expand Down
2 changes: 1 addition & 1 deletion netpacket.h → net/netpacket.h
Expand Up @@ -3,7 +3,7 @@

#include <vector>
#include <cstdint>
#include "netsock.h"
#include "net/netsock.h"

class NetPacket
{
Expand Down
6 changes: 3 additions & 3 deletions netsock.cpp → net/netsock.cpp
@@ -1,6 +1,6 @@
#include "netsock.h"
#include "netpacket.h"
#include "netaddr.h"
#include "net/netsock.h"
#include "net/netpacket.h"
#include "net/netaddr.h"
#include "settings.h"
#include "crypto.h"
#include <poll.h>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions node.cpp
@@ -1,7 +1,7 @@
#include "node.h"
#include "serialize.h"
#include "netsock.h"
#include "netpacket.h"
#include "net/netsock.h"
#include "net/netpacket.h"
#include "compression.h"
#include "sourcefile.h"
#include "server.h"
Expand Down
2 changes: 1 addition & 1 deletion nodedb.cpp
@@ -1,6 +1,6 @@
#include "nodedb.h"
#include "serialize.h"
#include "net.h"
#include "net/net.h"
#include <fstream>
#include <algorithm>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion nodedb.h
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <vector>
#include "node.h"
#include "filelocker.h"
#include "util/filelocker.h"

/// Maintains a database of Nodes
class NodeDB
Expand Down
4 changes: 2 additions & 2 deletions server.cpp
@@ -1,6 +1,6 @@
#include "server.h"
#include "net.h"
#include "netpacket.h"
#include "net/net.h"
#include "net/netpacket.h"
#include "settings.h"
#include "serialize.h"
#include "nodedb.h"
Expand Down
2 changes: 1 addition & 1 deletion server.h
@@ -1,7 +1,7 @@
#ifndef SERVER_H
#define SERVER_H

#include "netsock.h"
#include "net/netsock.h"
#include "crypto.h"
#include <atomic>

Expand Down
4 changes: 2 additions & 2 deletions servercommands.cpp
@@ -1,10 +1,10 @@
#include "server.h"
#include "netpacket.h"
#include "net/netpacket.h"
#include "serialize.h"
#include "nodedb.h"
#include "folderdb.h"
#include "compression.h"
#include "humanreadable.h"
#include "util/humanreadable.h"
#include <iostream>
#include <algorithm>

Expand Down
2 changes: 1 addition & 1 deletion source.cpp
@@ -1,5 +1,5 @@
#include "source.h"
#include "pathtools.h"
#include "util/pathtools.h"
#include <dirent.h>
#include <cstring>
#include <cassert>
Expand Down
4 changes: 2 additions & 2 deletions sourcefile.cpp
@@ -1,8 +1,8 @@
#include "sourcefile.h"
#include "source.h"
#include "serialize.h"
#include "filelocker.h"
#include "pathtools.h"
#include "util/filelocker.h"
#include "util/pathtools.h"
#include <sys/stat.h>
#include <sys/file.h>
#include <utime.h>
Expand Down
63 changes: 0 additions & 63 deletions tbak.pro

This file was deleted.

2 changes: 1 addition & 1 deletion filelocker.cpp → util/filelocker.cpp
@@ -1,4 +1,4 @@
#include "filelocker.h"
#include "util/filelocker.h"
#include <cstdlib>
#include <sys/file.h>
#include <sys/types.h>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion humanreadable.cpp → util/humanreadable.cpp
@@ -1,4 +1,4 @@
#include "humanreadable.h"
#include "util/humanreadable.h"
#include <cstdlib>

std::string humanReadableSize(double size)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pathtools.cpp → util/pathtools.cpp
@@ -1,4 +1,4 @@
#include "pathtools.h"
#include "util/pathtools.h"
#include <cassert>
#include <sys/stat.h>
#include <unistd.h>
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 00fbbbf

Please sign in to comment.