Skip to content

Commit a22cf41

Browse files
committed
新增 lithium.pytools 模块,更新 CMake 配置以支持新依赖,优化代码结构,添加类型注解,删除不再使用的代码和文件
1 parent 36a865c commit a22cf41

File tree

139 files changed

+14493
-3930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+14493
-3930
lines changed

CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,23 +164,22 @@ target_link_libraries(lithium_server
164164
lithium-config
165165
lithium-task
166166
lithium-addons
167-
oatpp-websocket
168-
oatpp-swagger
169-
oatpp-openssl
170-
oatpp-zlib
171-
oatpp
167+
lithium-debug
168+
lithium-script
172169
loguru
173170
atom
174171
fmt::fmt
175172
OpenSSL::SSL
176173
OpenSSL::Crypto
177174
${ZLIB_LIBRARIES}
178175
sqlite3
179-
cpp_httplib
180176
tinyxml2
181177
pocketpy
182178
${Readline_LIBRARIES}
179+
${FFI_LIBRARIES}
183180
pybind11::embed
181+
${CURSES_LIBRARIES}
182+
yaml-cpp::yaml-cpp
184183
)
185184

186185
if(WIN32)

cmake/FindFFI.cmake

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# FindFFI.cmake
2+
3+
# Locate libffi
4+
# This module defines
5+
# FFI_FOUND - True if libffi was found
6+
# FFI_INCLUDE_DIRS - Include directories for libffi
7+
# FFI_LIBRARIES - Linker flags for libffi
8+
9+
find_path(FFI_INCLUDE_DIRS
10+
NAMES ffi.h
11+
PATHS /usr/include /usr/local/include
12+
)
13+
14+
find_library(FFI_LIBRARIES
15+
NAMES ffi
16+
PATHS /usr/lib /usr/local/lib
17+
)
18+
19+
# Check if both the include directory and the library are found
20+
if (FFI_INCLUDE_DIRS AND FFI_LIBRARIES)
21+
set(FFI_FOUND TRUE)
22+
else()
23+
set(FFI_FOUND FALSE)
24+
endif()
25+
26+
# Provide a message about the finding
27+
if (FFI_FOUND)
28+
message(STATUS "Found libffi: ${FFI_LIBRARIES}")
29+
else()
30+
message(WARNING "libffi not found")
31+
endif()
32+
33+
# Export the results
34+
include(FindPackageHandleStandardArgs)
35+
find_package_handle_standard_args(FFI DEFAULT_MSG FFI_LIBRARIES FFI_INCLUDE_DIRS)
36+
37+
mark_as_advanced(FFI_INCLUDE_DIRS FFI_LIBRARIES)

cmake/find_packages.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ find_package(Readline REQUIRED)
66
find_package(pybind11 CONFIG REQUIRED)
77
find_package(Python COMPONENTS Interpreter REQUIRED)
88
include_directories(${pybind11_INCLUDE_DIRS} ${Python_INCLUDE_DIRS})
9+
find_package(FFI REQUIRED)
10+
find_package(Curses REQUIRED)
11+
find_package(yaml-cpp REQUIRED)

modules/atom.algorithm/pymodule.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ PYBIND11_MODULE(algorithm, m) {
158158

159159
m.def("base64_encode", &base64Encode, "Base64 encoding function");
160160
m.def("base64_decode", &base64Decode, "Base64 decoding function");
161-
m.def("fbase64_encode", &fbase64Encode, "Faster Base64 encoding function");
162-
m.def("fbase64_decode", &fbase64Decode, "Faster Base64 decoding function");
163161
m.def("xor_encrypt", &xorEncrypt, "Encrypt string using XOR algorithm");
164162
m.def("xor_decrypt", &xorDecrypt, "Decrypt string using XOR algorithm");
165163

modules/atom.error/pymodule.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ void bind_exceptions(py::module &m) {
99
py::register_exception<atom::error::Exception>(m, "Exception");
1010
py::register_exception<atom::error::SystemErrorException>(
1111
m, "SystemErrorException");
12-
py::register_exception<atom::error::NestedException>(m, "NestedException");
1312
py::register_exception<atom::error::RuntimeError>(m, "RuntimeError");
1413
py::register_exception<atom::error::LogicError>(m, "LogicError");
1514
py::register_exception<atom::error::UnlawfulOperation>(m,

modules/atom.sysinfo/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
cmake_minimum_required(VERSION 3.20)
88
project(atom_iosysinfo)
99

10-
# Set the C++ standard
11-
set(CMAKE_CXX_STANDARD 20)
12-
1310
# Add source files
1411
set(SOURCE_FILES
1512
component.cpp

modules/lithium.config/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ set(${PROJECT_NAME}_LIBS
1919
atom-component
2020
atom-error
2121
lithium-config
22+
lithium-script
23+
lithium-addon
2224
loguru
2325
${CMAKE_THREAD_LIBS_INIT}
2426
)

modules/lithium.cxxtools/tests/xml2json.cpp

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

modules/lithium.indiserver/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
cmake_minimum_required(VERSION 3.20)
88
project(lithium.indiserver)
99

10-
# Set the C++ standard
11-
set(CMAKE_CXX_STANDARD 20)
12-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
13-
set(CMAKE_CXX_EXTENSIONS OFF)
14-
1510
# Add source and header files in one place for better management
1611
set(SOURCE_FILES
1712
src/driverlist.cpp

modules/lithium.pytools/.gitignore

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution / packaging
7+
.Python
8+
build/
9+
develop-eggs/
10+
dist/
11+
downloads/
12+
eggs/
13+
.eggs/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
pip-wheel-metadata/
20+
share/python-wheels/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
MANIFEST
25+
26+
# PyInstaller
27+
# Usually these files are written by a python script from a template
28+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
29+
*.manifest
30+
31+
# Installer logs
32+
pip-log.txt
33+
pip-delete-this-directory.txt
34+
35+
# Unit test / coverage reports
36+
htmlcov/
37+
.tox/
38+
.nox/
39+
.coverage
40+
.coverage.*
41+
.cache
42+
nosetests.xml
43+
coverage.xml
44+
*.cover
45+
*.py,cover
46+
.hypothesis/
47+
.pytest_cache/
48+
49+
# Django stuff:
50+
*.log
51+
local_settings.py
52+
db.sqlite3
53+
db.sqlite3-journal
54+
55+
# Flask stuff:
56+
instance/
57+
.webassets-cache
58+
59+
# Scrapy stuff:
60+
.scrapy
61+
62+
# Sphinx documentation
63+
docs/_build/
64+
65+
# PyBuilder
66+
target/
67+
68+
# Jupyter Notebook
69+
.ipynb_checkpoints
70+
71+
# IPython
72+
profile_default/
73+
ipython_config.py
74+
75+
# pyenv
76+
.python-version
77+
78+
# pipenv
79+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
80+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
81+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
82+
# install all needed dependencies.
83+
#Pipfile.lock
84+
85+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
86+
__pypackages__/
87+
88+
# Celery stuff
89+
celerybeat-schedule
90+
celerybeat.pid
91+
92+
# SageMath parsed files
93+
*.sage.py
94+
95+
# Rope project settings
96+
.ropeproject
97+
98+
# mkdocs documentation
99+
/site
100+
101+
# mypy
102+
.mypy_cache/
103+
.dmypy.json
104+
dmypy.json
105+
106+
# Pyre type checker
107+
.pyre/
108+
tmp.json

0 commit comments

Comments
 (0)