Skip to content

Commit 8bafccb

Browse files
authored
Add WorkGraph C API and example usage (Geenz#9)
1 parent 07e5082 commit 8bafccb

File tree

4 files changed

+1701
-2
lines changed

4 files changed

+1701
-2
lines changed

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,15 @@ set(ENTROPY_C_API_SOURCES
128128
src/entropy/entropy_work_contract_handle_c.cpp
129129
src/entropy/entropy_work_contract_group_c.cpp
130130
src/entropy/entropy_work_service_c.cpp
131+
src/entropy/entropy_work_graph_c.cpp
131132
)
132133

133134
set(ENTROPY_C_API_HEADERS
134135
include/entropy/entropy_concurrency_types.h
135136
include/entropy/entropy_work_contract_handle.h
136137
include/entropy/entropy_work_contract_group.h
137138
include/entropy/entropy_work_service.h
139+
include/entropy/entropy_work_graph.h
138140
)
139141

140142
# VFS C API sources and headers
@@ -239,6 +241,13 @@ set_property(TARGET VFSCAPIExample PROPERTY LINKER_LANGUAGE CXX)
239241
# Link core
240242
target_link_libraries(VFSCAPIExample PRIVATE EntropyCore)
241243

244+
# WorkGraph C API example (pure C)
245+
add_executable(WorkGraphCAPIExample Examples/WorkGraphCAPIExample.c)
246+
# Ensure C++ linker is used (C target linking against C++ library)
247+
set_property(TARGET WorkGraphCAPIExample PROPERTY LINKER_LANGUAGE CXX)
248+
# Link core
249+
target_link_libraries(WorkGraphCAPIExample PRIVATE EntropyCore)
250+
242251
add_executable(VirtualFileSystemExample Examples/VirtualFileSystemExample.cpp)
243252
target_link_libraries(VirtualFileSystemExample PRIVATE EntropyCore)
244253
# Avoid Windows min/max macro pollution
@@ -311,10 +320,11 @@ if(WIN32)
311320
set_property(TARGET VFS_Metadata PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
312321
set_property(TARGET EntropyMainExample PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
313322
set_property(TARGET EntropyCppAppExample PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
323+
set_property(TARGET WorkGraphCAPIExample PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
314324
# Optionally disable RTTI if requested
315325
if(ENTROPY_REQUIRE_NO_RTTI)
316326
target_compile_options(EntropyCore PRIVATE /GR-)
317-
foreach(tgt IN ITEMS WorkContractExample WorkGraphYieldableExample EntropyObjectExample EntropyObjectHandleExample CInteropExample EntropyMainExample EntropyCppAppExample)
327+
foreach(tgt IN ITEMS WorkContractExample WorkGraphYieldableExample EntropyObjectExample EntropyObjectHandleExample CInteropExample EntropyMainExample EntropyCppAppExample WorkGraphCAPIExample)
318328
if(TARGET ${tgt})
319329
target_compile_options(${tgt} PRIVATE /GR-)
320330
endif()
@@ -335,7 +345,7 @@ else()
335345
# Optionally disable RTTI if requested
336346
if(ENTROPY_REQUIRE_NO_RTTI)
337347
target_compile_options(EntropyCore PRIVATE -fno-rtti)
338-
foreach(tgt IN ITEMS WorkContractExample WorkGraphYieldableExample EntropyObjectExample EntropyObjectHandleExample CInteropExample EntropyMainExample EntropyCppAppExample)
348+
foreach(tgt IN ITEMS WorkContractExample WorkGraphYieldableExample EntropyObjectExample EntropyObjectHandleExample CInteropExample EntropyMainExample EntropyCppAppExample WorkGraphCAPIExample)
339349
if(TARGET ${tgt})
340350
target_compile_options(${tgt} PRIVATE -fno-rtti)
341351
endif()

0 commit comments

Comments
 (0)