代码拉取完成,页面将自动刷新
cmake_minimum_required(VERSION 3.0)
project(sylar_learn)
include (cmake/utils.cmake)
set(CMAKE_VERBOSE_MAKEFILE on)
# 指定编译选项
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -std=c++11 -O0 -ggdb -Wall")
# -rdynamic: 将所有符号都加入到符号表中,便于使用dlopen或者backtrace追踪到符号
# -fPIC: 生成位置无关的代码,便于动态链接
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic -fPIC")
# -Wno-unused-function: 不要警告未使用函数
# -Wno-builtin-macro-redefined: 不要警告内置宏重定义,用于重定义内置的__FILE__宏
# -Wno-deprecated: 不要警告过时的特性
# -Wno-deprecated-declarations: 不要警告使用带deprecated属性的变量,类型,函数
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function -Wno-builtin-macro-redefined -Wno-deprecated -Wno-deprecated-declarations")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(.)
set(LIB_SRC
sylar/stream/zlib_stream.cc
sylar/stream/socket_stream.cc
sylar/stream.cc
sylar/tcp_server.cc
sylar/http/form_parser.cc
sylar/http/http_connection.cc
sylar/http/servlet.cc
sylar/http/http_server.cc
sylar/http/http_session.cc
sylar/http/http.cc
sylar/http/http11_parser.rl.cc
sylar/http/httpclient_parser.rl.cc
sylar/http/http_parser.cc
sylar/bytearray.cc
sylar/socket.cc
sylar/address.cc
sylar/fd_manager.cc
sylar/hook.cc
sylar/timer.cc
sylar/iomanager.cc
sylar/schedule.cc
sylar/fiber.cc
sylar/thread.cc
sylar/config.cc
sylar/uri.cc
sylar/util.cc
sylar/env.cc
sylar/mysql_pool.cc
sylar/daemon.cc
sylar/log.cc)
add_library(sylar SHARED ${LIB_SRC})
#force_redefine_file_macro_for_sources(sylar)
set(LIB_LIB
sylar
pthread
yaml-cpp
dl
jsoncpp
ssl
z
mysqlclient
opencv_dnn
opencv_imgproc
opencv_core
opencv_highgui
)
add_executable(testLog tests/test_log.cpp)
add_dependencies(testLog sylar)
target_link_libraries(testLog ${LIB_LIB})
add_executable(testConfig tests/test_config.cpp)
add_dependencies(testConfig sylar)
target_link_libraries(testConfig ${LIB_LIB})
add_executable(testThread tests/test_thread.cpp)
add_dependencies(testThread sylar)
target_link_libraries(testThread ${LIB_LIB})
add_executable(testUtil tests/test_util.cpp)
add_dependencies(testUtil sylar)
target_link_libraries(testUtil ${LIB_LIB})
add_executable(testFiber tests/testFiber.cpp)
add_dependencies(testFiber sylar)
target_link_libraries(testFiber ${LIB_LIB})
add_executable(test_scheduler tests/test_scheduler.cpp)
add_dependencies(test_scheduler sylar)
target_link_libraries(test_scheduler ${LIB_LIB})
add_executable(test_iomanager tests/test_iomanager.cpp)
add_dependencies(test_iomanager sylar)
target_link_libraries(test_iomanager ${LIB_LIB})
add_executable(test_hook tests/test_hook.cpp)
add_dependencies(test_hook sylar)
target_link_libraries(test_hook ${LIB_LIB})
add_executable(test_address tests/test_address.cpp)
add_dependencies(test_address sylar)
target_link_libraries(test_address ${LIB_LIB})
add_executable(test_socket tests/test_socket.cpp)
add_dependencies(test_socket sylar)
target_link_libraries(test_socket ${LIB_LIB})
add_executable(test_bytearray tests/test_bytearray.cpp)
add_dependencies(test_bytearray sylar)
target_link_libraries(test_bytearray ${LIB_LIB})
add_executable(test_http tests/test_http.cpp)
add_dependencies(test_http sylar)
target_link_libraries(test_http ${LIB_LIB})
add_executable(test_tcpserver tests/test_tcpserver.cpp)
add_dependencies(test_tcpserver sylar)
target_link_libraries(test_tcpserver ${LIB_LIB})
add_executable(echo_server examples/echo_server.cpp)
add_dependencies(echo_server sylar)
target_link_libraries(echo_server ${LIB_LIB})
add_executable(http_server examples/http_server.cpp)
add_dependencies(http_server sylar)
target_link_libraries(http_server ${LIB_LIB})
add_executable(test_httpserver tests/test_httpserver.cpp)
add_dependencies(test_httpserver sylar)
target_link_libraries(test_httpserver ${LIB_LIB})
add_executable(test_uri tests/test_uri.cpp)
add_dependencies(test_uri sylar)
target_link_libraries(test_uri ${LIB_LIB})
add_executable(test_daemon tests/test_daemon.cpp)
add_dependencies(test_daemon sylar)
target_link_libraries(test_daemon ${LIB_LIB})
add_executable(test_httpconnection tests/test_httpconnection.cpp)
add_dependencies(test_httpconnection sylar)
target_link_libraries(test_httpconnection ${LIB_LIB})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。