Files
zaloopipe/pipeline-runner/CMakeLists.txt
T
andrey 5ca6927baa feat: add ProcessExecutor, FAKE mode, fix thread lifecycle crash
- Add ProcessExecutor class wrapping PIProcess with proper cleanup
- Add CMake FAKE option (-DFAKE=ON) for testing without opencode
- Add 3 FAKE-mode tests for full pipeline execution, status transitions, output
- Fix PIThread lifecycle: use startOnce() instead of start(), track threads,
  wait + delete in destructor to prevent use-after-free of PIDeque<PIChar>
- Update build.sh with --fake flag and automatic cache invalidation
- Upgrade CMake to C++17 standard
- Update AGENTS.md with build commands and FAKE mode
2026-07-16 09:51:39 +03:00

62 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(PipelineRunner)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(FAKE "Fake mode for testing without opencode" OFF)
if(FAKE)
message(STATUS "FAKE mode ON — using fake process executor")
else()
message(STATUS "FAKE mode OFF — using real process executor")
endif()
# PIP
find_package(PIP REQUIRED)
# Google Test
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://git.shstk.ru/mirrors/googletest.git
GIT_TAG v1.14.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
# Source files
file(GLOB ALL_SRCS "src/*.cpp")
file(GLOB HDRS "src/*.h")
list(FILTER ALL_SRCS EXCLUDE REGEX ".*main\\.cpp$")
set(SRCS ${ALL_SRCS})
# Main executable
add_executable(pipeline-runner src/main.cpp ${SRCS} ${HDRS})
target_include_directories(pipeline-runner PRIVATE src)
target_link_libraries(pipeline-runner PIP PIP::HTTPServer PIP::Crypt PIP::Console)
if(FAKE)
target_compile_definitions(pipeline-runner PRIVATE FAKE)
endif()
set_target_properties(pipeline-runner PROPERTIES
INSTALL_RPATH "\$ORIGIN;\$ORIGIN/lib"
BUILD_RPATH "\$ORIGIN;\$ORIGIN/lib"
)
# Tests
add_executable(test-pipeline-runner tests/test_pipeline.cpp tests/test_runner.cpp ${SRCS})
target_include_directories(test-pipeline-runner PRIVATE src tests)
target_link_libraries(test-pipeline-runner PIP PIP::HTTPServer PIP::Crypt PIP::Console GTest::gtest_main)
if(FAKE)
target_compile_definitions(test-pipeline-runner PRIVATE FAKE)
endif()
include(GoogleTest)
gtest_discover_tests(test-pipeline-runner)
# Install
install(TARGETS pipeline-runner DESTINATION bin)
install(FILES pipeline-runner.conf DESTINATION bin)