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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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/boot.cpp
	source/console.cpp
	source/demangle.cpp
	source/errors.cpp
	source/environment.cpp
	source/handlers.cpp
	source/hash.cpp
	source/random.cpp
	source/string.cpp)

if(CRUCIBLE_PLATFORM_IS_POSIX_LIKE)
	target_sources(crucible_core PRIVATE
		source/posix_backtrace.cpp
		source/posix_errors.cpp
		source/posix_filesystem.cpp)
endif()

if(CRUCIBLE_PLATFORM_IS_WINDOWS_LIKE)
	target_compile_definitions(crucible_core PUBLIC
		# The Windows API defines macros called `min()` and `max()`... which shadow `std::min()` and
		# `std::max()` >:(
		# But this macro skips them! :D
		NOMINMAX

		# One of these is for the Windows API, and the other is for the C standard library. Do not ask me
		# which is which.
		_UNICODE
		UNICODE

		# Skip a bunch of stuff in the Windows API that we 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_backtrace.cpp
		source/windows_errors.cpp
		source/windows_filesystem.cpp
		source/windows_memory.cpp
		source/windows_unicode.cpp)
endif()

crucible_add_test_suite(test_collections tests/test_collections.cpp)
target_link_libraries(test_collections PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_filesystem tests/test_filesystem.cpp)
target_link_libraries(test_filesystem PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_format tests/test_format.cpp)
target_link_libraries(test_format PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_hash tests/test_hash.cpp)
target_link_libraries(test_hash PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_iterator tests/test_iterator.cpp)
target_link_libraries(test_iterator PRIVATE crucible_core crucible_test)

#crucible_add_test_suite(test_math tests/test_math.cpp)
#target_link_libraries(test_math PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_memory tests/test_memory.cpp)
target_link_libraries(test_memory PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_option tests/test_option.cpp)
target_link_libraries(test_option PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_random tests/test_random.cpp)
target_link_libraries(test_random PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_result tests/test_result.cpp)
target_link_libraries(test_result PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_string tests/test_string.cpp)
target_link_libraries(test_string PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_unicode tests/test_unicode.cpp)
target_link_libraries(test_unicode PRIVATE crucible_core crucible_test)

crucible_add_test_suite(test_utility tests/test_utility.cpp)
target_link_libraries(test_utility PRIVATE crucible_core crucible_test)