Commit aaeeb1f1 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Merge branch '9-add-a-new-scord-control-cmake-target' into 'main'

Resolve "Add a new `scord-control` CMake target"

This MR reorganizes the code so that a secondary `scord-ctl` daemon is built. Since a lot of the code is shared between `scord` and `scord-ctl`, it restructures the code structure and the CMake targets so that we can reuse as much as possible. In short, the following changes have been made:

- The source code for the `scord`  daemon now has its own directory in `src/scord`
- A new `scord-ctl` target is added for the new daemon that lives in `src/scord-ctl`
- Library code now lives under the  `lib` directory since `api` seemed ambiguous
- Public rpc definitions now live in `src/lib/rpcs/`
- Private rpc definitions for each daemon now live in `src/scord/rpcs/` and `src/scord-ctl/rpcs/`, respectively
- `config`, `logger`, and `network` code now live under the `common` directory

Closes #9

See merge request !7
parents 7ea41519 4d12b240
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@ list(APPEND examples_cxx
            ADM_register_job ADM_update_job ADM_remove_job
            ADM_register_adhoc_storage ADM_update_adhoc_storage
            ADM_remove_adhoc_storage ADM_deploy_adhoc_storage
            ADM_in_situ_ops ADM_in_transit_ops ADM_transfer_dataset
            # ADM_in_situ_ops ADM_in_transit_ops
            ADM_transfer_dataset
            ADM_set_dataset_information ADM_set_io_resources ADM_get_transfer_priority
            ADM_set_transfer_priority ADM_cancel_transfer ADM_get_pending_transfers
            ADM_set_qos_constraints ADM_get_qos_constraints ADM_define_data_operation ADM_connect_data_operation
@@ -37,6 +38,6 @@ foreach (example IN LISTS examples_cxx)
    add_executable(${example}_cxx)
    target_sources(${example}_cxx PRIVATE ${example}.cpp)
    target_link_libraries(${example}_cxx
      PUBLIC network_engine fmt::fmt adm_iosched)
      PUBLIC common::network::engine fmt::fmt adm_iosched)
    set_target_properties(${example}_cxx PROPERTIES OUTPUT_NAME ${example})
endforeach()
+5 −17
Original line number Diff line number Diff line
@@ -22,21 +22,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

add_subdirectory(config)
add_subdirectory(utils)
add_subdirectory(logger)
add_subdirectory(network)
add_subdirectory(common)
add_subdirectory(scord)
add_subdirectory(scord-ctl)

add_executable(scord server.cpp main.cpp)

target_include_directories(
  scord PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
)

target_link_libraries(
  scord PRIVATE config logger network_engine fmt::fmt Boost::program_options
)

install(TARGETS scord DESTINATION ${CMAKE_INSTALL_BINDIR})

add_subdirectory(api)
# public libraries
add_subdirectory(lib)
+46 −0
Original line number Diff line number Diff line
################################################################################
# Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain            #
#                                                                              #
# This software was partially supported by the EuroHPC-funded project ADMIRE   #
#   (Project ID: 956748, https://www.admire-eurohpc.eu).                       #
#                                                                              #
# This file is part of scord.                                                  #
#                                                                              #
# scord is free software: you can redistribute it and/or modify                #
# it under the terms of the GNU General Public License as published by         #
# the Free Software Foundation, either version 3 of the License, or            #
# (at your option) any later version.                                          #
#                                                                              #
# scord is distributed in the hope that it will be useful,                     #
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
# GNU General Public License for more details.                                 #
#                                                                              #
# You should have received a copy of the GNU General Public License            #
# along with scord.  If not, see <https://www.gnu.org/licenses/>.              #
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

add_library(common INTERFACE)
target_include_directories(common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

add_subdirectory(utils)
target_include_directories(_utils INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_library(common::utils ALIAS _utils)

add_subdirectory(config)
target_include_directories(_config INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_library(common::config ALIAS _config)

add_subdirectory(logger)
target_include_directories(_logger INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_library(common::logger ALIAS _logger)

add_subdirectory(network)
target_include_directories(_network_engine INTERFACE
  ${CMAKE_CURRENT_SOURCE_DIR})
add_library(common::network::engine ALIAS _network_engine)
target_include_directories(_rpc_server INTERFACE
  ${CMAKE_CURRENT_SOURCE_DIR})
add_library(common::network::rpc_server ALIAS _rpc_server)
+5 −5
Original line number Diff line number Diff line
@@ -23,18 +23,18 @@
################################################################################

# Create a config target for all configuration code
add_library(config STATIC)
add_library(_config STATIC)

# Since some of the sources will be auto-generated, we need to search for
# includes in ${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(
  config PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}
  _config PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
                 ${CMAKE_CURRENT_BINARY_DIR}
)
set_property(TARGET config PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET _config PROPERTY POSITION_INDEPENDENT_CODE ON)

target_sources(
  config
  _config
  PRIVATE config.hpp
          defaults.hpp
          ${CMAKE_CURRENT_BINARY_DIR}/defaults.cpp
@@ -46,7 +46,7 @@ target_sources(
          settings.hpp
)

target_link_libraries(config PRIVATE utils file_options::file_options)
target_link_libraries(_config PRIVATE common::utils file_options::file_options)

# ##############################################################################
# Produce several auto-generated files for 'config'
+0 −0

File moved.

Loading