Skip to content

Commit 1837780

Browse files
authored
Cmake Cleanup Faabric Part 2 (#165)
* 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
1 parent 2699f67 commit 1837780

File tree

89 files changed

+367
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+367
-467
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FAABRIC_VERSION=0.2.0
2-
FAABRIC_CLI_IMAGE=faasm/faabric:0.2.0
1+
FAABRIC_VERSION=0.2.1
2+
FAABRIC_CLI_IMAGE=faasm/faabric:0.2.1
33
COMPOSE_PROJECT_NAME=faabric-dev

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
build-args: FAABRIC_VERSION=${{ env.TAG_VERSION }}
3535

3636
build-mpi-native:
37+
needs: build-faabric
3738
runs-on: ubuntu-latest
3839
steps:
3940
- name: "Get the code"

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
REDIS_QUEUE_HOST: redis
1717
REDIS_STATE_HOST: redis
1818
container:
19-
image: faasm/faabric:0.2.0
19+
image: faasm/faabric:0.2.1
2020
defaults:
2121
run:
2222
working-directory: /code/faabric
@@ -45,7 +45,7 @@ jobs:
4545
REDIS_QUEUE_HOST: redis
4646
REDIS_STATE_HOST: redis
4747
container:
48-
image: faasm/faabric:0.2.0
48+
image: faasm/faabric:0.2.1
4949
defaults:
5050
run:
5151
working-directory: /code/faabric
@@ -92,7 +92,7 @@ jobs:
9292
REDIS_QUEUE_HOST: redis
9393
REDIS_STATE_HOST: redis
9494
container:
95-
image: faasm/faabric:0.2.0
95+
image: faasm/faabric:0.2.1
9696
defaults:
9797
run:
9898
working-directory: /code/faabric

CMakeLists.txt

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
cmake_minimum_required(VERSION 3.14.0)
1+
cmake_minimum_required(VERSION 3.21.0)
22
project(faabric)
33

44
option(FAABRIC_WASM_BUILD "Build Faabric wasm library" OFF)
55
option(FAABRIC_BUILD_TESTS "Build Faabric tests" ON)
66

7+
# Enable colorized compiler output
8+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
9+
add_compile_options(-fdiagnostics-color=always)
10+
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
11+
add_compile_options(-fcolor-diagnostics)
12+
endif()
13+
714
# Top-level CMake config
815
set(CMAKE_CXX_FLAGS "-Wall")
916
set(CMAKE_CXX_FLAGS_DEBUG "-g")
10-
set(CMAKE_CXX_STANDARD 17)
17+
set(CMAKE_CXX_STANDARD 20)
1118
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1219
set(CMAKE_CXX_EXTENSIONS OFF)
1320

@@ -26,37 +33,25 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
2633
include(cmake/ExternalProjects.cmake)
2734

2835
# Library funcs
29-
function(faabric_lib lib_name lib_deps)
30-
# "Normal" library used for linking internally
31-
add_library(${lib_name} ${lib_deps})
32-
target_include_directories(${lib_name}
33-
PUBLIC ${FAABRIC_INCLUDE_DIR}
34-
PUBLIC ${PISTACHE_INCLUDE_DIR}
35-
PUBLIC ${SPDLOG_INCLUDE_DIR}
36-
PUBLIC ${RAPIDJSON_INCLUDE_DIR}
37-
PUBLIC ${CPPCODEC_INCLUDE_DIR}
38-
PUBLIC ${ZEROMQ_INCLUDE_DIR}
39-
PUBLIC ${PROTOBUF_INCLUDE_DIR}
40-
)
36+
function(faabric_lib lib_name)
37+
# Shared dependencies between the object and normal library
38+
add_library(${lib_name}_deps INTERFACE)
39+
target_link_libraries(${lib_name}_deps INTERFACE faabric::common_dependencies)
4140

4241
# Object library for bundling everything together (should have the same
4342
# include dirs and dependencies as the normal library)
44-
add_library(${lib_name}_obj OBJECT ${lib_deps})
45-
target_include_directories(${lib_name}_obj
46-
PUBLIC ${FAABRIC_INCLUDE_DIR}
47-
PUBLIC ${PISTACHE_INCLUDE_DIR}
48-
PUBLIC ${SPDLOG_INCLUDE_DIR}
49-
PUBLIC ${RAPIDJSON_INCLUDE_DIR}
50-
PUBLIC ${CPPCODEC_INCLUDE_DIR}
51-
PUBLIC ${ZEROMQ_INCLUDE_DIR}
52-
PUBLIC ${PROTOBUF_INCLUDE_DIR}
53-
)
54-
55-
target_link_libraries(${lib_name}_obj ${lib_name})
43+
add_library(${lib_name}_obj OBJECT ${ARGN})
44+
target_link_libraries(${lib_name}_obj PUBLIC ${lib_name}_deps)
45+
add_library(faabric::${lib_name}_obj ALIAS ${lib_name}_obj)
46+
47+
# "Normal" library used for linking internally
48+
add_library(${lib_name} ${ARGN})
49+
target_link_libraries(${lib_name} PUBLIC ${lib_name}_deps)
50+
add_library(faabric::${lib_name} ALIAS ${lib_name})
5651

5752
if(BUILD_SHARED_LIBS)
58-
target_compile_options(${lib_name} PRIVATE "-fPIC")
59-
target_compile_options(${lib_name}_obj PRIVATE "-fPIC")
53+
set_property(TARGET ${lib_name} PROPERTY POSITION_INDEPENDENT_CODE ON)
54+
set_property(TARGET ${lib_name}_obj PROPERTY POSITION_INDEPENDENT_CODE ON)
6055
endif()
6156

6257
# Ensure library generates readable stack traces
@@ -99,33 +94,31 @@ add_library(faabric
9994
$<TARGET_OBJECTS:transport_obj>
10095
$<TARGET_OBJECTS:util_obj>
10196
)
102-
103-
add_dependencies(faabric pistache_ext spdlog_ext)
97+
add_library(faabric::faabric ALIAS faabric)
10498

10599
target_link_libraries(faabric PUBLIC
106-
faabricmpi
107-
hiredis
108-
boost_system
109-
boost_filesystem
110-
zstd::libzstd_static
111-
${PISTACHE_LIBRARY}
112-
${PROTOBUF_LIBRARY}
113-
${ZEROMQ_LIBRARY}
114-
)
100+
faabric::faabricmpi
101+
faabric::common_dependencies
102+
)
115103

116104
target_include_directories(faabric PUBLIC
117105
${FAABRIC_INCLUDE_DIR}
118106
${CMAKE_INSTALL_PREFIX}/include
119107
)
120108

109+
# Ensure faabric generates readable stack traces
110+
target_compile_options(faabric PUBLIC -fno-omit-frame-pointer)
111+
target_link_options(faabric PUBLIC -Wl,--export-dynamic)
112+
121113
# Tests - only include in static builds _and_ when requested
122114
if(BUILD_SHARED_LIBS)
123115
message(STATUS "Skipping test build with shared libs")
124116
elseif(FAABRIC_BUILD_TESTS)
125117
add_subdirectory(tests/dist)
126118
add_subdirectory(tests/test)
127-
add_subdirectory(tests/utils)
128119
endif()
120+
# Utils are used by faasm tests
121+
add_subdirectory(tests/utils)
129122

130123
# Install headers
131124
install(

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.0
1+
0.2.1

bin/run_clang_format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pushd ${TARGET_DIR} >> /dev/null
2222
FILES=$(git ls-files "*.h" "*.cpp" "*.c")
2323

2424
# Run clang-format
25-
clang-format-10 -i ${FILES}
25+
clang-format-13 -i ${FILES}
2626

2727
# Check newlines
2828
for f in ${FILES}; do

bin/run_clang_tidy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def do_tidy(file_list):
9898
def inner_tidy(file_chunk):
9999
print("Running clang-tidy on chunk of {} files".format(len(file_chunk)))
100100
cmd = [
101-
"clang-tidy-10",
101+
"clang-tidy-13",
102102
'-config "{}"'.format(CONFIG),
103103
"--fix",
104104
"--fix-errors",

0 commit comments

Comments
 (0)