blob: d9d99ba9e5fe7653c69791b2a912fd061126e15c (
plain) (
blame)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
cmake_minimum_required(
VERSION
3.20
)
project(
u8c
VERSION
27
DESCRIPTION
"Unicode manipulation library."
HOMEPAGE_URL
"https://mandelbrot.dk/delta/u8c"
LANGUAGES
CXX
)
set(
CMAKE_CXX_STANDARD
23
)
set(
CMAKE_CXX_EXTENSIONS
OFF
)
# Options:
option(
U8C_TEST
"Build test program."
OFF
)
# Disable in-souce builds:
if(
"${PROJECT_BINARY_DIR}"
STREQUAL
"${PROJECT_SOURCE_DIR}"
)
message(
FATAL_ERROR
"In-source building is not allowed."
)
endif()
# Compiler Settings:
message(
STATUS
"Enabling colour output for Clang or GCC..."
)
if(
"${CMAKE_CXX_COMPILER_ID}"
STREQUAL
"Clang"
)
add_compile_options(
"-fcolor-diagnostics"
)
elseif(
"${CMAKE_CXX_COMPILER_ID}"
STREQUAL
"GNU"
)
add_compile_options (
"-fdiagnostics-color=always"
)
endif()
message(
STATUS
"Enabling compile warnings..."
)
if(
MSVC
)
add_compile_options(
"/W4"
"/WX"
)
else()
add_compile_options(
"-Wfatal-errors"
"-Wall"
"-Werror"
"-Wextra"
"-Wno-attributes"
"-pedantic-errors"
)
endif()
if(
CMAKE_BUILD_TYPE
MATCHES
Release
)
message(
STATUS
"Setting optimisation level..."
)
if(
MSVC
)
add_compile_options(
"/Os"
)
else()
add_compile_options(
"-Os"
)
endif()
endif()
include_directories(
"${PROJECT_SOURCE_DIR}/u8c/include"
)
# u8c settings:
add_library(
u8c
SHARED
"u8c/src/operator.cc"
"u8c/src/u8c/fmt.cc"
"u8c/src/u8c/print.cc"
"u8c/src/u8c/println.cc"
)
# Test settings:
if(
U8C_TEST
)
add_executable(
test
"u8c-check/src/test.cc"
)
add_dependencies(
test
u8c
)
target_link_libraries(
test
u8c
)
endif()
|