代码拉取完成,页面将自动刷新
# 编译server
macro(build_server server_name)
cmake_minimum_required(VERSION 3.24)
project(${server_name})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/output)
set(ThirdPartyDIR ${CMAKE_SOURCE_DIR}/thirdparty)
include_directories(.)
file(GLOB_RECURSE SRC_ALL_FILES ${CMAKE_CURRENT_LIST_DIR} "*.cpp" "*.cc" "*.h" "*.hpp")
add_executable(${server_name} ${SRC_ALL_FILES})
target_link_libraries(${server_name} PRIVATE
SvrSDK
SvrMessage
# thirdparty
debug fmtd
optimized fmt
debug protobufd
optimized protobuf
debug hiredisd
optimized hiredis
tinyxml2 event event_core event_extra event_openssl event_pthreads
rdkafka++ rdkafka redis++ mysqlclient prometheus-cpp-core
prometheus-cpp-pull prometheus-cpp-push zookeeper_mt #gtest
curl ssl crypto z pthread dl
)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(${server_name} PRIVATE
uuid rt tcmalloc_minimal
)
endif ()
endmacro()
# 编译ext_module
macro(build_ext_mdoule module_name)
cmake_minimum_required(VERSION 3.24)
project(${module_name})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/output/ext_modules/${module_name})
set(ThirdPartyDIR ${CMAKE_SOURCE_DIR}/thirdparty)
include_directories(.)
file(GLOB_RECURSE SRC_ALL_FILES ${CMAKE_CURRENT_LIST_DIR} "*.cpp" "*.cc" "*.h" "*.hpp")
add_library(${module_name} SHARED
${SRC_ALL_FILES} ../IBaseExtModule.h
)
target_link_libraries(${module_name} PRIVATE
SvrSDK
# thirdparty
debug fmtd
optimized fmt
tinyxml2 z pthread dl
)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(${module_name} PRIVATE
uuid rt tcmalloc_minimal
)
endif ()
endmacro()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。