5
5
#
6
6
7
7
cmake_minimum_required (VERSION 3.12)
8
- project (bfdev VERSION 1.0.0 LANGUAGES C)
8
+ project (bfdev VERSION 1.0.1 LANGUAGES C)
9
9
10
10
include (GNUInstallDirs)
11
11
include (CheckIncludeFiles)
12
- include (CheckCXXSymbolExists)
13
- include (CheckFunctionExists)
14
- include (CheckCSourceCompiles)
15
12
16
13
set (BFDEV_ARCH dummy)
17
14
set (BFDEV_NAME sirius)
@@ -36,73 +33,40 @@ set(BFDEV_CONFIGURE ${BFDEV_GENERATED_PATH}/bfdev-config.cmake)
36
33
include (scripts/asm-generic.cmake)
37
34
include (scripts/hostrule.cmake)
38
35
include (scripts/packed-header.cmake)
36
+ include (scripts/packed-source .cmake)
39
37
include (scripts/commit.cmake)
40
38
41
39
commit_hash(BFDEV_COMMITID)
42
40
commit_branch(BFDEV_BRANCH)
43
41
44
42
option (BFDEV_DEVEL "Enable development mode" OFF )
45
- option (BFDEV_EXAMPLES "Build examples" OFF )
46
43
option (BFDEV_STRICT "Enable strict compilation" ON )
44
+ option (BFDEV_EXAMPLES "Build examples" OFF )
47
45
option (BFDEV_ASAN "Enable Address Sanitizer" OFF )
48
46
option (BFDEV_UBSAN "Enable Undefined Behaviour Sanitizer" OFF )
49
47
50
- option (BFDEV_DBGLIST "Dynamic debug list" ON )
51
- option (BFDEV_DBGSLIST "Dynamic debug slist" ON )
52
- option (BFDEV_DBGHLIST "Dynamic debug hlist" ON )
53
- option (BFDEV_DBGILIST "Dynamic debug ilist" ON )
54
- option (BFDEV_DBGRBTREE "Dynamic debug rbtree" ON )
55
- option (BFDEV_DBGHEAP "Dynamic debug heap" ON )
56
- option (BFDEV_DBGREFCNT "Dynamic debug refcnt" ON )
48
+ option (BFDEV_DEBUG_LIST "Dynamic debug list" ON )
49
+ option (BFDEV_DEBUG_SLIST "Dynamic debug slist" ON )
50
+ option (BFDEV_DEBUG_HLIST "Dynamic debug hlist" ON )
51
+ option (BFDEV_DEBUG_ILIST "Dynamic debug ilist" ON )
52
+ option (BFDEV_DEBUG_RBTREE "Dynamic debug rbtree" ON )
53
+ option (BFDEV_DEBUG_HEAP "Dynamic debug heap" ON )
54
+ option (BFDEV_DEBUG_REFCNT "Dynamic debug refcnt" ON )
55
+ option (BFDEV_CRC_EXTEND "CRC loop unfolding optimize" ON )
57
56
58
57
if (BFDEV_DEVEL)
59
58
set (BFDEV_EXAMPLES ON )
60
59
set (BFDEV_ASAN ON )
61
60
set (BFDEV_UBSAN ON )
62
61
endif ()
63
62
64
- if (BFDEV_DBGLIST)
65
- set (BFDEV_DEBUG_LIST ON )
66
- endif ()
67
-
68
- if (BFDEV_DBGSLIST)
69
- set (BFDEV_DEBUG_SLIST ON )
70
- endif ()
71
-
72
- if (BFDEV_DBGHLIST)
73
- set (BFDEV_DEBUG_HLIST ON )
74
- endif ()
75
-
76
- if (BFDEV_DBGILIST)
77
- set (BFDEV_DEBUG_ILIST ON )
78
- endif ()
79
-
80
- if (BFDEV_DBGRBTREE)
81
- set (BFDEV_DEBUG_RBTREE ON )
82
- endif ()
83
-
84
- if (BFDEV_DBGHEAP)
85
- set (BFDEV_DEBUG_HEAP ON )
86
- endif ()
87
-
88
- if (BFDEV_DBGREFCNT)
89
- set (BFDEV_DEBUG_REFCNT ON )
90
- endif ()
91
-
92
63
asm_generic(
93
64
bfdev/asm-generic/
94
65
${BFDEV_GENERATED_PATH} /bfdev/asm
95
66
${BFDEV_ARCH_HEADER_PATH} /bfdev/asm
96
67
${BFDEV_HEADER_PATH} /bfdev/asm-generic
97
68
)
98
69
99
- packed_header(
100
- bfdev/
101
- _BFDEV_H_
102
- ${BFDEV_GENERATED_PATH} /bfdev.h
103
- ${BFDEV_HEADER_PATH} /bfdev
104
- )
105
-
106
70
configure_file (
107
71
${BFDEV_MODULE_PATH} /config.h.in
108
72
${BFDEV_GENERATED_PATH} /bfdev/config.h
@@ -113,22 +77,6 @@ configure_file(
113
77
${BFDEV_CONFIGURE}
114
78
)
115
79
116
- file (GLOB BFDEV_HEADER
117
- ${BFDEV_HEADER_PATH} /bfdev/*.h
118
- )
119
-
120
- file (GLOB BFDEV_ASM_HEADER
121
- ${BFDEV_HEADER_PATH} /bfdev/asm-generic/*.h
122
- )
123
-
124
- file (GLOB BFDEV_ARCH_ASM_HEADER
125
- ${BFDEV_ARCH_HEADER_PATH} /bfdev/asm/*.h
126
- )
127
-
128
- file (GLOB BFDEV_GENERATED_HEADER
129
- ${BFDEV_GENERATED_PATH} /*.h
130
- )
131
-
132
80
add_compile_options (
133
81
-std=gnu11
134
82
-Wall
@@ -138,6 +86,8 @@ add_compile_options(
138
86
-Wno-sign-compare
139
87
-Wno-pointer-sign
140
88
-Wno-null-pointer-arithmetic
89
+ -Wmissing-prototypes
90
+ -Wmissing-declarations
141
91
-fvisibility=hidden
142
92
)
143
93
@@ -185,16 +135,23 @@ include_directories(${PROJECT_BINARY_DIR}/generated)
185
135
add_subdirectory (${PROJECT_SOURCE_DIR} /scripts)
186
136
include (${PROJECT_SOURCE_DIR} /build .cmake)
187
137
188
- set (BFDEV_LIBRARY
138
+ set (BFDEV_LIBRARY_HEADER
189
139
${BFDEV_HEADER}
190
140
${BFDEV_ASM_HEADER}
191
141
${BFDEV_ARCH_ASM_HEADER}
192
142
${BFDEV_GENERATED_HEADER}
193
- ${BFDEV_INCLUDE}
143
+ )
144
+
145
+ set (BFDEV_LIBRARY_SOURCE
194
146
${BFDEV_SOURCE}
195
147
${BFDEV_ARCH_SOURCE}
196
148
)
197
149
150
+ set (BFDEV_LIBRARY
151
+ ${BFDEV_LIBRARY_HEADER}
152
+ ${BFDEV_LIBRARY_SOURCE}
153
+ )
154
+
198
155
macro (bfdev_dependencies target )
199
156
add_dependencies (
200
157
${target}
@@ -208,6 +165,20 @@ macro(bfdev_dependencies target)
208
165
)
209
166
endmacro ()
210
167
168
+ packed_header(
169
+ bfdev/
170
+ _BFDEV_H_
171
+ ${BFDEV_GENERATED_PATH} /bfdev.h
172
+ ${BFDEV_HEADER_PATH} /bfdev
173
+ )
174
+
175
+ packed_source(
176
+ ${PROJECT_BINARY_DIR} /bfdev.c
177
+ "${BFDEV_LIBRARY_SOURCE} "
178
+ "#undef MODULE_NAME\n "
179
+ "#undef bfdev_log_fmt\n "
180
+ )
181
+
211
182
add_library (bfdev_object OBJECT ${BFDEV_LIBRARY} )
212
183
bfdev_dependencies(bfdev_object)
213
184
add_library (bfdev ALIAS bfdev_object)
@@ -245,9 +216,9 @@ if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
245
216
)
246
217
247
218
install (FILES
248
- ${CMAKE_SOURCE_DIR } /README.md
249
- ${CMAKE_SOURCE_DIR } /AUTHORS
250
- ${CMAKE_SOURCE_DIR } /COPYING
219
+ ${PROJECT_SOURCE_DIR } /README.md
220
+ ${PROJECT_SOURCE_DIR } /AUTHORS
221
+ ${PROJECT_SOURCE_DIR } /COPYING
251
222
DESTINATION ${CMAKE_INSTALL_DOCDIR}
252
223
)
253
224
0 commit comments