yalantinglibs/cmake/config.cmake

55 lines
2.0 KiB
CMake

message(STATUS "-------------PROJECT SETTING-------------")
option(ENABLE_SSL "Enable ssl support" ON)
message(STATUS "ENABLE_SSL: ${ENABLE_SSL}")
if (ENABLE_SSL)
find_package(OpenSSL REQUIRED)
add_compile_definitions(YLT_ENABLE_SSL)
link_libraries(OpenSSL::SSL OpenSSL::Crypto)
endif ()
option(ENABLE_PMR "Enable pmr support" OFF)
message(STATUS "ENABLE_PMR: ${ENABLE_PMR}")
if (ENABLE_PMR)
add_compile_definitions(YLT_ENABLE_PMR IGUANA_ENABLE_PMR)
endif ()
option(ENABLE_IO_URING "Enable io_uring" OFF)
message(STATUS "ENABLE_IO_URING: ${ENABLE_IO_URING}")
if (ENABLE_IO_URING)
find_package(uring)
if (NOT URING_FOUND)
message(STATUS "liburing not found, the io_uring is disable")
else()
message(STATUS "Use IO_URING for all I/O in linux")
add_compile_definitions(ASIO_HAS_IO_URING ASIO_DISABLE_EPOLL ASIO_HAS_FILE YLT_ENABLE_FILE_IO_URING)
add_link_options(-luring)
endif()
endif()
option(ENABLE_FILE_IO_URING "enable file io_uring" OFF)
if (NOT ENABLE_IO_URING)
message(STATUS "ENABLE_FILE_IO_URING: ${YLT_ENABLE_FILE_IO_URING}")
endif()
if(ENABLE_FILE_IO_URING)
if (NOT ENABLE_IO_URING)
if (NOT URING_FOUND)
message(STATUS "liburing not found, the file io_uring is disable")
else()
message(STATUS "Enable io_uring for file I/O in linux")
add_compile_definitions(ASIO_HAS_IO_URING ASIO_HAS_FILE YLT_ENABLE_FILE_IO_URING)
add_link_options(-luring)
endif()
endif()
endif()
option(ENABLE_STRUCT_PACK_UNPORTABLE_TYPE "enable struct_pack unportable type(like wchar_t)" OFF)
message(STATUS "ENABLE_STRUCT_PACK_UNPORTABLE_TYPE: ${ENABLE_STRUCT_PACK_UNPORTABLE_TYPE}")
if(ENABLE_STRUCT_PACK_UNPORTABLE_TYPE)
add_compile_definitions(STRUCT_PACK_ENABLE_UNPORTABLE_TYPE)
endif()
option(ENABLE_STRUCT_PACK_OPTIMIZE "enable struct_pack optimize(but cost more compile time)" OFF)
message(STATUS "ENABLE_STRUCT_PACK_OPTIMIZE: ${ENABLE_STRUCT_PACK_OPTIMIZE}")
if(ENABLE_STRUCT_PACK_OPTIMIZE)
add_compile_definitions(ENABLE_STRUCT_PACK_OPTIMIZE)
endif()