1 Star 0 Fork 2

宋君帆/isaac

forked from 李玉大哥/isaac 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 3.99 KB
一键复制 编辑 原始数据 按行查看 历史
李玉大哥 提交于 2023-03-31 18:13 . 日志
cmake_minimum_required(VERSION 3.5)
project(isaac)
set(CMAKE_CXX_STANDARD 11)
#优化等级
#set(CMAKE_CXX_FLAGS "-O2")
#生成调试信息
set(CMAKE_CXX_FLAGS "-g")
#打印所有警告信息
set(CMAKE_CXX_FLAGS "-Wall")
#过期方法不进行警告
#set(CMAKE_CXX_FLAGS "-Wno-deprecated")
#当前模式
#set(CMAKE_BUILD_TYPE Release)
#.c .cpp文件
aux_source_directory(${PROJECT_SOURCE_DIR}/src/utils SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/core SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/log SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/http_balance SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/http_client SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/parser/llhttp SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/parser/protocol SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/resource/llhttp SRC_LIST)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/resource/zlib SRC_LIST)
#.h文件
#set(INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include/parser/http/llhttp)
#include_directories(${INCLUDE_DIR})
#预定义宏
#add_definitions(-DNDEBUG)
add_compile_definitions(ISAAC_LOG=1)
add_compile_definitions(ISAAC_LOG_CHECK=1)
#add_compile_definitions(ISAAC_DEBUG=1)
#add_compile_definitions(ISAAC_PARSE_CHECK=1)
#add_compile_definitions(ISAAC_REQ_MAX_CHECK=1)
#操作系统层面不同处
if (CMAKE_HOST_APPLE)
add_compile_definitions(ISAAC_APPLE=1)
add_compile_definitions(ISAAC_TEST_PATH="/Users/liyudage/Documents/clion-workspace/isaac-loadbalance/bin/log/")
message("OS IS MACOS")
#mac
include_directories(${PROJECT_SOURCE_DIR}/include/core/unix INCLUDE_DIR)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/unix SRC_LIST)
include_directories(${PROJECT_SOURCE_DIR}/include/core/kqueue INCLUDE_DIR)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/kqueue SRC_LIST)
# include_directories(${PROJECT_SOURCE_DIR}/include/core/poll INCLUDE_DIR)
# aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/poll SRC_LIST)
#openssl
set(OPENSSL_INCLUDE_DIR /Users/liyudage/Documents/resources/openssl/include)
include_directories(${OPENSSL_INCLUDE_DIR})
elseif (CMAKE_HOST_UNIX)
add_compile_definitions(ISAAC_LINUX=1)
add_compile_definitions(ISAAC_TEST_PATH="/home/liyu/application/clion-workspace/isaac-loadbalance/bin/log/")
message("OS IS LINUX")
#linux需要用ASAN
set(CMAKE_CXX_FLAGS "-fsanitize=address")
set(CMAKE_CXX_FLAGS "-fno-stack-protector")
set(CMAKE_CXX_FLAGS "-fno-omit-frame-pointer")
#linux
include_directories(${PROJECT_SOURCE_DIR}/include/core/unix INCLUDE_DIR)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/unix SRC_LIST)
include_directories(${PROJECT_SOURCE_DIR}/include/core/epoll INCLUDE_DIR)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/epoll SRC_LIST)
# include_directories(${PROJECT_SOURCE_DIR}/include/core/poll INCLUDE_DIR)
# aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/poll SRC_LIST)
#openssl
# set(OPENSSL_INCLUDE_DIR /home/liyu/application/openssl/include)
# include_directories(${OPENSSL_INCLUDE_DIR})
set(OPENSSL_INCLUDE_DIR /home/lyee/Applications/resources/openssl/include)
include_directories(${OPENSSL_INCLUDE_DIR})
elseif (CMAKE_HOST_WIN32)
add_compile_definitions(ISAAC_WIN32=1)
add_compile_definitions(_WIN32_WINNT=0x0600)
add_compile_definitions(_POSIX=1)
add_compile_definitions(ISAAC_TEST_PATH="D:/clion-workspace/isaac-loadbalance/bin/log/")
message("OS IS WINDOWS")
#需要的一些库
set(CMAKE_CXX_FLAGS "-lwinmm")
link_libraries(ws2_32)
link_libraries(kernel32)
#windows专有的
include_directories(${PROJECT_SOURCE_DIR}/include/core/win32 INCLUDE_DIR)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/win32 SRC_LIST)
include_directories(${PROJECT_SOURCE_DIR}/include/core/wsapoll INCLUDE_DIR)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/core/wsapoll SRC_LIST)
#openssl windows编译的openssl有bug暂时不能使用
endif ()
add_subdirectory(test)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/song-junfan/isaac.git
git@gitee.com:song-junfan/isaac.git
song-junfan
isaac
isaac
master

搜索帮助