Commit 9ffcaaa0 authored by Marc Vef's avatar Marc Vef
Browse files

Merge branch 'cmake' into 'master'

Cmake and project cleanup

See merge request zdvresearch_bsc/adafs!10
parents a6432184 14a4f0b4
Loading
Loading
Loading
Loading
+23 −51
Original line number Diff line number Diff line
@@ -12,14 +12,13 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE Release
            CACHE STRING "Choose the type of build: Debug Release Memcheck
            FORCE")
    set(CMAKE_BUILD_TYPE Release
            CACHE STRING "Choose the type of build: Debug Release Memcheck" FORCE)
ENDIF (NOT CMAKE_BUILD_TYPE)
message("* Current daemon build type is : ${CMAKE_BUILD_TYPE}")
message("* Current build type is : ${CMAKE_BUILD_TYPE}")

# Compiler flags for various cmake build types
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64 -O3")
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")
@@ -106,47 +105,20 @@ if (NOT USE_OFI_VERBS AND NOT USE_OFI_PSM2 AND NOT USE_CCI AND NOT USE_BMI)
    add_definitions(-DRPC_PROTOCOL="bmi+tcp")
endif()
# boost dependencies, system is required for filesystem
find_package(Boost 1.53 REQUIRED COMPONENTS system filesystem serialization)

include_directories(include ${ROCKSDB_INCLUDE_DIR}
        # margo paths
        ${MARGO_INCLUDE_DIR} ${ABT_INCLUDE_DIR} ${ABT_SNOOZER_INCLUDE_DIR} ${MERCURY_INCLUDE_DIR} ${LIBEV_INCLUDE_DIRS} ${ABT_IO_INCLUDE_DIRS}
find_package(Boost 1.53 REQUIRED COMPONENTS system filesystem)

# 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}
)

include_directories(include)
# Daemon
add_subdirectory(src/daemon)

# Client library
add_subdirectory(src/preload)
#add_subdirectory(src/fuse3)

set(SOURCE_FILES main.cpp main.hpp include/configure.hpp configure_public.hpp util.cpp
        src/db/db_util.cpp src/classes/fs_data.cpp src/classes/rpc_data.cpp

        include/db/db_util.hpp include/classes/fs_data.hpp include/classes/rpc_data.hpp
        include/classes/metadata.hpp src/classes/metadata.cpp
        src/daemon/adafs_daemon.cpp include/daemon/adafs_daemon.hpp

        include/rpc/rpc_defs.hpp include/rpc/rpc_types.hpp

        #src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp
        src/adafs_ops/metadentry.cpp
        include/adafs_ops/metadentry.hpp src/db/db_ops.cpp src/db/db_ops.cpp include/db/db_ops.hpp
        src/rpc/handler/h_metadentry.cpp
        src/adafs_ops/data.cpp include/adafs_ops/data.hpp src/rpc/handler/h_data.cpp
        src/rpc/handler/h_preload.cpp
        include/rpc/rpc_utils.hpp src/rpc/rpc_utils.cpp include/global_defs.hpp)
add_executable(adafs_daemon ${SOURCE_FILES})

if (${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES}
            # rocksdb libs
            ${snappy_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${ZSTD_LIBRARIES} ${LZ4_LIBRARY} ${gflags_LIBRARIES}
            # margo libs
            ${NA_LIB} ${MERCURY_LIBRARIES} ${MERCURY_UTIL_LIBRARIES} ${ABT_LIBRARIES} ${ABT_SNOOZER_LIBRARIES} ${MARGO_LIBRARIES}
            -lpthread -lboost_system -lboost_filesystem -lboost_serialization -lboost_program_options -pg)
else ()
    target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES}
            # rocksdb libs
            ${snappy_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${ZSTD_LIBRARIES} ${LZ4_LIBRARY} ${gflags_LIBRARIES}
            # margo libs
            ${NA_LIB} ${MERCURY_LIBRARIES} ${MERCURY_UTIL_LIBRARIES} ${ABT_LIBRARIES} ${ABT_SNOOZER_LIBRARIES} ${MARGO_LIBRARIES}
            -lpthread -lboost_system -lboost_filesystem -lboost_serialization -lboost_program_options)
endif ()
 No newline at end of file
+44 −1
Original line number Diff line number Diff line
@@ -2,7 +2,48 @@
#ifndef IFS_ADAFS_DAEMON_HPP
#define IFS_ADAFS_DAEMON_HPP

#include "../../main.hpp"
// std libs
#include <string>
#include <iostream>
#include <cstdint>
#include <cerrno>
#include <unordered_map>
#include <thread>
#include <map>

// adafs config
#include <global/configure.hpp>
#include <global/global_defs.hpp>
// boost libs
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/program_options.hpp>
#include <boost/tokenizer.hpp>
// third party libs
#include <extern/spdlog/spdlog.h>
#include <extern/spdlog/fmt/fmt.h>
// rocksdb
#include <rocksdb/db.h>
#include <rocksdb/slice.h>
#include <rocksdb/options.h>
#include <rocksdb/utilities/transaction.h>
#include <rocksdb/utilities/optimistic_transaction_db.h>
#include <rocksdb/write_batch.h>
// margo
extern "C" {
#include <abt.h>
#include <mercury.h>
#include <margo.h>
}
// adafs
#include <daemon/classes/fs_data.hpp>
#include <daemon/classes/rpc_data.hpp>

namespace bfs = boost::filesystem;

#define INVALID_INODE static_cast<ino_t>(0)
#define ADAFS_DATA (static_cast<FsData*>(FsData::getInstance()))
#define RPC_DATA (static_cast<RPCData*>(RPCData::getInstance()))

bool init_environment();
void destroy_enviroment();
@@ -18,4 +59,6 @@ bool register_daemon_proc();

bool deregister_daemon_proc();

std::string get_my_hostname(bool short_hostname);

#endif //IFS_ADAFS_DAEMON_HPP
+1 −2
Original line number Diff line number Diff line
@@ -2,8 +2,7 @@
#ifndef IFS_DATA_HPP
#define IFS_DATA_HPP

#include "../../main.hpp"
#include <preload/preload_util.hpp>
#include <daemon/adafs_daemon.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/adafs_daemon.hpp>
#include <daemon/classes/metadata.hpp>

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

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

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


class FsData {
Loading