Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt « programs - github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ad4bb919d71914afb434b3649393e0adcfebf8f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
include(../cmake/QuickCppLibBootstrap.cmake)
include(QuickCppLibUtils)

project(llfio-programs VERSION 1.0 LANGUAGES CXX)

find_quickcpplib_library(quickcpplib
  GIT_REPOSITORY "https://github.com/ned14/quickcpplib.git"
  REQUIRED
  IS_HEADER_ONLY
)
find_quickcpplib_library(outcome
  GIT_REPOSITORY "https://github.com/ned14/outcome.git"
  GIT_TAG "master"
  REQUIRED
  IS_HEADER_ONLY
)
find_quickcpplib_library(kerneltest
  GIT_REPOSITORY "https://github.com/ned14/kerneltest.git"
  REQUIRED
  IS_HEADER_ONLY
)
if(NOT TARGET llfio::hl)
  add_subdirectory(.. llfio EXCLUDE_FROM_ALL)
endif()

# Looks like cmake's toolset for LLVM-vs* has some serious problems
if(CMAKE_GENERATOR_TOOLSET MATCHES "LLVM-vs.*")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi")
  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Z7")
endif()

function(make_program program)
  add_executable(${program} "${program}/main.cpp")
  if(WIN32)
    target_compile_definitions(${program} PRIVATE _UNICODE UNICODE)
    # cmake's support for LLVM clang is shocking :(
    if(CMAKE_GENERATOR_TOOLSET MATCHES "LLVM-vs.*")
      target_compile_options(${program} PRIVATE /EHsc)
    endif()
  endif()
  target_link_libraries(${program} ${ARGN})
  set_target_properties(${program} PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
    POSITION_INDEPENDENT_CODE ON
  )
endfunction()

make_program(benchmark-async llfio::hl)
make_program(benchmark-dynamic_thread_pool_group llfio::hl)
make_program(benchmark-iostreams llfio::hl)
make_program(benchmark-locking llfio::hl kerneltest::hl)
make_program(fs-probe llfio::hl)
make_program(illegal-codepoints llfio::hl)
make_program(key-value-store llfio::hl)

target_include_directories(benchmark-async PRIVATE "asio/asio/include")
target_include_directories(benchmark-dynamic_thread_pool_group PRIVATE "asio/asio/include")

if(MSVC)
  target_compile_options(illegal-codepoints PUBLIC /utf-8)
endif()

if(NOT WIN32 AND NOT APPLE)
  add_subdirectory(collision-check)
endif()