cryptopp: Build only required files

Instead of globbing all .cpp files that ship with CryptoPP, use an
explicit list of files to compile. This cuts out compilation of a lot of
stuff we don't use (reducing build times) and also works around
https://github.com/weidai11/cryptopp/issues/527
This commit is contained in:
Yuri Kunde Schlesner 2017-12-09 16:21:22 -08:00
parent a709e6528e
commit 7b2d7c5d9b

View File

@ -116,21 +116,45 @@ endif()
# Library headers # Library headers
file(GLOB cryptopp_HEADERS cryptopp/*.h) file(GLOB cryptopp_HEADERS cryptopp/*.h)
# Library sources. You can use the GNUmakefile to generate the list: `make sources`. # Library sources.
file(GLOB cryptopp_SOURCES cryptopp/*.cpp) # These have been trimmed to include only things Citra uses. This speeds up
list(REMOVE_ITEM cryptopp_SOURCES # compiles and reduces the amount of compilation breakage.
# These are removed in the original CMakeLists.txt set(cryptopp_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/pch.cpp cryptopp/algparam.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/simple.cpp cryptopp/asn.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp cryptopp/authenc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/cryptlib_bds.cpp cryptopp/basecode.cpp
${cryptopp_SOURCES_TEST} cryptopp/ccm.cpp
cryptopp/cpu.cpp
cryptopp/cryptlib.cpp
cryptopp/dll.cpp
cryptopp/ec2n.cpp
cryptopp/ecp.cpp
cryptopp/filters.cpp
cryptopp/fips140.cpp
cryptopp/gf2n.cpp
cryptopp/gfpcrypt.cpp
cryptopp/hex.cpp
cryptopp/hmac.cpp
cryptopp/hrtimer.cpp
cryptopp/integer.cpp
cryptopp/iterhash.cpp
cryptopp/md5.cpp
cryptopp/misc.cpp
cryptopp/modes.cpp
cryptopp/mqueue.cpp
cryptopp/nbtheory.cpp
cryptopp/oaep.cpp
cryptopp/osrng.cpp
cryptopp/pubkey.cpp
cryptopp/queue.cpp
cryptopp/randpool.cpp
cryptopp/rdtables.cpp
cryptopp/rijndael.cpp
cryptopp/rng.cpp
cryptopp/sha.cpp
) )
if(MINGW OR WIN32)
list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp)
endif()
if(MSVC AND NOT CRYPTOPP_DISABLE_ASM) if(MSVC AND NOT CRYPTOPP_DISABLE_ASM)
if(${CMAKE_GENERATOR} MATCHES ".*ARM") if(${CMAKE_GENERATOR} MATCHES ".*ARM")
message(STATUS "Disabling ASM because ARM is specified as target platform.") message(STATUS "Disabling ASM because ARM is specified as target platform.")
@ -160,9 +184,5 @@ target_include_directories(cryptopp INTERFACE .)
# Third-party libraries # Third-party libraries
#============================================================================ #============================================================================
if(WIN32)
target_link_libraries(cryptopp PRIVATE ws2_32)
endif()
find_package(Threads) find_package(Threads)
target_link_libraries(cryptopp PRIVATE ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(cryptopp PRIVATE ${CMAKE_THREAD_LIBS_INIT})