mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
use system packages for zlib, cryptopp, and cxxtest. WIP [ci skip]
This commit is contained in:
parent
a2bfdee2f2
commit
e4ec1a2850
7
.gitmodules
vendored
7
.gitmodules
vendored
|
@ -1,6 +1,5 @@
|
|||
[submodule "third-party/botan"]
|
||||
path = third-party/botan
|
||||
url = https://github.com/randombit/botan
|
||||
[submodule "third-party/libstudxml"]
|
||||
path = third-party/libstudxml
|
||||
url = http://scm.codesynthesis.com/libstudxml/libstudxml.git
|
||||
branch = master
|
||||
ignore = dirty
|
||||
|
||||
|
|
|
@ -1,43 +1,24 @@
|
|||
cmake_minimum_required(VERSION 3.1)
|
||||
project(xlnt VERSION 0.9.3)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
|
||||
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party ${CMAKE_CURRENT_BINARY_DIR}/third-party)
|
||||
|
||||
if(APPLE)
|
||||
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
|
||||
endif()
|
||||
|
||||
set(PROJECT_VENDOR "Thomas Fussell")
|
||||
set(PROJECT_CONTACT "thomas.fussell@gmail.com")
|
||||
set(PROJECT_URL "https://github.com/tfussell/xlnt")
|
||||
set(PROJECT_DESCRIPTION "cross-platform user-friendly xlsx library for C++14")
|
||||
|
||||
set(XLNT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
set(XLNT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party)
|
||||
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/installed" CACHE PATH "default install path" FORCE)
|
||||
if(APPLE)
|
||||
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
|
||||
endif()
|
||||
|
||||
if(NOT INC_DEST_DIR)
|
||||
set(INC_DEST_DIR ${CMAKE_INSTALL_PREFIX}/include)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(NOT LIB_DEST_DIR)
|
||||
set(LIB_DEST_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif()
|
||||
set(XLNT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
if(NOT BIN_DEST_DIR)
|
||||
set(BIN_DEST_DIR ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif()
|
||||
set(XLNT_INCLUDE_DIR ${XLNT_ROOT_DIR}/include)
|
||||
set(XLNT_SOURCE_DIR ${XLNT_ROOT_DIR}/source)
|
||||
set(THIRD_PARTY_DIR ${XLNT_ROOT_DIR}/third-party)
|
||||
add_subdirectory(${THIRD_PARTY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/third-party)
|
||||
|
||||
if(COVERAGE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
|
@ -58,15 +39,6 @@ if(APPLE)
|
|||
set(CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_VERSION})
|
||||
endif()
|
||||
|
||||
# Includes
|
||||
include_directories(${XLNT_INCLUDE_DIR}
|
||||
${XLNT_INCLUDE_DIR}/xlnt
|
||||
${XLNT_SOURCE_DIR}
|
||||
${XLNT_SOURCE_DIR}/detail
|
||||
${LIBSTUDXML_INCLUDE_DIR}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${CRYPTOPP_INCLUDE_DIR})
|
||||
|
||||
file(GLOB ROOT_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/*.hpp)
|
||||
file(GLOB CELL_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/cell/*.hpp)
|
||||
file(GLOB CELL_SOURCES ${XLNT_SOURCE_DIR}/cell/*.cpp)
|
||||
|
@ -100,6 +72,23 @@ set(XLNT_SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES}
|
|||
${STYLES_SOURCES} ${UTILS_SOURCES} ${WORKBOOK_SOURCES}
|
||||
${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
|
||||
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/installed"
|
||||
CACHE PATH "default install path" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT INC_DEST_DIR)
|
||||
set(INC_DEST_DIR ${CMAKE_INSTALL_PREFIX}/include)
|
||||
endif()
|
||||
|
||||
if(NOT LIB_DEST_DIR)
|
||||
set(LIB_DEST_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif()
|
||||
|
||||
if(NOT BIN_DEST_DIR)
|
||||
set(BIN_DEST_DIR ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif()
|
||||
|
||||
if(NOT STATIC)
|
||||
add_library(xlnt SHARED ${XLNT_HEADERS} ${XLNT_SOURCES})
|
||||
target_compile_definitions(xlnt PRIVATE XLNT_SHARED=1)
|
||||
|
@ -108,23 +97,17 @@ if(NOT STATIC)
|
|||
target_compile_definitions(xlnt PRIVATE XLNT_EXPORT=1 _CRT_SECURE_NO_WARNINGS=1)
|
||||
endif()
|
||||
|
||||
install(TARGETS xlnt
|
||||
LIBRARY DESTINATION ${LIB_DEST_DIR}
|
||||
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
||||
RUNTIME DESTINATION ${BIN_DEST_DIR})
|
||||
set_target_properties(
|
||||
xlnt
|
||||
set_target_properties(xlnt
|
||||
PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
INSTALL_NAME_DIR "${LIB_DEST_DIR}")
|
||||
|
||||
if(FRAMEWORK)
|
||||
add_custom_command(
|
||||
TARGET xlnt
|
||||
add_custom_command(TARGET xlnt
|
||||
POST_BUILD
|
||||
COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions/${PROJECT_VERSION_FULL}/Headers"
|
||||
COMMAND cp -R ../include/xlnt/* "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions/${PROJECT_VERSION_FULL}/Headers"
|
||||
COMMAND cp -R ${XLNT_INCLUDE_DIR}/xlnt/* "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions/${PROJECT_VERSION_FULL}/Headers"
|
||||
COMMAND cp "lib/lib${PROJECT_NAME}.${PROJECT_VERSION_FULL}.dylib" "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions/${PROJECT_VERSION_FULL}/xlnt"
|
||||
COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework/Versions" && ln -s "${PROJECT_VERSION_FULL}" Current
|
||||
COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/xlnt.framework" && ln -s Versions/Current/* ./
|
||||
|
@ -135,23 +118,17 @@ else()
|
|||
target_compile_definitions(xlnt PUBLIC XLNT_STATIC=1)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_definitions(xlnt PRIVATE _CRT_SECURE_NO_WARNINGS=1 NOMINMAX)
|
||||
target_compile_definitions(xlnt PRIVATE _CRT_SECURE_NO_WARNINGS=1)
|
||||
endif()
|
||||
|
||||
install(TARGETS xlnt
|
||||
LIBRARY DESTINATION ${LIB_DEST_DIR}
|
||||
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
||||
RUNTIME DESTINATION ${BIN_DEST_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(xlnt
|
||||
PRIVATE LIBSTUDXML_STATIC_LIB=1
|
||||
PRIVATE NO_OS_DEPENDENCE=1
|
||||
PRIVATE CRYPTOPP_DISABLE_ASM=1)
|
||||
target_link_libraries(xlnt ${CRYPTOPP_LIBRARY})
|
||||
target_link_libraries(xlnt ${ZLIB_LIBRARY_RELEASE})
|
||||
target_link_libraries(xlnt libstudxml)
|
||||
target_link_libraries(xlnt ${CRYPTOPP_LIBRARY} ${ZLIB_LIBRARY_RELEASE} libstudxml)
|
||||
|
||||
target_include_directories(xlnt
|
||||
PUBLIC ${XLNT_INCLUDE_DIR}
|
||||
PRIVATE ${XLNT_SOURCE_DIR}
|
||||
PRIVATE ${ZLIB_INCLUDE_DIR}
|
||||
PRIVATE ${CRYPTOPP_INCLUDE_DIR})
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\" /MP")
|
||||
|
@ -171,35 +148,31 @@ source_group(utils FILES ${UTILS_HEADERS} ${UTILS_SOURCES})
|
|||
source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES})
|
||||
source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES})
|
||||
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
set(PKG_CONFIG_LIBDIR ${LIB_DEST_DIR})
|
||||
set(PKG_CONFIG_INCLUDEDIR ${INC_DEST_DIR})
|
||||
set(PKG_CONFIG_LIBS "-L\${libdir} -lxlnt")
|
||||
set(PKG_CONFIG_CFLAGS "-I\${includedir}")
|
||||
|
||||
install(TARGETS xlnt
|
||||
LIBRARY DESTINATION ${LIB_DEST_DIR}
|
||||
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
||||
RUNTIME DESTINATION ${BIN_DEST_DIR})
|
||||
|
||||
if(NOT MSVC)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/pkg-config.pc.cmake"
|
||||
configure_file("${XLNT_ROOT_DIR}/cmake/pkg-config.pc.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/xlnt.pc")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
install(
|
||||
DIRECTORY ${XLNT_INCLUDE_DIR}/xlnt
|
||||
DESTINATION include
|
||||
PATTERN ".DS_Store" EXCLUDE)
|
||||
|
||||
if(NOT MSVC)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/xlnt.pc"
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/xlnt.pc"
|
||||
DESTINATION ${LIB_DEST_DIR}/pkgconfig)
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
install(DIRECTORY ${XLNT_INCLUDE_DIR}/xlnt
|
||||
DESTINATION include
|
||||
PATTERN ".DS_Store" EXCLUDE)
|
||||
|
||||
configure_file("${XLNT_ROOT_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <cxxtest/TestSuite.h>
|
||||
|
||||
#include <xlnt/utils/utf8string.hpp>
|
||||
|
||||
class test_utf8string : public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
void test_utf8()
|
||||
{
|
||||
auto utf8_valid = xlnt::utf8string::from_utf8("abc");
|
||||
auto utf8_invalid = xlnt::utf8string::from_utf8("\xc3\x28");
|
||||
|
||||
TS_ASSERT(utf8_valid.is_valid());
|
||||
TS_ASSERT(!utf8_invalid.is_valid());
|
||||
}
|
||||
|
||||
void test_latin1()
|
||||
{
|
||||
auto latin1_valid = xlnt::utf8string::from_latin1("abc");
|
||||
TS_ASSERT(latin1_valid.is_valid());
|
||||
}
|
||||
|
||||
void test_utf16()
|
||||
{
|
||||
auto utf16_valid = xlnt::utf8string::from_utf16({ 'a', 'b', 'c' });
|
||||
TS_ASSERT(utf16_valid.is_valid());
|
||||
}
|
||||
|
||||
void test_utf32()
|
||||
{
|
||||
auto utf32_valid = xlnt::utf8string::from_utf32({ 'a', 'b', 'c' });
|
||||
TS_ASSERT(utf32_valid.is_valid());
|
||||
}
|
||||
};
|
|
@ -13,31 +13,31 @@ public:
|
|||
void test_decrypt_agile()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load(path_helper::get_data_directory("11_encrypted_excel_2016.xlsx"), "secret");
|
||||
wb.load(path_helper::data_directory("11_encrypted_excel_2016.xlsx"), "secret");
|
||||
}
|
||||
|
||||
void test_decrypt_libre_office()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load(path_helper::get_data_directory("12_encrypted_libre_office.xlsx"), "secret");
|
||||
wb.load(path_helper::data_directory("12_encrypted_libre_office.xlsx"), "secret");
|
||||
}
|
||||
|
||||
void test_decrypt_standard()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load(path_helper::get_data_directory("13_encrypted_excel_2007.xlsx"), "password");
|
||||
wb.load(path_helper::data_directory("13_encrypted_excel_2007.xlsx"), "password");
|
||||
}
|
||||
|
||||
void test_decrypt_numbers()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load(path_helper::get_data_directory("14_encrypted_numbers.xlsx"), "secret");
|
||||
wb.load(path_helper::data_directory("14_encrypted_numbers.xlsx"), "secret");
|
||||
}
|
||||
|
||||
void test_comments()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load("data/15_basic_comments.xlsx");
|
||||
wb.load(path_helper::data_directory("15_basic_comments.xlsx"));
|
||||
|
||||
auto sheet1 = wb[0];
|
||||
TS_ASSERT_EQUALS(sheet1.cell("A1").value<std::string>(), "Sheet1!A1");
|
||||
|
@ -54,12 +54,13 @@ public:
|
|||
{
|
||||
#ifdef _MSC_VER
|
||||
xlnt::workbook wb;
|
||||
static const std::string data_dir = STRING_LITERAL(XLNT_TEST_DATA_DIR);
|
||||
wb.load(L"data\\16_unicode_Λ.xlsx");
|
||||
TS_ASSERT_EQUALS(wb.active_sheet().cell("A1").value<std::string>(), "unicode!");
|
||||
#endif
|
||||
#ifndef __MINGW32__
|
||||
xlnt::workbook wb2;
|
||||
wb2.load(u8"data/16_unicode_Λ.xlsx");
|
||||
wb2.load(U8STRING_LITERAL(XLNT_TEST_DATA_DIR) u8"/16_unicode_Λ.xlsx");
|
||||
TS_ASSERT_EQUALS(wb2.active_sheet().cell("A1").value<std::string>(), "unicode!");
|
||||
#endif
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ public:
|
|||
void test_read_hyperlink()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load("data/17_with_hyperlink.xlsx");
|
||||
wb.load(path_helper::data_directory("17_with_hyperlink.xlsx"));
|
||||
TS_ASSERT(wb.active_sheet().cell("A1").has_hyperlink());
|
||||
TS_ASSERT_EQUALS(wb.active_sheet().cell("A1").hyperlink(),
|
||||
"https://fr.wikipedia.org/wiki/Ille-et-Vilaine");
|
||||
|
@ -76,7 +77,7 @@ public:
|
|||
void test_read_headers_and_footers()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load("data/18_headers_and_footers.xlsx");
|
||||
wb.load(path_helper::data_directory("18_headers_and_footers.xlsx"));
|
||||
auto ws = wb.active_sheet();
|
||||
|
||||
TS_ASSERT_EQUALS(ws.cell("A1").value<std::string>(), "header");
|
||||
|
@ -108,7 +109,7 @@ public:
|
|||
void test_read_custom_properties()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load("data/21_custom_properties.xlsx");
|
||||
wb.load(path_helper::data_directory("21_custom_properties.xlsx"));
|
||||
TS_ASSERT(wb.has_custom_property("Client"));
|
||||
TS_ASSERT_EQUALS(wb.custom_property("Client").get<std::string>(), "me!");
|
||||
}
|
||||
|
@ -116,7 +117,7 @@ public:
|
|||
void test_read_formulae()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load("data/22_formulae.xlsx");
|
||||
wb.load(path_helper::data_directory("22_formulae.xlsx"));
|
||||
auto ws = wb.active_sheet();
|
||||
TS_ASSERT_EQUALS(ws.cell("A1").value<int>(), 6);
|
||||
TS_ASSERT(ws.cell("A1").has_formula());
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
void test_produce_empty()
|
||||
{
|
||||
xlnt::workbook wb = xlnt::workbook::empty();
|
||||
TS_ASSERT(workbook_matches_file(wb, path_helper::get_data_directory("9_default-excel.xlsx")));
|
||||
TS_ASSERT(workbook_matches_file(wb, path_helper::data_directory("9_default-excel.xlsx")));
|
||||
}
|
||||
|
||||
void test_produce_simple_excel()
|
||||
|
@ -152,13 +152,13 @@ public:
|
|||
sheet2.cell("A2").value("Sheet2!A2");
|
||||
sheet2.cell("A2").comment("Sheet2 comment2", comment_font, "Microsoft Office User");
|
||||
|
||||
TS_ASSERT(workbook_matches_file(wb, xlnt::path("data/15_basic_comments.xlsx")));
|
||||
TS_ASSERT(workbook_matches_file(wb, path_helper::data_directory("15_basic_comments.xlsx")));
|
||||
}
|
||||
|
||||
void test_save_after_clear_all_formulae()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
wb.load("data/22_formulae.xlsx");
|
||||
wb.load(path_helper::data_directory("22_formulae.xlsx"));
|
||||
auto ws = wb.active_sheet();
|
||||
TS_ASSERT(ws.cell("A1").has_formula());
|
||||
TS_ASSERT_EQUALS(ws.cell("A1").formula(), "A2*A3");
|
||||
|
|
|
@ -65,31 +65,31 @@ public:
|
|||
|
||||
void test_round_trip_empty_excel_rw()
|
||||
{
|
||||
auto path = path_helper::get_data_directory("9_default-excel.xlsx");
|
||||
auto path = path_helper::data_directory("9_default-excel.xlsx");
|
||||
TS_ASSERT(round_trip_matches_rw(path));
|
||||
}
|
||||
|
||||
void test_round_trip_all_styles_rw()
|
||||
{
|
||||
auto path = path_helper::get_data_directory("10_all_styles.xlsx");
|
||||
auto path = path_helper::data_directory("10_all_styles.xlsx");
|
||||
TS_ASSERT(round_trip_matches_rw(path));
|
||||
}
|
||||
|
||||
void test_round_trip_headers_footers()
|
||||
{
|
||||
auto path = path_helper::get_data_directory("18_headers_and_footers.xlsx");
|
||||
auto path = path_helper::data_directory("18_headers_and_footers.xlsx");
|
||||
TS_ASSERT(round_trip_matches_rw(path));
|
||||
}
|
||||
|
||||
void test_round_trip_row_and_col_props()
|
||||
{
|
||||
auto path = path_helper::get_data_directory("19_row_and_col_properties.xlsx");
|
||||
auto path = path_helper::data_directory("19_row_and_col_properties.xlsx");
|
||||
TS_ASSERT(round_trip_matches_rw(path));
|
||||
}
|
||||
|
||||
void test_round_trip_page_breaks()
|
||||
{
|
||||
auto path = path_helper::get_data_directory("20_page_breaks.xlsx");
|
||||
auto path = path_helper::data_directory("20_page_breaks.xlsx");
|
||||
TS_ASSERT(round_trip_matches_rw(path));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,14 +8,6 @@ if(NOT COMBINED_PROJECT)
|
|||
add_subdirectory(${LIBRARY_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/source)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../source)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../source/detail)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(${CXXTEST_INCLUDE_DIR})
|
||||
include_directories(${LIBSTUDXML_INCLUDE_DIR})
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
|
||||
file(GLOB CELL_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/cell/tests/test_*.hpp)
|
||||
file(GLOB CHARTS_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/charts/tests/test_*.hpp)
|
||||
file(GLOB CHARTSHEET_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../source/chartsheet/tests/test_*.hpp)
|
||||
|
@ -49,8 +41,13 @@ if(COVERAGE)
|
|||
endif()
|
||||
|
||||
add_executable(xlnt.test ${TEST_HELPERS} ${TESTS} ${RUNNER} ${XLNT_ZIP})
|
||||
target_compile_definitions(xlnt.test PRIVATE LIBSTUDXML_STATIC_LIB=1)
|
||||
target_link_libraries(xlnt.test xlnt)
|
||||
target_include_directories(xlnt.test
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../source
|
||||
PRIVATE ${CXXTEST_INCLUDE_DIR})
|
||||
set(XLNT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
||||
target_compile_definitions(xlnt.test PRIVATE XLNT_TEST_DATA_DIR=${XLNT_TEST_DATA_DIR})
|
||||
|
||||
source_group(helpers FILES ${TEST_HELPERS})
|
||||
source_group(xlnt\\detail FILES ${XLNT_ZIP})
|
||||
|
@ -85,5 +82,3 @@ add_custom_command(OUTPUT ${RUNNER}
|
|||
|
||||
add_custom_target(generate-test-runner DEPENDS ${RUNNER})
|
||||
add_dependencies(xlnt.test generate-test-runner)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
|
|
|
@ -20,13 +20,20 @@
|
|||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#define STRING_LITERAL2(a) #a
|
||||
#define LSTRING_LITERAL2(a) L#a
|
||||
#define U8STRING_LITERAL2(a) u8#a
|
||||
#define STRING_LITERAL(a) STRING_LITERAL2(a)
|
||||
#define LSTRING_LITERAL(a) STRING_LITERAL2(a)
|
||||
#define U8STRING_LITERAL(a) STRING_LITERAL2(a)
|
||||
|
||||
class path_helper
|
||||
{
|
||||
public:
|
||||
static xlnt::path get_data_directory(const std::string &append = "")
|
||||
static xlnt::path data_directory(const std::string &append = "")
|
||||
{
|
||||
return xlnt::path("data")
|
||||
.append(xlnt::path(append));
|
||||
static const std::string data_dir = STRING_LITERAL(XLNT_TEST_DATA_DIR);
|
||||
return xlnt::path(data_dir).append(xlnt::path(append));
|
||||
}
|
||||
|
||||
static void copy_file(const xlnt::path &source, const xlnt::path &destination, bool overwrite)
|
||||
|
|
33
third-party/CMakeLists.txt
vendored
33
third-party/CMakeLists.txt
vendored
|
@ -1,26 +1,12 @@
|
|||
cmake_minimum_required(VERSION 3.2)
|
||||
project(xlnt.third-party)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(CryptoPP REQUIRED)
|
||||
find_package(CxxTest REQUIRED)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(libstudxml-download
|
||||
GIT_REPOSITORY http://scm.codesynthesis.com/libstudxml/libstudxml.git
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libstudxml
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
STEP_TARGETS build
|
||||
EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
set(LIBSTUDXML_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/libstudxml/src/libstudxml)
|
||||
|
||||
include_directories(${LIBSTUDXML_ROOT_DIR})
|
||||
set(LIBSTUDXML_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libstudxml)
|
||||
|
||||
set(LIBSTUDXML
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/parser.cxx
|
||||
|
@ -38,8 +24,8 @@ set(LIBSTUDXML
|
|||
set(EXPAT
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmlparse.c
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmlrole.c
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok_impl.c
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok_ns.c
|
||||
# ${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok_impl.c
|
||||
# ${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok_ns.c
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/xmltok.c
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/ascii.h
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details/expat/asciitab.h
|
||||
|
@ -61,5 +47,12 @@ set(GENX
|
|||
${LIBSTUDXML_ROOT_DIR}/xml/details/genx/genx.h)
|
||||
|
||||
add_library(libstudxml STATIC ${LIBSTUDXML} ${EXPAT} ${GENX})
|
||||
target_compile_definitions(libstudxml PRIVATE LIBSTUDXML_STATIC_LIB=1)
|
||||
add_dependencies(libstudxml libstudxml-download)
|
||||
target_compile_definitions(libstudxml PUBLIC LIBSTUDXML_STATIC_LIB=1)
|
||||
target_include_directories(libstudxml PUBLIC ${LIBSTUDXML_ROOT_DIR})
|
||||
|
||||
add_custom_target(libstudxml-config)
|
||||
add_custom_command(TARGET libstudxml-config PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy ${CMAKE_CURRENT_SOURCE_DIR}/../source/detail/xml/details/config.h
|
||||
${LIBSTUDXML_ROOT_DIR}/xml/details)
|
||||
add_dependencies(libstudxml libstudxml-config)
|
||||
|
|
1
third-party/libstudxml
vendored
Submodule
1
third-party/libstudxml
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 132522ca4c895e9b07d7e323d5529474806e5829
|
Loading…
Reference in New Issue
Block a user