Skip to content

Commit

Permalink
新增 lithium.pytools 模块,更新 CMake 配置以支持新依赖,优化代码结构,添加类型注解,删除不再使用的代码和文件
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroAir committed Nov 29, 2024
1 parent 36a865c commit a22cf41
Show file tree
Hide file tree
Showing 139 changed files with 14,493 additions and 3,930 deletions.
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,22 @@ target_link_libraries(lithium_server
lithium-config
lithium-task
lithium-addons
oatpp-websocket
oatpp-swagger
oatpp-openssl
oatpp-zlib
oatpp
lithium-debug
lithium-script
loguru
atom
fmt::fmt
OpenSSL::SSL
OpenSSL::Crypto
${ZLIB_LIBRARIES}
sqlite3
cpp_httplib
tinyxml2
pocketpy
${Readline_LIBRARIES}
${FFI_LIBRARIES}
pybind11::embed
${CURSES_LIBRARIES}
yaml-cpp::yaml-cpp
)

if(WIN32)
Expand Down
37 changes: 37 additions & 0 deletions cmake/FindFFI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# FindFFI.cmake

# Locate libffi
# This module defines
# FFI_FOUND - True if libffi was found
# FFI_INCLUDE_DIRS - Include directories for libffi
# FFI_LIBRARIES - Linker flags for libffi

find_path(FFI_INCLUDE_DIRS
NAMES ffi.h
PATHS /usr/include /usr/local/include
)

find_library(FFI_LIBRARIES
NAMES ffi
PATHS /usr/lib /usr/local/lib
)

# Check if both the include directory and the library are found
if (FFI_INCLUDE_DIRS AND FFI_LIBRARIES)
set(FFI_FOUND TRUE)
else()
set(FFI_FOUND FALSE)
endif()

# Provide a message about the finding
if (FFI_FOUND)
message(STATUS "Found libffi: ${FFI_LIBRARIES}")
else()
message(WARNING "libffi not found")
endif()

# Export the results
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFI DEFAULT_MSG FFI_LIBRARIES FFI_INCLUDE_DIRS)

mark_as_advanced(FFI_INCLUDE_DIRS FFI_LIBRARIES)
3 changes: 3 additions & 0 deletions cmake/find_packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ find_package(Readline REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
find_package(Python COMPONENTS Interpreter REQUIRED)
include_directories(${pybind11_INCLUDE_DIRS} ${Python_INCLUDE_DIRS})
find_package(FFI REQUIRED)
find_package(Curses REQUIRED)
find_package(yaml-cpp REQUIRED)
2 changes: 0 additions & 2 deletions modules/atom.algorithm/pymodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ PYBIND11_MODULE(algorithm, m) {

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

Expand Down
1 change: 0 additions & 1 deletion modules/atom.error/pymodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ void bind_exceptions(py::module &m) {
py::register_exception<atom::error::Exception>(m, "Exception");
py::register_exception<atom::error::SystemErrorException>(
m, "SystemErrorException");
py::register_exception<atom::error::NestedException>(m, "NestedException");
py::register_exception<atom::error::RuntimeError>(m, "RuntimeError");
py::register_exception<atom::error::LogicError>(m, "LogicError");
py::register_exception<atom::error::UnlawfulOperation>(m,
Expand Down
3 changes: 0 additions & 3 deletions modules/atom.sysinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
cmake_minimum_required(VERSION 3.20)
project(atom_iosysinfo)

# Set the C++ standard
set(CMAKE_CXX_STANDARD 20)

# Add source files
set(SOURCE_FILES
component.cpp
Expand Down
2 changes: 2 additions & 0 deletions modules/lithium.config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ set(${PROJECT_NAME}_LIBS
atom-component
atom-error
lithium-config
lithium-script
lithium-addon
loguru
${CMAKE_THREAD_LIBS_INIT}
)
Expand Down
70 changes: 0 additions & 70 deletions modules/lithium.cxxtools/tests/xml2json.cpp

This file was deleted.

5 changes: 0 additions & 5 deletions modules/lithium.indiserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
cmake_minimum_required(VERSION 3.20)
project(lithium.indiserver)

# Set the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Add source and header files in one place for better management
set(SOURCE_FILES
src/driverlist.cpp
Expand Down
108 changes: 108 additions & 0 deletions modules/lithium.pytools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
tmp.json
Loading

0 comments on commit a22cf41

Please sign in to comment.