Proper cmake patching

This commit is contained in:
FriwiDev
2021-11-24 00:01:10 +01:00
parent 16d14bf294
commit 0e8dc56b0d
7 changed files with 91 additions and 328 deletions

34
scripts/patch_cmake.py Normal file
View File

@@ -0,0 +1,34 @@
#Small script to patch CMakeLists.txt files with custom build options
#Will replace file contents between two markers ("Determine the platform"
#and "Add this project's cmake")
#Usage: python patch_cmake.py <input> <patch>
import sys
input = sys.argv[1]
patch = sys.argv[2]
print("Patching "+input+" to accept further build architectures...")
f = open(input, "r")
p = open(patch, "r")
result = ""
inpatch = False
for x in f:
if x.startswith("# Determine the platform"):
inpatch = True
for y in p:
result += y
elif x.startswith("# Add this project's cmake"):
inpatch = False
if inpatch == False:
result += x
f.close()
p.close()
f = open(input, "w")
f.write(result)
f.close()
print("Done.")

View File

@@ -23,14 +23,14 @@ if [ ! -f "/jcef/README.md" ]; then
git clone ${REPO} /jcef
cd /jcef
git checkout ${REF}
#Temporary CMakeLists patching - beautify in the future
rm CMakeLists.txt
curl -o CMakeLists.txt https://raw.githubusercontent.com/jcefmaven/jcefbuild/master/CMakeLists.txt
else
echo "Found existing files to build"
cd /jcef
fi
#CMakeLists patching
python3 /builder/patch_cmake.py CMakeLists.txt /builder/CMakeLists.txt.patch
# Create and enter the `jcef_build` directory.
# The `jcef_build` directory name is required by other JCEF tooling
# and should not be changed.

View File

@@ -12,9 +12,8 @@ if exist "jcef\README.md" (echo "Found existing files to build" && cd jcef) ^
else (echo "Did not find files to build - cloning..." && GOTO :CLONE)
:BUILD
:: Temporary CMakeLists patching - beautify in the future
del /f CMakeLists.txt
curl -o CMakeLists.txt https://raw.githubusercontent.com/jcefmaven/jcefbuild/master/CMakeLists.txt
:: CMakeLists patching
python3 C:/patch_cmake.py CMakeLists.txt C:/CMakeLists.txt.patch
:: Prepare build dir
mkdir jcef_build && cd jcef_build