Skip to content
Merged
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.25)

project(eventbus)

Expand All @@ -7,7 +7,10 @@ set(CXX_STANDARD_REQUIRED ON)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(CPM)

option(EVENTBUS_BUILD_TESTS "Build unit tests." ON)
option(EVENTBUS_BUILD_BENCHMARKS "Build benchmarks." OFF)
option(EVENTBUS_BUILD_EXAMPLES "Build examples" OFF)

# set up warnings interface project to re-use
include(CompilerWarnings)
Expand All @@ -23,6 +26,8 @@ if(EVENTBUS_BUILD_TESTS)
CPMAddPackage(
NAME doctest
GITHUB_REPOSITORY onqtam/doctest
# bump CMake version to 3.5
GIT_TAG 3a01ec37828affe4c9650004edb5b304fb9d5b75
VERSION 2.4.11
)

Expand All @@ -33,4 +38,11 @@ if(EVENTBUS_BUILD_TESTS)
endif()

add_subdirectory(eventbus)
add_subdirectory(demo)

if(EVENTBUS_BUILD_EXAMPLES)
add_subdirectory(demo)
endif()

if(EVENTBUS_BUILD_BENCHMARKS)
add_subdirectory(benchmark)
endif()
355 changes: 196 additions & 159 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,161 +1,198 @@
{
"version": 3,
"configurePresets": [
{
"name": "linux-base",
"hidden": true,
"description": "Target the Windows Subsystem for Linux (WSL) or a remote Linux system.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
},
"cacheVariables": {
"EVENTBUS_BUILD_TESTS": "ON"
}
},
{
"name": "windows-base",
"description": "Target Windows with the Visual Studio development environment.",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl",
"CMAKE_C_COMPILER": "cl"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "gcc-base",
"hidden": true,
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_C_COMPILER": "gcc"
}
},
{
"name": "gcc-debug",
"inherits": "gcc-base",
"displayName": "GCC Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "gcc-release",
"inherits": "gcc-base",
"displayName": "GCC Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "clang-base",
"hidden": true,
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_COMPILER": "clang"
}
},
{
"name": "clang-debug",
"inherits": "clang-base",
"displayName": "Clang Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "clang-release",
"inherits": "clang-base",
"displayName": "Clang Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "clang-release-with-debug-info",
"inherits": "clang-base",
"displayName": "Clang RelWithDebInfo",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-debug-clang",
"displayName": "x64 Debug Clang",
"description": "Target Windows (64-bit) with Clang",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release-clang",
"displayName": "x64 Release Clang",
"description": "Target Windows (64-bit) with Clang (Release)",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Release)",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x64-release-with-debug",
"displayName": "x64 Release w/Debug",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (RelWithDebInfo)",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
"version": 3,
"configurePresets": [
{
"name": "base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/build/install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES",
"EVENTBUS_BUILD_TESTS": "ON",
"EVENTBUS_BUILD_EXAMPLES": "ON",
"EVENTBUS_BUILD_BENCHMARKS": "ON"
}
},
{
"name": "macos-base",
"hidden": true,
"inherits": "base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "clang-debug",
"inherits": "macos-base",
"displayName": "macOS Clang Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_COMPILER": "clang"
}
},
{
"name": "clang-release",
"inherits": "macos-base",
"displayName": "macOS Clang Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_COMPILER": "clang"
}
},
{
"name": "linux-base",
"hidden": true,
"inherits": "base",
"description": "Target the Windows Subsystem for Linux (WSL) or a remote Linux system.",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
]
}
}
},
{
"name": "windows-base",
"description": "Target Windows with the Visual Studio development environment.",
"hidden": true,
"inherits": "base",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl",
"CMAKE_C_COMPILER": "cl"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "gcc-base",
"hidden": true,
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_C_COMPILER": "gcc"
}
},
{
"name": "gcc-debug",
"inherits": "gcc-base",
"displayName": "GCC Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "gcc-release",
"inherits": "gcc-base",
"displayName": "GCC Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "clang-base",
"hidden": true,
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_COMPILER": "clang"
}
},
{
"name": "clang-debug",
"inherits": "clang-base",
"displayName": "Clang Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "clang-release",
"inherits": "clang-base",
"displayName": "Clang Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "clang-release-with-debug-info",
"inherits": "clang-base",
"displayName": "Clang RelWithDebInfo",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-debug-clang",
"displayName": "x64 Debug Clang",
"description": "Target Windows (64-bit) with Clang",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release-clang",
"displayName": "x64 Release Clang",
"description": "Target Windows (64-bit) with Clang (Release)",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Release)",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x64-release-with-debug",
"displayName": "x64 Release w/Debug",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (RelWithDebInfo)",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
}
]
}
Loading