Revision: 60544 http://sourceforge.net/p/brlcad/code/60544 Author: starseeker Date: 2014-05-08 15:26:10 +0000 (Thu, 08 May 2014) Log Message: ----------- Add build targets that allow for running the style tests independently of the 'primary' build. This may need to be reworked to some sort of 'per-target' setup, rather than per file - doing it per source file generates a *lot* of build targets and makes something like ninja more attractive when validation is enabled.
Modified Paths: -------------- brlcad/trunk/misc/CMake/BRLCAD_Targets.cmake Added Paths: ----------- brlcad/trunk/misc/CMake/validate_checkstamp.cmake.in Modified: brlcad/trunk/misc/CMake/BRLCAD_Targets.cmake =================================================================== --- brlcad/trunk/misc/CMake/BRLCAD_Targets.cmake 2014-05-08 12:55:23 UTC (rev 60543) +++ brlcad/trunk/misc/CMake/BRLCAD_Targets.cmake 2014-05-08 15:26:10 UTC (rev 60544) @@ -154,9 +154,14 @@ endmacro(CXX_NO_STRICT cxx_srcslist) macro(ADD_STYLE_TEST srcfile test_name) + # Generated files won't conform to our style guidelines get_property(IS_GENERATED SOURCE ${srcfile} PROPERTY GENERATED) if(NOT IS_GENERATED) + + # Set up the test scripts and tie them to the object file output + # produced by compiling this particular source file. This hooks + # in the "integrated" style checking get_filename_component(root_name ${srcfile} NAME_WE) string(MD5 path_md5 "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}") set(outfiles_root "${CMAKE_CURRENT_BINARY_DIR}/validation/${root_name}_${path_md5}_${test_name}") @@ -170,6 +175,23 @@ COMMENT "Validating style of ${srcfile}" ) set_source_files_properties(${srcfile} PROPERTIES OBJECT_DEPENDS ${outfiles_root}.checked) + + # Define the individual and per-test-type build targets (if need be) + # and associate the individual test with the test-type target. This + # allows the style tests to be run as their own build targets, independent + # of the primary build. + if(NOT TARGET regress-${root_name}_${path_md5}_${test_name}) + configure_file(${BRLCAD_SOURCE_DIR}/misc/CMake/validate_checkstamp.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${outfiles_root}_validate.cmake @ONLY) + add_custom_target(regress-${root_name}_${path_md5}_${test_name} + ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/${outfiles_root}_validate.cmake + DEPENDS ${outfiles_root}.checked + ) + endif(NOT TARGET regress-${root_name}_${path_md5}_${test_name}) + if(NOT TARGET regress-${test_name}) + add_custom_target(regress-${test_name}) + endif(NOT TARGET regress-${test_name}) + add_dependencies(regress-${test_name} regress-${root_name}_${path_md5}_${test_name}) + endif(NOT IS_GENERATED) endmacro(ADD_STYLE_TEST srcfile test_name) Added: brlcad/trunk/misc/CMake/validate_checkstamp.cmake.in =================================================================== --- brlcad/trunk/misc/CMake/validate_checkstamp.cmake.in (rev 0) +++ brlcad/trunk/misc/CMake/validate_checkstamp.cmake.in 2014-05-08 15:26:10 UTC (rev 60544) @@ -0,0 +1,15 @@ +set(STRICT_MODE @BRLCAD_ENABLE_STRICT@) +if(NOT EXISTS "@outfiles_root@.valid") + if(STRICT_MODE) + message(FATAL_ERROR "Compilation failure due to @test_name@ style errors: @srcfile_tmp@") + else(STRICT_MODE) + message("Warning - @test_name@ style errors in source code: @srcfile_tmp@") + endif(STRICT_MODE) +endif(NOT EXISTS "@outfiles_root@.valid") + +# Local Variables: +# tab-width: 8 +# mode: cmake +# indent-tabs-mode: t +# End: +# ex: shiftwidth=2 tabstop=8 Property changes on: brlcad/trunk/misc/CMake/validate_checkstamp.cmake.in ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits