# CMake build system is not officially supported.
# If you find out it's not working fix it and send a pull request.
cmake_minimum_required(VERSION 3.1)
project(libdill VERSION 1.6 LANGUAGES C)
include(CheckSymbolExists)
include(CheckFunctionExists)
file(GLOB sources ${CMAKE_CURRENT_LIST_DIR}/*.c ${CMAKE_CURRENT_LIST_DIR}/dns/dns.c)
include_directories(${PROJECT_SOURCE_DIR} "${PROJECT_SOURCE_DIR}/dns")
set_source_files_properties(dns/dns.c PROPERTIES COMPILE_FLAGS -std=c99)
add_library(dill ${sources})
# add pthread
list(APPEND CMAKE_REQUIRED_LIBRARIES pthread)
target_link_libraries(dill pthread)
# add openssl # requires libssl-dev on ubuntu
list(APPEND CMAKE_REQUIRED_LIBRARIES ssl crypto)
target_link_libraries(dill ssl crypto)
# check and enable rt if available
list(APPEND CMAKE_REQUIRED_LIBRARIES rt)
check_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
if(HAVE_CLOCK_GETTIME)
target_link_libraries(dill rt)
endif()
# Installation (https://github.com/forexample/package-example)
# Layout. This works for all platforms:
# * <prefix>/lib/cmake/<PROJECT-NAME>
# * <prefix>/lib/
# * <prefix>/include/
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(include_install_dir "include")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
# Configuration
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
# Include module with fuction 'write_basic_package_version_file'
include(CMakePackageConfigHelpers)
# Configure '<PROJECT-NAME>ConfigVersion.cmake'
# Use:
# * PROJECT_VERSION
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)
# Configure '<PROJECT-NAME>Config.cmake'
# Use variables:
# * TARGETS_EXPORT_NAME
# * PROJECT_NAME
configure_package_config_file(
"cmake/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)
# Targets:
# * <prefix>/lib/libdill.a
# * header location after install: <prefix>/include/libdill.h
install(
TARGETS dill
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "${include_install_dir}"
)
# Headers:
# * libdill.h -> <prefix>/include/libdill.h
install(
FILES libdill.h
DESTINATION "${include_install_dir}"
)
# Config
# * <prefix>/lib/cmake/libdill/libdillConfig.cmake
# * <prefix>/lib/cmake/libdill/libdillConfigVersion.cmake
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)
# Config
# * <prefix>/lib/cmake/libdill/libdillTargets.cmake
install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)
set(CMAKE_REQUIRED_LIBRARIES )
# check and enable stack guard and dns if available
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
set(CMAKE_REQUIRED_LIBRARIES )
set(CMAKE_REQUIRED_DEFINITIONS )
add_definitions(-DDILL_THREADS)
add_definitions(-DDILL_SOCKETS)
check_function_exists(mprotect HAVE_MPROTECT)
if(HAVE_MPROTECT)
add_definitions(-DHAVE_MPROTECT)
endif()
check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN)
if(HAVE_POSIX_MEMALIGN)
add_definitions(-DHAVE_POSIX_MEMALIGN)
endif()
# tests
include(CTest)
if(BUILD_TESTING)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
set(test_files
tests/bundle.c
tests/chan.c
tests/choose.c
tests/example.c
tests/fd.c
tests/go1.c
tests/go2.c
tests/go3.c
tests/go4.c
tests/go5.c
tests/handle.c
tests/happyeyeballs.c
tests/http.c
tests/iol.c
tests/ipaddr.c
tests/ipc.c
tests/overload.c
tests/prefix.c
tests/rbtree.c
tests/signals.c
tests/sleep.c
tests/socks5.c
tests/suffix.c
tests/tcp.c
tests/threads.c
tests/threads2.c
tests/tls.c
tests/udp.c
tests/ws.c)
foreach(test_file IN LISTS test_files)
get_filename_component(test_name ${test_file} NAME_WE)
add_executable(test_${test_name} ${test_file})
set_target_properties(test_${test_name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests
OUTPUT_NAME ${test_name})
target_link_libraries(test_${test_name} dill)
add_test(test_${test_name} tests/${test_name})
endforeach()
endif()
# perf
if(BUILD_PERF)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/perf)
set(perf_files
perf/chan.c
perf/choose.c
perf/ctxswitch.c
perf/go.c
perf/hdone.c
perf/timer.c
perf/whispers.c)
foreach(perf_file IN LISTS perf_files)
get_filename_component(perf_name ${perf_file} NAME_WE)
add_executable(perf_${perf_name} ${perf_file})
set_target_properties(perf_${perf_name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/perf
OUTPUT_NAME ${perf_name})
target_link_libraries(perf_${perf_name} dill)
endforeach()
endif()
没有合适的资源?快使用搜索试试~ 我知道了~
Structured concurrency in C.zip
共427个文件
html:128个
3:114个
c:86个
需积分: 5 0 下载量 55 浏览量
2023-12-31
10:10:35
上传
评论
收藏 792KB ZIP 举报
温馨提示
Structured concurrency in C.zip
资源推荐
资源详情
资源评论
收起资源包目录
Structured concurrency in C.zip (427个子文件)
toc.3 6KB
ws_attach_server_mem.3 5KB
ws_attach_client_mem.3 5KB
ws_attach_server.3 4KB
ws_attach_client.3 4KB
ws_recvl.3 4KB
ws_sendl.3 4KB
udp_recvl.3 4KB
ipc_connect_mem.3 3KB
udp_sendl.3 3KB
tls_attach_server_mem.3 3KB
mrecvl.3 3KB
msendl.3 3KB
term_attach_mem.3 3KB
brecvl.3 3KB
bsendl.3 3KB
tls_attach_client_mem.3 3KB
ipc_connect.3 3KB
tcp_connect_mem.3 3KB
ipc_listen_mem.3 3KB
tls_attach_server.3 3KB
choose.3 3KB
ws_recv.3 3KB
ws_send.3 3KB
http_sendfield.3 3KB
udp_open_mem.3 3KB
ws_detach.3 3KB
ws_done.3 3KB
term_attach.3 3KB
http_recvfield.3 3KB
tcp_accept_mem.3 3KB
http_recvrequest.3 3KB
http_sendstatus.3 3KB
http_sendrequest.3 3KB
go_mem.3 3KB
tls_attach_client.3 3KB
http_done.3 3KB
ipc_accept_mem.3 3KB
ipaddr_remotes.3 3KB
tcp_connect.3 3KB
ipc_listen.3 3KB
http_recvstatus.3 3KB
ipaddr_remote.3 3KB
http_attach_mem.3 3KB
bundle_go_mem.3 3KB
bundle_go.3 3KB
prefix_attach_mem.3 3KB
udp_open.3 3KB
tcp_listen_mem.3 3KB
go.3 3KB
ws_status.3 3KB
tcp_accept.3 2KB
http_detach.3 2KB
udp_recv.3 2KB
suffix_attach_mem.3 2KB
term_detach.3 2KB
ipc_close.3 2KB
ipc_accept.3 2KB
happyeyeballs_connect.3 2KB
term_done.3 2KB
tcp_close.3 2KB
ws_response_key.3 2KB
http_attach.3 2KB
ipc_fromfd_mem.3 2KB
prefix_attach.3 2KB
ipc_listener_fromfd_mem.3 2KB
bundle_mem.3 2KB
tcp_done.3 2KB
tcp_listen.3 2KB
tls_detach.3 2KB
tcp_fromfd_mem.3 2KB
ipc_done.3 2KB
tls_done.3 2KB
tcp_listener_fromfd_mem.3 2KB
ipaddr_local.3 2KB
suffix_attach.3 2KB
suffix_detach.3 2KB
chsend.3 2KB
brecv.3 2KB
chrecv.3 2KB
prefix_detach.3 2KB
hquery.3 2KB
udp_send.3 2KB
ipc_fromfd.3 2KB
msend.3 2KB
mrecv.3 2KB
ipc_listener_fromfd.3 2KB
bundle.3 2KB
bsend.3 2KB
tcp_fromfd.3 2KB
fdin.3 2KB
ws_request_key.3 2KB
fdout.3 2KB
tcp_listener_fromfd.3 2KB
ipc_pair_mem.3 2KB
bundle_wait.3 2KB
chmake_mem.3 2KB
hmake.3 2KB
ipc_pair.3 1KB
hown.3 1KB
共 427 条
- 1
- 2
- 3
- 4
- 5
资源评论
暮苍梧~
- 粉丝: 41
- 资源: 258
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功