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
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- image: ubuntu-latest
generator: Ninja
build_type: Release
- image: windows-latest
generator: Visual Studio 17 2022
build_type: Release
- image: macos-latest
generator: Ninja
build_type: Release
runs-on: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4

- name: Configure
run: cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DLIBSTREAM_POST_BUILD_UNITTEST=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5

- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel

- name: Test
run: ctest --test-dir build --build-config ${{ matrix.build_type }} --output-on-failure
55 changes: 55 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# Build directory
build/
71 changes: 20 additions & 51 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 3.24)

if (NOT CMAKE_MESSAGE_CONTEXT)
set(CMAKE_MESSAGE_CONTEXT stream)
set(CMAKE_MESSAGE_CONTEXT_SHOW ON CACHE BOOL "Show CMake message context")
endif()

project(stream VERSION 1.0.3 LANGUAGES CXX)
project(stream VERSION 1.0.4 LANGUAGES CXX)

add_subdirectory(cmake)

if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()

get_filename_component(ROOT_DIR ${CMAKE_SOURCE_DIR} REALPATH)
if (NOT ${PROJECT_SOURCE_DIR} STREQUAL ${ROOT_DIR})
set(BUILDING_AS_SUBMODULE ON)
message(STATUS "Building as submodule")
else()

if (PROJECT_IS_TOP_LEVEL)
message(STATUS "Building standalone")
set(CMAKE_FOLDER "${CMAKE_FOLDER}/stream")
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ".CMakePredefinedTargets")
else()
message(STATUS "Building as submodule")
endif()

option(LIBSTREAM_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" OFF)
Expand All @@ -40,9 +42,13 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake

set(FETCHCONTENT_EXTERNALS_DIR ${ROOT_DIR}/build/__external CACHE PATH "FetchContent folder prefix")

include(StreamUtils)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

opendaq_get_cmake_mode(_LIBSTREAM_CMAKE_MODE)
if (NOT _LIBSTREAM_CMAKE_MODE)
opendaq_set_cmake_mode(MODERN)
endif()

if (WIN32)
set(MIN_SUPPORTED_WINDOWS 0x0601)
add_compile_definitions(WIN32_LEAN_AND_MEAN
Expand All @@ -53,61 +59,24 @@ if (WIN32)
message(STATUS "Setting minimum supported API to Windows 7 (${MIN_SUPPORTED_WINDOWS})")
endif()

if (NOT COMMAND set_mode)
message(STATUS "Including Modern.cmake")
include(Modern)
else()
set_mode(MODERN)
endif()

add_library(websocket INTERFACE)
add_library(daq::websocket ALIAS websocket)

target_compile_definitions(websocket INTERFACE BOOST_ALL_NO_LIB)

if (NOT TARGET Boost::beast)
# we are using headers only (asio and beast for websockets)
set(Boost_REQUIREDVERSION "1.71.0")
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost ${Boost_REQUIREDVERSION} COMPONENTS system)

if (Boost_FOUND)
message(STATUS "Boost ${Boost_VERSION_STRING} at: ${Boost_INCLUDE_DIRS} | ${Boost_LIBRARY_DIRS}")

target_link_libraries(websocket INTERFACE ${Boost_LIBRARIES})
target_include_directories(websocket INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
)

set(BOOST_LIBS ${Boost_LIBRARIES})
else (Boost_FOUND)
message(STATUS "Pre-installed required Boost not found. Fetching Boost 1.82.0 ...")
get_custom_fetch_content_params(Boost FC_PARAMS)
FetchContent_Declare(Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.82.0/boost-1.82.0.tar.xz
URL_HASH SHA256=fd60da30be908eff945735ac7d4d9addc7f7725b1ff6fcdcaede5262d511d21e
${FC_PARAMS}
)
FetchContent_MakeAvailable(Boost)
endif (Boost_FOUND)
endif()

if (TARGET Boost::beast)
target_link_libraries(websocket
INTERFACE
$<BUILD_INTERFACE:Boost::beast>
$<BUILD_INTERFACE:Boost::align>
)
endif()

if (ENABLE_ASAN)
set(ASAN_COMPILE_FLAGS -fsanitize=address -fno-omit-frame-pointer)
set(ASAN_LINK_FLAGS asan)
endif()

add_subdirectory(external)

target_link_libraries(websocket
INTERFACE
$<BUILD_INTERFACE:Boost::beast>
$<BUILD_INTERFACE:Boost::align>
)

add_subdirectory(src)

# install the library and generate export set (note that no
Expand Down
8 changes: 7 additions & 1 deletion changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ Initial version of libstream.

## v1.0.1

Fix Microsoft Visual Studio 2017 compilation
Fix Microsoft Visual Studio 2017 compilation

## v1.0.4

Migrate to opendaq-cmake-utils
Add CI build: Ubuntu, macOS, Windows
Fix macOS tests
12 changes: 12 additions & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
list(APPEND CMAKE_MESSAGE_CONTEXT cmake)
set(CURR_MESSAGE_CONTEXT ${CMAKE_MESSAGE_CONTEXT})

message(STATUS "Import functions and macro from opendaq-cmake-utils repo")
include(FetchContent)
FetchContent_Declare(
opendaq-cmake-utils
GIT_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git
GIT_TAG v1.0.1
GIT_PROGRESS ON
)
FetchContent_MakeAvailable(opendaq-cmake-utils)
44 changes: 0 additions & 44 deletions cmake/Modern.cmake

This file was deleted.

53 changes: 0 additions & 53 deletions cmake/StreamUtils.cmake

This file was deleted.

8 changes: 6 additions & 2 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
set_mode(ANCIENT)
opendaq_get_cmake_mode(_LIBSTREAM_CMAKE_MODERN_MODE_SAVED)
opendaq_set_cmake_mode(ANCIENT)
set(CMAKE_FOLDER "external")

list(APPEND CMAKE_MESSAGE_CONTEXT external)

add_subdirectory(boost)

if (LIBSTREAM_POST_BUILD_UNITTEST)
add_subdirectory(googletest)
endif()

opendaq_set_cmake_mode(${_LIBSTREAM_CMAKE_MODERN_MODE_SAVED})
20 changes: 20 additions & 0 deletions external/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
if (NOT TARGET Boost::beast)
set(Boost_REQUIREDVERSION "1.71.0")
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost ${Boost_REQUIREDVERSION} COMPONENTS system)

if (Boost_FOUND)
message(STATUS "Boost ${Boost_VERSION_STRING} at: ${Boost_INCLUDE_DIRS} | ${Boost_LIBRARY_DIRS}")
else()
message(STATUS "Pre-installed required Boost not found. Fetching Boost 1.82.0 ...")
include(FetchContent)
opendaq_get_custom_fetch_content_params(Boost FC_PARAMS)
FetchContent_Declare(Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.82.0/boost-1.82.0.tar.xz
URL_HASH SHA256=fd60da30be908eff945735ac7d4d9addc7f7725b1ff6fcdcaede5262d511d21e
${FC_PARAMS}
)
FetchContent_MakeAvailable(Boost)
endif()
endif()
5 changes: 2 additions & 3 deletions external/googletest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# option global for find_package was introduced with 3.24
cmake_minimum_required(VERSION 3.24)
set_cmake_folder_context(TARGET_FOLDER_NAME)
opendaq_set_cmake_folder_context(TARGET_FOLDER_NAME)

set(GTest_REQUIREDVERSION "1.12.1")

Expand All @@ -11,7 +10,7 @@ else()
message(STATUS "Fetching GTest version ${GTest_REQUIREDVERSION}")

include(FetchContent)
get_custom_fetch_content_params(GTest FC_PARAMS)
opendaq_get_custom_fetch_content_params(GTest FC_PARAMS)

set(GTest_WITH_POST_BUILD_UNITTEST OFF)
set(GTest_WITH_TESTS OFF)
Expand Down
Loading
Loading