Browse Source

Fixed to generate consisten FileList.cmake and SampleFileList.cmake regardless of input order of files listed by find. Results in less better diff's moving forward

David Wimsey 11 years ago
parent
commit
f60ece4523
2 changed files with 41 additions and 13 deletions
  1. 9 9
      Build/cmake/gen_filelists.sh
  2. 32 4
      Build/cmake/gen_samplelists.sh

+ 9 - 9
Build/cmake/gen_filelists.sh

@@ -13,32 +13,32 @@ pypath=Python
 printfiles() {
 printfiles() {
     # Print headers
     # Print headers
     echo ${hdr/lib/$1} >>$file
     echo ${hdr/lib/$1} >>$file
-    find  $srcpath/$1/ -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; >>$file
+    find  $srcpath/$1 -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; | sort >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print public headers
     # Print public headers
     echo ${pubhdr/lib/$1} >>$file
     echo ${pubhdr/lib/$1} >>$file
-    find  $hdrpath/$1/ -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; >>$file
+    find  $hdrpath/$1 -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; | sort >>$file
     # Print main public header
     # Print main public header
     echo '    '$srcdir/Include/Rocket/$1.h >>$file
     echo '    '$srcdir/Include/Rocket/$1.h >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print source files
     # Print source files
     echo ${src/lib/$1} >>$file
     echo ${src/lib/$1} >>$file
-    find  $srcpath/$1/ -maxdepth 1 -iname "*.cpp" -exec echo '    '$srcdir/{} \; >>$file
+    find  $srcpath/$1 -maxdepth 1 -iname "*.cpp" -exec echo '    '$srcdir/{} \; | sort >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
 }
 }
 
 
 printpyfiles() {
 printpyfiles() {
     # Print headers
     # Print headers
-    echo ${hdr/lib/Py${1,}} >>$file
-    find  $srcpath/$1/$pypath -iname "*.h" -exec echo '    '$srcdir/{} \; >>$file
+    echo ${hdr/lib/Py${1}} >>$file
+    find  $srcpath/$1/$pypath -iname "*.h" -exec echo '    '$srcdir/{} \; | sort >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print public headers
     # Print public headers
-    echo ${pubhdr/lib/Py${1,}} >>$file
-    find  $hdrpath/$1/$pypath -iname "*.h" -exec echo '    '$srcdir/{} \; >>$file 2>/dev/null
+    echo ${pubhdr/lib/Py${1}} >>$file
+    find  $hdrpath/$1/$pypath -iname "*.h" -exec echo '    '$srcdir/{} \; | sort >>$file 2>/dev/null
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print source files
     # Print source files
-    echo ${src/lib/Py${1,}} >>$file
-    find  $srcpath/$1/$pypath -iname "*.cpp" -exec echo '    '$srcdir/{} \; >>$file
+    echo ${src/lib/Py${1}} >>$file
+    find  $srcpath/$1/$pypath -iname "*.cpp" -exec echo '    '$srcdir/{} \; | sort >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
 }
 }
 
 

+ 32 - 4
Build/cmake/gen_samplelists.sh

@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 
 basedir="../.."
 basedir="../.."
 file=Build/cmake/SampleFileList.cmake
 file=Build/cmake/SampleFileList.cmake
@@ -16,12 +16,12 @@ printfiles() {
     name=${1//basic\//} #substitute basic/ for nothing
     name=${1//basic\//} #substitute basic/ for nothing
     name=${name//tutorial\/} #substitute tutorial/ for nothing
     name=${name//tutorial\/} #substitute tutorial/ for nothing
     echo ${hdr/sample/$name} >>$file
     echo ${hdr/sample/$name} >>$file
-    find  $srcpath/$1/src -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; >>$file
-    find  $srcpath/$1/include -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; >>$file 2>/dev/null
+    find  $srcpath/$1/src -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; | sort -f >>$file
+    find  $srcpath/$1/include -maxdepth 1 -iname "*.h" -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print source files
     # Print source files
     echo ${src/sample/$name} >>$file
     echo ${src/sample/$name} >>$file
-    find  $srcpath/$1/src -maxdepth 1 -iname "*.cpp" -exec echo '    '$srcdir/{} \; >>$file
+    find  $srcpath/$1/src -maxdepth 1 -iname "*.cpp" -exec echo '    '$srcdir/{} \; | sort -f >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
 }
 }
 
 
@@ -30,5 +30,33 @@ echo -e "# This file was auto-generated with gen_samplelists.sh\n" >$file
 for sample in ${samples[@]}; do
 for sample in ${samples[@]}; do
     printfiles $sample
     printfiles $sample
 done
 done
+
+echo '# Deal with platform specific sources for sample shell' >> $file
+echo 'if(WIN32)' >> $file
+echo '       list(APPEND shell_SRC_FILES' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/src/win32/ShellWin32.cpp' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/src/win32/InputWin32.cpp' >> $file
+echo '       )' >> $file
+echo '       list(APPEND shell_HDR_FILES' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/include/win32/InputWin32.h' >> $file
+echo '       )' >> $file
+echo 'elseif(APPLE)' >> $file
+echo '       list(APPEND shell_SRC_FILES' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/src/macosx/ShellMacOSX.cpp' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/src/macosx/InputMacOSX.cpp' >> $file
+echo '       )' >> $file
+echo '       list(APPEND shell_HDR_FILES' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/include/macosx/InputMacOSX.h' >> $file
+echo '       )' >> $file
+echo 'else()' >> $file
+echo '       list(APPEND shell_SRC_FILES' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/src/x11/ShellX11.cpp' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/src/x11/InputX11.cpp' >> $file
+echo '       )' >> $file
+echo '       list(APPEND shell_HDR_FILES' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/include/x11/InputX11.h' >> $file
+echo '       )' >> $file
+echo 'endif()' >> $file
+
 popd
 popd