aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: b50768a6d66eaf54f91eae4ca9d1ee1736fafe2e (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
cmake_minimum_required(VERSION "4.2.0")

project("ttwhy"
  VERSION "1.0.0"
  LANGUAGES CXX
)

### Fetch Dependencies

include("FetchContent")

FetchContent_Declare("asio"
  GIT_REPOSITORY "https://github.com/chriskohlhoff/asio"
  GIT_TAG "asio-1-38-0"
)

FetchContent_Declare("sml"
  GIT_REPOSITORY "https://github.com/boost-ext/sml"
  GIT_TAG "v1.2.0"
)

FetchContent_MakeAvailable(
  "asio"
  "sml"
)

### asio

find_package("Threads")

add_library("asio" INTERFACE)
add_library("ext::asio" ALIAS "asio")

target_include_directories("asio" SYSTEM INTERFACE
  "${asio_SOURCE_DIR}/asio/include"
)

target_link_libraries("asio" INTERFACE
  "Threads::Threads"
)

### Core Library

add_library("ttwhy-core")
add_library("ttwhy::lib" ALIAS "ttwhy-core")

target_sources("ttwhy-core" PUBLIC
  FILE_SET CXX_MODULES
  FILES

  "ttwhy/event.cppm"
  "ttwhy/io.cppm"
  "ttwhy/lib.cppm"
  "ttwhy/scoped_attributes.cppm"
)

target_include_directories("ttwhy-core" PUBLIC
  "${CMAKE_SOURCE_DIR}"
)

target_compile_features("ttwhy-core" PUBLIC
  "cxx_std_23"
)

target_link_libraries("ttwhy-core" PUBLIC
  "ext::asio"
  "sml::sml"
)

target_compile_options("ttwhy-core" PUBLIC
  "$<$<CXX_COMPILER_ID:Clang,GNU>:-Wall>"
  "$<$<CXX_COMPILER_ID:Clang,GNU>:-Wextra>"
  "$<$<CXX_COMPILER_ID:Clang,GNU>:-Werror>"
  "$<$<CXX_COMPILER_ID:Clang,GNU>:-pedantic-errors>"
)

### Main Executable

add_executable("ttwhy")
add_executable("ttwhy::app" ALIAS "ttwhy")

target_sources("ttwhy" PRIVATE
  "ttwhy/main.cpp"
)

target_link_libraries("ttwhy" PRIVATE
  "ttwhy::lib"
)