optimised crypto++ build (only using files we need - tested on win, mac, linux).

This commit is contained in:
Nick Bolton 2013-05-31 14:55:22 +00:00
parent f4f7f69b3f
commit b2b9ae5484
1 changed files with 43 additions and 22 deletions

View File

@ -13,38 +13,59 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
set(cpp_dir cryptopp562) set(cryptopp_dir cryptopp562)
file(GLOB cpp_src ${cpp_dir}/*.cpp) # only compile the crypto++ files we need.
set(cryptopp_src
if (WIN32) ${cryptopp_dir}/3way.cpp
file(GLOB cpp_hdr ${cpp_dir}/*.h) ${cryptopp_dir}/algparam.cpp
list(APPEND cpp_src ${cpp_hdr}) ${cryptopp_dir}/asn.cpp
endif() ${cryptopp_dir}/authenc.cpp
${cryptopp_dir}/basecode.cpp
file(GLOB cpp_ignore ${cryptopp_dir}/cpu.cpp
${cpp_dir}/simple.cpp ${cryptopp_dir}/cryptlib.cpp
${cpp_dir}/strciphr.cpp ${cryptopp_dir}/dll.cpp
${cpp_dir}/polynomi.cpp ${cryptopp_dir}/ec2n.cpp
${cpp_dir}/eprecomp.cpp ${cryptopp_dir}/ecp.cpp
${cpp_dir}/eccrypto.cpp ${cryptopp_dir}/filters.cpp
${cpp_dir}/algebra.cpp) ${cryptopp_dir}/fips140.cpp
list(REMOVE_ITEM cpp_src ${cpp_ignore}) ${cryptopp_dir}/gcm.cpp
${cryptopp_dir}/gf2n.cpp
${cryptopp_dir}/gfpcrypt.cpp
${cryptopp_dir}/hex.cpp
${cryptopp_dir}/hmac.cpp
${cryptopp_dir}/hrtimer.cpp
${cryptopp_dir}/integer.cpp
${cryptopp_dir}/iterhash.cpp
${cryptopp_dir}/misc.cpp
${cryptopp_dir}/modes.cpp
${cryptopp_dir}/mqueue.cpp
${cryptopp_dir}/nbtheory.cpp
${cryptopp_dir}/oaep.cpp
${cryptopp_dir}/osrng.cpp
${cryptopp_dir}/pubkey.cpp
${cryptopp_dir}/queue.cpp
${cryptopp_dir}/randpool.cpp
${cryptopp_dir}/rdtables.cpp
${cryptopp_dir}/rijndael.cpp
${cryptopp_dir}/rng.cpp
${cryptopp_dir}/sha.cpp
)
# if 64-bit windows, compile asm file. # if 64-bit windows, compile asm file.
if (CMAKE_CL_64) if (CMAKE_CL_64)
list(APPEND cpp_src ${cpp_dir}/x64dll.asm ${cpp_dir}/x64masm.asm) list(APPEND cryptopp_src ${cryptopp_dir}/x64dll.asm ${cryptopp_dir}/x64masm.asm)
add_custom_command(OUTPUT $(IntDir)x64dll.obj add_custom_command(OUTPUT $(IntDir)x64dll.obj
COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64dll.obj /Zi COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64dll.obj /Zi
"${CMAKE_CURRENT_SOURCE_DIR}/${cpp_dir}/x64dll.asm" "${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64dll.asm"
MAIN_DEPENDENCY ${cpp_dir}/x64dll.asm MAIN_DEPENDENCY ${cryptopp_dir}/x64dll.asm
VERBATIM) VERBATIM)
add_custom_command(OUTPUT $(IntDir)x64masm.obj add_custom_command(OUTPUT $(IntDir)x64masm.obj
COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64masm.obj /Zi COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64masm.obj /Zi
"${CMAKE_CURRENT_SOURCE_DIR}/${cpp_dir}/x64masm.asm" "${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64masm.asm"
MAIN_DEPENDENCY ${cpp_dir}/x64masm.asm MAIN_DEPENDENCY ${cryptopp_dir}/x64masm.asm
VERBATIM) VERBATIM)
endif() endif()
@ -61,4 +82,4 @@ if (UNIX)
endif() endif()
endif() endif()
add_library(cryptopp STATIC ${cpp_src}) add_library(cryptopp STATIC ${cryptopp_src})