diff options
author | Gereon Kremer <nafur42@gmail.com> | 2021-10-27 12:58:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-27 19:58:48 +0000 |
commit | 95685c06c1c3983bc50a5cf4b4196fc1c5ae2247 (patch) | |
tree | b260b1bdb0a3e5f343f82ea015125cc0022c2d53 | |
parent | b3f0087c07dd183748d063f0581a711f781e2d42 (diff) |
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.
-rw-r--r-- | cmake/FindPoly.cmake | 14 | ||||
-rwxr-xr-x | cmake/deps-utils/Poly-windows-patch.sh | 14 |
2 files changed, 16 insertions, 12 deletions
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 <SOURCE_DIR>/ -type f ! -name "*.orig" -exec - sed -i.orig "s/%z[diu]/%\\\" PRIu64 \\\"/g" {} + - COMMAND find <SOURCE_DIR>/ -type f ! -name "*.orig" -exec - sed -i.orig "s/%ll[du]/%\\\" PRIu64 \\\"/g" {} + - # Make sure the new macros are available - COMMAND find <SOURCE_DIR>/ -type f ! -name "*.orig" -exec - sed -i.orig "s/#include <stdio.h>/#include <stdio.h>\\\\n#include <inttypes.h>/" {} + - COMMAND find <SOURCE_DIR>/ -type f ! -name "*.orig" -exec - sed -i.orig "s/#include <cstdio>/#include <cstdio>\\\\n#include <inttypes.h>/" {} + + set(patchcmd COMMAND + ${CMAKE_SOURCE_DIR}/cmake/deps-utils/Poly-windows-patch.sh <SOURCE_DIR> ) 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 <stdio.h>/#include <stdio.h>\\n#include <inttypes.h>/" {} + +find $1/ -type f ! -name "*.orig" -exec \ + sed -i.orig "s/#include <cstdio>/#include <cstdio>\\n#include <inttypes.h>/" {} +
\ No newline at end of file |