diff --git a/.env b/.env index cfb0127e6..55f963e83 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -FAABRIC_VERSION=0.2.0 -FAABRIC_CLI_IMAGE=faasm/faabric:0.2.0 +FAABRIC_VERSION=0.2.1 +FAABRIC_CLI_IMAGE=faasm/faabric:0.2.1 COMPOSE_PROJECT_NAME=faabric-dev diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1752c6916..7ec59bdaa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,7 @@ jobs: build-args: FAABRIC_VERSION=${{ env.TAG_VERSION }} build-mpi-native: + needs: build-faabric runs-on: ubuntu-latest steps: - name: "Get the code" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 99476dd42..908905126 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: REDIS_QUEUE_HOST: redis REDIS_STATE_HOST: redis container: - image: faasm/faabric:0.2.0 + image: faasm/faabric:0.2.1 defaults: run: working-directory: /code/faabric @@ -45,7 +45,7 @@ jobs: REDIS_QUEUE_HOST: redis REDIS_STATE_HOST: redis container: - image: faasm/faabric:0.2.0 + image: faasm/faabric:0.2.1 defaults: run: working-directory: /code/faabric @@ -92,7 +92,7 @@ jobs: REDIS_QUEUE_HOST: redis REDIS_STATE_HOST: redis container: - image: faasm/faabric:0.2.0 + image: faasm/faabric:0.2.1 defaults: run: working-directory: /code/faabric diff --git a/CMakeLists.txt b/CMakeLists.txt index af9ad31d6..5df357d55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,20 @@ -cmake_minimum_required(VERSION 3.14.0) +cmake_minimum_required(VERSION 3.21.0) project(faabric) option(FAABRIC_WASM_BUILD "Build Faabric wasm library" OFF) option(FAABRIC_BUILD_TESTS "Build Faabric tests" ON) +# Enable colorized compiler output +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + add_compile_options(-fdiagnostics-color=always) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options(-fcolor-diagnostics) +endif() + # Top-level CMake config set(CMAKE_CXX_FLAGS "-Wall") set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -26,37 +33,25 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) include(cmake/ExternalProjects.cmake) # Library funcs -function(faabric_lib lib_name lib_deps) - # "Normal" library used for linking internally - add_library(${lib_name} ${lib_deps}) - target_include_directories(${lib_name} - PUBLIC ${FAABRIC_INCLUDE_DIR} - PUBLIC ${PISTACHE_INCLUDE_DIR} - PUBLIC ${SPDLOG_INCLUDE_DIR} - PUBLIC ${RAPIDJSON_INCLUDE_DIR} - PUBLIC ${CPPCODEC_INCLUDE_DIR} - PUBLIC ${ZEROMQ_INCLUDE_DIR} - PUBLIC ${PROTOBUF_INCLUDE_DIR} - ) +function(faabric_lib lib_name) + # Shared dependencies between the object and normal library + add_library(${lib_name}_deps INTERFACE) + target_link_libraries(${lib_name}_deps INTERFACE faabric::common_dependencies) # Object library for bundling everything together (should have the same # include dirs and dependencies as the normal library) - add_library(${lib_name}_obj OBJECT ${lib_deps}) - target_include_directories(${lib_name}_obj - PUBLIC ${FAABRIC_INCLUDE_DIR} - PUBLIC ${PISTACHE_INCLUDE_DIR} - PUBLIC ${SPDLOG_INCLUDE_DIR} - PUBLIC ${RAPIDJSON_INCLUDE_DIR} - PUBLIC ${CPPCODEC_INCLUDE_DIR} - PUBLIC ${ZEROMQ_INCLUDE_DIR} - PUBLIC ${PROTOBUF_INCLUDE_DIR} - ) - - target_link_libraries(${lib_name}_obj ${lib_name}) + add_library(${lib_name}_obj OBJECT ${ARGN}) + target_link_libraries(${lib_name}_obj PUBLIC ${lib_name}_deps) + add_library(faabric::${lib_name}_obj ALIAS ${lib_name}_obj) + + # "Normal" library used for linking internally + add_library(${lib_name} ${ARGN}) + target_link_libraries(${lib_name} PUBLIC ${lib_name}_deps) + add_library(faabric::${lib_name} ALIAS ${lib_name}) if(BUILD_SHARED_LIBS) - target_compile_options(${lib_name} PRIVATE "-fPIC") - target_compile_options(${lib_name}_obj PRIVATE "-fPIC") + set_property(TARGET ${lib_name} PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET ${lib_name}_obj PROPERTY POSITION_INDEPENDENT_CODE ON) endif() # Ensure library generates readable stack traces @@ -99,33 +94,31 @@ add_library(faabric $ $ ) - -add_dependencies(faabric pistache_ext spdlog_ext) +add_library(faabric::faabric ALIAS faabric) target_link_libraries(faabric PUBLIC - faabricmpi - hiredis - boost_system - boost_filesystem - zstd::libzstd_static - ${PISTACHE_LIBRARY} - ${PROTOBUF_LIBRARY} - ${ZEROMQ_LIBRARY} - ) + faabric::faabricmpi + faabric::common_dependencies +) target_include_directories(faabric PUBLIC ${FAABRIC_INCLUDE_DIR} ${CMAKE_INSTALL_PREFIX}/include ) +# Ensure faabric generates readable stack traces +target_compile_options(faabric PUBLIC -fno-omit-frame-pointer) +target_link_options(faabric PUBLIC -Wl,--export-dynamic) + # Tests - only include in static builds _and_ when requested if(BUILD_SHARED_LIBS) message(STATUS "Skipping test build with shared libs") elseif(FAABRIC_BUILD_TESTS) add_subdirectory(tests/dist) add_subdirectory(tests/test) - add_subdirectory(tests/utils) endif() +# Utils are used by faasm tests +add_subdirectory(tests/utils) # Install headers install( diff --git a/VERSION b/VERSION index 0ea3a944b..0c62199f1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.0 +0.2.1 diff --git a/bin/run_clang_format.sh b/bin/run_clang_format.sh index 53988dcde..2e25b96b6 100755 --- a/bin/run_clang_format.sh +++ b/bin/run_clang_format.sh @@ -22,7 +22,7 @@ pushd ${TARGET_DIR} >> /dev/null FILES=$(git ls-files "*.h" "*.cpp" "*.c") # Run clang-format -clang-format-10 -i ${FILES} +clang-format-13 -i ${FILES} # Check newlines for f in ${FILES}; do diff --git a/bin/run_clang_tidy.py b/bin/run_clang_tidy.py index 7bd04eb19..46d3f087e 100644 --- a/bin/run_clang_tidy.py +++ b/bin/run_clang_tidy.py @@ -98,7 +98,7 @@ def do_tidy(file_list): def inner_tidy(file_chunk): print("Running clang-tidy on chunk of {} files".format(len(file_chunk))) cmd = [ - "clang-tidy-10", + "clang-tidy-13", '-config "{}"'.format(CONFIG), "--fix", "--fix-errors", diff --git a/cmake/ExternalProjects.cmake b/cmake/ExternalProjects.cmake index f27fe9301..7f16a103b 100644 --- a/cmake/ExternalProjects.cmake +++ b/cmake/ExternalProjects.cmake @@ -2,95 +2,97 @@ include(FindGit) find_package(Git) include (ExternalProject) include (FetchContent) +find_package (Threads REQUIRED) -# Protobuf -set(PROTOBUF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libprotobuf.so) -ExternalProject_Add(protobuf_ext - GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git - GIT_TAG "v3.16.0" - SOURCE_SUBDIR "cmake" - CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:STRING=Release" - "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" - "-Dprotobuf_BUILD_TESTS:BOOL=OFF" - "-Dprotobuf_BUILD_SHARED_LIBS:BOOL=ON" - BUILD_BYPRODUCTS ${PROTOBUF_LIBRARY} -) -ExternalProject_Get_Property(protobuf_ext SOURCE_DIR) -set(PROTOBUF_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) -set(PROTOBUF_PROTOC_EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/protoc) -add_library(protobuf_imported SHARED IMPORTED) -add_dependencies(protobuf_imported protobuf_ext) -set_target_properties(protobuf_imported - PROPERTIES IMPORTED_LOCATION ${PROTOBUF_LIBRARY} -) +# Find conan-generated package descriptions +list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR}) +list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}) -# FlatBuffers -set(FLATBUFFERS_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libflatbuffers.so) -ExternalProject_Add(flatbuffers_ext - GIT_REPOSITORY https://github.com/google/flatbuffers.git - GIT_TAG "v2.0.0" - CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:STRING=Release" - "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" - "-DFLATBUFFERS_BUILD_SHAREDLIB:BOOL=ON" - "-DFLATBUFFERS_BUILD_TESTS:BOOL=OFF" - BUILD_BYPRODUCTS ${FLATBUFFERS_LIBRARY} -) -ExternalProject_Get_Property(flatbuffers_ext SOURCE_DIR) -set(FLATBUFFERS_INCLUDE_DIRS ${SOURCE_DIR}/include) -set(FLATBUFFERS_FLATC_EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/flatc) -add_library(flatbuffers_imported SHARED IMPORTED) -add_dependencies(flatbuffers_imported flatbuffers_ext) -set_target_properties(flatbuffers_imported - PROPERTIES IMPORTED_LOCATION ${FLATBUFFERS_LIBRARY} -) +if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conan.cmake") + message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") + file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.16.1/conan.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/conan.cmake" + EXPECTED_HASH SHA256=396e16d0f5eabdc6a14afddbcfff62a54a7ee75c6da23f32f7a31bc85db23484 + TLS_VERIFY ON) +endif() -# Pistache -set(PISTACHE_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libpistache.so) -ExternalProject_Add(pistache_ext - GIT_REPOSITORY "https://github.com/pistacheio/pistache.git" - GIT_TAG "2ef937c434810858e05d446e97acbdd6cc1a5a36" - CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" - BUILD_BYPRODUCTS ${PISTACHE_LIBRARY} -) -ExternalProject_Get_Property(pistache_ext SOURCE_DIR) -set(PISTACHE_INCLUDE_DIR ${SOURCE_DIR}/include) -add_library(pistache_imported SHARED IMPORTED) -add_dependencies(pistache_imported pistache_ext) -set_target_properties(pistache_imported - PROPERTIES IMPORTED_LOCATION ${PISTACHE_LIBRARY} -) +include(${CMAKE_CURRENT_BINARY_DIR}/conan.cmake) -# RapidJSON -ExternalProject_Add(rapidjson_ext - GIT_REPOSITORY "https://github.com/Tencent/rapidjson" - GIT_TAG "2ce91b823c8b4504b9c40f99abf00917641cef6c" - CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" - "-DRAPIDJSON_BUILD_DOC:BOOL=OFF" - "-DRAPIDJSON_BUILD_EXAMPLES:BOOL=OFF" - "-DRAPIDJSON_BUILD_TESTS:BOOL=OFF" +conan_check(VERSION 1.41.0 REQUIRED) + +conan_cmake_configure( + REQUIRES + boost/1.77.0 + catch2/2.13.7 + cppcodec/0.2 + cpprestsdk/2.10.18 + cppzmq/4.8.1 + flatbuffers/2.0.0 + hiredis/1.0.2 + protobuf/3.17.1 + rapidjson/cci.20200410 + spdlog/1.9.2 + zeromq/4.3.4 + GENERATORS + cmake_find_package + cmake_paths + OPTIONS + flatbuffers:options_from_context=False + flatbuffers:flatc=True + flatbuffers:flatbuffers=True + boost:error_code_header_only=True + boost:system_no_deprecated=True + boost:filesystem_no_deprecated=True + boost:zlib=False + boost:bzip2=False + boost:lzma=False + boost:zstd=False + boost:without_locale=True + boost:without_log=True + boost:without_mpi=True + boost:without_python=True + boost:without_test=True + boost:without_wave=True + cpprestsdk:with_websockets=False + zeromq:encryption=None ) -ExternalProject_Get_Property(rapidjson_ext SOURCE_DIR) -set(RAPIDJSON_INCLUDE_DIR ${SOURCE_DIR}/include) -# spdlog -ExternalProject_Add(spdlog_ext - GIT_REPOSITORY "https://github.com/gabime/spdlog" - GIT_TAG "v1.8.0" - CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" +conan_cmake_autodetect(FAABRIC_CONAN_SETTINGS) + +conan_cmake_install(PATH_OR_REFERENCE . + BUILD outdated + REMOTE conancenter + PROFILE_HOST ${CMAKE_CURRENT_LIST_DIR}/../conan-profile.txt + PROFILE_BUILD ${CMAKE_CURRENT_LIST_DIR}/../conan-profile.txt + SETTINGS ${FAABRIC_CONAN_SETTINGS} ) -ExternalProject_Get_Property(spdlog_ext SOURCE_DIR) -set(SPDLOG_INCLUDE_DIR ${SOURCE_DIR}/include) -# cppcodec (for base64) -ExternalProject_Add(cppcodec_ext - GIT_REPOSITORY "https://github.com/tplgy/cppcodec" - GIT_TAG "v0.2" - CMAKE_ARGS "-DBUILD_TESTING=OFF" - CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" +include(${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake) + +find_package(Boost 1.77.0 REQUIRED) +find_package(Catch2 REQUIRED) +find_package(Flatbuffers REQUIRED) +find_package(Protobuf REQUIRED) +find_package(RapidJSON REQUIRED) +find_package(ZLIB REQUIRED) +find_package(ZeroMQ REQUIRED) +find_package(cppcodec REQUIRED) +find_package(cpprestsdk REQUIRED) +find_package(cppzmq REQUIRED) +find_package(fmt REQUIRED) +find_package(hiredis REQUIRED) +find_package(spdlog REQUIRED) + +# Pistache - Conan version is out of date and doesn't support clang +FetchContent_Declare(pistache_ext + GIT_REPOSITORY "https://github.com/pistacheio/pistache.git" + GIT_TAG "ff9db0d9439a4411b24541d97a937968f384a4d3" ) -ExternalProject_Get_Property(cppcodec_ext SOURCE_DIR) -set(CPPCODEC_INCLUDE_DIR ${SOURCE_DIR}) +FetchContent_MakeAvailable(pistache_ext) +add_library(pistache::pistache ALIAS pistache_static) + +# zstd (Conan version not customizable enough) set(ZSTD_BUILD_CONTRIB OFF CACHE INTERNAL "") set(ZSTD_BUILD_CONTRIB OFF CACHE INTERNAL "") set(ZSTD_BUILD_PROGRAMS OFF CACHE INTERNAL "") @@ -116,45 +118,28 @@ FetchContent_MakeAvailable(zstd_ext) target_include_directories(libzstd_static INTERFACE $) add_library(zstd::libzstd_static ALIAS libzstd_static) -# ZeroMQ -set(ZEROMQ_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libzmq.so) -ExternalProject_Add(libzeromq_ext - GIT_REPOSITORY "https://github.com/zeromq/libzmq.git" - GIT_TAG "v4.3.4" - CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" - "-DCMAKE_BUILD_TESTS:BOOL=OFF" - BUILD_BYPRODUCTS ${ZEROMQ_LIBRARY} +# Group all external dependencies into a convenient virtual CMake library +add_library(faabric_common_dependencies INTERFACE) +target_include_directories(faabric_common_dependencies INTERFACE + ${FAABRIC_INCLUDE_DIR} ) -ExternalProject_Get_Property(libzeromq_ext SOURCE_DIR) -set(LIBZEROMQ_INCLUDE_DIR ${SOURCE_DIR}) -ExternalProject_Add(cppzeromq_ext - GIT_REPOSITORY "https://github.com/zeromq/cppzmq.git" - GIT_TAG "v4.7.1" - CMAKE_CACHE_ARGS "-DCPPZMQ_BUILD_TESTS:BOOL=OFF" - "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" +target_link_libraries(faabric_common_dependencies INTERFACE + Boost::Boost + Boost::filesystem + Boost::system + cppcodec::cppcodec + cpprestsdk::cpprestsdk + cppzmq::cppzmq + flatbuffers::flatbuffers + hiredis::hiredis + pistache::pistache + protobuf::libprotobuf + RapidJSON::RapidJSON + spdlog::spdlog + Threads::Threads + zstd::libzstd_static ) -add_dependencies(cppzeromq_ext libzeromq_ext) -ExternalProject_Get_Property(cppzeromq_ext SOURCE_DIR) -set(CPPZEROMQ_INCLUDE_DIR ${SOURCE_DIR}) -set(ZEROMQ_INCLUDE_DIR ${LIBZEROMQ_INCLUDE_DIR} ${CPPZEROMQ_INCLUDE_DIR}) -add_library(zeromq_imported SHARED IMPORTED) -add_dependencies(zeromq_imported cppzeromq_ext) -set_target_properties(zeromq_imported - PROPERTIES IMPORTED_LOCATION ${ZEROMQ_LIBRARY} +target_compile_definitions(faabric_common_dependencies INTERFACE + FMT_DEPRECATED= # Suppress warnings about use of deprecated api by spdlog ) - - -if(FAABRIC_BUILD_TESTS) - # Catch (tests) - set(CATCH_INSTALL_DOCS OFF CACHE INTERNAL "") - set(CATCH_INSTALL_EXTRAS OFF CACHE INTERNAL "") - - ExternalProject_Add(catch_ext - GIT_REPOSITORY "https://github.com/catchorg/Catch2" - GIT_TAG "v2.13.2" - CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}" - ) - ExternalProject_Get_Property(catch_ext SOURCE_DIR) - include_directories(${CMAKE_INSTALL_PREFIX}/include/catch2) -endif() - +add_library(faabric::common_dependencies ALIAS faabric_common_dependencies) diff --git a/conan-profile.txt b/conan-profile.txt new file mode 100644 index 000000000..f7549957e --- /dev/null +++ b/conan-profile.txt @@ -0,0 +1,14 @@ +[settings] +os=Linux +os_build=Linux +arch=x86_64 +arch_build=x86_64 +compiler=clang +compiler.version=13 +compiler.libcxx=libstdc++11 +build_type=Release +[options] +[build_requires] +[env] +CC=/usr/bin/clang-13 +CXX=/usr/bin/clang++-13 diff --git a/docker/faabric.dockerfile b/docker/faabric.dockerfile index 7e552573d..2dd092f60 100644 --- a/docker/faabric.dockerfile +++ b/docker/faabric.dockerfile @@ -1,4 +1,4 @@ -FROM faasm/faabric-base:0.1.0 +FROM faasm/faabric-base:0.2.0 ARG FAABRIC_VERSION # faabic-base image is not re-built often, so tag may be behind diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 0b63ebf74..b9c25772c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.13.0) +cmake_minimum_required(VERSION 3.21.0) project(faabric-examples) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -12,21 +12,19 @@ set(CMAKE_CXX_EXTENSIONS OFF) # ----------------------------------------------- set(FAABRIC_LIB_DIR "/build/faabric/install/lib") +include(../cmake/ExternalProjects.cmake) + function(add_example example_name) add_executable(${example_name} ${example_name}.cpp) target_link_libraries(${example_name} ${FAABRIC_LIB_DIR}/libfaabric.so ${FAABRIC_LIB_DIR}/libfaabricmpi.so - ${FAABRIC_LIB_DIR}/libprotobuf.so - ${FAABRIC_LIB_DIR}/libpistache.so - ${FAABRIC_LIB_DIR}/libzmq.so - boost_system - boost_filesystem - hiredis - pthread + faabric::common_dependencies ) + set_property(TARGET ${example_name} PROPERTY BUILD_RPATH "${FAABRIC_LIB_DIR}") + set(ALL_EXAMPLES ${ALL_EXAMPLES} ${example_name} PARENT_SCOPE) endfunction() diff --git a/include/faabric/util/queue.h b/include/faabric/util/queue.h index 7dc8973ef..521527dc2 100644 --- a/include/faabric/util/queue.h +++ b/include/faabric/util/queue.h @@ -4,6 +4,7 @@ #include #include +#include #include #define DEFAULT_QUEUE_TIMEOUT_MS 5000 diff --git a/mpi-native/examples/CMakeLists.txt b/mpi-native/examples/CMakeLists.txt index 27f1e2681..addb18525 100644 --- a/mpi-native/examples/CMakeLists.txt +++ b/mpi-native/examples/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.13.0) +cmake_minimum_required(VERSION 3.21.0) project(faabric-mpi-examples) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -10,6 +10,8 @@ set(CMAKE_CXX_EXTENSIONS OFF) # ----------------------------------------------- set(FAABRIC_LIB_DIR "/build/faabric/install/lib") +include(../../cmake/ExternalProjects.cmake) + function(add_example example_name) add_executable(${example_name} ${example_name}.cpp) @@ -17,15 +19,11 @@ function(add_example example_name) ${FAABRIC_LIB_DIR}/libfaabric.so ${FAABRIC_LIB_DIR}/libfaabricmpi.so ${FAABRIC_LIB_DIR}/libfaabricmpi_native.so - ${FAABRIC_LIB_DIR}/libprotobuf.so - ${FAABRIC_LIB_DIR}/libpistache.so - ${FAABRIC_LIB_DIR}/libzmq.so - boost_system - boost_filesystem - hiredis - pthread + faabric::common_dependencies ) + set_property(TARGET ${example_name} PROPERTY BUILD_RPATH "${FAABRIC_LIB_DIR}") + set(ALL_EXAMPLES ${ALL_EXAMPLES} ${example_name} PARENT_SCOPE) endfunction() diff --git a/mpi-native/mpi-native.env b/mpi-native/mpi-native.env index 18912f1d0..5b6f0bc21 100644 --- a/mpi-native/mpi-native.env +++ b/mpi-native/mpi-native.env @@ -1,4 +1,4 @@ -FAABRIC_VERSION=0.2.0 +FAABRIC_VERSION=0.2.1 FAABRIC_MPI_NATIVE_IMAGE=faasm/faabric-mpi-native:0.0.18 COMPOSE_PROJECT_NAME=faabric-mpi diff --git a/src/endpoint/CMakeLists.txt b/src/endpoint/CMakeLists.txt index d4e20c598..7237570e6 100644 --- a/src/endpoint/CMakeLists.txt +++ b/src/endpoint/CMakeLists.txt @@ -1,12 +1,8 @@ -file(GLOB HEADERS "${FAABRIC_INCLUDE_DIR}/faabric/endpoint/*.h") -set(LIB_FILES - Endpoint.cpp - FaabricEndpoint.cpp - FaabricEndpointHandler.cpp - ${HEADERS} - ) +faabric_lib(endpoint + Endpoint.cpp + FaabricEndpoint.cpp + FaabricEndpointHandler.cpp +) -faabric_lib(endpoint "${LIB_FILES}") - -target_link_libraries(endpoint pistache_imported pthread util) +target_link_libraries(endpoint PRIVATE faabric::util) diff --git a/src/flat/CMakeLists.txt b/src/flat/CMakeLists.txt index 86f86f4a3..18230c182 100644 --- a/src/flat/CMakeLists.txt +++ b/src/flat/CMakeLists.txt @@ -10,7 +10,7 @@ add_custom_command( OUTPUT "${FB_HEADER}" DEPENDS faabric.fbs WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - COMMAND ${FLATBUFFERS_FLATC_EXECUTABLE} + COMMAND ${CONAN_FLATBUFFERS_ROOT}/bin/flatc ARGS --cpp --gen-mutable --raw-binary faabric.fbs ) @@ -18,29 +18,17 @@ add_custom_command( add_custom_command( OUTPUT "${FB_HEADER_COPIED}" DEPENDS "${FB_HEADER}" - COMMAND ${CMAKE_COMMAND} -E copy - ${FB_HEADER} - ${FB_HEADER_COPIED} - ) + COMMAND ${CMAKE_COMMAND} -E copy ${FB_HEADER} ${FB_HEADER_COPIED} +) + +add_custom_target( + faabric_fbs_copied + DEPENDS ${FB_HEADER_COPIED} +) # ---------------------------------------------- # Faabric wrapper library # ---------------------------------------------- -set(HEADERS - ${FB_HEADER_COPIED} - ) - -set(LIB_FILES - ${HEADERS} - flat.cpp - ) - -# To get faabric_lib to work here we have to set this include_directory. -include_directories(${FAABRIC_INCLUDE_DIR}/faabric/flat) -faabric_lib(flat "${LIB_FILES}") - -# Add include directories for flatbuffers themselves -target_include_directories(flat PUBLIC ${FLATBUFFERS_INCLUDE_DIRS}) - -target_link_libraries(flat flatbuffers_imported) +faabric_lib(flat flat.cpp) +add_dependencies(faabric_common_dependencies faabric_fbs_copied) diff --git a/src/mpi/CMakeLists.txt b/src/mpi/CMakeLists.txt index 1bc4a1ceb..68e961757 100644 --- a/src/mpi/CMakeLists.txt +++ b/src/mpi/CMakeLists.txt @@ -13,13 +13,11 @@ set(PUBLIC_HEADERS ${FAABRIC_INCLUDE_DIR}/faabric/mpi/mpi.h ) -if(BUILD_SHARED_LIBS) - add_library(faabricmpi SHARED mpi.cpp ${PUBLIC_HEADERS}) -else() - add_library(faabricmpi STATIC mpi.cpp ${PUBLIC_HEADERS}) -endif() -set_target_properties(faabricmpi +add_library(faabricmpi mpi.cpp ${PUBLIC_HEADERS}) +add_library(faabric::faabricmpi ALIAS faabricmpi) + +set_target_properties(faabricmpi PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}" ) diff --git a/src/mpi_native/CMakeLists.txt b/src/mpi_native/CMakeLists.txt index dc6d1f461..766f611f1 100644 --- a/src/mpi_native/CMakeLists.txt +++ b/src/mpi_native/CMakeLists.txt @@ -19,11 +19,8 @@ set(LIB_FILES ${MPI_NATIVE_HEADERS} ) -if(BUILD_SHARED_LIBS) - add_library(faabricmpi_native SHARED ${LIB_FILES}) -else() - add_library(faabricmpi_native STATIC ${LIB_FILES}) -endif() +add_library(faabricmpi_native ${LIB_FILES}) +add_library(faabric::faabricmpi_native ALIAS faabricmpi_native) set_target_properties(faabricmpi_native PROPERTIES PUBLIC_HEADER "${MPI_NATIVE_HEADERS}" @@ -34,12 +31,9 @@ target_include_directories(faabricmpi_native ) set(FAABRIC_LIB_DIR "/build/faabric/install/lib") -target_link_libraries(faabricmpi_native - faabric - faabricmpi - ${FAABRIC_LIB_DIR}/libpistache.so - ${FAABRIC_LIB_DIR}/libprotobuf.so - ${FAABRIC_LIB_DIR}/libzmq.so +target_link_libraries(faabricmpi_native PUBLIC + faabric::faabric + faabric::faabricmpi ) install(TARGETS faabricmpi_native diff --git a/src/proto/CMakeLists.txt b/src/proto/CMakeLists.txt index abb8a2a1a..e5a343f36 100644 --- a/src/proto/CMakeLists.txt +++ b/src/proto/CMakeLists.txt @@ -2,45 +2,27 @@ # Protobuf/gRPC generation # ---------------------------------------------- -set(PB_HEADER "${CMAKE_CURRENT_BINARY_DIR}/faabric.pb.h") set(PB_HEADER_COPIED "${FAABRIC_INCLUDE_DIR}/faabric/proto/faabric.pb.h") -set(PB_SRC "${CMAKE_CURRENT_BINARY_DIR}/faabric.pb.cc") -add_custom_command( - OUTPUT "${PB_HEADER}" "${PB_SRC}" - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS --cpp_out "${CMAKE_CURRENT_BINARY_DIR}" - -I "${CMAKE_CURRENT_LIST_DIR}" - faabric.proto - DEPENDS faabric.proto -) +protobuf_generate_cpp(PB_SRC PB_HEADER faabric.proto) # Copy the generated headers into place add_custom_command( OUTPUT "${PB_HEADER_COPIED}" DEPENDS "${PB_HEADER}" - COMMAND ${CMAKE_COMMAND} -E copy - ${PB_HEADER} - ${FAABRIC_INCLUDE_DIR}/faabric/proto/ - ) + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${PB_HEADER} ${FAABRIC_INCLUDE_DIR}/faabric/proto/ +) + +add_custom_target( + faabric_pbh_copied + DEPENDS ${PB_HEADER_COPIED} +) # ---------------------------------------------- # Faabric wrapper library # ---------------------------------------------- -set(HEADERS - ${PB_HEADER_COPIED} - ${GRPC_HEADER_COPIED} - ) - -set(LIB_FILES - ${HEADERS} - ${PB_SRC} - ${GRPC_SRC} - ) - -faabric_lib(proto "${LIB_FILES}") - -add_dependencies(proto spdlog_ext) - -target_link_libraries(proto protobuf_imported) +faabric_lib(proto ${PB_SRC}) +add_dependencies(faabric_common_dependencies faabric_pbh_copied) +target_include_directories(proto_deps INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/redis/CMakeLists.txt b/src/redis/CMakeLists.txt index c2496a22a..bf79682e5 100644 --- a/src/redis/CMakeLists.txt +++ b/src/redis/CMakeLists.txt @@ -1,8 +1,4 @@ -set(LIB_FILES - Redis.cpp - ${FAABRIC_INCLUDE_DIR}/faabric/redis/Redis.h - ) -faabric_lib(redis "${LIB_FILES}") +faabric_lib(redis Redis.cpp) -target_link_libraries(redis util pthread hiredis) +target_link_libraries(redis PRIVATE faabric::util) diff --git a/src/runner/CMakeLists.txt b/src/runner/CMakeLists.txt index 44ecf3da2..6781adacb 100644 --- a/src/runner/CMakeLists.txt +++ b/src/runner/CMakeLists.txt @@ -1,8 +1,4 @@ -set(LIB_FILES - "${FAABRIC_INCLUDE_DIR}/faabric/runner/FaabricMain.h" - FaabricMain.cpp - ) -faabric_lib(runner "${LIB_FILES}") +faabric_lib(runner FaabricMain.cpp) -target_link_libraries(runner scheduler util endpoint) +target_link_libraries(runner PRIVATE faabric::scheduler faabric::util faabric::endpoint) diff --git a/src/scheduler/CMakeLists.txt b/src/scheduler/CMakeLists.txt index 425160e31..fa02a1c8c 100644 --- a/src/scheduler/CMakeLists.txt +++ b/src/scheduler/CMakeLists.txt @@ -1,19 +1,20 @@ -file(GLOB HEADERS "${FAABRIC_INCLUDE_DIR}/faabric/scheduler/*.h") -set(LIB_FILES - ExecutorFactory.cpp - Executor.cpp - ExecGraph.cpp - FunctionCallClient.cpp - FunctionCallServer.cpp - Scheduler.cpp - MpiContext.cpp - MpiMessageBuffer.cpp - MpiWorldRegistry.cpp - MpiWorld.cpp - ${HEADERS} - ) +faabric_lib(scheduler + ExecutorFactory.cpp + Executor.cpp + ExecGraph.cpp + FunctionCallClient.cpp + FunctionCallServer.cpp + Scheduler.cpp + MpiContext.cpp + MpiMessageBuffer.cpp + MpiWorldRegistry.cpp + MpiWorld.cpp +) -faabric_lib(scheduler "${LIB_FILES}") - -target_link_libraries(scheduler snapshot state faabricmpi redis) +target_link_libraries(scheduler PRIVATE + faabric::snapshot + faabric::state + faabric::faabricmpi + faabric::redis +) diff --git a/src/snapshot/CMakeLists.txt b/src/snapshot/CMakeLists.txt index c26f94b8e..00546f320 100644 --- a/src/snapshot/CMakeLists.txt +++ b/src/snapshot/CMakeLists.txt @@ -1,12 +1,13 @@ -file(GLOB HEADERS "${FAABRIC_INCLUDE_DIR}/faabric/snapshot/*.h") -set(LIB_FILES +faabric_lib(snapshot SnapshotClient.cpp SnapshotRegistry.cpp SnapshotServer.cpp - ${HEADERS} ) -faabric_lib(snapshot "${LIB_FILES}") - -target_link_libraries(snapshot proto flat transport util) +target_link_libraries(snapshot PRIVATE + faabric::proto + faabric::flat + faabric::transport + faabric::util +) diff --git a/src/state/CMakeLists.txt b/src/state/CMakeLists.txt index ea7455753..18f17ff0e 100644 --- a/src/state/CMakeLists.txt +++ b/src/state/CMakeLists.txt @@ -1,16 +1,16 @@ -file(GLOB HEADERS "${FAABRIC_INCLUDE_DIR}/faabric/state/*.h") -set(LIB_FILES - InMemoryStateKeyValue.cpp - InMemoryStateRegistry.cpp - State.cpp - StateClient.cpp - StateKeyValue.cpp - StateServer.cpp - RedisStateKeyValue.cpp - ${HEADERS} - ) +faabric_lib(state + InMemoryStateKeyValue.cpp + InMemoryStateRegistry.cpp + State.cpp + StateClient.cpp + StateKeyValue.cpp + StateServer.cpp + RedisStateKeyValue.cpp +) -faabric_lib(state "${LIB_FILES}") - -target_link_libraries(state proto redis transport) +target_link_libraries(state PRIVATE + faabric::proto + faabric::redis + faabric::transport +) diff --git a/src/transport/CMakeLists.txt b/src/transport/CMakeLists.txt index a9ffb8684..c349b1ed9 100644 --- a/src/transport/CMakeLists.txt +++ b/src/transport/CMakeLists.txt @@ -2,21 +2,7 @@ # Faabric transport library: ZeroMQ + Protobuf # ---------------------------------------------- -set(HEADERS - "${FAABRIC_INCLUDE_DIR}/faabric/transport/common.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/context.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/macros.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/Message.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/MessageEndpoint.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/MessageEndpointClient.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/MessageEndpointServer.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/MpiMessageEndpoint.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/PointToPointBroker.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/PointToPointClient.h" - "${FAABRIC_INCLUDE_DIR}/faabric/transport/PointToPointServer.h" -) - -set(LIB_FILES +faabric_lib(transport context.cpp Message.cpp MessageEndpoint.cpp @@ -26,10 +12,6 @@ set(LIB_FILES PointToPointBroker.cpp PointToPointClient.cpp PointToPointServer.cpp - ${HEADERS} ) -faabric_lib(transport "${LIB_FILES}") - -target_link_libraries(transport util proto zeromq_imported) - +target_link_libraries(transport PRIVATE faabric::util faabric::proto) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index dd93029fc..bee41ed71 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,45 +1,26 @@ -find_package(RapidJSON) -file(GLOB HEADERS "${FAABRIC_INCLUDE_DIR}/faabric/util/*.h") - -set(LIB_FILES - barrier.cpp - bytes.cpp - config.cpp - clock.cpp - crash.cpp - delta.cpp - environment.cpp - files.cpp - func.cpp - gids.cpp - json.cpp - latch.cpp - logging.cpp - memory.cpp - network.cpp - queue.cpp - random.cpp - scheduling.cpp - snapshot.cpp - state.cpp - string_tools.cpp - timing.cpp - testing.cpp - ${HEADERS} - ) - -faabric_lib(util "${LIB_FILES}") - -add_dependencies(util pistache_ext) -add_dependencies(util spdlog_ext) -add_dependencies(util rapidjson_ext) -add_dependencies(util cppcodec_ext) - -target_link_libraries( - util PUBLIC - proto - boost_system - boost_filesystem - zstd::libzstd_static +faabric_lib(util + barrier.cpp + bytes.cpp + config.cpp + clock.cpp + crash.cpp + delta.cpp + environment.cpp + files.cpp + func.cpp + gids.cpp + json.cpp + latch.cpp + logging.cpp + memory.cpp + network.cpp + queue.cpp + random.cpp + scheduling.cpp + snapshot.cpp + state.cpp + string_tools.cpp + timing.cpp + testing.cpp ) diff --git a/src/util/crash.cpp b/src/util/crash.cpp index bbbdb7ae0..9a6e97f17 100644 --- a/src/util/crash.cpp +++ b/src/util/crash.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include diff --git a/tasks/dev.py b/tasks/dev.py index 7b0faa227..b202c0e6e 100644 --- a/tasks/dev.py +++ b/tasks/dev.py @@ -38,8 +38,8 @@ def cmake(ctx, clean=False, shared=False, build="Debug"): "-DCMAKE_INSTALL_PREFIX={}".format(FAABRIC_INSTALL_PREFIX), "-DCMAKE_BUILD_TYPE={}".format(build), "-DBUILD_SHARED_LIBS={}".format("ON" if shared else "OFF"), - "-DCMAKE_CXX_COMPILER=/usr/bin/clang++-10", - "-DCMAKE_C_COMPILER=/usr/bin/clang-10", + "-DCMAKE_CXX_COMPILER=/usr/bin/clang++-13", + "-DCMAKE_C_COMPILER=/usr/bin/clang-13", PROJ_ROOT, ] diff --git a/tasks/examples.py b/tasks/examples.py index c81786833..6d06712f5 100644 --- a/tasks/examples.py +++ b/tasks/examples.py @@ -34,8 +34,8 @@ def build(ctx, clean=False): "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_CXX_FLAGS=-I{}".format(INCLUDE_DIR), "-DCMAKE_EXE_LINKER_FLAGS=-L{}".format(LIB_DIR), - "-DCMAKE_CXX_COMPILER=/usr/bin/clang++-10", - "-DCMAKE_C_COMPILER=/usr/bin/clang-10", + "-DCMAKE_CXX_COMPILER=/usr/bin/clang++-13", + "-DCMAKE_C_COMPILER=/usr/bin/clang-13", EXAMPLES_DIR, ] ) diff --git a/tasks/mpi_native.py b/tasks/mpi_native.py index bc1b2d5e6..d69a38e15 100644 --- a/tasks/mpi_native.py +++ b/tasks/mpi_native.py @@ -34,8 +34,8 @@ def build_mpi(ctx, clean=False): "-DCMAKE_BUILD_TYPE=Debug", "-DCMAKE_CXX_FLAGS=-I{}".format(INCLUDE_DIR), "-DCMAKE_EXE_LINKER_FLAGS=-L{}".format(LIB_DIR), - "-DCMAKE_CXX_COMPILER=/usr/bin/clang++-10", - "-DCMAKE_C_COMPILER=/usr/bin/clang-10", + "-DCMAKE_CXX_COMPILER=/usr/bin/clang++-13", + "-DCMAKE_C_COMPILER=/usr/bin/clang-13", MPI_EXAMPLES_DIR, ] ) diff --git a/tests/dist/CMakeLists.txt b/tests/dist/CMakeLists.txt index d24e4b6b9..fd798c5b4 100644 --- a/tests/dist/CMakeLists.txt +++ b/tests/dist/CMakeLists.txt @@ -1,10 +1,5 @@ file(GLOB_RECURSE TEST_FILES ${CMAKE_CURRENT_LIST_DIR} test_*.cpp) -include_directories( - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/../utils -) - # Shared add_library(faabric_dist_tests_lib init.h @@ -15,7 +10,8 @@ add_library(faabric_dist_tests_lib transport/functions.cpp ) -target_link_libraries(faabric_dist_tests_lib faabric_test_utils) +target_link_libraries(faabric_dist_tests_lib PUBLIC faabric::test_utils) +target_include_directories(faabric_dist_tests_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) # Tests add_executable( @@ -24,7 +20,7 @@ add_executable( ${TEST_FILES} ) -target_link_libraries(faabric_dist_tests faabric_dist_tests_lib) +target_link_libraries(faabric_dist_tests PRIVATE faabric_dist_tests_lib) add_test(NAME faabric_dist_tests COMMAND "tests/dist/faabric_dist_tests") @@ -34,5 +30,4 @@ add_executable( server.cpp ) -target_link_libraries(faabric_dist_test_server faabric_dist_tests_lib) - +target_link_libraries(faabric_dist_test_server PRIVATE faabric_dist_tests_lib) diff --git a/tests/dist/main.cpp b/tests/dist/main.cpp index a93cfcd35..f45bb4e32 100644 --- a/tests/dist/main.cpp +++ b/tests/dist/main.cpp @@ -1,6 +1,6 @@ #define CATCH_CONFIG_RUNNER -#include +#include #include "DistTestExecutor.h" #include "faabric_utils.h" diff --git a/tests/dist/scheduler/functions.cpp b/tests/dist/scheduler/functions.cpp index 48b767b0e..b862cbb4d 100644 --- a/tests/dist/scheduler/functions.cpp +++ b/tests/dist/scheduler/functions.cpp @@ -1,4 +1,4 @@ -#include +#include #include "DistTestExecutor.h" #include "faabric_utils.h" diff --git a/tests/dist/scheduler/test_funcs.cpp b/tests/dist/scheduler/test_funcs.cpp index f4fe5445e..191aa547d 100644 --- a/tests/dist/scheduler/test_funcs.cpp +++ b/tests/dist/scheduler/test_funcs.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include "fixtures.h" #include "init.h" diff --git a/tests/dist/scheduler/test_hosts.cpp b/tests/dist/scheduler/test_hosts.cpp index 63850685a..e913bd3ab 100644 --- a/tests/dist/scheduler/test_hosts.cpp +++ b/tests/dist/scheduler/test_hosts.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include "fixtures.h" #include "init.h" diff --git a/tests/dist/scheduler/test_snapshots.cpp b/tests/dist/scheduler/test_snapshots.cpp index 67e141947..a2e0aa084 100644 --- a/tests/dist/scheduler/test_snapshots.cpp +++ b/tests/dist/scheduler/test_snapshots.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" #include "fixtures.h" diff --git a/tests/dist/scheduler/test_threads.cpp b/tests/dist/scheduler/test_threads.cpp index 23eb52b79..86f0d1b3f 100644 --- a/tests/dist/scheduler/test_threads.cpp +++ b/tests/dist/scheduler/test_threads.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include "fixtures.h" #include "init.h" diff --git a/tests/dist/transport/functions.cpp b/tests/dist/transport/functions.cpp index 82bc540d3..6a519113d 100644 --- a/tests/dist/transport/functions.cpp +++ b/tests/dist/transport/functions.cpp @@ -1,4 +1,4 @@ -#include +#include #include "DistTestExecutor.h" #include "faabric_utils.h" diff --git a/tests/dist/transport/test_point_to_point.cpp b/tests/dist/transport/test_point_to_point.cpp index 3e2f01832..7d5e488ba 100644 --- a/tests/dist/transport/test_point_to_point.cpp +++ b/tests/dist/transport/test_point_to_point.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" #include "fixtures.h" diff --git a/tests/test/CMakeLists.txt b/tests/test/CMakeLists.txt index 1a04953b7..46afa61ad 100644 --- a/tests/test/CMakeLists.txt +++ b/tests/test/CMakeLists.txt @@ -1,19 +1,18 @@ file(GLOB_RECURSE TEST_FILES ${CMAKE_CURRENT_LIST_DIR} test_*.cpp) -include_directories( - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/../utils -) - add_executable( faabric_tests main.cpp ${TEST_FILES} ) -target_link_libraries(faabric_tests - faabric_test_utils +target_include_directories(faabric_tests PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} ) -add_test(NAME faabric_tests COMMAND "tests/test/faabric_tests") +target_link_libraries(faabric_tests PRIVATE + faabric::test_utils + faabric::common_dependencies +) +add_test(NAME faabric_tests COMMAND "tests/test/faabric_tests") diff --git a/tests/test/endpoint/test_endpoint_api.cpp b/tests/test/endpoint/test_endpoint_api.cpp index 9d3f7c024..b3cf5861c 100644 --- a/tests/test/endpoint/test_endpoint_api.cpp +++ b/tests/test/endpoint/test_endpoint_api.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/endpoint/test_handler.cpp b/tests/test/endpoint/test_handler.cpp index 964767a97..748ac59f4 100644 --- a/tests/test/endpoint/test_handler.cpp +++ b/tests/test/endpoint/test_handler.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/main.cpp b/tests/test/main.cpp index b3f846b59..2b1022978 100644 --- a/tests/test/main.cpp +++ b/tests/test/main.cpp @@ -1,6 +1,6 @@ #define CATCH_CONFIG_RUNNER -#include +#include #include "faabric_utils.h" diff --git a/tests/test/proto/test_proto.cpp b/tests/test/proto/test_proto.cpp index c96c2bb0d..69139c748 100644 --- a/tests/test/proto/test_proto.cpp +++ b/tests/test/proto/test_proto.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/redis/test_redis.cpp b/tests/test/redis/test_redis.cpp index c6711b67b..b5455c096 100644 --- a/tests/test/redis/test_redis.cpp +++ b/tests/test/redis/test_redis.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/runner/test_main.cpp b/tests/test/runner/test_main.cpp index 9d81fc8aa..5c01f7425 100644 --- a/tests/test/runner/test_main.cpp +++ b/tests/test/runner/test_main.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include #include diff --git a/tests/test/scheduler/test_exec_graph.cpp b/tests/test/scheduler/test_exec_graph.cpp index 595c8eb12..755053ce6 100644 --- a/tests/test/scheduler/test_exec_graph.cpp +++ b/tests/test/scheduler/test_exec_graph.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/scheduler/test_executor.cpp b/tests/test/scheduler/test_executor.cpp index 3925d44ac..02028c551 100644 --- a/tests/test/scheduler/test_executor.cpp +++ b/tests/test/scheduler/test_executor.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include diff --git a/tests/test/scheduler/test_function_client_server.cpp b/tests/test/scheduler/test_function_client_server.cpp index 519679935..c7e982540 100644 --- a/tests/test/scheduler/test_function_client_server.cpp +++ b/tests/test/scheduler/test_function_client_server.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/scheduler/test_mpi_context.cpp b/tests/test/scheduler/test_mpi_context.cpp index d2a64bae2..37fb96b19 100644 --- a/tests/test/scheduler/test_mpi_context.cpp +++ b/tests/test/scheduler/test_mpi_context.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/scheduler/test_mpi_message_buffer.cpp b/tests/test/scheduler/test_mpi_message_buffer.cpp index 40a845c0e..350108c5e 100644 --- a/tests/test/scheduler/test_mpi_message_buffer.cpp +++ b/tests/test/scheduler/test_mpi_message_buffer.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/scheduler/test_mpi_world.cpp b/tests/test/scheduler/test_mpi_world.cpp index 0dec3519e..bcbf53973 100644 --- a/tests/test/scheduler/test_mpi_world.cpp +++ b/tests/test/scheduler/test_mpi_world.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/scheduler/test_remote_mpi_worlds.cpp b/tests/test/scheduler/test_remote_mpi_worlds.cpp index a16febff7..edf5db2d3 100644 --- a/tests/test/scheduler/test_remote_mpi_worlds.cpp +++ b/tests/test/scheduler/test_remote_mpi_worlds.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/scheduler/test_scheduler.cpp b/tests/test/scheduler/test_scheduler.cpp index 6f59af05c..19b2feadf 100644 --- a/tests/test/scheduler/test_scheduler.cpp +++ b/tests/test/scheduler/test_scheduler.cpp @@ -1,4 +1,4 @@ -#include +#include #include "DummyExecutorFactory.h" #include "faabric_utils.h" diff --git a/tests/test/snapshot/test_snapshot_client_server.cpp b/tests/test/snapshot/test_snapshot_client_server.cpp index c2c67c830..aaf1cfa7f 100644 --- a/tests/test/snapshot/test_snapshot_client_server.cpp +++ b/tests/test/snapshot/test_snapshot_client_server.cpp @@ -1,6 +1,6 @@ #include "faabric_utils.h" #include "fixtures.h" -#include +#include #include diff --git a/tests/test/snapshot/test_snapshot_diffs.cpp b/tests/test/snapshot/test_snapshot_diffs.cpp index 63ddc956a..2269d8ba7 100644 --- a/tests/test/snapshot/test_snapshot_diffs.cpp +++ b/tests/test/snapshot/test_snapshot_diffs.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/snapshot/test_snapshot_registry.cpp b/tests/test/snapshot/test_snapshot_registry.cpp index 7491bcb66..b68219628 100644 --- a/tests/test/snapshot/test_snapshot_registry.cpp +++ b/tests/test/snapshot/test_snapshot_registry.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include diff --git a/tests/test/state/test_redis_state.cpp b/tests/test/state/test_redis_state.cpp index 8f5fa2c41..64eaf483b 100644 --- a/tests/test/state/test_redis_state.cpp +++ b/tests/test/state/test_redis_state.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/state/test_state.cpp b/tests/test/state/test_state.cpp index 1827531cd..af9e7aa3b 100644 --- a/tests/test/state/test_state.cpp +++ b/tests/test/state/test_state.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/state/test_state_server.cpp b/tests/test/state/test_state_server.cpp index b2d8c6699..4e66d5837 100644 --- a/tests/test/state/test_state_server.cpp +++ b/tests/test/state/test_state_server.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/transport/test_message_endpoint_client.cpp b/tests/test/transport/test_message_endpoint_client.cpp index f8ca68b1b..307639a65 100644 --- a/tests/test/transport/test_message_endpoint_client.cpp +++ b/tests/test/transport/test_message_endpoint_client.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include #include diff --git a/tests/test/transport/test_message_server.cpp b/tests/test/transport/test_message_server.cpp index fdb4b4080..65ffd35cd 100644 --- a/tests/test/transport/test_message_server.cpp +++ b/tests/test/transport/test_message_server.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/transport/test_mpi_message_endpoint.cpp b/tests/test/transport/test_mpi_message_endpoint.cpp index 670062b20..939c0174a 100644 --- a/tests/test/transport/test_mpi_message_endpoint.cpp +++ b/tests/test/transport/test_mpi_message_endpoint.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/transport/test_point_to_point.cpp b/tests/test/transport/test_point_to_point.cpp index 0e02b131c..5cfb9c1f5 100644 --- a/tests/test/transport/test_point_to_point.cpp +++ b/tests/test/transport/test_point_to_point.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/util/test_barrier.cpp b/tests/test/util/test_barrier.cpp index 2997d3c1c..14af1f2c0 100644 --- a/tests/test/util/test_barrier.cpp +++ b/tests/test/util/test_barrier.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/util/test_bytes.cpp b/tests/test/util/test_bytes.cpp index f9573a572..20d549dff 100644 --- a/tests/test/util/test_bytes.cpp +++ b/tests/test/util/test_bytes.cpp @@ -1,4 +1,4 @@ -#include +#include #include using namespace faabric::util; diff --git a/tests/test/util/test_config.cpp b/tests/test/util/test_config.cpp index 383253057..1c734758f 100644 --- a/tests/test/util/test_config.cpp +++ b/tests/test/util/test_config.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/util/test_delta.cpp b/tests/test/util/test_delta.cpp index 664680edd..b40e4b5c5 100644 --- a/tests/test/util/test_delta.cpp +++ b/tests/test/util/test_delta.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/util/test_environment.cpp b/tests/test/util/test_environment.cpp index 0e2b329a2..4c1f67e02 100644 --- a/tests/test/util/test_environment.cpp +++ b/tests/test/util/test_environment.cpp @@ -1,5 +1,5 @@ #include "faabric_utils.h" -#include +#include #include #include diff --git a/tests/test/util/test_files.cpp b/tests/test/util/test_files.cpp index d0f44cce3..d8725303a 100644 --- a/tests/test/util/test_files.cpp +++ b/tests/test/util/test_files.cpp @@ -1,6 +1,6 @@ #include "faabric/util/bytes.h" #include "faabric/util/config.h" -#include +#include #include diff --git a/tests/test/util/test_func.cpp b/tests/test/util/test_func.cpp index 2d381a820..a70b8c87d 100644 --- a/tests/test/util/test_func.cpp +++ b/tests/test/util/test_func.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/tests/test/util/test_gids.cpp b/tests/test/util/test_gids.cpp index 0dacd0ea6..da049f33a 100644 --- a/tests/test/util/test_gids.cpp +++ b/tests/test/util/test_gids.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/util/test_json.cpp b/tests/test/util/test_json.cpp index c2acaa399..2e2ecfa5a 100644 --- a/tests/test/util/test_json.cpp +++ b/tests/test/util/test_json.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/util/test_latch.cpp b/tests/test/util/test_latch.cpp index 3025ed06a..c383c7b96 100644 --- a/tests/test/util/test_latch.cpp +++ b/tests/test/util/test_latch.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/util/test_memory.cpp b/tests/test/util/test_memory.cpp index 1c50386b8..89095298a 100644 --- a/tests/test/util/test_memory.cpp +++ b/tests/test/util/test_memory.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/tests/test/util/test_network.cpp b/tests/test/util/test_network.cpp index 1a907f1d0..9b083c69e 100644 --- a/tests/test/util/test_network.cpp +++ b/tests/test/util/test_network.cpp @@ -1,4 +1,4 @@ -#include +#include #include using namespace faabric::util; diff --git a/tests/test/util/test_queue.cpp b/tests/test/util/test_queue.cpp index fbf1560ab..a8c40253a 100644 --- a/tests/test/util/test_queue.cpp +++ b/tests/test/util/test_queue.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/test/util/test_random.cpp b/tests/test/util/test_random.cpp index 4ae62df12..4dab409a9 100644 --- a/tests/test/util/test_random.cpp +++ b/tests/test/util/test_random.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/tests/test/util/test_scheduling.cpp b/tests/test/util/test_scheduling.cpp index 7e5ee73fe..c4180cf94 100644 --- a/tests/test/util/test_scheduling.cpp +++ b/tests/test/util/test_scheduling.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" #include "fixtures.h" diff --git a/tests/test/util/test_snapshot.cpp b/tests/test/util/test_snapshot.cpp index 4ae49966c..2a3701ae0 100644 --- a/tests/test/util/test_snapshot.cpp +++ b/tests/test/util/test_snapshot.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" #include "fixtures.h" diff --git a/tests/test/util/test_state.cpp b/tests/test/util/test_state.cpp index 8482e6026..8b71353a0 100644 --- a/tests/test/util/test_state.cpp +++ b/tests/test/util/test_state.cpp @@ -1,4 +1,4 @@ -#include +#include #include using namespace faabric::util; diff --git a/tests/test/util/test_strings.cpp b/tests/test/util/test_strings.cpp index 2d7b33475..610c2a216 100644 --- a/tests/test/util/test_strings.cpp +++ b/tests/test/util/test_strings.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/test/util/test_tokens.cpp b/tests/test/util/test_tokens.cpp index 4bc35f444..8104c8a31 100644 --- a/tests/test/util/test_tokens.cpp +++ b/tests/test/util/test_tokens.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/utils/CMakeLists.txt b/tests/utils/CMakeLists.txt index 294165f87..1390e5d10 100644 --- a/tests/utils/CMakeLists.txt +++ b/tests/utils/CMakeLists.txt @@ -1,23 +1,23 @@ -set(LIB_FILES + +add_library(faabric_test_utils DummyExecutor.cpp - DummyExecutor.h DummyExecutorFactory.cpp - DummyExecutorFactory.h exec_graph_utils.cpp - faabric_utils.h - fixtures.h http_utils.cpp message_utils.cpp scheduling_utils.cpp system_utils.cpp - ) - -add_library(faabric_test_utils "${LIB_FILES}") +) target_compile_options(faabric_test_utils PUBLIC -fno-omit-frame-pointer) target_link_options(faabric_test_utils PUBLIC -Wl,--export-dynamic) -add_dependencies(faabric_test_utils catch_ext) -target_include_directories(faabric_test_utils PUBLIC ${CMAKE_CURRENT_LIST_DIR}) +target_include_directories(faabric_test_utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries(faabric_test_utils PUBLIC + faabric::common_dependencies + faabric::faabric + Catch2::Catch2 +) -target_link_libraries(faabric_test_utils state runner scheduler transport) +add_library(faabric::test_utils ALIAS faabric_test_utils) diff --git a/tests/utils/exec_graph_utils.cpp b/tests/utils/exec_graph_utils.cpp index 6178fcfaa..42a14a611 100644 --- a/tests/utils/exec_graph_utils.cpp +++ b/tests/utils/exec_graph_utils.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/utils/http_utils.cpp b/tests/utils/http_utils.cpp index 7d52b3e82..edd969f7b 100644 --- a/tests/utils/http_utils.cpp +++ b/tests/utils/http_utils.cpp @@ -24,7 +24,7 @@ std::pair submitGetRequestToUrl(const std::string& host, int port, const std::string& body) { - Http::Client client; + Http::Experimental::Client client; client.init(); std::string fullUrl = fmt::format("{}:{}", host, port); diff --git a/tests/utils/message_utils.cpp b/tests/utils/message_utils.cpp index 843dc9762..d441d26b8 100644 --- a/tests/utils/message_utils.cpp +++ b/tests/utils/message_utils.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/utils/scheduling_utils.cpp b/tests/utils/scheduling_utils.cpp index fb123bc80..4a39d53cc 100644 --- a/tests/utils/scheduling_utils.cpp +++ b/tests/utils/scheduling_utils.cpp @@ -1,4 +1,4 @@ -#include +#include #include "faabric_utils.h" diff --git a/tests/utils/system_utils.cpp b/tests/utils/system_utils.cpp index 411a0bf92..353af7a55 100644 --- a/tests/utils/system_utils.cpp +++ b/tests/utils/system_utils.cpp @@ -1,5 +1,5 @@ #include "DummyExecutorFactory.h" -#include +#include #include #include