Verified Commit 27f032a6 authored by Marc Vef's avatar Marc Vef
Browse files

CMake: Removing duplicate code from client and daemon

parent 68fe6d28
Loading
Loading
Loading
Loading
+14 −75
Original line number Diff line number Diff line
@@ -48,10 +48,7 @@ set(PRELOAD_HEADERS
    ../../include/global/rpc/rpc_types.hpp
    ../../include/global/rpc/rpc_util.hpp
    )

add_library(gkfs_intercept SHARED ${PRELOAD_SRC} ${PRELOAD_HEADERS})

target_link_libraries(gkfs_intercept
set(PRELOAD_LINK_LIBRARIES
    # internal
    metadata
    distributor
@@ -62,73 +59,33 @@ target_link_libraries(gkfs_intercept
    mercury
    hermes
    fmt::fmt
    Boost::boost # needed for tokenizer header
    Boost::boost
    Threads::Threads
    Date::TZ
    )

target_include_directories(gkfs_intercept
    PRIVATE
set(PRELOAD_INCLUDE_DIRS
    ${ABT_INCLUDE_DIRS}
    ${MARGO_INCLUDE_DIRS}
    )

add_library(gkfs_intercept SHARED ${PRELOAD_SRC} ${PRELOAD_HEADERS})

target_link_libraries(gkfs_intercept ${PRELOAD_LINK_LIBRARIES})

target_include_directories(gkfs_intercept PRIVATE ${PRELOAD_INCLUDE_DIRS})

install(TARGETS gkfs_intercept
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gkfs
    )

################### Forwarding client ###################
if (GKFS_ENABLE_FORWARDING)
    set(FWD_PRELOAD_SRC
        gkfs_functions.cpp
        hooks.cpp
        intercept.cpp
        logging.cpp
        open_file_map.cpp
        open_dir.cpp
        path.cpp
        preload.cpp
        preload_context.cpp
        preload_util.cpp
        ../global/path_util.cpp
        ../global/rpc/rpc_util.cpp
        rpc/rpc_types.cpp
        rpc/forward_data.cpp
        rpc/forward_management.cpp
        rpc/forward_metadata.cpp
        syscalls/detail/syscall_info.c
        ${PRELOAD_SRC}
        )
    set(FWD_PRELOAD_HEADERS
        ../../include/client/gkfs_functions.hpp
        ../../include/config.hpp
        ../../include/client/env.hpp
        ../../include/client/hooks.hpp
        ../../include/client/intercept.hpp
        ../../include/client/logging.hpp
        ../../include/client/make_array.hpp
        ../../include/client/open_file_map.hpp
        ../../include/client/open_dir.hpp
        ../../include/client/path.hpp
        ../../include/client/preload.hpp
        ../../include/client/preload_context.hpp
        ../../include/client/preload_util.hpp
        ../../include/client/rpc/rpc_types.hpp
        ../../include/client/rpc/forward_management.hpp
        ../../include/client/rpc/forward_metadata.hpp
        ../../include/client/rpc/forward_data.hpp
        ../../include/client/syscalls/args.hpp
        ../../include/client/syscalls/decoder.hpp
        ../../include/client/syscalls/errno.hpp
        ../../include/client/syscalls/rets.hpp
        ../../include/client/syscalls/syscall.hpp
        ../../include/client/syscalls/detail/syscall_info.h
        ../../include/global/cmake_configure.hpp
        ../../include/global/chunk_calc_util.hpp
        ../../include/global/global_defs.hpp
        ../../include/global/path_util.hpp
        ../../include/global/rpc/rpc_types.hpp
        ../../include/global/rpc/rpc_util.hpp
        ${PRELOAD_HEADERS}
        )

    add_library(gkfwd_intercept SHARED ${FWD_PRELOAD_SRC} ${FWD_PRELOAD_HEADERS})
@@ -149,27 +106,9 @@ if (GKFS_ENABLE_FORWARDING)
    message(STATUS "[gekkofs] Forwarding mode: ${GKFS_ENABLE_FORWARDING}")
    message(STATUS "[gekkofs] AGIOS scheduling: ${GKFS_ENABLE_AGIOS}")

    target_link_libraries(gkfwd_intercept
        # internal
        metadata
        distributor
        env_util
        # external
        Syscall_intercept::Syscall_intercept
        dl
        mercury
        hermes
        fmt::fmt
        Boost::boost # needed for tokenizer header
        Threads::Threads
        Date::TZ
        )
    target_link_libraries(gkfwd_intercept ${PRELOAD_LINK_LIBRARIES})

    target_include_directories(gkfwd_intercept
        PRIVATE
        ${ABT_INCLUDE_DIRS}
        ${MARGO_INCLUDE_DIRS}
        )
    target_include_directories(gkfwd_intercept PRIVATE ${PRELOAD_INCLUDE_DIRS})

    install(TARGETS gkfwd_intercept
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+13 −53
Original line number Diff line number Diff line
@@ -31,8 +31,7 @@ set(DAEMON_HEADERS
    ../../include/daemon/handler/rpc_defs.hpp
    ../../include/daemon/handler/rpc_util.hpp
    )
add_executable(gkfs_daemon ${DAEMON_SRC} ${DAEMON_HEADERS})
target_link_libraries(gkfs_daemon
set(DAEMON_LINK_LIBRARIES
    # internal libs
    metadata
    metadata_db
@@ -47,54 +46,33 @@ target_link_libraries(gkfs_daemon
    mercury
    ${MARGO_LIBRARIES}
    # others
    Boost::boost # needed for tokenizer header
    Boost::boost
    Boost::program_options
    Boost::filesystem
    Threads::Threads
    )

target_include_directories(gkfs_daemon
    PRIVATE
set(DAEMON_INCLUDE_DIRS
    ${ABT_INCLUDE_DIRS}
    ${MARGO_INCLUDE_DIRS}
    )

add_executable(gkfs_daemon ${DAEMON_SRC} ${DAEMON_HEADERS})
target_link_libraries(gkfs_daemon ${DAEMON_LINK_LIBRARIES})

target_include_directories(gkfs_daemon PRIVATE ${DAEMON_INCLUDE_DIRS})

install(TARGETS gkfs_daemon
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    )

################### Forwarding daemon ###################
if (GKFS_ENABLE_FORWARDING)
    set(FWD_DAEMON_SRC
        ../global/rpc/rpc_util.cpp
        ../global/path_util.cpp
        daemon.cpp
        util.cpp
        ops/metadentry.cpp
        ops/data.cpp
        classes/fs_data.cpp
        classes/rpc_data.cpp
        handler/srv_data.cpp
        handler/srv_metadata.cpp
        handler/srv_management.cpp
        ${DAEMON_SRC}
        scheduler/agios.cpp
        )
    set(FWD_DAEMON_HEADERS
        ../../include/config.hpp
        ../../include/version.hpp
        ../../include/global/cmake_configure.hpp
        ../../include/global/global_defs.hpp
        ../../include/global/rpc/rpc_types.hpp
        ../../include/global/rpc/rpc_util.hpp
        ../../include/global/path_util.hpp
        ../../include/daemon/daemon.hpp
        ../../include/daemon/util.hpp
        ${DAEMON_HEADERS}
        ../../include/daemon/scheduler/agios.hpp
        ../../include/daemon/ops/data.hpp
        ../../include/daemon/ops/metadentry.hpp
        ../../include/daemon/classes/fs_data.hpp
        ../../include/daemon/classes/rpc_data.hpp
        ../../include/daemon/handler/rpc_defs.hpp
        ../../include/daemon/handler/rpc_util.hpp
        )
    add_executable(gkfwd_daemon ${FWD_DAEMON_SRC} ${FWD_DAEMON_HEADERS})

@@ -115,32 +93,14 @@ if (GKFS_ENABLE_FORWARDING)
    message(STATUS "[gekkofs] AGIOS scheduling: ${GKFS_ENABLE_AGIOS}")

    target_link_libraries(gkfwd_daemon
        # internal libs
        metadata
        metadata_db
        storage
        distributor
        log_util
        env_util
        spdlog
        fmt::fmt
        ${DAEMON_LINK_LIBRARIES}
        ${AGIOS_LIBRARIES}
        # margo libs
        ${ABT_LIBRARIES}
        mercury
        ${MARGO_LIBRARIES}
        # others
        Boost::boost # needed for tokenizer header
        Boost::program_options
        Boost::filesystem
        Threads::Threads
        )

    target_include_directories(gkfwd_daemon
        PRIVATE
        ${DAEMON_INCLUDE_DIRS}
        ${AGIOS_INCLUDE_DIRS}
        ${ABT_INCLUDE_DIRS}
        ${MARGO_INCLUDE_DIRS}
        )

    install(TARGETS gkfwd_daemon