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:
Thomas Fussell 2017-01-02 10:47:54 -05:00
parent ab1af4f73e
commit ccd2a0eb1e
2 changed files with 52 additions and 25 deletions

View File

@ -8,18 +8,6 @@ endif()
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)
option(FRAMEWORK "Set to ON to package dylib and headers into a .framework, OSX only" OFF)
endif()
@ -128,7 +116,7 @@ set(XLNT_SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES}
${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
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)
if(MSVC)
@ -172,7 +160,10 @@ else()
)
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)
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_CFLAGS "-I\${includedir}")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
if(NOT MSVC)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/cmake_uninstall.cmake.in"
@ -213,9 +206,11 @@ install(
DESTINATION include
PATTERN ".DS_Store" EXCLUDE)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${LIB_DEST_DIR}/pkgconfig)
if(NOT MSVC)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${LIB_DEST_DIR}/pkgconfig)
endif()
add_custom_target(
uninstall

View File

@ -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/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)
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "-Wno-implicit-function-declaration")
else()
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "/wd\"4018\"")
endif()
add_library(xlnt.third-party OBJECT ${LIBSTUDXML} ${GENX} ${EXPAT} ${ZLIB})
target_compile_definitions(xlnt.third-party PRIVATE LIBSTUDXML_STATIC_LIB=1)
add_library(xlnt.third-party OBJECT
${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)
set_target_properties(xlnt.third-party
PROPERTIES POSITION_INDEPENDENT_CODE 1)
set_target_properties(xlnt.third-party PROPERTIES POSITION_INDEPENDENT_CODE 1)
endif()
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")
endif()