-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAutoCompileLatestSEM.script
More file actions
executable file
·105 lines (104 loc) · 2.8 KB
/
AutoCompileLatestSEM.script
File metadata and controls
executable file
·105 lines (104 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
if [ $# != 4 ]
then
echo "Usage: $0 SEMRootDir ITKSourceRootDir ITKInstallRootDir [ON/OFF]"
echo "ON/OFF: Build shared libraries"
exit 2
fi
SEMRootDir=$1
echo "SEMRootDir: $SEMRootDir"
ITKSourceRootDir=$2
echo "ITKSourceRootDir: $ITKSourceRootDir"
ITKInstallRootDir=$3
echo "ITKInstallRootDir: $ITKInstallRootDir"
scriptDIR="$( cd "$( dirname "$0" )" && pwd )"
if [ ! -e "$scriptDIR/ConfigurationVariables.script" ]
then
echo "ConfigurationVariables.script not found. It should be there:"
echo "$scriptDIR/ConfigurationVariables.script"
exit 1
fi
source $scriptDIR/ConfigurationVariables.script
if [ ! -e "$scriptDIR/../Resources/CompileEnvironment.script" ]
then
echo "CompileEnvironment.script not found. It should be there:"
echo "$scriptDIR/../Resources/CompileEnvironment.script"
exit 1
fi
source $scriptDIR/../Resources/CompileEnvironment.script
currentDir=`pwd`
echo "Current directory: ${currentDir}"
#Check ITK tag
ITKSourceDir=ITK-Auto
cd $ITKSourceRootDir/$ITKSourceDir
#get last tag
tag=`git describe --abbrev=0 --tags`
echo "Last tag (ITK): $tag"
#If Release Candidate, do nothing
if [ "`echo $tag |grep rc`" != "" ]
then
echo "Current latest tag is a release candidate"
exit 1
fi
#If tag is not already compiled on the system, exit
#SlicerExecutionModel needs ITK
git checkout tags/$tag
ITKInstallDir=$ITKInstallRootDir/ITK$tag
if [ ! -d $ITKInstallDir ]
then
echo "ITK tag ($tag) is not compiled. SlicerExecutionModel needs it"
exit 3
fi
#Update SlicerExecutionModel that will be recompiled after
SEMSourceDir=SlicerExecutionModel
cd ${SEMRootDir}
if [ ! -d $SEMSourceDir ]
then
git clone https://github.com/Slicer/SlicerExecutionModel.git $SEMSourceDir
else
cd $SEMSourceDir
git fetch --all
git reset --hard origin/master
fi
#Build SlicerExecutionModel both in shared and static libraries
shared=$4
echo "Shared: $shared"
if [ $shared == ON ]
then
suff="dyn"
else
suff="stat"
fi
echo "Suffix: $suff"
tagNum=${tag#"v"}
echo "ITK Tag#: $tagNum"
tagMinor=${tagNum:0:3}
echo "ITK Tag# Major.Minor: $tagMinor"
echo "cmake: ${CMAKE}"
echo "Build testing: ${BUILD_TESTING}"
echo "cmake_build_type: ${CMAKE_BUILD_TYPE}"
nbThreads=8
echo "#Threads: ${nbThreads}"
#SlicerExecutionModel
#Configure
SEMBuildDir=${SEMRootDir}/SlicerExecutionModel-build_ITK${tag}-${suff}
if [ $SEMBuildDir ]
then
rm -rf $SEMBuildDir
fi
mkdir $SEMBuildDir
cd $SEMBuildDir
ITKConfigDIR=$ITKInstallDir/ITK${tag}_THL64_${suff}_Release/lib/cmake/ITK-${tagMinor}
echo "ITK Config Dir: $ITKConfigDIR"
echo "Configure SlicerExecutionModel"
CC=${CC} CXX=${CXX} ${CMAKE} \
-DBUILD_TESTING:BOOL=${BUILD_TESTING} \
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \
-DITK_DIR:PATH=${ITKConfigDIR} \
-DBUILD_SHARED_LIBS:BOOL=$shared \
../$SEMSourceDir
#Compile
echo "Compilation"
make -j ${nbThreads}
cd $currentDir
exit 0