aboutsummaryrefslogtreecommitdiff
path: root/PxShared/src/compiler/cmake/findfileswithspec.py
diff options
context:
space:
mode:
authormtamis <[email protected]>2017-02-15 16:06:25 +0100
committermtamis <[email protected]>2017-02-15 16:06:25 +0100
commit85305930aeeb1d513e23522bd91f29ba81aa6d14 (patch)
tree45f1bb20a45a300d1fef107e436cac95602a0e57 /PxShared/src/compiler/cmake/findfileswithspec.py
downloadnvcloth-85305930aeeb1d513e23522bd91f29ba81aa6d14.tar.xz
nvcloth-85305930aeeb1d513e23522bd91f29ba81aa6d14.zip
NvCloth library v1.0.0
Diffstat (limited to 'PxShared/src/compiler/cmake/findfileswithspec.py')
-rw-r--r--PxShared/src/compiler/cmake/findfileswithspec.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/PxShared/src/compiler/cmake/findfileswithspec.py b/PxShared/src/compiler/cmake/findfileswithspec.py
new file mode 100644
index 0000000..484ff4f
--- /dev/null
+++ b/PxShared/src/compiler/cmake/findfileswithspec.py
@@ -0,0 +1,23 @@
+import os,argparse,sys,string
+
+#
+# Simple helper program - give it a path and it will list all of the files of the specified extension in relative format, using the
+# pathroot variable as a substitution. This greatly simplifies one part of the process of creating a CMake file for a project
+#
+parser = argparse.ArgumentParser()
+parser.add_argument("dir", help="Path to find files in")
+parser.add_argument("extension", help="Spec to find (ie .cpp)")
+parser.add_argument("--pathroot", help="Path variable to prepend to each line, example: ${PX_ROOT}", default="${DUDER}")
+
+args = parser.parse_args()
+
+if not os.path.exists(args.dir):
+ print("Unable to find path {}".format(args.dir))
+ exit(1)
+
+for root, dirs, files in os.walk(args.dir):
+ for file in files:
+ if file.endswith(args.extension):
+ result = os.path.join(root, file)
+
+ print(result.replace(args.dir, args.pathroot))