2015-11-02 01:31:29 +08:00
|
|
|
project(xlnt)
|
|
|
|
|
2015-11-04 12:02:43 +08:00
|
|
|
set(PROJECT_VENDOR "Thomas Fussell")
|
|
|
|
set(PROJECT_CONTACT "thomas.fussellgmail.com")
|
|
|
|
set(PROJECT_URL "https://github.com/tfussell/xlnt")
|
|
|
|
set(PROJECT_DESCRIPTION "user-friendly xlsx library for C++14")
|
|
|
|
include(VERSION.cmake)
|
|
|
|
|
|
|
|
if(NOT CMAKE_INSTALL_PREFIX)
|
2015-11-11 09:47:07 +08:00
|
|
|
if(MSVC)
|
|
|
|
set(CMAKE_INSTALL_PREFIX /c/Program Files/xlnt)
|
|
|
|
else()
|
|
|
|
set(CMAKE_INSTALL_PREFIX /usr/local)
|
|
|
|
endif()
|
2015-11-04 12:02:43 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(INC_DEST_DIR ${CMAKE_INSTALL_PREFIX}/include)
|
|
|
|
|
|
|
|
if(NOT LIB_DEST_DIR)
|
|
|
|
set(LIB_DEST_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
|
|
|
endif()
|
|
|
|
|
2015-11-11 09:47:07 +08:00
|
|
|
if(NOT BIN_DEST_DIR)
|
|
|
|
set(BIN_DEST_DIR ${CMAKE_INSTALL_PREFIX}/bin)
|
|
|
|
endif()
|
|
|
|
|
2015-11-02 01:31:29 +08:00
|
|
|
include_directories(../include)
|
2015-11-04 13:36:14 +08:00
|
|
|
include_directories(../include/xlnt)
|
2015-11-02 01:31:29 +08:00
|
|
|
include_directories(../source)
|
|
|
|
include_directories(../third-party/miniz)
|
|
|
|
include_directories(../third-party/pugixml/src)
|
2015-11-05 07:45:03 +08:00
|
|
|
include_directories(../third-party/utfcpp)
|
2015-11-02 01:31:29 +08:00
|
|
|
|
|
|
|
FILE(GLOB ROOT_HEADERS ../include/xlnt/*.hpp)
|
|
|
|
FILE(GLOB CELL_HEADERS ../include/xlnt/cell/*.hpp)
|
|
|
|
FILE(GLOB CHARTS_HEADERS ../include/xlnt/charts/*.hpp)
|
|
|
|
FILE(GLOB CHARTSHEET_HEADERS ../include/xlnt/chartsheet/*.hpp)
|
|
|
|
FILE(GLOB DRAWING_HEADERS ../include/xlnt/drawing/*.hpp)
|
2015-11-04 07:26:33 +08:00
|
|
|
FILE(GLOB FORMULA_HEADERS ../include/xlnt/formula/*.hpp)
|
2015-11-02 01:31:29 +08:00
|
|
|
FILE(GLOB PACKAGING_HEADERS ../include/xlnt/packaging/*.hpp)
|
|
|
|
FILE(GLOB SERIALIZATION_HEADERS ../include/xlnt/serialization/*.hpp)
|
|
|
|
FILE(GLOB STYLES_HEADERS ../include/xlnt/styles/*.hpp)
|
2015-11-03 21:38:09 +08:00
|
|
|
FILE(GLOB UTILS_HEADERS ../include/xlnt/utils/*.hpp)
|
2015-11-02 01:31:29 +08:00
|
|
|
FILE(GLOB WORKBOOK_HEADERS ../include/xlnt/workbook/*.hpp)
|
|
|
|
FILE(GLOB WORKSHEET_HEADERS ../include/xlnt/worksheet/*.hpp)
|
|
|
|
FILE(GLOB DETAIL_HEADERS ../source/detail/*.hpp)
|
|
|
|
|
2015-11-03 21:38:09 +08:00
|
|
|
SET(HEADERS ${ROOT_HEADERS} ${CELL_HEADERS} ${CHARTS_HEADERS} ${CHARTSHEET_HEADERS} ${DRAWING_HEADERS} ${FORMULA_HEADERS} ${PACKAGING_HEADERS} ${SERIALIZATION_HEADERS} ${STYLES_HEADERS} ${UTILS_HEADERS} ${WORKBOOK_HEADERS} ${WORKSHEET_HEADERS} ${DETAIL_HEADERS})
|
|
|
|
|
2015-11-02 01:31:29 +08:00
|
|
|
FILE(GLOB CELL_SOURCES ../source/cell/*.cpp)
|
|
|
|
FILE(GLOB CHARTS_SOURCES ../source/charts/*.cpp)
|
|
|
|
FILE(GLOB CHARTSHEET_SOURCES ../source/chartsheet/*.cpp)
|
|
|
|
FILE(GLOB DRAWING_SOURCES ../source/drawing/*.cpp)
|
2015-11-04 07:26:33 +08:00
|
|
|
FILE(GLOB FORMULA_SOURCES ../source/formula/*.cpp)
|
2015-11-02 01:31:29 +08:00
|
|
|
FILE(GLOB PACKAGING_SOURCES ../source/packaging/*.cpp)
|
|
|
|
FILE(GLOB SERIALIZATION_SOURCES ../source/serialization/*.cpp)
|
|
|
|
FILE(GLOB STYLES_SOURCES ../source/styles/*.cpp)
|
2015-11-03 21:38:09 +08:00
|
|
|
FILE(GLOB UTILS_SOURCES ../source/utils/*.cpp)
|
2015-11-02 01:31:29 +08:00
|
|
|
FILE(GLOB WORKBOOK_SOURCES ../source/workbook/*.cpp)
|
|
|
|
FILE(GLOB WORKSHEET_SOURCES ../source/worksheet/*.cpp)
|
2015-11-03 21:38:09 +08:00
|
|
|
FILE(GLOB DETAIL_SOURCES ../source/detail/*.cpp)
|
|
|
|
|
|
|
|
SET(SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES} ${DRAWING_SOURCES} ${FORMULA_SOURCES} ${PACKAGING_SOURCES} ${SERIALIZATION_SOURCES} ${STYLES_SOURCES} ${UTILS_SOURCES} ${WORKBOOK_SOURCES} ${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
|
|
|
|
|
|
|
|
SET(MINIZ ../third-party/miniz/miniz.c ../third-party/miniz/miniz.h)
|
|
|
|
|
|
|
|
SET(PUGIXML ../third-party/pugixml/src/pugixml.hpp ../third-party/pugixml/src/pugixml.cpp ../third-party/pugixml/src/pugiconfig.hpp)
|
2015-11-02 01:31:29 +08:00
|
|
|
|
2015-11-04 12:02:43 +08:00
|
|
|
if(SHARED)
|
|
|
|
add_library(xlnt SHARED ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
|
2015-11-08 09:00:54 +08:00
|
|
|
add_definitions(-DXLNT_SHARED)
|
|
|
|
if(MSVC)
|
2015-11-11 10:01:39 +08:00
|
|
|
target_compile_definitions(xlnt PRIVATE XLNT_EXPORT=1)
|
2015-11-11 09:47:07 +08:00
|
|
|
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\"")
|
2015-11-08 09:00:54 +08:00
|
|
|
endif()
|
2015-11-04 12:02:43 +08:00
|
|
|
else()
|
|
|
|
add_library(xlnt STATIC ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES(
|
|
|
|
xlnt
|
|
|
|
PROPERTIES
|
|
|
|
VERSION ${PROJECT_VERSION_FULL}
|
|
|
|
SOVERSION ${PROJECT_VERSION}
|
|
|
|
INSTALL_NAME_DIR "${LIB_DEST_DIR}"
|
|
|
|
)
|
2015-11-02 01:31:29 +08:00
|
|
|
|
2015-11-03 21:38:09 +08:00
|
|
|
source_group(xlnt FILES ${ROOT_HEADERS})
|
2015-11-02 01:31:29 +08:00
|
|
|
source_group(detail FILES ${DETAIL_HEADERS} ${DETAIL_SOURCES})
|
|
|
|
source_group(cell FILES ${CELL_HEADERS} ${CELL_SOURCES})
|
|
|
|
source_group(charts FILES ${CHARTS_HEADERS} ${CHARTS_SOURCES})
|
|
|
|
source_group(chartsheet FILES ${CHARTSHEET_HEADERS} ${CHARTSHEET_SOURCES})
|
|
|
|
source_group(drawing FILES ${DRAWING_HEADERS} ${DRAWING_SOURCES})
|
2015-11-04 07:26:33 +08:00
|
|
|
source_group(formula FILES ${FORMULA_HEADERS} ${FORMULA_SOURCES})
|
2015-11-02 01:31:29 +08:00
|
|
|
source_group(packaging FILES ${PACKAGING_HEADERS} ${PACKAGING_SOURCES})
|
|
|
|
source_group(serialization FILES ${SERIALIZATION_HEADERS} ${SERIALIZATION_SOURCES})
|
|
|
|
source_group(styles FILES ${STYLES_HEADERS} ${STYLES_SOURCES})
|
2015-11-03 21:38:09 +08:00
|
|
|
source_group(utils FILES ${UTILS_HEADERS} ${UTILS_SOURCES})
|
2015-11-02 01:31:29 +08:00
|
|
|
source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES})
|
|
|
|
source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES})
|
2015-11-03 21:38:09 +08:00
|
|
|
source_group(third-party\\miniz FILES ${MINIZ})
|
|
|
|
source_group(third-party\\pugixml FILES ${PUGIXML})
|
2015-11-04 12:02:43 +08:00
|
|
|
|
|
|
|
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}")
|
|
|
|
|
|
|
|
CONFIGURE_FILE(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
|
|
|
)
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
|
2015-11-08 09:00:54 +08:00
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../include/xlnt
|
2015-11-04 12:02:43 +08:00
|
|
|
DESTINATION include
|
|
|
|
PATTERN ".DS_Store" EXCLUDE
|
|
|
|
)
|
|
|
|
|
|
|
|
install(TARGETS xlnt
|
|
|
|
LIBRARY DESTINATION ${LIB_DEST_DIR}
|
|
|
|
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
2015-11-11 09:47:07 +08:00
|
|
|
RUNTIME DESTINATION ${BIN_DEST_DIR}
|
2015-11-04 12:02:43 +08:00
|
|
|
)
|
|
|
|
|
2015-11-08 09:00:54 +08:00
|
|
|
install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
|
2015-11-04 12:02:43 +08:00
|
|
|
DESTINATION ${LIB_DEST_DIR}/pkgconfig
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(uninstall
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|