aboutsummaryrefslogtreecommitdiff
path: root/core/CMakeLists.txt
blob: 5ec88e4bddf5872c1ea762b863c74a7276a18a88 (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
# Library

add_library("core"
  "src/disposition.cpp"
  "src/init.cpp"
  "src/participant.cpp"
  "src/settings.cpp"
  "src/turn_order.cpp"
)

add_library("turns::core" ALIAS "core")

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

if(NOT TURNS_USE_INSTALLED_SCHEMA_FILES)
  target_compile_definitions("core" PUBLIC
    "TURNS_SETTINGS_SCHEMA_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\""
  )
endif()

target_include_directories("core" PUBLIC
  "include"
)

target_link_libraries("core" PUBLIC
  "PkgConfig::giomm"
  "PkgConfig::glibmm"
  "nlohmann_json::nlohmann_json"
)

target_add_glib_schemas("core"
  SCHEMA_DIR "schemas"
)

enable_coverage("core")

install(FILES
  "schemas/ch.arknet.Turns.gschema.xml"
  DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/glib-2.0/schemas"
)

# Tests

add_executable("core-tests"
  "tests/glib_test_init.cpp"

  "tests/disposition.cpp"
  "tests/participant.cpp"
  "tests/turn_order_bugs.cpp"
  "tests/turn_order.cpp"
)

target_link_libraries("core-tests" PRIVATE
  "Catch2::Catch2WithMain"

  "turns::core"
)

target_link_options("core-tests" PRIVATE
  "$<$<AND:$<CXX_COMPILER_ID:GNU,Clang>,$<CONFIG:Debug>>:--coverage>"
)

catch_discover_tests("core-tests")