From b59ee2d1e2f3960ce2aba24a2c71841edb7273c8 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Tue, 17 Feb 2015 01:02:15 +0100 Subject: [PATCH] Switch to biicode --- .gitignore | 2 - CMakeLists.txt | 96 +++++++++++++++++++ src/cryfs_lib/CryConfig.cpp => CryConfig.cpp | 2 +- src/cryfs_lib/CryConfig.h => CryConfig.h | 2 +- src/cryfs_lib/CryDevice.cpp => CryDevice.cpp | 2 +- src/cryfs_lib/CryDevice.h => CryDevice.h | 6 +- src/cryfs_lib/CryDir.cpp => CryDir.cpp | 2 +- src/cryfs_lib/CryDir.h => CryDir.h | 2 +- src/cryfs_lib/CryFile.cpp => CryFile.cpp | 2 +- src/cryfs_lib/CryFile.h => CryFile.h | 2 +- src/cryfs_lib/CryNode.cpp => CryNode.cpp | 2 +- src/cryfs_lib/CryNode.h => CryNode.h | 4 +- .../CryOpenFile.cpp => CryOpenFile.cpp | 2 +- src/cryfs_lib/CryOpenFile.h => CryOpenFile.h | 4 +- biicode.conf | 43 +++++++++ {src/cryfs_lib/impl => impl}/DirBlock.cpp | 2 +- {src/cryfs_lib/impl => impl}/DirBlock.h | 6 +- {src/cryfs_lib/impl => impl}/FileBlock.cpp | 0 {src/cryfs_lib/impl => impl}/FileBlock.h | 2 +- {src/cryfs_lib/impl => impl}/MagicNumbers.h | 0 src/main.cpp => main.cpp | 11 +-- src/cryfs_lib/CMakeLists.txt | 3 - 22 files changed, 164 insertions(+), 33 deletions(-) delete mode 100644 .gitignore create mode 100644 CMakeLists.txt rename src/cryfs_lib/CryConfig.cpp => CryConfig.cpp (96%) rename src/cryfs_lib/CryConfig.h => CryConfig.h (92%) rename src/cryfs_lib/CryDevice.cpp => CryDevice.cpp (97%) rename src/cryfs_lib/CryDevice.h => CryDevice.h (86%) rename src/cryfs_lib/CryDir.cpp => CryDir.cpp (96%) rename src/cryfs_lib/CryDir.h => CryDir.h (94%) rename src/cryfs_lib/CryFile.cpp => CryFile.cpp (92%) rename src/cryfs_lib/CryFile.h => CryFile.h (91%) rename src/cryfs_lib/CryNode.cpp => CryNode.cpp (93%) rename src/cryfs_lib/CryNode.h => CryNode.h (85%) rename src/cryfs_lib/CryOpenFile.cpp => CryOpenFile.cpp (95%) rename src/cryfs_lib/CryOpenFile.h => CryOpenFile.h (87%) create mode 100644 biicode.conf rename {src/cryfs_lib/impl => impl}/DirBlock.cpp (98%) rename {src/cryfs_lib/impl => impl}/DirBlock.h (89%) rename {src/cryfs_lib/impl => impl}/FileBlock.cpp (100%) rename {src/cryfs_lib/impl => impl}/FileBlock.h (91%) rename {src/cryfs_lib/impl => impl}/MagicNumbers.h (100%) rename src/main.cpp => main.cpp (66%) delete mode 100644 src/cryfs_lib/CMakeLists.txt diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d69a93cf..00000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -build.debug -build.release diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..0084b223 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,96 @@ + +# Initializes block variables +INIT_BIICODE_BLOCK() + +# Actually create targets: EXEcutables and libraries. +ADD_BIICODE_TARGETS() + +ACTIVATE_CPP14() + +ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64) + +# You can safely delete lines from here... + +############################################################################### +# REFERENCE # +############################################################################### +# +# This CMakeLists.txt file helps defining your block building and compiling +# To learn more about the CMake use with biicode, visit http://docs.biicode.com/c++.html +# +# ---------------------------------------------------- +# NEW FEATURE! Include cmake files from remote blocks: +# ----------------------------------------------------- +# Now you can handle cmake dependencies alike you do with c/c++: +# +# INCLUDE(user/block/myrecipe) # include myrecipe.cmake from remote user/block +# +# > EXAMPLE: Include our recipes and activate C++11 in your block (http://www.biicode.com/biicode/cmake) +# +# INCLUDE(biicode/cmake/tools) # Include tools.cmake file from "cmake" block from the "biicode" user +# ACTIVATE_CPP11(INTERFACE ${BII_BLOCK_TARGET}) +# +# Remember to run "bii find" to download out cmake tools file +# +# --------------------- +# INIT_BIICODE_BLOCK() +# --------------------- +# This function creates several helper variables as ${BII_BLOCK_NAME} and ${BII_BLOCK_USER} +# Also it loads variables from the cmake/bii_user_block_vars.cmake +# ${BII_LIB_SRC} File list to create the library +# ${BII_LIB_TYPE} Empty (default, STATIC most casess) STATIC or SHARED +# ${BII_LIB_DEPS} Dependencies to other libraries (user2_block2, user3_blockX) +# ${BII_LIB_SYSTEM_HEADERS} System linking requirements as windows.h, pthread.h, etc +# +# You can use or modify them here, for example, to add or remove files from targets based on OS +# Or use typical cmake configurations done BEFORE defining targets. Examples: +# ADD_DEFINITIONS(-DFOO) +# FIND_PACKAGE(OpenGL QUIET) +# You can add INCLUDE_DIRECTORIES here too +# +# --------------------- +# ADD_BIICODE_TARGETS() +# --------------------- +# +# This function creates the following variables: +# ${BII_BLOCK_TARGET} Interface (no files) target for convenient configuration of all +# targets in this block, as the rest of targets always depend on it +# has name in the form "user_block_interface" +# ${BII_LIB_TARGET} Target library name, usually in the form "user_block". May not exist +# if BII_LIB_SRC is empty +# ${BII_BLOCK_TARGETS} List of all targets defined in this block +# ${BII_BLOCK_EXES} List of executables targets defined in this block +# ${BII_exe_name_TARGET}: Executable target (e.g. ${BII_main_TARGET}. You can also use +# directly the name of the executable target (e.g. user_block_main) +# +# > EXAMPLE: Add include directories to all targets of this block +# +# TARGET_INCLUDE_DIRECTORIES(${BII_BLOCK_TARGET} INTERFACE myincludedir) +# +# You can add private include directories to the Lib (if existing) +# +# > EXAMPLE: Link with pthread: +# +# TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE pthread) +# or link against library: +# TARGET_LINK_LIBRARIES(${BII_LIB_TARGET} PUBLIC pthread) +# or directly use the library target name: +# TARGET_LINK_LIBRARIES(user_block PUBLIC pthread) +# +# NOTE: This can be also done adding pthread to ${BII_LIB_DEPS} +# BEFORE calling ADD_BIICODE_TARGETS() +# +# > EXAMPLE: how to activate C++11 +# +# IF(APPLE) +# TARGET_COMPILE_OPTIONS(${BII_BLOCK_TARGET} INTERFACE "-std=c++11 -stdlib=libc++") +# ELSEIF (WIN32 OR UNIX) +# TARGET_COMPILE_OPTIONS(${BII_BLOCK_TARGET} INTERFACE "-std=c++11") +# ENDIF(APPLE) +# +# > EXAMPLE: Set properties to target +# +# SET_TARGET_PROPERTIES(${BII_BLOCK_TARGET} PROPERTIES COMPILE_DEFINITIONS "IOV_MAX=255") +# + + diff --git a/src/cryfs_lib/CryConfig.cpp b/CryConfig.cpp similarity index 96% rename from src/cryfs_lib/CryConfig.cpp rename to CryConfig.cpp index b21a3e69..957f04c2 100644 --- a/src/cryfs_lib/CryConfig.cpp +++ b/CryConfig.cpp @@ -1,4 +1,4 @@ -#include +#include "CryConfig.h" #include #include diff --git a/src/cryfs_lib/CryConfig.h b/CryConfig.h similarity index 92% rename from src/cryfs_lib/CryConfig.h rename to CryConfig.h index d6b932cc..b5f68dcb 100644 --- a/src/cryfs_lib/CryConfig.h +++ b/CryConfig.h @@ -4,7 +4,7 @@ #include -#include "fspp/utils/macros.h" +#include "messmer/cpp-utils/macros.h" namespace cryfs { diff --git a/src/cryfs_lib/CryDevice.cpp b/CryDevice.cpp similarity index 97% rename from src/cryfs_lib/CryDevice.cpp rename to CryDevice.cpp index 704a8935..e6aded69 100644 --- a/src/cryfs_lib/CryDevice.cpp +++ b/CryDevice.cpp @@ -3,7 +3,7 @@ #include "CryDir.h" #include "CryFile.h" -#include "fspp/fuse/FuseErrnoException.h" +#include "messmer/fspp/fuse/FuseErrnoException.h" #include "impl/DirBlock.h" using std::unique_ptr; diff --git a/src/cryfs_lib/CryDevice.h b/CryDevice.h similarity index 86% rename from src/cryfs_lib/CryDevice.h rename to CryDevice.h index 2e1206d3..4acd6006 100644 --- a/src/cryfs_lib/CryDevice.h +++ b/CryDevice.h @@ -2,13 +2,13 @@ #ifndef CRYFS_LIB_CRYDEVICE_H_ #define CRYFS_LIB_CRYDEVICE_H_ -#include +#include #include "CryConfig.h" #include -#include +#include -#include "fspp/utils/macros.h" +#include "messmer/cpp-utils/macros.h" namespace cryfs { diff --git a/src/cryfs_lib/CryDir.cpp b/CryDir.cpp similarity index 96% rename from src/cryfs_lib/CryDir.cpp rename to CryDir.cpp index dd98bb1f..60801072 100644 --- a/src/cryfs_lib/CryDir.cpp +++ b/CryDir.cpp @@ -5,7 +5,7 @@ #include #include -#include "fspp/fuse/FuseErrnoException.h" +#include "messmer/fspp/fuse/FuseErrnoException.h" #include "CryDevice.h" #include "CryFile.h" diff --git a/src/cryfs_lib/CryDir.h b/CryDir.h similarity index 94% rename from src/cryfs_lib/CryDir.h rename to CryDir.h index 6cf85570..cc4c34c2 100644 --- a/src/cryfs_lib/CryDir.h +++ b/CryDir.h @@ -2,7 +2,7 @@ #ifndef CRYFS_LIB_CRYDIR_H_ #define CRYFS_LIB_CRYDIR_H_ -#include +#include #include "CryNode.h" #include "impl/DirBlock.h" diff --git a/src/cryfs_lib/CryFile.cpp b/CryFile.cpp similarity index 92% rename from src/cryfs_lib/CryFile.cpp rename to CryFile.cpp index 7c6f89db..bcc7a169 100644 --- a/src/cryfs_lib/CryFile.cpp +++ b/CryFile.cpp @@ -2,7 +2,7 @@ #include "CryDevice.h" #include "CryOpenFile.h" -#include "fspp/fuse/FuseErrnoException.h" +#include "messmer/fspp/fuse/FuseErrnoException.h" namespace bf = boost::filesystem; diff --git a/src/cryfs_lib/CryFile.h b/CryFile.h similarity index 91% rename from src/cryfs_lib/CryFile.h rename to CryFile.h index e2493e02..91007aa2 100644 --- a/src/cryfs_lib/CryFile.h +++ b/CryFile.h @@ -2,7 +2,7 @@ #ifndef CRYFS_LIB_CRYFILE_H_ #define CRYFS_LIB_CRYFILE_H_ -#include +#include #include "CryNode.h" #include "impl/FileBlock.h" diff --git a/src/cryfs_lib/CryNode.cpp b/CryNode.cpp similarity index 93% rename from src/cryfs_lib/CryNode.cpp rename to CryNode.cpp index 65e8c393..0dfda4a7 100644 --- a/src/cryfs_lib/CryNode.cpp +++ b/CryNode.cpp @@ -3,7 +3,7 @@ #include #include "CryDevice.h" -#include "fspp/fuse/FuseErrnoException.h" +#include "messmer/fspp/fuse/FuseErrnoException.h" namespace bf = boost::filesystem; diff --git a/src/cryfs_lib/CryNode.h b/CryNode.h similarity index 85% rename from src/cryfs_lib/CryNode.h rename to CryNode.h index c1546181..ddfa4f57 100644 --- a/src/cryfs_lib/CryNode.h +++ b/CryNode.h @@ -2,8 +2,8 @@ #ifndef CRYFS_LIB_CRYNODE_H_ #define CRYFS_LIB_CRYNODE_H_ -#include -#include "fspp/utils/macros.h" +#include +#include "messmer/cpp-utils/macros.h" #include "CryDevice.h" diff --git a/src/cryfs_lib/CryOpenFile.cpp b/CryOpenFile.cpp similarity index 95% rename from src/cryfs_lib/CryOpenFile.cpp rename to CryOpenFile.cpp index 05d51ea8..6eb3d307 100644 --- a/src/cryfs_lib/CryOpenFile.cpp +++ b/CryOpenFile.cpp @@ -4,7 +4,7 @@ #include #include "CryDevice.h" -#include "fspp/fuse/FuseErrnoException.h" +#include "messmer/fspp/fuse/FuseErrnoException.h" namespace bf = boost::filesystem; diff --git a/src/cryfs_lib/CryOpenFile.h b/CryOpenFile.h similarity index 87% rename from src/cryfs_lib/CryOpenFile.h rename to CryOpenFile.h index 0e7a7ce7..0d0e1e49 100644 --- a/src/cryfs_lib/CryOpenFile.h +++ b/CryOpenFile.h @@ -2,8 +2,8 @@ #ifndef CRYFS_LIB_CRYOPENFILE_H_ #define CRYFS_LIB_CRYOPENFILE_H_ -#include "fspp/fs_interface/OpenFile.h" -#include "fspp/utils/macros.h" +#include "messmer/fspp/fs_interface/OpenFile.h" +#include "messmer/cpp-utils/macros.h" namespace cryfs { class CryDevice; diff --git a/biicode.conf b/biicode.conf new file mode 100644 index 00000000..106248c3 --- /dev/null +++ b/biicode.conf @@ -0,0 +1,43 @@ +# Biicode configuration file + +[requirements] + messmer/blockstore + messmer/cpp-utils + messmer/fspp + +[parent] + # The parent version of this block. Must match folder name. E.g. + # user/block # No version number means not published yet + # You can change it to publish to a different track, and change version, e.g. + # user/block(track): 7 + +[paths] + # Local directories to look for headers (within block) + # / + # include + +[dependencies] + # Manual adjust file implicit dependencies, add (+), remove (-), or overwrite (=) + # hello.h + hello_imp.cpp hello_imp2.cpp + # *.h + *.cpp + +[mains] + # Manual adjust of files that define an executable + # !main.cpp # Do not build executable from this file + # main2.cpp # Build it (it doesnt have a main() function, but maybe it includes it) + +[hooks] + # These are defined equal to [dependencies],files names matching bii*stage*hook.py + # will be launched as python scripts at stage = {post_process, clean} + # CMakeLists.txt + bii/my_post_process1_hook.py bii_clean_hook.py + +[includes] + # Mapping of include patterns to external blocks + # hello*.h: user3/depblock # includes will be processed as user3/depblock/hello*.h + +[data] + # Manually define data files dependencies, that will be copied to bin for execution + # By default they are copied to bin/user/block/... which should be taken into account + # when loading from disk such data + # image.cpp + image.jpg # code should write open("user/block/image.jpg") + diff --git a/src/cryfs_lib/impl/DirBlock.cpp b/impl/DirBlock.cpp similarity index 98% rename from src/cryfs_lib/impl/DirBlock.cpp rename to impl/DirBlock.cpp index 88d7506b..f421a36e 100644 --- a/src/cryfs_lib/impl/DirBlock.cpp +++ b/impl/DirBlock.cpp @@ -3,7 +3,7 @@ #include //TODO Remove and replace with exception hierarchy -#include "fspp/fuse/FuseErrnoException.h" +#include "messmer/fspp/fuse/FuseErrnoException.h" #include "MagicNumbers.h" diff --git a/src/cryfs_lib/impl/DirBlock.h b/impl/DirBlock.h similarity index 89% rename from src/cryfs_lib/impl/DirBlock.h rename to impl/DirBlock.h index a33e38d6..77211df0 100644 --- a/src/cryfs_lib/impl/DirBlock.h +++ b/impl/DirBlock.h @@ -2,9 +2,9 @@ #ifndef CRYFS_LIB_IMPL_DIRBLOCK_H_ #define CRYFS_LIB_IMPL_DIRBLOCK_H_ -#include -#include -#include "fspp/utils/macros.h" +#include +#include +#include "messmer/cpp-utils/macros.h" #include #include diff --git a/src/cryfs_lib/impl/FileBlock.cpp b/impl/FileBlock.cpp similarity index 100% rename from src/cryfs_lib/impl/FileBlock.cpp rename to impl/FileBlock.cpp diff --git a/src/cryfs_lib/impl/FileBlock.h b/impl/FileBlock.h similarity index 91% rename from src/cryfs_lib/impl/FileBlock.h rename to impl/FileBlock.h index f2287759..5b8529d5 100644 --- a/src/cryfs_lib/impl/FileBlock.h +++ b/impl/FileBlock.h @@ -2,7 +2,7 @@ #ifndef CRYFS_LIB_IMPL_FILEBLOCK_H_ #define CRYFS_LIB_IMPL_FILEBLOCK_H_ -#include +#include #include namespace cryfs { diff --git a/src/cryfs_lib/impl/MagicNumbers.h b/impl/MagicNumbers.h similarity index 100% rename from src/cryfs_lib/impl/MagicNumbers.h rename to impl/MagicNumbers.h diff --git a/src/main.cpp b/main.cpp similarity index 66% rename from src/main.cpp rename to main.cpp index 49310a41..629911d6 100644 --- a/src/main.cpp +++ b/main.cpp @@ -1,13 +1,11 @@ -#include +#include #include #include #include -#include "buildconfig/BuildConfig.h" -#include "fspp/fuse/Fuse.h" -#include "fspp/impl/FilesystemImpl.h" -#include "copyfs/CopyDevice.h" -#include "cryfs_lib/CryDevice.h" +#include "messmer/fspp/fuse/Fuse.h" +#include "messmer/fspp/impl/FilesystemImpl.h" +#include "CryDevice.h" namespace bf = boost::filesystem; @@ -17,7 +15,6 @@ using std::make_unique; int main (int argc, char *argv[]) { - printf("Version: %d\n", buildconfig::VERSION::MAJOR); auto blockStore = make_unique(bf::path("/home/heinzi/cryfstest/root")); auto config = make_unique(bf::path("/home/heinzi/cryfstest/config.json")); cryfs::CryDevice device(std::move(config), std::move(blockStore)); diff --git a/src/cryfs_lib/CMakeLists.txt b/src/cryfs_lib/CMakeLists.txt deleted file mode 100644 index 35c9cdf2..00000000 --- a/src/cryfs_lib/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(cryfs_lib CryDevice.cpp CryDir.cpp CryFile.cpp CryNode.cpp CryOpenFile.cpp CryConfig.cpp impl/DirBlock.cpp impl/FileBlock.cpp) - -target_link_libraries(cryfs_lib)