Skip to content

Commit

Permalink
Copy all CMake files needed for out of tree builds
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Jan 30, 2024
1 parent 177149c commit d596acb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tools/make-module.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ def fix_string(input, modname):
.replace("SCRATCH", modname.upper())


def copy_dir(source, dest, modname):
def copy_dir(source, dest, modname, top=True):
for x in os.listdir(source):
if x == ".svn" or x == 'CMakeLists.txt':
if x == ".svn" or x == 'ModuleBuild.cmake':
continue
# We only want the top-level cmake file (for out of tree modules);
# the rest are auto-generated
if x == "CMakeLists.txt" and not top:
continue
if x.endswith(".pyc"):
continue
Expand All @@ -29,14 +33,15 @@ def copy_dir(source, dest, modname):
if os.path.isdir(xspath):
xdpath = os.path.join(dest, x)
os.mkdir(xdpath)
copy_dir(xspath, xdpath, modname)
copy_dir(xspath, xdpath, modname, top=False)
else:
xdpath = os.path.join(dest, fix_string(x, modname))
with open(xspath, 'r') as fh:
input = fh.read()
if xspath.endswith(".cpp") or xspath.endswith(".h") \
or xspath.endswith(".i-in") or xspath.endswith(".py") \
or xspath.endswith(".md"):
or xspath.endswith(".md") \
or xspath.endswith("CMakeLists.txt"):
output = fix_string(input, modname)
else:
output = input
Expand Down

0 comments on commit d596acb

Please sign in to comment.