Skip to content

Instantly share code, notes, and snippets.

View jcfr's full-sized avatar
🎯
Focusing

Jean-Christophe Fillion-Robin jcfr

🎯
Focusing
View GitHub Profile
#-----------------------------------------------------------------------------
project(TestGitCmd)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
#-----------------------------------------------------------------------------
find_program(git_EXECUTABLE
NAMES git.cmd git eg.cmd eg
license_file=~/Projects/Visomics/NOTICE
while read i;
do
echo "Checking $i"
if ! grep -q Copyright $i
then
echo "=> Updating $i"
cat $license_file $i >$i.new && mv $i.new $i
@jcfr
jcfr / slicer-4.0-module-description.xsl
Created October 21, 2011 03:49
slicer-4.0-module-description.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" encoding="UTF-8"/>
<xsl:template name="newline"><xsl:text>&#10;</xsl:text></xsl:template>
<!-- Source: http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx -->
<xsl:template name="string-replace-all">
@jcfr
jcfr / slicer-4.0-module-category.xsl
Created October 21, 2011 03:50
slicer-4.0-module-category.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" encoding="UTF-8"/>
<xsl:template match="/executable">
<xsl:value-of select="category" />
</xsl:template>
@jcfr
jcfr / slicer-4.0-module-parameterdescription.xsl
Last active September 27, 2015 17:08
slicer-4.0-module-parameterdescription.xslThe XSLT understands nested parameter tag (Thanks Julien)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" encoding="UTF-8"/>
<xsl:template name="newline"><xsl:text>&#10;</xsl:text></xsl:template>
<!-- See http://na-mic.org/Mantis/view.php?id=2536 -->
<xsl:template match="name"> (<xsl:value-of select="."/>)</xsl:template>
@jcfr
jcfr / slicer-4.0-module-acknowledgements.xsl
Last active September 27, 2015 17:08
slicer-4.0-module-acknowledgements.xsl In addition to Acknowledgements, also display Title, Authod/Contributor and License (Thanks Julien)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" encoding="UTF-8"/>
<xsl:template name="newline"><xsl:text>&#10;</xsl:text></xsl:template>
<xsl:template match="/executable">
<xsl:text>:'''Title:''' </xsl:text><xsl:value-of select="title"/><xsl:call-template name="newline"/>
@jcfr
jcfr / CleanCLIModuleBuildDirectory.sh
Created February 2, 2012 13:11
This script allows to clean the CLI build directory following an update to revision >= 19202
#!/bin/bash
#
# 1) Save this file in <Slicer-Superbuild/Slicer-build>.
# 2) Chmod u+x CleanCLIModuleBuildDirectory.sh
# 3) Run the script
# 4) Rebuild
#
cliBinSubDirectory=./lib/Slicer-4.0/cli-modules/
@jcfr
jcfr / CTest.cmake
Created February 15, 2012 23:50
Modified script where CTEST_LAUNCH_* are set independently of BUILD_TESTING
# - Configure a project for testing with CTest/CDash
# Include this module in the top CMakeLists.txt file of a project to
# enable testing with CTest and dashboard submissions to CDash:
# project(MyProject)
# ...
# include(CTest)
# The module automatically creates a BUILD_TESTING option that selects
# whether to enable testing support (ON by default). After including
# the module, use code like
# if(BUILD_TESTING)
@jcfr
jcfr / cmake-illustrate-function-scope.cmake
Created February 23, 2012 00:54
Small example illustrating how CMake function scope works
function(myfunc)
set(foo "myfunc")
message("Line ${CMAKE_CURRENT_LIST_LINE} - foo: ${foo} [scope: myfunc]")
endfunction()
function(myfunc_parent_scope)
set(foo "myfunc_parent_scope" PARENT_SCOPE)
message("Line ${CMAKE_CURRENT_LIST_LINE} - foo: ${foo} [scope: myfunc_parent_scope]")
endfunction()
@jcfr
jcfr / cmake-command-to-lowercase.sh
Created March 22, 2012 23:18
The following script allows to automatically change the case of CMake script from upper to lower case.
#!/bin/sh
for file in $(find . -type f -name '*\.cmake' -o -name '*\.txt' -o -name '*\.ctest')
do
echo "Processing file [$file]"
for cmd in $(cmake --help-command-list)
do
sed -i "s/${cmd}(/${cmd}(/gI" $file
done
done