Skip to content

Commit 0c33400

Browse files
committed
Separated search from xfs
1 parent b4c2773 commit 0c33400

File tree

17 files changed

+727
-1371
lines changed

17 files changed

+727
-1371
lines changed

.github/workflows/macos.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,4 @@ jobs:
2525
cmake --version
2626
2727
- name: Build with CMake
28-
run: |
29-
mkdir build
30-
cd build
31-
cmake ..
32-
make
28+
run: ./build.sh --examples --tools --install

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ add_library(xutils STATIC
7979
./src/sys/log.c
8080
./src/sys/sig.c
8181
./src/sys/xfs.c
82+
./src/sys/search.c
8283
./src/sys/xtime.c
8384
)
8485

Makefile

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,52 @@
33
# https://github.com/kala13x/smake #
44
####################################
55

6-
CFLAGS = -D_XUTILS_USE_SSL -g -O2 -Wall -D_XUTILS_DEBUG -D_XUTILS_USE_GNU -D_ASSERT_TIMED
6+
CFLAGS = -g -O2 -Wall -D_XUTILS_DEBUG -D_XUTILS_USE_GNU -D_ASSERT_TIMED -D_XUTILS_USE_SSL
77
CFLAGS += -I./src/crypt -I./src/data -I./src/net -I./src/sys -I./src
8-
LIBS = -lssl -lcrypto -lpthread
8+
LIBS = -lpthread -lssl -lcrypto
99
NAME = libxutils.a
1010
ODIR = ./build
1111
OBJ = o
1212

13-
OBJS = xver.$(OBJ) \
14-
aes.$(OBJ) \
15-
base64.$(OBJ) \
16-
crc32.$(OBJ) \
17-
crypt.$(OBJ) \
18-
hmac.$(OBJ) \
19-
md5.$(OBJ) \
20-
rsa.$(OBJ) \
21-
sha256.$(OBJ) \
22-
sha1.$(OBJ) \
23-
array.$(OBJ) \
24-
hash.$(OBJ) \
25-
json.$(OBJ) \
26-
jwt.$(OBJ) \
27-
list.$(OBJ) \
28-
map.$(OBJ) \
29-
buf.$(OBJ) \
30-
str.$(OBJ) \
31-
addr.$(OBJ) \
32-
event.$(OBJ) \
33-
http.$(OBJ) \
34-
mdtp.$(OBJ) \
35-
ntp.$(OBJ) \
36-
rtp.$(OBJ) \
37-
sock.$(OBJ) \
38-
api.$(OBJ) \
39-
ws.$(OBJ) \
40-
sync.$(OBJ) \
41-
pool.$(OBJ) \
42-
thread.$(OBJ) \
43-
type.$(OBJ) \
44-
cli.$(OBJ) \
45-
cpu.$(OBJ) \
46-
mon.$(OBJ) \
47-
log.$(OBJ) \
48-
sig.$(OBJ) \
49-
xfs.$(OBJ) \
50-
xtime.$(OBJ) \
13+
OBJS = addr.$(OBJ) \
14+
aes.$(OBJ) \
15+
api.$(OBJ) \
16+
array.$(OBJ) \
17+
base64.$(OBJ) \
18+
buf.$(OBJ) \
19+
cli.$(OBJ) \
20+
cpu.$(OBJ) \
21+
crc32.$(OBJ) \
22+
crypt.$(OBJ) \
23+
event.$(OBJ) \
24+
hash.$(OBJ) \
25+
hmac.$(OBJ) \
26+
http.$(OBJ) \
27+
json.$(OBJ) \
28+
jwt.$(OBJ) \
29+
list.$(OBJ) \
30+
log.$(OBJ) \
31+
map.$(OBJ) \
32+
md5.$(OBJ) \
33+
mdtp.$(OBJ) \
34+
mon.$(OBJ) \
35+
ntp.$(OBJ) \
36+
pool.$(OBJ) \
37+
rsa.$(OBJ) \
38+
rtp.$(OBJ) \
39+
search.$(OBJ) \
40+
sha1.$(OBJ) \
41+
sha256.$(OBJ) \
42+
sig.$(OBJ) \
43+
sock.$(OBJ) \
44+
str.$(OBJ) \
45+
sync.$(OBJ) \
46+
thread.$(OBJ) \
47+
type.$(OBJ) \
48+
ws.$(OBJ) \
49+
xfs.$(OBJ) \
50+
xtime.$(OBJ) \
51+
xver.$(OBJ)
5152

5253
OBJECTS = $(patsubst %,$(ODIR)/%,$(OBJS))
5354
INSTALL_INC = /usr/local/include/xutils

README.md

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@
4242
#### System:
4343
- [Cross-platform file and directory operations](https://github.com/kala13x/libxutils/blob/main/src/sys/xfs.h)
4444
- [Cross-platform CPU affinity manipulation](https://github.com/kala13x/libxutils/blob/main/src/sys/cpu.h)
45-
- [Implementation of advanced file search](https://github.com/kala13x/libxutils/blob/main/src/sys/xfs.h)
45+
- [Implementation of advanced file search](https://github.com/kala13x/libxutils/blob/main/src/sys/search.h)
4646
- [System time manipulation library](https://github.com/kala13x/libxutils/blob/main/src/sys/xtime.h)
4747
- [Performance monitoring library](https://github.com/kala13x/libxutils/blob/main/src/sys/mon.h)
48+
- [File and directory operations](https://github.com/kala13x/libxutils/blob/main/src/sys/xfs.h)
4849
- [Simple and fast memory pool](https://github.com/kala13x/libxutils/blob/main/src/sys/pool.h)
4950
- [Advanced logging library](https://github.com/kala13x/libxutils/blob/main/src/sys/log.h)
5051

@@ -109,38 +110,6 @@ make
109110
sudo make install
110111
```
111112

112-
### Build particular files only
113-
If you want to use particular files and functions, you can configure the library and select only that functionality for the build. In this way, it is possible not to increase the size of the program and to avoid the linkage of unused code.
114-
115-
The `libxutils` project has a config file that contains a list of modules that will be included in the build. This file is used by the `build.sh` script, which resolves dependencies for each enabled module and generates a `CMakeList.txt` file.
116-
117-
Open `xutils.conf` file with a text editor and mark only the functionality you want to include in the build. Use a low-case `y` symbol to enable and any other symbol to disable modules. Removing a related line from the list will also disable the module.
118-
119-
Example:
120-
```
121-
...
122-
USE_ARRAY=n
123-
USE_CRYPT=n
124-
USE_XTIME=n
125-
USE_EVENT=y
126-
USE_LIST=n
127-
USE_BUF=n
128-
USE_HASH=n
129-
USE_SOCK=n
130-
USE_LOG=y
131-
USE_STR=n
132-
...
133-
```
134-
After updating the configuration, use the `build.sh` script to generate the `Makefile` and build the project.
135-
136-
```bash
137-
./build.sh --tool=cmake
138-
```
139-
140-
You may notice that when you select only one module, several other modules may be also included in the build. Because some files depend on other files in the project, the `build.sh` script will automatically resolve these dependencies and include required files in the build as well.
141-
142-
For example, if you only mark HTTP library for a build, the socket library will be automatically enabled because HTTP uses some functionality from sockets.
143-
144113
### Dependencies
145114
The only dependency that the library uses is the `openssl-devel` package for the `SSL` and `RSA` implementations.\
146115
You can either install the `openssl-devel` package or disable the `SSL` support in the library.
@@ -186,7 +155,7 @@ cmake . && make
186155
#### XTOP and more
187156

188157
<p align="center">
189-
<img src="https://raw.githubusercontent.com/kala13x/libxutils/main/misc/xtop.png" alt="alternate text">
158+
<img src="https://raw.githubusercontent.com/kala13x/libxutils/main/examples/xtop.png" alt="alternate text">
190159
</p>
191160

192161
`XTOP` is `HTOP` like performance monitor that supports to monitor CPU, memory, and network traffic into a single window. In addition, it has powerful `REST API` client/server mode and much more.

build.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TOOL_PATH=$PROJ_PATH/tools
77
LIB_PATH=$PROJ_PATH
88

99
INSTALL_PREFIX="/usr/local"
10-
MAKE_TOOL="make"
10+
MAKE_TOOL="cmake"
1111
USE_SSL="yes"
1212

1313
EXAMPLES_DONE=0
@@ -111,20 +111,18 @@ build_examples() {
111111
}
112112

113113
build_library() {
114-
cd $PROJ_PATH/misc
115-
./generate.sh $MAKE_TOOL --prefix=$INSTALL_PREFIX --ssl=$USE_SSL
116114
cd $PROJ_PATH
117115

118116
if [[ $MAKE_TOOL == "make" ]]; then
119117
make -j $CPU_COUNT
120118
LIB_PATH=$PROJ_PATH
119+
elif [[ $MAKE_TOOL == "smake" ]]; then
120+
smake . && make -j $CPU_COUNT
121+
LIB_PATH=$PROJ_PATH
121122
elif [[ $MAKE_TOOL == "cmake" ]]; then
122123
mkdir -p build && cd build
123124
cmake .. && make -j $CPU_COUNT
124125
LIB_PATH=$PROJ_PATH/build
125-
elif [[ $MAKE_TOOL == "smake" ]]; then
126-
smake . && make -j $CPU_COUNT
127-
LIB_PATH=$PROJ_PATH
128126
else
129127
echo "Unknown build tool: $MAKE_TOOL"
130128
echo "Specify cmake, smake or make)"
File renamed without changes.

misc/CMakeLists.tmp

Lines changed: 0 additions & 73 deletions
This file was deleted.

misc/Makefile.tmp

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)