Verified Commit 138e04ca authored by Marc Vef's avatar Marc Vef
Browse files

Restructuring directory hierarchy of the project + re-adding header files to CMake sources.

- Previously the directory hierarchy was not clear regarding to which
  file belong to which part of the project (client or daemon).
  Further, we will have other clients in the future (such as Fuse).
- CMake files now differentiate between include dirs for all targets
  and target specific ones.
- Removed duplicate -pg flag.
- Not listing header files when adding executables or libraries
  is considered bad practice. Note that include_directories() is adding
  include paths to the code while adding all files used for executables
  and libraries provide the context which files belong to each binary.
  When only include_directories() is set, CMake assumes that all files
  belong to a binary (which is not necessarily true). As a result,
  some IDEs may break as the do not support this assumption.

  In general we should almost always favor explicitness over implicitness.
parent 87926c12
Loading
Loading
Loading
Loading
+45 −26
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ message("* Current build type is : ${CMAKE_BUILD_TYPE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall --pedantic -g -O0")
set(CMAKE_CXX_FLAGS_MEMCHECK "-Wall --pedantic -g -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_MAINTAINER "-Wall --pedantic -g -O0 -pg -no-pie -pg")
set(CMAKE_CXX_FLAGS_MAINTAINER "-Wall --pedantic -g -O0 -pg -no-pie")
mark_as_advanced(CMAKE_CXX_FLAGS_MAINTAINER)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
@@ -107,37 +107,57 @@ endif()
# boost dependencies, system is required for filesystem
find_package(Boost 1.53 REQUIRED COMPONENTS system filesystem serialization)

include_directories(include)
# define include directories that are relevant for all targets
include_directories(
    include
    ${ABT_INCLUDE_DIRS}
    ${ABT_SNOOZER_INCLUDE_DIRS}
    ${LIBEV_INCLUDE_DIRS}
    ${MERCURY_INCLUDE_DIRS}
    ${MARGO_INCLUDE_DIRS}
)
# Add client library
add_subdirectory(src/preload)

set(DAEMON_SRC
    main.cpp
    util.cpp
    src/daemon/adafs_daemon.cpp
    src/db/db_util.cpp
    src/db/db_ops.cpp
    src/classes/fs_data.cpp
    src/classes/rpc_data.cpp
    src/classes/metadata.cpp
    src/adafs_ops/data.cpp
    src/adafs_ops/metadentry.cpp
    src/rpc/handler/h_metadentry.cpp
    src/rpc/handler/h_data.cpp
    src/rpc/handler/h_preload.cpp
    src/rpc/rpc_utils.cpp
    src/daemon/db/db_util.cpp
    src/daemon/db/db_ops.cpp
    src/daemon/classes/fs_data.cpp
    src/daemon/classes/rpc_data.cpp
    src/daemon/classes/metadata.cpp
    src/daemon/adafs_ops/data.cpp
    src/daemon/adafs_ops/metadentry.cpp
    src/daemon/handler/h_metadentry.cpp
    src/daemon/handler/h_data.cpp
    src/daemon/handler/h_preload.cpp
    src/global/rpc/rpc_utils.cpp
    )

add_executable(adafs_daemon ${DAEMON_SRC})
set(DAEMON_HEADERS
    main.hpp
    configure_public.hpp
    include/global/configure.hpp
    include/global/global_defs.hpp
    include/global/rpc/rpc_defs.hpp
    include/global/rpc/rpc_types.hpp
    include/global/rpc/rpc_utils.hpp
    include/daemon/adafs_daemon.hpp
    include/daemon/adafs_ops/data.hpp
    include/daemon/adafs_ops/metadentry.hpp
    include/daemon/classes/fs_data.hpp
    include/daemon/classes/metadata.hpp
    include/daemon/classes/rpc_data.hpp
    include/daemon/db/db_ops.hpp
    include/daemon/db/db_util.hpp
    )
add_executable(adafs_daemon ${DAEMON_SRC} ${DAEMON_HEADERS})
# define target specific directory includes
target_include_directories(adafs_daemon PUBLIC
    ${ROCKSDB_INCLUDE_DIRS}
    ${MARGO_INCLUDE_DIRS}
    ${ABT_INCLUDE_DIRS}
    ${ABT_SNOOZER_INCLUDE_DIRS}
    ${MERCURY_INCLUDE_DIRS}
    ${LIBEV_INCLUDE_DIRS}
    ${ABT_IO_INCLUDE_DIRS}
    ${ROCKSDB_INCLUDE_DIRS}
)

target_link_libraries(adafs_daemon
    ${ROCKSDB_LIBRARIES}
    # rocksdb libs
@@ -148,14 +168,13 @@ target_link_libraries(adafs_daemon
    ${LZ4_LIBRARY}
    ${gflags_LIBRARIES}
    # margo libs
    ${ABT_LIBRARIES}
    ${ABT_SNOOZER_LIBRARIES}
    ${NA_LIB}
    ${MERCURY_LIBRARIES}
    ${MERCURY_UTIL_LIBRARIES}
    ${ABT_LIBRARIES}
    ${ABT_SNOOZER_LIBRARIES}
    ${MARGO_LIBRARIES}
)

set_target_properties(adafs_daemon PROPERTIES LINK_FLAGS
    "-lpthread -lboost_system -lboost_filesystem -lboost_serialization -lboost_program_options")
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef IFS_DATA_HPP
#define IFS_DATA_HPP

#include "../../main.hpp"
#include "../../../main.hpp"
#include <preload/preload_util.hpp>

std::string path_to_fspath(const std::string& path);
+2 −2
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@
#ifndef IFS_METADENTRY_HPP
#define IFS_METADENTRY_HPP

#include <classes/metadata.hpp>
#include "../../main.hpp"
#include <daemon/classes/metadata.hpp>
#include "../../../main.hpp"

int create_node(const std::string& path, const uid_t uid, const gid_t gid, mode_t mode);

+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef LFS_FS_DATA_H
#define LFS_FS_DATA_H

#include "../../main.hpp"
#include "../../../main.hpp"
#include <map>


+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef FS_METADATA_H
#define FS_METADATA_H

#include "../../main.hpp"
#include "../../../main.hpp"

class Metadata {

Loading