55#
66
77cmake_minimum_required (VERSION 3.12)
8- project (bfdev VERSION 1.0.0 LANGUAGES C)
8+ project (bfdev VERSION 1.0.1 LANGUAGES C)
99
1010include (GNUInstallDirs)
1111include (CheckIncludeFiles)
12- include (CheckCXXSymbolExists)
13- include (CheckFunctionExists)
14- include (CheckCSourceCompiles)
1512
1613set (BFDEV_ARCH dummy)
1714set (BFDEV_NAME sirius)
@@ -36,73 +33,40 @@ set(BFDEV_CONFIGURE ${BFDEV_GENERATED_PATH}/bfdev-config.cmake)
3633include (scripts/asm-generic.cmake)
3734include (scripts/hostrule.cmake)
3835include (scripts/packed-header.cmake)
36+ include (scripts/packed-source .cmake)
3937include (scripts/commit.cmake)
4038
4139commit_hash(BFDEV_COMMITID)
4240commit_branch(BFDEV_BRANCH)
4341
4442option (BFDEV_DEVEL "Enable development mode" OFF )
45- option (BFDEV_EXAMPLES "Build examples" OFF )
4643option (BFDEV_STRICT "Enable strict compilation" ON )
44+ option (BFDEV_EXAMPLES "Build examples" OFF )
4745option (BFDEV_ASAN "Enable Address Sanitizer" OFF )
4846option (BFDEV_UBSAN "Enable Undefined Behaviour Sanitizer" OFF )
4947
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 )
5756
5857if (BFDEV_DEVEL)
5958 set (BFDEV_EXAMPLES ON )
6059 set (BFDEV_ASAN ON )
6160 set (BFDEV_UBSAN ON )
6261endif ()
6362
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-
9263asm_generic(
9364 bfdev/asm-generic/
9465 ${BFDEV_GENERATED_PATH} /bfdev/asm
9566 ${BFDEV_ARCH_HEADER_PATH} /bfdev/asm
9667 ${BFDEV_HEADER_PATH} /bfdev/asm-generic
9768)
9869
99- packed_header(
100- bfdev/
101- _BFDEV_H_
102- ${BFDEV_GENERATED_PATH} /bfdev.h
103- ${BFDEV_HEADER_PATH} /bfdev
104- )
105-
10670configure_file (
10771 ${BFDEV_MODULE_PATH} /config.h.in
10872 ${BFDEV_GENERATED_PATH} /bfdev/config.h
@@ -113,22 +77,6 @@ configure_file(
11377 ${BFDEV_CONFIGURE}
11478)
11579
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-
13280add_compile_options (
13381 -std=gnu11
13482 -Wall
@@ -138,6 +86,8 @@ add_compile_options(
13886 -Wno-sign-compare
13987 -Wno-pointer-sign
14088 -Wno-null-pointer-arithmetic
89+ -Wmissing-prototypes
90+ -Wmissing-declarations
14191 -fvisibility=hidden
14292)
14393
@@ -185,16 +135,23 @@ include_directories(${PROJECT_BINARY_DIR}/generated)
185135add_subdirectory (${PROJECT_SOURCE_DIR} /scripts)
186136include (${PROJECT_SOURCE_DIR} /build .cmake)
187137
188- set (BFDEV_LIBRARY
138+ set (BFDEV_LIBRARY_HEADER
189139 ${BFDEV_HEADER}
190140 ${BFDEV_ASM_HEADER}
191141 ${BFDEV_ARCH_ASM_HEADER}
192142 ${BFDEV_GENERATED_HEADER}
193- ${BFDEV_INCLUDE}
143+ )
144+
145+ set (BFDEV_LIBRARY_SOURCE
194146 ${BFDEV_SOURCE}
195147 ${BFDEV_ARCH_SOURCE}
196148)
197149
150+ set (BFDEV_LIBRARY
151+ ${BFDEV_LIBRARY_HEADER}
152+ ${BFDEV_LIBRARY_SOURCE}
153+ )
154+
198155macro (bfdev_dependencies target )
199156 add_dependencies (
200157 ${target}
@@ -208,6 +165,20 @@ macro(bfdev_dependencies target)
208165 )
209166endmacro ()
210167
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+
211182add_library (bfdev_object OBJECT ${BFDEV_LIBRARY} )
212183bfdev_dependencies(bfdev_object)
213184add_library (bfdev ALIAS bfdev_object)
@@ -245,9 +216,9 @@ if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
245216 )
246217
247218 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
251222 DESTINATION ${CMAKE_INSTALL_DOCDIR}
252223 )
253224
0 commit comments