From: Gereon Kremer Date: Wed, 27 Oct 2021 19:58:48 +0000 (-0700) Subject: Fix patching for poly on windows (#7513) X-Git-Tag: cvc5-1.0.0~952 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=95685c06c1c3983bc50a5cf4b4196fc1c5ae2247;p=cvc5.git Fix patching for poly on windows (#7513) This PR is another step to fix our windows nightlies. It moves the patch steps for libpoly in a separate script. Apparently, it is impossible to properly escape this stuff to work on all platforms and all cmake versions. --- diff --git a/cmake/FindPoly.cmake b/cmake/FindPoly.cmake index b55eca939..f363147cc 100644 --- a/cmake/FindPoly.cmake +++ b/cmake/FindPoly.cmake @@ -59,18 +59,8 @@ if(NOT Poly_FOUND_SYSTEM) check_if_cross_compiling(CCWIN "Windows" "") if(CCWIN) - # Roughly following https://stackoverflow.com/a/44383330/2375725 - set(patchcmd - # Avoid %z and %llu format specifiers - COMMAND find / -type f ! -name "*.orig" -exec - sed -i.orig "s/%z[diu]/%\\\" PRIu64 \\\"/g" {} + - COMMAND find / -type f ! -name "*.orig" -exec - sed -i.orig "s/%ll[du]/%\\\" PRIu64 \\\"/g" {} + - # Make sure the new macros are available - COMMAND find / -type f ! -name "*.orig" -exec - sed -i.orig "s/#include /#include \\\\n#include /" {} + - COMMAND find / -type f ! -name "*.orig" -exec - sed -i.orig "s/#include /#include \\\\n#include /" {} + + set(patchcmd COMMAND + ${CMAKE_SOURCE_DIR}/cmake/deps-utils/Poly-windows-patch.sh ) else() unset(patchcmd) diff --git a/cmake/deps-utils/Poly-windows-patch.sh b/cmake/deps-utils/Poly-windows-patch.sh new file mode 100755 index 000000000..3b613bc0f --- /dev/null +++ b/cmake/deps-utils/Poly-windows-patch.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Roughly following https://stackoverflow.com/a/44383330/2375725 +# Avoid %z and %llu format specifiers +find $1/ -type f ! -name "*.orig" -exec \ + sed -i.orig "s/%z[diu]/%\\\" PRIu64 \\\"/g" {} + +find $1/ -type f ! -name "*.orig" -exec \ + sed -i.orig "s/%ll[du]/%\\\" PRIu64 \\\"/g" {} + + +# Make sure the new macros are available +find $1/ -type f ! -name "*.orig" -exec \ + sed -i.orig "s/#include /#include \\n#include /" {} + +find $1/ -type f ! -name "*.orig" -exec \ + sed -i.orig "s/#include /#include \\n#include /" {} + \ No newline at end of file