Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
Language: Cpp
BasedOnStyle: Microsoft
AlignConsecutiveAssignments: Consecutive
AllowShortBlocksOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortFunctionsOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
PointerAlignment: Left
SpaceAfterTemplateKeyword: false
53 changes: 53 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CMake

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
format-check:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jidicula/clang-format-action@v4.13.0
with:
clang-format-version: '17'
exclude-regex: '(third_party)'

build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]

runs-on: ${{ matrix.os }}
continue-on-error: true

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(getconf _NPROCESSORS_ONLN)

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@
*.exe
*.out
*.app

.vscode/
build/
docs/
10 changes: 10 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[submodule "third_party/thread-pool"]
path = third_party/thread-pool
url = https://github.com/bshoshany/thread-pool/
[submodule "third_party/spdlog"]
path = third_party/spdlog
url = https://github.com/gabime/spdlog.git
branch = v1.x
[submodule "third_party/doxygen-awesome-css"]
path = third_party/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
93 changes: 93 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
cmake_minimum_required(VERSION 3.10)

if(PROJECT_NAME)
option(flow-core_BUILD_TESTS "Build tests for flow-core" OFF)
else()
option(flow-core_BUILD_TESTS "Build tests for flow-core" ON)
endif()

project(flow-core VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(APPLE)
enable_language(OBJC)
elseif(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()

find_package(nlohmann_json CONFIG QUIET)
if (NOT nlohmann_json_FOUND)
include(FetchContent)
FetchContent_Declare(
nlohmann_json OVERRIDE_FIND_PACKAGE
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
)
FetchContent_MakeAvailable(nlohmann_json)
endif()

add_subdirectory(third_party)

add_library(${PROJECT_NAME} SHARED
src/Connection.cpp
src/Connections.cpp
src/Env.cpp
src/Graph.cpp
src/Log.cpp
src/Node.cpp
src/NodeFactory.cpp
src/Port.cpp
src/TypeConversion.cpp
src/UUID.cpp
)

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${thread_pool_SOURCE_DIR}/include)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/flow/core)

if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
target_link_libraries(${PROJECT_NAME} PUBLIC
nlohmann_json::nlohmann_json
spdlog::spdlog_header_only
)
elseif(APPLE)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_link_libraries(${PROJECT_NAME} PUBLIC
"-framework CoreFoundation"
pthread

nlohmann_json::nlohmann_json
spdlog::spdlog_header_only
)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_link_libraries(${PROJECT_NAME} PUBLIC
dl
pthread
uuid

nlohmann_json::nlohmann_json
spdlog::spdlog_header_only
)
endif()

if (flow-core_BUILD_TESTS)
enable_testing()

find_package(GTest CONFIG QUIET)
if (NOT GTest_FOUND)
include(FetchContent)
FetchContent_Declare(
googletest OVERRIDE_FIND_PACKAGE
URL https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz
GIT_TAG v1.15.2
)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
endif()

add_subdirectory(tests)
endif()
Loading