From f5182912168daa47bdaa102f6a640120b0d0eb70 Mon Sep 17 00:00:00 2001
From: Ma Aiguo <maaiguo@uniontech.com>
Date: Mon, 30 May 2022 16:08:06 +0800
Subject: [PATCH] use system xlsxwriter lib

---
 CMakeLists.txt             | 1 -
 application/CMakeLists.txt | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2329862..4496377 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,5 +12,4 @@ add_subdirectory(logViewerTruncate)
 
 add_subdirectory(logViewerService)
 
-add_subdirectory(tests)
 option(PERF_ON "open the info of benchmark" ON)
diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt
index f6b6887..df33ffe 100755
--- a/application/CMakeLists.txt
+++ b/application/CMakeLists.txt
@@ -118,6 +118,7 @@ find_package(Qt5LinguistTools REQUIRED)
 find_package(DFrameworkdbus REQUIRED)
 find_package(RapidJSON)
 pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus)
+pkg_check_modules(XLSxwriter REQUIRED xlsxwriter)
 find_package(Boost)
 find_package(XercesC)
 find_package(ZLIB)
@@ -239,9 +240,6 @@ function(include_sub_directories_recursively root_dir)
     endforeach()
 endfunction()
 
-#--------------------libxlsx源码引入---------------------------------
-file(GLOB LXW_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/libxlsxwriter/src/*.c)
-file(GLOB_RECURSE LXW_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/libxlsxwriter/include *.h)
 
 set (MINIZIP_SOURCES
     ../3rdparty/minizip/ioapi.c
@@ -294,7 +292,6 @@ qt5_create_translation(APP_QM_FILES ${APP_TS_FILES} ${APP_QM_FILES})
 
 add_executable (${EXE_NAME} ${APP_CPP_FILES}  ${APP_QRC_FILES} ${DOCX_CPP_FILES} ${APP_QM_FILES}  ${MINIZIP_SOURCES} ${LXW_SOURCES} ${DOCXFAC_SOURCES} ${DOCXFAC_SOURCES_C} ${TMPFILE_SOURCES} ${MD5SOURCES} )
 include_sub_directories_recursively("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/docx")
-include_sub_directories_recursively("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/libxlsxwriter")
 include_sub_directories_recursively("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/DocxFactory/include")
 include_sub_directories_recursively("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/md5")
 include_sub_directories_recursively("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/minizip")
@@ -306,6 +303,7 @@ include_directories(${DtkGui_INCLUDE_DIRS})
 include_directories( ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
 include_directories( ${Qt5Widgets_PRIVATE_INCLUDE_DIRS})
 include_directories( ${DFrameworkDBus_INCLUDE_DIRS})
+include_directories( ${XLSxwriter_INCLUDE_DIRS})
 include_directories( ${Boost_INCLUDE_DIRS})
 include_directories( ${ZLIB_INCLUDE_DIRS})
 message("ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}")
@@ -313,7 +311,7 @@ include_directories( ${RapidJSON_INCLUDE_DIRS})
 #include_directories(${ImageMagick_INCLUDE_DIRS})
 include_directories(${XercesC_INCLUDE_DIRS})
 
-target_link_libraries(${EXE_NAME}  ${LINK_LIBS} ${DFrameworkDBus_LIBRARIES}  -lsystemd -licui18n -licuuc  -ldl -fPIC)
+target_link_libraries(${EXE_NAME}  ${LINK_LIBS} ${DFrameworkDBus_LIBRARIES} ${XLSxwriter_LIBRARIES}  -lsystemd -licui18n -licuuc  -ldl -fPIC)
 target_link_libraries(${EXE_NAME} ${DtkWidget_LIBRARIES})
 target_link_libraries(${EXE_NAME} ${DtkCore_LIBRARIES})
 target_link_libraries(${EXE_NAME} ${DtkGUI_LIBRARIES})
-- 
2.36.1

