Skip to content

Commit

Permalink
Cmake Cleanup Faabric Part 2 (#165)
Browse files Browse the repository at this point in the history
* Update to clang 13

* CMake cleanup, Conan dependency management

* Use full Catch2 path in tests to fix compilation error

* Add missing includes

* Pistache update changed where the Http client is located

* Point faabric to the newer faabric-base

* Bump version to v0.2.1

* MPI-Native uses the Faabric container, make sure it gets built first
  • Loading branch information
eigenraven authored Oct 27, 2021
1 parent 2699f67 commit 1837780
Show file tree
Hide file tree
Showing 89 changed files with 367 additions and 467 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
73 changes: 33 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -99,33 +94,31 @@ add_library(faabric
$<TARGET_OBJECTS:transport_obj>
$<TARGET_OBJECTS:util_obj>
)

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(
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1
2 changes: 1 addition & 1 deletion bin/run_clang_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/run_clang_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 1837780

Please sign in to comment.