Echo Writes Code

CMakeLists.txt

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
crucible_add_library(crucible.core)

configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/include/crucible/core/platform.hpp.in"
  "${CMAKE_CURRENT_BINARY_DIR}/include/crucible/core/platform.hpp"
  NEWLINE_STYLE UNIX)

target_include_directories(crucible.core PUBLIC
  "${CMAKE_CURRENT_BINARY_DIR}/include"
  "${CMAKE_CURRENT_SOURCE_DIR}/include")

target_sources(crucible.core PRIVATE
  source/assert.cpp
  source/backtrace.cpp
  source/console.cpp
  source/demangle.cpp
  source/format.cpp
  source/handlers.cpp)

if(CRUCIBLE_PLATFORM_IS_POSIX_LIKE)
  target_sources(crucible.core PRIVATE
    source/posix_errors.cpp
    source/posix_filesystem.cpp)
endif()

if(CRUCIBLE_PLATFORM_IS_WINDOWS_LIKE)
  target_compile_definitions(crucible.core PUBLIC
    # <Windows.h> defines macros called `min()` and `max()`... which shadow `std::min()` and
    # `std::max()` >:(
    NOMINMAX

    # One of these is for the Windows API, and the other is for the C standard library
    _UNICODE
    UNICODE

    # Skip a bunch of stuff in `<Windows.h>` that we probably don't need
    WIN32_LEAN_AND_MEAN)

  target_link_libraries(crucible.core PUBLIC
    # Provides stack-walking and address-to-source-location conversion
    dbghelp)

  target_sources(crucible.core PRIVATE
    source/windows_errors.cpp
    source/windows_filesystem.cpp
    source/windows_unicode.cpp
    source/windows_utility.cpp)
endif()

add_subdirectory(tests)

#crucible_add_test_suite(crucible.core.test_filesystem tests/test_filesystem.cpp)
#target_link_libraries(crucible.core.test_filesystem PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_format tests/test_format.cpp)
#target_link_libraries(crucible.core.test_format PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_iterators tests/test_iterators.cpp)
#target_link_libraries(crucible.core.test_iterators PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_math tests/test_math.cpp)
#target_link_libraries(crucible.core.test_math PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_memory tests/test_memory.cpp)
#target_link_libraries(crucible.core.test_memory PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_result tests/test_result.cpp)
#target_link_libraries(crucible.core.test_result PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_string tests/test_string.cpp)
#target_link_libraries(crucible.core.test_string PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_unicode tests/test_unicode.cpp)
#target_link_libraries(crucible.core.test_unicode PRIVATE crucible.core crucible.test)
#
#crucible_add_test_suite(crucible.core.test_utility tests/test_utility.cpp)
#target_link_libraries(crucible.core.test_utility PRIVATE crucible.core crucible.test)