mirror of
https://github.com/jcefmaven/jcefbuild.git
synced 2025-09-17 21:06:38 +08:00
35 lines
724 B
Python
35 lines
724 B
Python
#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.")
|