From 5f8223ebb529ff753f09abdba4c4179c4df086c7 Mon Sep 17 00:00:00 2001 From: Mikhail Titov Date: Mon, 7 Dec 2015 14:53:38 -0600 Subject: [PATCH] Patch for 64-bit zlib build with MSVC assembly --- build/CMakeLists.txt | 9 +++++++-- build/cmake-zlib-amd64.patch | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 build/cmake-zlib-amd64.patch diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index f8556e09..a12623dd 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -250,14 +250,19 @@ if (NOT ZLIB_FOUND ) # We are probably on Windows find_program( PATCH patch C:/Program Files/Git/usr/bin C:/msys64/usr/bin C:/msys32/usr/bin C:/Strawberry/c/bin ) include( ExternalProject ) + if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + set( ZLIB_EXTRA -DAMD64=ON ) + else() + set( ZLIB_EXTRA -DASM686=ON "-DCMAKE_ASM_MASM_FLAGS=/W0 /safeseh" ) + endif() ExternalProject_Add(zlib-project URL http://zlib.net/zlib-1.2.8.tar.gz URL_MD5 44d667c142d7cda120332623eab69f40 PREFIX ${CMAKE_CURRENT_BINARY_DIR}/zlib PATCH_COMMAND "${PATCH}" -p0 < ${CMAKE_CURRENT_SOURCE_DIR}/cmake-zlib-static.patch + && "${PATCH}" -p0 < ${CMAKE_CURRENT_SOURCE_DIR}/cmake-zlib-amd64.patch CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - -DWITH_STATIC=${WITH_STATIC} - -DAMD64=ON -DASM686=ON "-DCMAKE_ASM_MASM_FLAGS=/W0 /safeseh" + -DWITH_STATIC=${WITH_STATIC} ${ZLIB_EXTRA} ) if (WITH_PCH) add_dependencies( stdafx zlib-project ) diff --git a/build/cmake-zlib-amd64.patch b/build/cmake-zlib-amd64.patch new file mode 100644 index 00000000..7ea1d9fe --- /dev/null +++ b/build/cmake-zlib-amd64.patch @@ -0,0 +1,10 @@ +--- CMakeLists.txt.orig 2015-12-07 14:19:36.447689600 -0600 ++++ CMakeLists.txt 2015-12-07 14:18:23.004419900 -0600 +@@ -165,6 +165,7 @@ + ENABLE_LANGUAGE(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx64/gvmat64.asm ++ contrib/masmx64/inffas8664.c + contrib/masmx64/inffasx64.asm + ) + endif()