Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
sanpeqf committed Feb 23, 2024
2 parents bea4ab9 + 391541f commit d055e6e
Show file tree
Hide file tree
Showing 227 changed files with 6,816 additions and 2,546 deletions.
10 changes: 5 additions & 5 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
-----------
Bfdev Designer Group

Name : ffashion
Email : [email protected]
Represent : global

Name : John Sanpe
Email : [email protected]
Represent : global
Represent : framework

Name : ffashion
Email : [email protected]
Represent : array, cmake
107 changes: 39 additions & 68 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
#

cmake_minimum_required(VERSION 3.12)
project(bfdev VERSION 1.0.0 LANGUAGES C)
project(bfdev VERSION 1.0.1 LANGUAGES C)

include(GNUInstallDirs)
include(CheckIncludeFiles)
include(CheckCXXSymbolExists)
include(CheckFunctionExists)
include(CheckCSourceCompiles)

set(BFDEV_ARCH dummy)
set(BFDEV_NAME sirius)
Expand All @@ -36,73 +33,40 @@ set(BFDEV_CONFIGURE ${BFDEV_GENERATED_PATH}/bfdev-config.cmake)
include(scripts/asm-generic.cmake)
include(scripts/hostrule.cmake)
include(scripts/packed-header.cmake)
include(scripts/packed-source.cmake)
include(scripts/commit.cmake)

commit_hash(BFDEV_COMMITID)
commit_branch(BFDEV_BRANCH)

option(BFDEV_DEVEL "Enable development mode" OFF)
option(BFDEV_EXAMPLES "Build examples" OFF)
option(BFDEV_STRICT "Enable strict compilation" ON)
option(BFDEV_EXAMPLES "Build examples" OFF)
option(BFDEV_ASAN "Enable Address Sanitizer" OFF)
option(BFDEV_UBSAN "Enable Undefined Behaviour Sanitizer" OFF)

option(BFDEV_DBGLIST "Dynamic debug list" ON)
option(BFDEV_DBGSLIST "Dynamic debug slist" ON)
option(BFDEV_DBGHLIST "Dynamic debug hlist" ON)
option(BFDEV_DBGILIST "Dynamic debug ilist" ON)
option(BFDEV_DBGRBTREE "Dynamic debug rbtree" ON)
option(BFDEV_DBGHEAP "Dynamic debug heap" ON)
option(BFDEV_DBGREFCNT "Dynamic debug refcnt" ON)
option(BFDEV_DEBUG_LIST "Dynamic debug list" ON)
option(BFDEV_DEBUG_SLIST "Dynamic debug slist" ON)
option(BFDEV_DEBUG_HLIST "Dynamic debug hlist" ON)
option(BFDEV_DEBUG_ILIST "Dynamic debug ilist" ON)
option(BFDEV_DEBUG_RBTREE "Dynamic debug rbtree" ON)
option(BFDEV_DEBUG_HEAP "Dynamic debug heap" ON)
option(BFDEV_DEBUG_REFCNT "Dynamic debug refcnt" ON)
option(BFDEV_CRC_EXTEND "CRC loop unfolding optimize" ON)

if(BFDEV_DEVEL)
set(BFDEV_EXAMPLES ON)
set(BFDEV_ASAN ON)
set(BFDEV_UBSAN ON)
endif()

if(BFDEV_DBGLIST)
set(BFDEV_DEBUG_LIST ON)
endif()

if(BFDEV_DBGSLIST)
set(BFDEV_DEBUG_SLIST ON)
endif()

if(BFDEV_DBGHLIST)
set(BFDEV_DEBUG_HLIST ON)
endif()

if(BFDEV_DBGILIST)
set(BFDEV_DEBUG_ILIST ON)
endif()

if(BFDEV_DBGRBTREE)
set(BFDEV_DEBUG_RBTREE ON)
endif()

if(BFDEV_DBGHEAP)
set(BFDEV_DEBUG_HEAP ON)
endif()

if(BFDEV_DBGREFCNT)
set(BFDEV_DEBUG_REFCNT ON)
endif()

asm_generic(
bfdev/asm-generic/
${BFDEV_GENERATED_PATH}/bfdev/asm
${BFDEV_ARCH_HEADER_PATH}/bfdev/asm
${BFDEV_HEADER_PATH}/bfdev/asm-generic
)

packed_header(
bfdev/
_BFDEV_H_
${BFDEV_GENERATED_PATH}/bfdev.h
${BFDEV_HEADER_PATH}/bfdev
)

configure_file(
${BFDEV_MODULE_PATH}/config.h.in
${BFDEV_GENERATED_PATH}/bfdev/config.h
Expand All @@ -113,22 +77,6 @@ configure_file(
${BFDEV_CONFIGURE}
)

file(GLOB BFDEV_HEADER
${BFDEV_HEADER_PATH}/bfdev/*.h
)

file(GLOB BFDEV_ASM_HEADER
${BFDEV_HEADER_PATH}/bfdev/asm-generic/*.h
)

file(GLOB BFDEV_ARCH_ASM_HEADER
${BFDEV_ARCH_HEADER_PATH}/bfdev/asm/*.h
)

file(GLOB BFDEV_GENERATED_HEADER
${BFDEV_GENERATED_PATH}/*.h
)

add_compile_options(
-std=gnu11
-Wall
Expand All @@ -138,6 +86,8 @@ add_compile_options(
-Wno-sign-compare
-Wno-pointer-sign
-Wno-null-pointer-arithmetic
-Wmissing-prototypes
-Wmissing-declarations
-fvisibility=hidden
)

Expand Down Expand Up @@ -185,16 +135,23 @@ include_directories(${PROJECT_BINARY_DIR}/generated)
add_subdirectory(${PROJECT_SOURCE_DIR}/scripts)
include(${PROJECT_SOURCE_DIR}/build.cmake)

set(BFDEV_LIBRARY
set(BFDEV_LIBRARY_HEADER
${BFDEV_HEADER}
${BFDEV_ASM_HEADER}
${BFDEV_ARCH_ASM_HEADER}
${BFDEV_GENERATED_HEADER}
${BFDEV_INCLUDE}
)

set(BFDEV_LIBRARY_SOURCE
${BFDEV_SOURCE}
${BFDEV_ARCH_SOURCE}
)

set(BFDEV_LIBRARY
${BFDEV_LIBRARY_HEADER}
${BFDEV_LIBRARY_SOURCE}
)

macro(bfdev_dependencies target)
add_dependencies(
${target}
Expand All @@ -208,6 +165,20 @@ macro(bfdev_dependencies target)
)
endmacro()

packed_header(
bfdev/
_BFDEV_H_
${BFDEV_GENERATED_PATH}/bfdev.h
${BFDEV_HEADER_PATH}/bfdev
)

packed_source(
${PROJECT_BINARY_DIR}/bfdev.c
"${BFDEV_LIBRARY_SOURCE}"
"#undef MODULE_NAME\n"
"#undef bfdev_log_fmt\n"
)

add_library(bfdev_object OBJECT ${BFDEV_LIBRARY})
bfdev_dependencies(bfdev_object)
add_library(bfdev ALIAS bfdev_object)
Expand Down Expand Up @@ -245,9 +216,9 @@ if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
)

install(FILES
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/AUTHORS
${CMAKE_SOURCE_DIR}/COPYING
${PROJECT_SOURCE_DIR}/README.md
${PROJECT_SOURCE_DIR}/AUTHORS
${PROJECT_SOURCE_DIR}/COPYING
DESTINATION ${CMAKE_INSTALL_DOCDIR}
)

Expand Down
8 changes: 5 additions & 3 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ bfdev is a high-performance, aesthetically pleasing, and portable infrastructure
- Offers a rich and well-organized set of APIs for users.
- Conforms to the GNUC standard, ensuring strong cross-platform compatibility.

### WARNING

This project is not yet fully completed, so it is not recommended for use in a production environment.
> [!NOTE]
> We are seeking developers to collaborate with us on improve this project.
View supported components: [Docs](docs/components.md)

Expand Down Expand Up @@ -84,6 +83,9 @@ graph LR

Quickly start, API manual, see [Bfdev Documentation Tutorial](https://openbfdev.github.io/bfdev-docs)

> [!CAUTION]
> This project is not yet fully completed, so it is not recommended for use in a production environment.
## License

This is free software: you can redistribute it and/or modify it under the terms of the latest GNU General Public License as published by the Free Software Foundation.
Expand Down
16 changes: 16 additions & 0 deletions build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,21 @@
# Copyright(c) 2023 John Sanpe <[email protected]>
#

file(GLOB BFDEV_HEADER
${BFDEV_HEADER_PATH}/bfdev/*.h
)

file(GLOB BFDEV_ASM_HEADER
${BFDEV_HEADER_PATH}/bfdev/asm-generic/*.h
)

file(GLOB BFDEV_ARCH_ASM_HEADER
${BFDEV_ARCH_HEADER_PATH}/bfdev/asm/*.h
)

file(GLOB BFDEV_GENERATED_HEADER
${BFDEV_GENERATED_PATH}/*.h
)

include(${BFDEV_ARCH_PATH}/build.cmake)
include(${BFDEV_SOURCE_PATH}/build.cmake)
9 changes: 5 additions & 4 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

BFDEV_BEGIN_DECLS

#define BFDEV_VERSION_MAJOR ${CMAKE_PROJECT_VERSION_MAJOR}
#define BFDEV_VERSION_MINOR ${CMAKE_PROJECT_VERSION_MINOR}
#define BFDEV_VERSION_PATCH ${CMAKE_PROJECT_VERSION_PATCH}
#define BFDEV_VERSION_TWEAK ${CMAKE_PROJECT_VERSION_TWEAK}
#define BFDEV_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}
#define BFDEV_VERSION_MINOR ${PROJECT_VERSION_MINOR}
#define BFDEV_VERSION_PATCH ${PROJECT_VERSION_PATCH}
#define BFDEV_VERSION_TWEAK ${PROJECT_VERSION_TWEAK}
#define BFDEV_EXTREVERSION ${BFDEV_EXTREVERSION}

#define BFDEV_ARCH ${BFDEV_ARCH}
Expand All @@ -33,6 +33,7 @@ BFDEV_BEGIN_DECLS
#cmakedefine BFDEV_DEBUG_RBTREE
#cmakedefine BFDEV_DEBUG_HEAP
#cmakedefine BFDEV_DEBUG_REFCNT
#cmakedefine BFDEV_CRC_EXTEND

#define BFDEV_VERSION_CHECK(major, minor, patch) ( \
((major) == BFDEV_VERSION_MAJOR) && \
Expand Down
Empty file modified docs/images/logo.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
# Copyright(c) 2023 ffashion <[email protected]>
#

add_subdirectory(action)
add_subdirectory(allocator)
add_subdirectory(arc4)
add_subdirectory(array)
add_subdirectory(base32)
add_subdirectory(base64)
add_subdirectory(bfdev)
add_subdirectory(bloom)
add_subdirectory(btree)
add_subdirectory(cache)
add_subdirectory(circle)
add_subdirectory(crc)
add_subdirectory(fifo)
add_subdirectory(fsm)
Expand All @@ -25,11 +28,15 @@ add_subdirectory(list)
add_subdirectory(log)
add_subdirectory(log2)
add_subdirectory(matrix)
add_subdirectory(minpool)
add_subdirectory(mpi)
add_subdirectory(notifier)
add_subdirectory(once)
add_subdirectory(radix)
add_subdirectory(rbtree)
add_subdirectory(ringbuf)
add_subdirectory(segtree)
add_subdirectory(skiplist)
add_subdirectory(slist)
add_subdirectory(sort)
add_subdirectory(textsearch)
2 changes: 2 additions & 0 deletions examples/action/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-or-later
/action-simple
22 changes: 22 additions & 0 deletions examples/action/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright(c) 2023 ffashion <[email protected]>
#

add_executable(action-simple simple.c)
target_link_libraries(action-simple bfdev)
add_test(action-simple action-simple)

if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
install(FILES
simple.c
DESTINATION
${CMAKE_INSTALL_DOCDIR}/examples/action
)

install(TARGETS
action-simple
DESTINATION
${CMAKE_INSTALL_DOCDIR}/bin
)
endif()
36 changes: 36 additions & 0 deletions examples/action/simple.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright(c) 2023 John Sanpe <[email protected]>
*/

#define MODULE_NAME "action-simple"
#define bfdev_log_fmt(fmt) MODULE_NAME ": " fmt

#include <stdio.h>
#include <bfdev/action.h>
#include <bfdev/log.h>

static int
test_action(void *pdata)
{
bfdev_log_info("%s\n", (char *)pdata);
return 0;
}

int main(int argc, char **argv)
{
BFDEV_DEFINE_ACTION(action, test_action, NULL);
int retval;

bfdev_action_update(&action, "hello world");
retval = bfdev_action_call(&action);
if (retval)
return retval;

bfdev_action_update(&action, "wow bfdev");
retval = bfdev_action_call(&action);
if (retval)
return retval;

return 0;
}
Empty file modified examples/allocator/CMakeLists.txt
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions examples/arc4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-or-later
/arc4-bandwidth
22 changes: 22 additions & 0 deletions examples/arc4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright(c) 2024 John Sanpe <[email protected]>
#

add_executable(arc4-bandwidth bandwidth.c)
target_link_libraries(arc4-bandwidth bfdev)
add_test(arc4-bandwidth arc4-bandwidth)

if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
install(FILES
bandwidth.c
DESTINATION
${CMAKE_INSTALL_DOCDIR}/examples/arc4
)

install(TARGETS
arc4-bandwidth
DESTINATION
${CMAKE_INSTALL_DOCDIR}/bin
)
endif()
Loading

0 comments on commit d055e6e

Please sign in to comment.