فهرست منبع

autoexplicit on linux

Former-commit-id: 60ff1b495277b9e643df6e1e4df4edd7364158da
Alec Jacobson (jalec 12 سال پیش
والد
کامیت
d043c5a235
2فایلهای تغییر یافته به همراه52 افزوده شده و 1 حذف شده
  1. 2 1
      scripts/autoexplicit.sh
  2. 50 0
      scripts/autoexplicit_linux.sh

+ 2 - 1
scripts/autoexplicit.sh

@@ -1,6 +1,7 @@
 #!/bin/bash
 # Usage:
-#   make 2>&1 | autoexplicit.sh
+#   cd $IGL_LIB/include/igl
+#   make -C [your_project] 2>&1 | ../../scripts/autoexplicit.sh
 
 
 # process input line by line

+ 50 - 0
scripts/autoexplicit_linux.sh

@@ -0,0 +1,50 @@
+#!/bin/bash
+# Usage:
+#   cd $IGL_LIB/include/igl
+#   make -C [your_project] 2>&1 | ../../scripts/autoexplicit_linux.sh
+
+
+# process input line by line
+while read line; do
+  if ! echo "$line" | grep -q "undefined reference to \`.*'$"
+  then 
+    # undefined symbol line not found
+    continue
+  fi
+  symbol=`echo "$line" | sed -e "s/.*undefined reference to .\(.*\)'$/\1/"`
+  #echo "symbol = $symbol"
+  filename=`echo "$symbol" | perl -pe "s#.*?igl::([A-z0-9_]*).*$'$'#\1#"`
+  #echo "filename = $filename"
+  cpp="$filename.cpp"
+  # append .cpp and check that file exists
+  if [ ! -e "$cpp" ]
+  then
+    echo "Warning: $cpp does not exist, skipping ..."
+    continue
+  fi
+
+  if ! grep -q "^\/\/ Explicit template specialization*$" "$cpp"
+  then
+    echo "Warning: skipping $cpp because it does not match ^\/\/ Explicit template specialization*$ "
+    continue;
+  fi
+
+  before=`sed '/^\/\/ Explicit template specialization$/q' "$cpp"`;
+  #echo "before = $before"
+  after=`sed '1,/^\/\/ Explicit template specialization$/d' $cpp`;
+  #echo "after = $after"
+  explicit="template $symbol;"
+  #echo "$explicit"
+  if grep -F "$explicit" "$cpp"
+  then
+    echo "Error: $cpp already contains $explicit"
+    echo "       Recompile igl static lib, recompile your project, and try again."
+    continue
+  fi
+  #echo "$before" > "$cpp"
+  #echo "// generated by autoexplicit.sh" >> "$cpp"
+  #echo "$explicit" >> "$cpp"
+  #echo "$after" >> "$cpp"
+
+done
+