Commit 67c0cd22 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Header containing GLSL source code is generated only after change of any of shader source files.

parent 618a5f0e
Loading
Loading
Loading
Loading
+34 −22
Original line number Original line Diff line number Diff line
@@ -4,6 +4,19 @@
# number of input files
# number of input files
list( LENGTH inputFiles shadersNumber ) 
list( LENGTH inputFiles shadersNumber ) 


# check if GLSL source files were updated since the last time
set( update "FALSE" )
foreach( inputFile ${inputFiles} )
    if( ${inputFile} IS_NEWER_THAN ${outputFile} )
        set( update "TRUE" )
    endif( ${inputFile} IS_NEWER_THAN ${outputFile} )
endforeach( inputFile ${inputFiles} )

if( NOT update )
    message( "Headers are up-to-date" )
    return()
endif( NOT update )

# write header
# write header
file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake.
file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake.


@@ -35,7 +48,6 @@ foreach( inputFile ${inputFiles} )
    string( REGEX REPLACE "\"$" "," contents "${contents}" )
    string( REGEX REPLACE "\"$" "," contents "${contents}" )


    file( APPEND ${outputFile} "${contents}" )
    file( APPEND ${outputFile} "${contents}" )

endforeach( inputFile ${inputFiles} )
endforeach( inputFile ${inputFiles} )


# write footer
# write footer