Concurrent I/O without threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4KB

  1. cmake_minimum_required(VERSION 3.5)
  2. include(CheckFunctionExists)
  3. include(CheckSymbolExists)
  4. check_function_exists(mmap HAVE_MMAP)
  5. if(HAVE_MMAP)
  6. check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS)
  7. if(NOT HAVE_MAP_ANONYMOUS)
  8. check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON)
  9. endif()
  10. check_function_exists(mremap HAVE_MREMAP)
  11. endif()
  12. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
  13. set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Werror -std=c99")
  14. include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
  15. add_library(allocation src/allocation.c)
  16. add_library(coroutine src/coroutine.c)
  17. target_link_libraries(coroutine LINK_PUBLIC allocation)
  18. add_library(default_allocator src/default_allocator.c)
  19. set(ALLOCATORS default_allocator)
  20. add_library(heap src/heap.c)
  21. target_link_libraries(heap LINK_PUBLIC allocation)
  22. if(HAVE_MMAP)
  23. add_library(mmap_allocator src/mmap_allocator.c)
  24. set(ALLOCATORS ${ALLOCATORS} mmap_allocator)
  25. endif()
  26. add_executable(test-allocation test/allocation.c)
  27. target_link_libraries(test-allocation LINK_PUBLIC allocation ${ALLOCATORS})
  28. add_executable(test-coroutine test/coroutine.c)
  29. target_link_libraries(test-coroutine LINK_PUBLIC coroutine ${ALLOCATORS})
  30. add_executable(test-heap test/heap.c)
  31. target_link_libraries(test-heap LINK_PUBLIC heap ${ALLOCATORS})