测试将OpenXLSX-development-aral的默认zip库改为libzip

the test is very hard

I set option(OPENXLSX_ENABLE_LIBZIP "Enable using libzip" ON) in OpenXLSX-development-aral/CMakeLists.txt
and run

mkdir build2
cd build2
cmake ..

it reports

-- Configuring done
CMake Error at OpenXLSX/CMakeLists.txt:178 (target_link_libraries):
  Target "OpenXLSX" links to:

    libzip::zip

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



-- Generating done

but I can run make, it stoped at

In file included from /par/OpenXLSX-development-aral/OpenXLSX/sources/XLZipArchive.cpp:48:
/par/OpenXLSX-development-aral/OpenXLSX/headers/detail/LibZip.hpp:11:10: fatal error: zip.h: No such file or directory
   11 | #include <zip.h>        // libzip

so I add export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/par/libzip-1.11.4/lib and it continue

[  8%] Linking CXX static library ../output/libOpenXLSX.a
[ 60%] Built target OpenXLSX
[ 62%] Building CXX object Examples/CMakeFiles/Demo1.dir/Demo1.cpp.o
[ 64%] Linking CXX executable ../output/Demo1
/usr/bin/ld: cannot find -llibzip::zip: No such file or directory

I then modified the OpenXLSX-development-aral/OpenXLSX/CMakeLists.txt, replace all libzip::zip to zip
and make sure the libzip.so in the following path

ls -l /par/libzip-1.11.4/build/lib
total 332
drwxrwxrwx 1 root root   4096 Aug 25 11:49 CMakeFiles
-rwxrwxrwx 1 root root    263 Aug 25 11:49 CTestTestfile.cmake
-rwxrwxrwx 1 root root 127726 Aug 25 11:49 Makefile
-rwxrwxrwx 1 root root   3132 Aug 25 11:49 cmake_install.cmake
lrwxrwxrwx 1 root root     11 Aug 25 11:49 libzip.so -> libzip.so.5
lrwxrwxrwx 1 root root     13 Aug 25 11:49 libzip.so.5 -> libzip.so.5.5
-rwxrwxrwx 1 root root 200368 Aug 25 11:49 libzip.so.5.5
-rwxrwxrwx 1 root root   3142 Aug 25 11:49 zip_err_str.c

I set export LIBRARY_PATH=$LIBRARY_PATH:/par/libzip-1.11.4/build/lib and make it again, it finished at

[100%] Built target Demo10

I made sure it depends on libzip by

ldd output/Demo5
        linux-vdso.so.1 (0x00007fffae1f0000)
        libzip.so.5 => /par/libzip-1.11.4/build/lib/libzip.so.5 (0x00007fa234a87000)

then

export LD_LIBRARY_PATH=$LIBRARY_PATH:/par/libzip-1.11.4/build/lib

it can run now, but it much slower than the orignal OPENXLSX_ENABLE_LIBZIP OFF config(in build).

root@6ae32a5ffcde:/par/OpenXLSX-development-aral/build2# time output/Demo5
********************************************************************************
DEMO PROGRAM #05: Ranges and Iterators
********************************************************************************

Generating spreadsheet ...
Saving spreadsheet ...
Re-opening spreadsheet ...
Reading data from spreadsheet ...
Cell count: 8388608
Sum of cell values: 415132707

real    0m48.306s
user    0m43.401s
sys     0m2.463s
root@6ae32a5ffcde:/par/OpenXLSX-development-aral/build2# cd ../build
root@6ae32a5ffcde:/par/OpenXLSX-development-aral/build# time output/Demo5
********************************************************************************
DEMO PROGRAM #05: Ranges and Iterators
********************************************************************************

Generating spreadsheet ...
Saving spreadsheet ...
Re-opening spreadsheet ...
Reading data from spreadsheet ...
Cell count: 8388608
Sum of cell values: 415096577

real    0m16.781s
user    0m14.867s
sys     0m2.513s
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值