89 lines
2.4 KiB
CMake
89 lines
2.4 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(humanus.cpp VERSION 0.1.0)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# 查找OpenSSL库
|
|
find_package(OpenSSL 3.0.0 REQUIRED)
|
|
if(OPENSSL_FOUND)
|
|
message(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
|
|
message(STATUS "OpenSSL include directory: ${OPENSSL_INCLUDE_DIR}")
|
|
message(STATUS "OpenSSL libraries: ${OPENSSL_LIBRARIES}")
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT)
|
|
else()
|
|
message(FATAL_ERROR "OpenSSL not found. Please install OpenSSL development libraries.")
|
|
endif()
|
|
|
|
# 查找Python库
|
|
find_package(Python3 COMPONENTS Development)
|
|
if(Python3_FOUND)
|
|
message(STATUS "Python3 found: ${Python3_VERSION}")
|
|
message(STATUS "Python3 include directory: ${Python3_INCLUDE_DIRS}")
|
|
message(STATUS "Python3 libraries: ${Python3_LIBRARIES}")
|
|
include_directories(${Python3_INCLUDE_DIRS})
|
|
add_compile_definitions(PYTHON_FOUND)
|
|
else()
|
|
message(WARNING "Python3 development libraries not found. Python interpreter will not be available.")
|
|
endif()
|
|
|
|
# 添加MCP库
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mcp)
|
|
|
|
# 添加服务器组件
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/server)
|
|
|
|
# 添加包含目录
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/mcp/include)
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/mcp/common)
|
|
|
|
# 查找必要的包
|
|
find_package(Threads REQUIRED)
|
|
|
|
# 添加源文件
|
|
file(GLOB AGENT_SOURCES
|
|
"agent/*.cpp"
|
|
"agent/*.cc"
|
|
)
|
|
|
|
file(GLOB TOOL_SOURCES
|
|
"tool/*.cpp"
|
|
"tool/*.cc"
|
|
)
|
|
|
|
file(GLOB FLOW_SOURCES
|
|
"flow/*.cpp"
|
|
"flow/*.cc"
|
|
)
|
|
|
|
# 添加可执行文件
|
|
add_executable(humanus_cpp
|
|
main.cpp
|
|
config.cpp
|
|
llm.cpp
|
|
prompt.cpp
|
|
logger.cpp
|
|
schema.cpp
|
|
${AGENT_SOURCES}
|
|
${TOOL_SOURCES}
|
|
${FLOW_SOURCES}
|
|
)
|
|
|
|
# 链接库
|
|
target_link_libraries(humanus_cpp PRIVATE Threads::Threads mcp server ${OPENSSL_LIBRARIES})
|
|
if(Python3_FOUND)
|
|
target_link_libraries(humanus_cpp PRIVATE ${Python3_LIBRARIES})
|
|
endif()
|
|
|
|
# 添加简单版本的可执行文件
|
|
add_executable(humanus_simple main_simple.cpp logger.cpp schema.cpp)
|
|
target_link_libraries(humanus_simple PRIVATE Threads::Threads ${OPENSSL_LIBRARIES})
|
|
if(Python3_FOUND)
|
|
target_link_libraries(humanus_simple PRIVATE ${Python3_LIBRARIES})
|
|
endif()
|
|
|
|
# 安装目标
|
|
install(TARGETS humanus_cpp DESTINATION bin)
|
|
install(TARGETS humanus_simple DESTINATION bin) |