chore: update the file

This commit is contained in:
x-tools-author 2025-02-24 14:41:49 +08:00
parent 59ed5861fb
commit e046df0097
5 changed files with 40 additions and 16 deletions

View File

@ -49,11 +49,11 @@ endif()
# --------------------------------------------------------------------------------------------------
# CMake module
include(${CMAKE_SOURCE_DIR}/cmake/QIFW/QIFW.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/xtools.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/git.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/xToolsDeployQt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/xToolsThirdParty.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/xtools.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/QXlsx.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/deployqt.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/QIFW/QIFW.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Qt-Advanced-Stylesheets.cmake)
# --------------------------------------------------------------------------------------------------
@ -236,7 +236,7 @@ if(NOT Qt${QT_VERSION_MAJOR}Charts_FOUND)
endif()
if(X_TOOLS_ENABLE_MODULE_CHARTS)
add_compile_definitions(X_TOOLS_ENABLE_MODULE_CHARTS)
x_tools_add_xlsx()
# x_tools_add_xlsx()
else()
message(STATUS "Charts module is disable, chart files will be removed.")
set(TMP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/IO)
@ -263,7 +263,8 @@ qt_add_executable(xTools ${xTools_ICON} ${X_TOOLS_SOURCE} xTools.rc xTools.qrc)
x_tools_generate_translations(xTools)
x_tools_deploy_qt(xTools)
x_tools_tar_target(xTools)
x_tools_deploy_qss(xTools)
# x_tools_deploy_qss(xTools)
x_tools_install_qxlsx(xTools)
set(macos_version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
set(android_dir ${CMAKE_CURRENT_SOURCE_DIR}/android)
@ -277,7 +278,8 @@ set_target_properties(xTools PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${android_
# Link libraries
target_link_libraries(
xTools
PRIVATE Qt${QT_VERSION_MAJOR}::Core
PRIVATE Qt${QT_VERSION_MAJOR}::CorePrivate
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Svg
@ -303,7 +305,7 @@ if(X_TOOLS_ENABLE_MODULE_BLUETOOTH)
endif()
if(X_TOOLS_ENABLE_MODULE_CHARTS)
target_link_libraries(xTools PUBLIC Qt${QT_VERSION_MAJOR}::Charts QXlsx)
target_link_libraries(xTools PUBLIC Qt${QT_VERSION_MAJOR}::Charts QXlsx::QXlsx)
endif()
if(X_TOOLS_ENABLE_QSS)

29
cmake/QXlsx.cmake Normal file
View File

@ -0,0 +1,29 @@
# https://github.com/QtExcel/QXlsx
set(package_name "QXlsx-1.4.7")
# --------------------------------------------------------------------------------------------------
# Extract QXlsx-1.4.7.zip...
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/3rd/${package_name})
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${package_name}.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rd)
endif()
# --------------------------------------------------------------------------------------------------
# Add QXlsx module...
set(dst_dir ${CMAKE_SOURCE_DIR}/libs/${CMAKE_BUILD_TYPE}/${package_name})
if(EXISTS ${dst_dir})
set(CMAKE_PREFIX_PATH ${dst_dir} ${CMAKE_PREFIX_PATH})
include_directories(${dst_dir}/include/QXlsxQt${QT_VERSION_MAJOR})
find_package(QXlsxQt${QT_VERSION_MAJOR} REQUIRED)
else()
add_subdirectory(${CMAKE_SOURCE_DIR}/3rd/${package_name}/QXlsx)
endif()
# --------------------------------------------------------------------------------------------------
# Install QXlsx library to libs
function(x_tools_install_qxlsx target)
add_custom_target(
${target}_install_xlsx
COMMAND ${CMAKE_COMMAND} --install . --prefix ${dst_dir}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rd/${package_name}/QXlsx)
endfunction()

View File

@ -1,7 +0,0 @@
function(x_tools_add_xlsx)
set(xlsx "QXlsx-1.4.7")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${xlsx}.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rd)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rd/${xlsx}/QXlsx/header)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rd/${xlsx}/QXlsx)
endfunction()

View File

@ -28,8 +28,8 @@
#include <QTextBrowser>
#include <QVariant>
#include "AssistantFactory.h"
#include "IOPage/IOPage.h"
#include "Tools/AssistantFactory.h"
#include "common/xtools.h"
#ifdef Q_OS_WIN