Skip to content

Dev #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open

Dev #44

Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5430382
添加新的测试文件和更新推荐引擎类以支持隐式反馈和评估功能
AstroAir Nov 2, 2024
2a9a892
添加网络管理器和进程信息结构,更新字符串处理函数,增强配置管理功能
AstroAir Nov 3, 2024
6ae3365
更新头文件引用,修复类成员类型,添加新的 TCP 代理功能,优化组件管理器
AstroAir Nov 4, 2024
c82e365
重构命名空间,优化代码结构,添加 SHA1 算法实现,更新 CMake 配置以支持 Python 模块
AstroAir Nov 6, 2024
f6238e6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2024
09efb50
Fix code scanning alert no. 242: Clear-text logging of sensitive info…
AstroAir Nov 6, 2024
bff073e
添加 MimeTypes 类以支持 MIME 类型处理,重构 LCG 类以内联最小和最大值函数,优化 XML 头文件包含,更新插件管理器中…
AstroAir Nov 6, 2024
cecaaad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 7, 2024
c961407
重构代码结构,优化依赖管理,新增 Preloader 类及其功能,添加 Python 支持,更新存储监控类,增强 JSON 处理能力
AstroAir Nov 7, 2024
eab1e33
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 7, 2024
4d09888
新增多个模块的 CMakeLists.txt 文件,重命名项目以统一命名规范,添加 atom.async、atom.algorithm、a…
AstroAir Nov 8, 2024
7873e97
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 8, 2024
fcf1577
新增 CMake 配置文件以支持多个依赖项,重构模块扫描功能,更新安装路径设置,删除过时的 CMake 模块
AstroAir Nov 9, 2024
ebd9ec5
Merge branch 'dev' of https://github.com/ElementAstro/Lithium into dev
AstroAir Nov 9, 2024
13c671f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2024
a49a6ef
新增 GPIO 类,添加任务等待功能,重命名波特率枚举,更新相机和配置管理器接口,优化打印格式,增加 INDI 服务器中间件功能
AstroAir Nov 9, 2024
7df7c23
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2024
4632507
优化模块扫描功能,更新安装路径设置,重构 CMake 配置以支持多个依赖项
AstroAir Nov 9, 2024
7fac5c6
新增文件权限比较功能,添加 INDI 服务器接口,创建配置模块的 CMake 和 xmake 配置
AstroAir Nov 10, 2024
b509219
新增 GPIO、Focuser、USB 和 Telescope 中间件,重构 CMake 配置,删除不再使用的内置任务功能
AstroAir Nov 10, 2024
d1754be
新增时间管理器实现设置功能,添加命令可用性检查,优化日志文件添加接口,扩展依赖图解析功能,新增 APK 工具类以支持 APK 文件处理
AstroAir Nov 12, 2024
11535f6
新增简单模块,优化存储监控逻辑,添加文件分类功能,更新 CMake 配置,删除不再使用的 Python 配置文件和速率限制插件
AstroAir Nov 13, 2024
7ac7ad7
新增线程安全机制,优化 BloomFilter 和 BigNumber 类,添加 fnmatch 异常处理,增强模式匹配功能
AstroAir Nov 13, 2024
32e4f67
优化 Huffman 编码实现,重构分数类构造函数,添加内存对齐分配功能,更新异常处理,增强 Any 类的类型安全性
AstroAir Nov 14, 2024
fd0eb61
删除未使用的头文件和测试文件,清理代码库
AstroAir Nov 14, 2024
46cc301
新增 Atom 子模块,更新 .gitmodules 文件以包含新的库路径
AstroAir Nov 14, 2024
7450e1b
更新 CMake 配置,重命名 Atom 模块路径,移除未使用的自定义目标
AstroAir Nov 14, 2024
b9bff5e
更新 lithium.indiserver 模块,添加异步系统命令类,优化配置管理,新增测试文件,改进 CMake 配置以支持测试
AstroAir Nov 14, 2024
536bf24
新增 JSON 转换器类,支持 JSON 到 CSV、YAML、INI 和 XML 的转换,更新相关头文件,改进异常处理,删除未使用的测试文件
AstroAir Nov 15, 2024
529fc4b
更新 lithium.image 模块,重构图像加载和保存功能,新增 imgio.hpp 和 imgio.cpp 文件,优化 base64…
AstroAir Nov 16, 2024
575673b
重构 lithium.image 模块,删除未使用的 solver.hpp 文件,更新 stack.hpp 函数签名,新增图像保存功能至 …
AstroAir Nov 16, 2024
195cc48
新增 unzip 和 ffmpeg 模块的测试文件,涵盖解压、格式转换、音频提取等功能,改进异常处理和测试用例
AstroAir Nov 17, 2024
96f81f3
新增多个模块的初始化文件,重构自适应拉伸模块,添加新的图像处理功能,更新 CMake 配置以支持 pybind11,删除未使用的文件,优化…
AstroAir Nov 18, 2024
05a2f8d
新增多个模块的初始化文件,重构缺陷图和自动直方图模块,删除未使用的文件,优化星体检测和颜色校正功能,改进缺陷插值算法
AstroAir Nov 19, 2024
15c2064
新增 grexpert 模块的测试文件,涵盖参数验证功能,添加多个测试用例以确保输入有效性和错误处理,新增 nginx 和 hotspot…
AstroAir Nov 20, 2024
2ee637f
删除 qhyccd 模块的头文件和实现文件,更新 camera.cpp 文件以移除未使用的包含,新增 usb_test.py 文件以测试 …
AstroAir Nov 20, 2024
73bb3ae
新增多个测试文件,涵盖天文计算功能,包括黄昏时间、当前高度、行星信息和命名星体查找,改进测试覆盖率和异常处理
AstroAir Nov 20, 2024
522ebc0
重构 CMake 配置,新增库创建函数,删除不再使用的脚本文件,优化 Python 接口功能,增强多线程执行和性能分析支持
AstroAir Nov 20, 2024
ffcbdfb
新增脚本模块,重构解释器类,优化资源预加载功能,更新 CMake 配置以支持新模块,改进 YAML 转 JSON 的异常处理
AstroAir Nov 21, 2024
247a896
新增设置终端大小的函数,删除不再使用的配置文件和 CMakeLists.txt,优化项目结构
AstroAir Nov 21, 2024
4b9ceff
更新子项目引用,删除不再使用的依赖,优化头文件包含,重构 CMake 配置,改进代码结构和异常处理
AstroAir Nov 23, 2024
36a865c
重构 efw_test.py 文件中的导入路径,新增 output.py 测试文件,覆盖多种文件格式的打印和验证功能,改进 ci_rele…
AstroAir Nov 23, 2024
a22cf41
新增 lithium.pytools 模块,更新 CMake 配置以支持新依赖,优化代码结构,添加类型注解,删除不再使用的代码和文件
AstroAir Nov 29, 2024
6294b16
更新子项目引用至新提交,保持依赖关系的最新状态
AstroAir Nov 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
191 changes: 17 additions & 174 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,10 @@ cmake_minimum_required(VERSION 3.20)
project(Lithium VERSION 1.0.0 LANGUAGES C CXX)

# Set project options
option(ENABLE_ASYNC "Enable Async Server Mode" ON)
option(ENABLE_NATIVE_SERVER "Enable to use INDI native server" OFF)
option(ENABLE_DEBUG "Enable Debug Mode" OFF)
option(ENABLE_FASHHASH "Enable Using emhash8 as fast hash map" OFF)
option(ENABLE_WEB_SERVER "Enable Web Server" ON)
option(ENABLE_WEB_CLIENT "Enable Web Client" ON)

# Set compile definitions based on options
if(ENABLE_ASYNC)
add_compile_definitions(ENABLE_ASYNC_FLAG=1)
endif()
if(ENABLE_DEBUG)
add_compile_definitions(ENABLE_DEBUG_FLAG=1)
endif()
if(ENABLE_NATIVE_SERVER)
add_compile_definitions(ENABLE_NATIVE_SERVER_FLAG=1)
endif()
if(ENABLE_FASHHASH)
add_compile_definitions(ENABLE_FASHHASH_FLAG=1)
endif()
if(ENABLE_WEB_SERVER)
add_compile_definitions(ENABLE_WEB_SERVER_FLAG=1)
endif()
if(ENABLE_WEB_CLIENT)
add_compile_definitions(ENABLE_WEB_CLIENT_FLAG=1)
endif()
include(cmake/options.cmake)

# Set policies
if(POLICY CMP0003)
cmake_policy(SET CMP0003 NEW)
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW)
endif()
include(cmake/policies.cmake)

# Set project directories
set(Lithium_PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR})
Expand All @@ -55,15 +25,15 @@ set(lithium_task_dir ${lithium_src_dir}/task)

add_custom_target(CmakeAdditionalFiles
SOURCES
${lithium_src_dir}/../cmake_modules/compiler_options.cmake)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/")
include(cmake_modules/compiler_options.cmake)
${lithium_src_dir}/../cmake/compiler_options.cmake)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/")
include(cmake/compiler_options.cmake)

# ------------------ CPM Begin ------------------

set(CPM_DOWNLOAD_VERSION 0.35.6)
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake_modules/CPM.cmake")
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM.cmake")

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake")
Expand Down Expand Up @@ -137,131 +107,10 @@ include_directories(${CMAKE_SOURCE_DIR}/libs/oatpp-websocket/oatpp-websocket)
include_directories(${CMAKE_SOURCE_DIR}/libs/oatpp-openssl/oatpp-openssl)

# Find packages
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(fmt REQUIRED)
find_package(Readline REQUIRED)

find_package(Python COMPONENTS Interpreter REQUIRED)

# Specify the path to requirements.txt
set(REQUIREMENTS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt")

# Define a function to check if a Python package is installed
function(check_python_package package version)
# Replace hyphens with underscores for the import statement
string(REPLACE "-" "_" import_name ${package})

# Check if the package can be imported
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import ${import_name}"
RESULT_VARIABLE result
)

if(NOT result EQUAL 0)
set(result FALSE PARENT_SCOPE)
return()
endif()

# Get the installed package version
execute_process(
COMMAND ${Python_EXECUTABLE} -m pip show ${package}
OUTPUT_VARIABLE package_info
)

# Extract version information from the output
string(FIND "${package_info}" "Version:" version_pos)

if(version_pos EQUAL -1)
set(result FALSE PARENT_SCOPE)
return() # Return false if version not found
endif()

# Extract the version string
string(SUBSTRING "${package_info}" ${version_pos} 1000 version_string)
string(REGEX REPLACE "Version: ([^ ]+).*" "\\1" installed_version "${version_string}")

# Compare versions
if("${installed_version}" VERSION_LESS "${version}")
set(result FALSE PARENT_SCOPE) # Return false if installed version is less than required
return()
endif()

set(result TRUE PARENT_SCOPE)
endfunction()

if (EXISTS "${CMAKE_BINARY_DIR}/check_marker.txt")
message(STATUS "Check marker file found, skipping the checks.")
else()
# Create a virtual environment
set(VENV_DIR "${CMAKE_BINARY_DIR}/venv")
execute_process(
COMMAND ${Python_EXECUTABLE} -m venv ${VENV_DIR}
)

set(PYTHON_EXECUTABLE "${VENV_DIR}/bin/python")
set(PIP_EXECUTABLE "${VENV_DIR}/bin/pip")

# Upgrade pip in the virtual environment
execute_process(
COMMAND ${PIP_EXECUTABLE} install --upgrade pip
)

# Read the requirements.txt file and install missing packages
file(READ ${REQUIREMENTS_FILE} requirements_content)

# Split the requirements file content into lines
string(REPLACE "\n" ";" requirements_list "${requirements_content}")
include(cmake/find_packages.cmake)

# Check and install each package
foreach(requirement ${requirements_list})
# Skip empty lines
string(STRIP ${requirement} trimmed_requirement)
if(trimmed_requirement STREQUAL "")
continue()
endif()

# Get the package name and version (without the version number)
if(${trimmed_requirement} MATCHES "==")
string(REPLACE "==" ";" parts ${trimmed_requirement})
elseif(${trimmed_requirement} MATCHES ">=")
string(REPLACE ">=" ";" parts ${trimmed_requirement})
else()
message(WARNING "Could not parse requirement '${trimmed_requirement}'. Skipping...")
continue()
endif()

list(GET parts 0 package_name)
list(GET parts 1 package_version)

# If the package name or version could not be parsed, output a warning and skip
if(NOT package_name OR NOT package_version)
message(WARNING "Could not parse requirement '${trimmed_requirement}'. Skipping...")
continue()
endif()

# Check if the package is installed
message(STATUS "Checking if Python package '${package_name}' is installed...")
check_python_package(${package_name} ${package_version})
if(NOT result)
message(STATUS "Package '${package_name}' is not installed or needs an upgrade. Installing...")
execute_process(
COMMAND ${PIP_EXECUTABLE} install ${trimmed_requirement}
RESULT_VARIABLE install_result
)
if(NOT install_result EQUAL 0)
message(FATAL_ERROR "Failed to install Python package '${package_name}'.")
endif()
else()
message(STATUS "Package '${package_name}' is already installed with a suitable version.")
endif()
endforeach()
execute_process(
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_BINARY_DIR}/check_marker.txt"
RESULT_VARIABLE result
)
endif()
# Configure Python environment
include(cmake/python_environment.cmake)

# Configure config.h
configure_file(${lithium_src_dir}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
Expand All @@ -271,13 +120,16 @@ set(BUILD_SHARED_LIBS ON)
# Add subdirectories
add_subdirectory(libs)
add_subdirectory(modules)

add_subdirectory(${lithium_module_dir})

add_subdirectory(${lithium_src_dir}/config)
add_subdirectory(${lithium_src_dir}/task)
add_subdirectory(${lithium_src_dir}/server)
add_subdirectory(${lithium_src_dir}/utils)
add_subdirectory(${lithium_src_dir}/addon)
add_subdirectory(${lithium_src_dir}/client)
add_subdirectory(${lithium_src_dir}/target)
add_subdirectory(${lithium_src_dir}/device)
add_subdirectory(tests)

Expand Down Expand Up @@ -307,13 +159,13 @@ set(debug_module
)

set(device_module
${lithium_src_dir}/device/manager.cpp

${lithium_src_dir}/device/template/device.cpp
)

set(script_module
${lithium_src_dir}/script/manager.cpp
${lithium_src_dir}/script/pycaller.cpp
${lithium_src_dir}/script/pycaller.hpp
${lithium_src_dir}/script/sheller.cpp
)

Expand Down Expand Up @@ -364,6 +216,7 @@ target_link_libraries(lithium_server
tinyxml2
pocketpy
${Readline_LIBRARIES}
pybind11::embed
)

if(WIN32)
Expand Down Expand Up @@ -395,17 +248,7 @@ target_compile_definitions(lithium_server PRIVATE LOGURU_DEBUG_LOGGING)
set_target_properties(lithium_server PROPERTIES OUTPUT_NAME lithium_server)

# Set install paths
if(UNIX AND NOT APPLE)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr CACHE PATH "Lithium install path" FORCE)
endif()
endif()

if(WIN32)
set(CMAKE_INSTALL_PREFIX "C:/Program Files/LithiumServer")
elseif(LINUX)
set(CMAKE_INSTALL_PREFIX "/usr/lithium")
endif()
include(cmake/install_paths.cmake)

# Enable folder grouping in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ Alternatively, utilize the provided quick-build scripts to streamline the proces
### Intellectual Inspiration

Embarking on the journey with Lithium, we embrace curiosity and an unwavering pursuit of knowledge, echoing the adapted verse which reminds us that every attempt, though fraught with challenges and setbacks, is a necessary step toward wisdom and understanding. Together, let us navigate the vast cosmos of astronomical imaging, our technology the vessel, innovation our sail, advancing relentlessly forward.

<figure><embed src="https://wakatime.com/share/@018d39f0-57c9-4a13-aedb-90454b61e6cc/e1b2b694-2ecc-4cfd-9c75-2d01b8581e4d.svg"></embed></figure>
<figure><embed src="https://wakatime.com/share/@018d39f0-57c9-4a13-aedb-90454b61e6cc/d6c29fb7-c5b3-4ffc-8e17-16634c7b669a.svg"></embed></figure>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions cmake/FindGlib.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# - Try to find Glib-2.0 (with gobject)
# Once done, this will define
#
# Glib_FOUND - system has Glib
# Glib_INCLUDE_DIRS - the Glib include directories
# Glib_LIBRARIES - link these to use Glib

include(LibFindMacros)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(Glib_PKGCONF glib-2.0>=2.16)

# Main include dir
find_path(Glib_INCLUDE_DIR
NAMES glib.h
PATHS ${Glib_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES glib-2.0
)

# Glib-related libraries also use a separate config header, which is in lib dir
find_path(GlibConfig_INCLUDE_DIR
NAMES glibconfig.h
PATHS ${Glib_PKGCONF_INCLUDE_DIRS} /usr
PATH_SUFFIXES lib/glib-2.0/include
)

# Finally the library itself
find_library(Glib_LIBRARY
NAMES glib-2.0
PATHS ${Glib_PKGCONF_LIBRARY_DIRS}
)

# Find gobject library
find_library(GObject_LIBRARY
NAMES gobject-2.0
PATHS ${Glib_PKGCONF_LIBRARY_DIRS}
)

# Find gthread library
find_library(GThread_LIBRARY
NAMES gthread-2.0
PATHS ${Glib_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(Glib_PROCESS_INCLUDES Glib_INCLUDE_DIR GlibConfig_INCLUDE_DIR)
set(Glib_PROCESS_LIBS Glib_LIBRARY GObject_LIBRARY GThread_LIBRARY)
libfind_process(Glib)

# Redefine variables for backward compatibility
set(GLIB_INCLUDE_DIRS ${Glib_INCLUDE_DIRS})
set(GLIB_LIBRARIES ${Glib_LIBRARIES})
set(GLIB_FOUND ${Glib_FOUND})

# Provide a summary of the found libraries
if(Glib_FOUND)
message(STATUS "Found Glib: ${Glib_LIBRARIES}")
message(STATUS "Glib include directories: ${Glib_INCLUDE_DIRS}")
else()
message(WARNING "Glib not found")
endif()
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions cmake/FindLibSecret.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# - Try to find LIBSECRET-1
# Once done, this will define
#
# LIBSECRET_FOUND - system has LIBSECRET
# LIBSECRET_INCLUDE_DIRS - the LIBSECRET include directories
# LIBSECRET_LIBRARIES - link these to use LIBSECRET

include(LibFindMacros)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(LIBSECRET_PKGCONF LIBSECRET-1)

# Main include dir
find_path(LIBSECRET_INCLUDE_DIR
NAMES LIBSECRET/secret.h
PATHS ${LIBSECRET_PKGCONF_INCLUDE_DIRS}
)

# Finally the library itself
find_library(LIBSECRET_LIBRARY
NAMES secret-1
PATHS ${LIBSECRET_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(LIBSECRET_PROCESS_INCLUDES LIBSECRET_INCLUDE_DIR)
set(LIBSECRET_PROCESS_LIBS LIBSECRET_LIBRARY)
libfind_process(LIBSECRET)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading