mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
finally figure out how to build cryptopp directly rather than as an external project, time to test on other platforms
This commit is contained in:
parent
ab1af4f73e
commit
ccd2a0eb1e
|
@ -8,18 +8,6 @@ endif()
|
||||||
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party ${CMAKE_CURRENT_BINARY_DIR}/third-party)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party ${CMAKE_CURRENT_BINARY_DIR}/third-party)
|
||||||
|
|
||||||
include(ExternalProject)
|
|
||||||
ExternalProject_Add(cryptopp
|
|
||||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/cryptopp
|
|
||||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/cryptopp
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
CONFIGURE_COMMAND ""
|
|
||||||
BUILD_COMMAND "")
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/cryptopp ${CMAKE_CURRENT_BINARY_DIR}/cryptopp)
|
|
||||||
set_target_properties(cryptopp-shared PROPERTIES EXCLUDE_FROM_ALL True)
|
|
||||||
set_target_properties(cryptest PROPERTIES EXCLUDE_FROM_ALL True)
|
|
||||||
target_compile_definitions(cryptopp-object PRIVATE NO_OS_DEPENDENCE=1)
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
|
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
@ -128,7 +116,7 @@ set(XLNT_SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES}
|
||||||
${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
|
${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
|
||||||
|
|
||||||
if(NOT STATIC)
|
if(NOT STATIC)
|
||||||
add_library(xlnt SHARED ${XLNT_HEADERS} ${XLNT_SOURCES} $<TARGET_OBJECTS:xlnt.third-party> $<TARGET_OBJECTS:cryptopp-object>)
|
add_library(xlnt SHARED ${XLNT_HEADERS} ${XLNT_SOURCES} $<TARGET_OBJECTS:xlnt.third-party>)
|
||||||
target_compile_definitions(xlnt PRIVATE XLNT_SHARED=1)
|
target_compile_definitions(xlnt PRIVATE XLNT_SHARED=1)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
@ -172,7 +160,10 @@ else()
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE LIBSTUDXML_STATIC_LIB=1)
|
target_compile_definitions(${PROJECT_NAME}
|
||||||
|
PRIVATE LIBSTUDXML_STATIC_LIB=1
|
||||||
|
PRIVATE NO_OS_DEPENDENCE=1
|
||||||
|
PRIVATE CRYPTOPP_DISABLE_ASM=1)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\" /MP")
|
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\" /MP")
|
||||||
|
@ -199,9 +190,11 @@ set(PKG_CONFIG_INCLUDEDIR ${INC_DEST_DIR})
|
||||||
set(PKG_CONFIG_LIBS "-L\${libdir} -lxlnt")
|
set(PKG_CONFIG_LIBS "-L\${libdir} -lxlnt")
|
||||||
set(PKG_CONFIG_CFLAGS "-I\${includedir}")
|
set(PKG_CONFIG_CFLAGS "-I\${includedir}")
|
||||||
|
|
||||||
configure_file(
|
if(NOT MSVC)
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/pkg-config.pc.cmake"
|
configure_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
|
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/pkg-config.pc.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
|
||||||
|
endif()
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/cmake_uninstall.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/cmake_uninstall.cmake.in"
|
||||||
|
@ -213,9 +206,11 @@ install(
|
||||||
DESTINATION include
|
DESTINATION include
|
||||||
PATTERN ".DS_Store" EXCLUDE)
|
PATTERN ".DS_Store" EXCLUDE)
|
||||||
|
|
||||||
install(
|
if(NOT MSVC)
|
||||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
install(
|
||||||
DESTINATION ${LIB_DEST_DIR}/pkgconfig)
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||||
|
DESTINATION ${LIB_DEST_DIR}/pkgconfig)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
uninstall
|
uninstall
|
||||||
|
|
42
third-party/CMakeLists.txt
vendored
42
third-party/CMakeLists.txt
vendored
|
@ -69,22 +69,54 @@ set(ZLIB ${CMAKE_CURRENT_SOURCE_DIR}/zlib/adler32.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zlib.h
|
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zlib.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zutil.h)
|
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zutil.h)
|
||||||
|
|
||||||
|
file(GLOB CRYPTOPP ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/*.cpp)
|
||||||
|
list(REMOVE_ITEM CRYPTOPP
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/pch.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/simple.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/cryplib_bds.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/test.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/bench1.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/bench2.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat0.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat1.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat2.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/validat3.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/adhoc.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/datatest.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/regtest.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/fipsalgt.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/dlltest.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/fipstest.cpp)
|
||||||
|
if(MINGW OR WIN32)
|
||||||
|
list(APPEND CRYPTOPP ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "-Wno-implicit-function-declaration")
|
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "-Wno-implicit-function-declaration")
|
||||||
else()
|
else()
|
||||||
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "/wd\"4018\"")
|
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "/wd\"4018\"")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(xlnt.third-party OBJECT ${LIBSTUDXML} ${GENX} ${EXPAT} ${ZLIB})
|
add_library(xlnt.third-party OBJECT
|
||||||
target_compile_definitions(xlnt.third-party PRIVATE LIBSTUDXML_STATIC_LIB=1)
|
${LIBSTUDXML}
|
||||||
|
${GENX}
|
||||||
|
${EXPAT}
|
||||||
|
${ZLIB}
|
||||||
|
${CRYPTOPP})
|
||||||
|
target_compile_definitions(xlnt.third-party
|
||||||
|
PRIVATE LIBSTUDXML_STATIC_LIB=1
|
||||||
|
PRIVATE NO_OS_DEPENDENCE=1
|
||||||
|
PRIVATE CRYPTOPP_DISABLE_ASM=1)
|
||||||
|
|
||||||
if(NOT STATIC)
|
if(NOT STATIC)
|
||||||
set_target_properties(xlnt.third-party
|
set_target_properties(xlnt.third-party PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
||||||
PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_definitions(xlnt.third-party PRIVATE _CRT_SECURE_NO_WARNINGS=1 NOMINMAX)
|
target_compile_definitions(xlnt.third-party PRIVATE
|
||||||
|
_CRT_SECURE_NO_WARNINGS=1
|
||||||
|
NOMINMAX)
|
||||||
set_target_properties(xlnt.third-party PROPERTIES COMPILE_FLAGS "/MP")
|
set_target_properties(xlnt.third-party PROPERTIES COMPILE_FLAGS "/MP")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user