Skip to content

Commit 86c07cd

Browse files
committed
Initial commit
0 parents  commit 86c07cd

Some content is hidden

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

73 files changed

+18569
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build*
2+
.idea
3+
.DS_Store

CMakeLists.txt

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
cmake_minimum_required(VERSION 3.28)
2+
project(EntropyCore
3+
VERSION 1.0.0
4+
DESCRIPTION "Core utilities and concurrency primitives for Entropy Engine"
5+
LANGUAGES CXX
6+
)
7+
8+
# Options
9+
option(BUILD_SHARED_LIBS "Build as a shared library" OFF)
10+
option(ENTROPY_BUILD_TESTS "Build tests for EntropyCore" OFF)
11+
12+
# Set C++20 standard with modules support
13+
set(CMAKE_CXX_STANDARD 20)
14+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
15+
set(CMAKE_CXX_EXTENSIONS OFF)
16+
#
17+
# # Configure vcpkg
18+
if(DEFINED CMAKE_TOOLCHAIN_FILE)
19+
message(STATUS "Using vcpkg toolchain: ${CMAKE_TOOLCHAIN_FILE}")
20+
endif()
21+
22+
# Find packages
23+
find_package(Tracy CONFIG REQUIRED)
24+
find_package(Catch2 3 CONFIG REQUIRED)
25+
26+
# Core library source files
27+
set(ENTROPY_CORE_SOURCES
28+
src/Logging/Logger.cpp
29+
src/Logging/ConsoleSink.cpp
30+
src/Concurrency/WorkContractHandle.cpp
31+
src/Concurrency/WorkContractGroup.cpp
32+
src/Concurrency/WorkGraph.cpp
33+
src/Concurrency/WorkService.cpp
34+
src/Concurrency/AdaptiveRankingScheduler.cpp
35+
src/Concurrency/RandomScheduler.cpp
36+
src/Concurrency/RoundRobinScheduler.cpp
37+
src/Concurrency/NodeStateManager.cpp
38+
src/Concurrency/NodeScheduler.cpp
39+
)
40+
41+
set(ENTROPY_CORE_HEADERS
42+
src/CoreCommon.h
43+
src/Core/EventBus.h
44+
src/EntropyCore.h
45+
src/ServiceLocator.h
46+
src/TypeSystem/GenericHandle.h
47+
src/Graph/DirectedAcyclicGraph.h
48+
src/Graph/AcyclicNodeHandle.h
49+
src/Debug/INamed.h
50+
src/Debug/DebugUtilities.h
51+
src/Debug/Profiling.h
52+
src/Debug/Debug.h
53+
src/Logging/LogLevel.h
54+
src/Logging/LogEntry.h
55+
src/Logging/ILogSink.h
56+
src/Logging/ConsoleSink.h
57+
src/Logging/Logger.h
58+
src/Concurrency/WorkContractHandle.h
59+
src/Concurrency/WorkContractGroup.h
60+
src/Concurrency/WorkGraph.h
61+
src/Concurrency/WorkGraphTypes.h
62+
src/Concurrency/WorkGraphEvents.h
63+
src/Concurrency/NodeStateManager.h
64+
src/Concurrency/NodeScheduler.h
65+
src/Concurrency/WorkService.h
66+
src/Concurrency/SignalTree.h
67+
src/Concurrency/IConcurrencyProvider.h
68+
src/Concurrency/IWorkScheduler.h
69+
src/Concurrency/DirectScheduler.h
70+
src/Concurrency/SpinningDirectScheduler.h
71+
src/Concurrency/AdaptiveRankingScheduler.h
72+
src/Concurrency/RandomScheduler.h
73+
src/Concurrency/RoundRobinScheduler.h
74+
)
75+
76+
# Create the core library
77+
add_library(EntropyCore)
78+
target_sources(EntropyCore
79+
PRIVATE
80+
${ENTROPY_CORE_SOURCES}
81+
PUBLIC
82+
FILE_SET HEADERS
83+
BASE_DIRS src
84+
FILES ${ENTROPY_CORE_HEADERS}
85+
)
86+
87+
# Set target properties for C++20 module support
88+
target_compile_features(EntropyCore PUBLIC cxx_std_20)
89+
90+
# Include directories
91+
target_include_directories(EntropyCore
92+
PUBLIC
93+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
94+
$<INSTALL_INTERFACE:include>
95+
)
96+
97+
# Link dependencies
98+
target_link_libraries(EntropyCore
99+
PUBLIC
100+
Tracy::TracyClient
101+
)
102+
103+
add_executable(WorkContractExample Examples/WorkContractExample.cpp)
104+
105+
target_link_libraries(WorkContractExample EntropyCore)
106+
107+
# Platform and compiler-specific settings
108+
if(WIN32)
109+
# Settings for Windows
110+
target_compile_definitions(EntropyCore PUBLIC WIN32_LEAN_AND_MEAN EntropyWindows)
111+
if(MSVC)
112+
target_compile_options(EntropyCore PRIVATE /W4)
113+
endif()
114+
else()
115+
# Settings for non-Windows platforms (macOS, Linux)
116+
target_compile_options(EntropyCore PRIVATE -Wall -Wextra -Wpedantic)
117+
target_compile_options(EntropyCore PUBLIC -fexperimental-library)
118+
if(APPLE)
119+
# macOS specific
120+
target_compile_definitions(EntropyCore PUBLIC EntropyDarwin)
121+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
122+
# Linux specific
123+
target_compile_definitions(EntropyCore PUBLIC EntropyLinux)
124+
endif()
125+
endif()
126+
127+
# Define preprocessor macros
128+
target_compile_definitions(EntropyCore
129+
PUBLIC
130+
TRACY_ENABLE
131+
TRACY_ON_DEMAND
132+
)
133+
134+
# Add EntropyDebug macro for Debug and Release with Debug Info builds.
135+
if($<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
136+
target_compile_definitions(EntropyCore PUBLIC EntropyDebug)
137+
endif()
138+
139+
# Export include directories for dependent projects
140+
set_target_properties(EntropyCore PROPERTIES
141+
VERSION ${PROJECT_VERSION}
142+
SOVERSION ${PROJECT_VERSION_MAJOR}
143+
EXPORT_NAME Core
144+
)
145+
146+
# Testing
147+
if(ENTROPY_BUILD_TESTS)
148+
enable_testing()
149+
150+
# Test executable
151+
add_executable(EntropyCoreTests
152+
Tests/LoggingTests.cpp
153+
Tests/DebugInterfaceTests.cpp
154+
Tests/GraphTests.cpp
155+
Tests/TypeSystemTests.cpp
156+
Tests/WorkContractGroupTests.cpp
157+
Tests/WorkContractHighContentionTest.cpp
158+
Tests/MainThreadWorkTest.cpp
159+
Tests/WorkGraphTests.cpp
160+
Tests/WorkServiceTests.cpp
161+
Tests/WorkGraphArchitectureTests.cpp
162+
Tests/WorkGraphServiceIntegrationTests.cpp
163+
Tests/WorkGraphMemoryTest.cpp
164+
Tests/WorkGraphDebugTest.cpp
165+
Tests/WorkGraphSimpleTest.cpp
166+
Tests/WorkGraphVectorTest.cpp
167+
Tests/WorkGraphIsolatedHangTest.cpp
168+
Tests/WorkGraphMainThreadTest.cpp
169+
)
170+
171+
target_link_libraries(EntropyCoreTests
172+
PRIVATE
173+
EntropyCore
174+
Catch2::Catch2WithMain
175+
)
176+
177+
target_compile_features(EntropyCoreTests PRIVATE cxx_std_20)
178+
179+
# Register tests with CTest
180+
include(CTest)
181+
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
182+
if(TARGET Catch2::Catch2)
183+
include(Catch)
184+
catch_discover_tests(EntropyCoreTests)
185+
endif()
186+
endif()
187+
188+
# Installation
189+
include(GNUInstallDirs)
190+
191+
install(TARGETS EntropyCore
192+
EXPORT EntropyCoreTargets
193+
FILE_SET HEADERS DESTINATION include
194+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
195+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
196+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
197+
)
198+
199+
install(EXPORT EntropyCoreTargets
200+
FILE EntropyCoreTargets.cmake
201+
NAMESPACE EntropyCore::
202+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EntropyCore
203+
)
204+
205+
# Create config file
206+
include(CMakePackageConfigHelpers)
207+
208+
configure_package_config_file(
209+
"cmake/EntropyCoreConfig.cmake.in"
210+
"${CMAKE_CURRENT_BINARY_DIR}/EntropyCoreConfig.cmake"
211+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EntropyCore
212+
)
213+
214+
write_basic_package_version_file(
215+
EntropyCoreConfigVersion.cmake
216+
VERSION ${PROJECT_VERSION}
217+
COMPATIBILITY SameMajorVersion
218+
)
219+
220+
install(FILES
221+
"${CMAKE_CURRENT_BINARY_DIR}/EntropyCoreConfig.cmake"
222+
"${CMAKE_CURRENT_BINARY_DIR}/EntropyCoreConfigVersion.cmake"
223+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EntropyCore
224+
)

0 commit comments

Comments
 (0)