Subversion Repositories gelsvn

Rev

Rev 249 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 249 Rev 253
1
!include "LogicLib.nsh" 
1
!include "LogicLib.nsh" 
2
!include "WinMessages.NSH"
2
!include "WinMessages.NSH"
3
 
3
 
-
 
4
!define TEMP1 $R0 ;Temp variable
-
 
5
 
4
; The name of the installer
6
; The name of the installer
5
Name "GEL Externals"
7
Name "GEL Externals"
6
 
8
 
7
; The file to write
9
; The file to write
8
OutFile "GELsetup.exe"
10
OutFile "GELsetup.exe"
9
 
11
 
10
; The default installation directory
12
; The default installation directory
11
InstallDir $DOCUMENTS\GEL
13
InstallDir $DOCUMENTS\GEL
12
 
14
 
-
 
15
; Show install details
-
 
16
ShowInstDetails show
-
 
17
 
-
 
18
;Things that need to be extracted on startup (keep these lines before any File command!)
-
 
19
;Only useful for BZIP2 compression
-
 
20
;Use ReserveFile for your own InstallOptions INI files too!
-
 
21
 
-
 
22
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
-
 
23
ReserveFile "custdir.ini"
-
 
24
 
-
 
25
 
13
;--------------------------------
26
;--------------------------------
14
 
27
 
15
; Pages
28
; Pages
16
 
29
 
17
Page directory
30
;Page directory
-
 
31
Page custom SetCustom "" ": Installation Folder"
18
Page components
32
Page components
19
 
33
 
20
InstType "Externals only"
34
InstType "Externals only"
21
InstType "Full"
35
InstType "Full"
22
 
36
 
23
Section "Externals" Externals_flag
37
Section "Externals" Externals_flag
24
SectionIn 1 2
38
SectionIn 1 2
25
SectionEnd
39
SectionEnd
26
 
40
 
27
SectionGroup "GEL binary (ver. 0.1)"
41
SectionGroup "GEL binary (ver. 0.1)"
28
 
42
 
29
Section "CGLA" CGLA_flag
43
Section "CGLA" CGLA_flag
30
SectionIn 2
44
SectionIn 2
31
SectionEnd
45
SectionEnd
32
 
46
 
33
 
47
 
34
Section "Geometry" Geometry_flag
48
Section "Geometry" Geometry_flag
35
SectionIn 2
49
SectionIn 2
36
SectionEnd
50
SectionEnd
37
 
51
 
38
Section "GLGraphics" GLGraphics_flag
52
Section "GLGraphics" GLGraphics_flag
39
SectionIn 2
53
SectionIn 2
40
SectionEnd
54
SectionEnd
41
 
55
 
42
Section "HMesh" HMesh_flag
56
Section "HMesh" HMesh_flag
43
SectionIn 2
57
SectionIn 2
44
SectionEnd
58
SectionEnd
45
 
59
 
46
Section "LinAlg" LinAlg_flag
60
Section "LinAlg" LinAlg_flag
47
SectionIn 2
61
SectionIn 2
48
SectionEnd
62
SectionEnd
49
 
63
 
50
Section "Util" Util_flag
64
Section "Util" Util_flag
51
SectionIn 2
65
SectionIn 2
52
SectionEnd
66
SectionEnd
53
 
67
 
54
SectionGroupEnd
68
SectionGroupEnd
55
 
69
 
56
 
70
 
57
 
71
 
58
Page instfiles
72
Page instfiles
59
 
73
 
60
;--------------------------------
74
;--------------------------------
61
 
75
 
-
 
76
 
-
 
77
 
62
Section ""
78
Section ""
63
 
79
 
-
 
80
  ReadINIStr $INSTDIR "$PLUGINSDIR\custdir.ini" "Field 2" "State"
-
 
81
   
64
  Var /GLOBAL Externals
82
  Var /GLOBAL Externals
65
  Var /GLOBAL CGLA
83
  Var /GLOBAL CGLA
66
  Var /GLOBAL Geometry 
84
  Var /GLOBAL Geometry 
67
  Var /GLOBAL GLGraphics 
85
  Var /GLOBAL GLGraphics 
68
  Var /GLOBAL HMesh 
86
  Var /GLOBAL HMesh 
69
  Var /GLOBAL LinAlg
87
  Var /GLOBAL LinAlg
70
  Var /GLOBAL Util 
88
  Var /GLOBAL Util 
71
 
89
 
72
  # Get flags of each section into appropriate variables
90
  # Get flags of each section into appropriate variables
73
  SectionGetFlags ${Externals_flag} $Externals
91
  SectionGetFlags ${Externals_flag} $Externals
74
  SectionGetFlags ${CGLA_flag} $CGLA 
92
  SectionGetFlags ${CGLA_flag} $CGLA 
75
  SectionGetFlags ${Geometry_flag} $Geometry
93
  SectionGetFlags ${Geometry_flag} $Geometry
76
  SectionGetFlags ${GLGraphics_flag} $GLGraphics
94
  SectionGetFlags ${GLGraphics_flag} $GLGraphics
77
  SectionGetFlags ${HMesh_flag} $HMesh
95
  SectionGetFlags ${HMesh_flag} $HMesh
78
  SectionGetFlags ${LinAlg_flag} $LinAlg
96
  SectionGetFlags ${LinAlg_flag} $LinAlg
79
  SectionGetFlags ${Util_flag} $Util
97
  SectionGetFlags ${Util_flag} $Util
80
  
98
  
81
  ;MessageBox MB_OK "Externals: $0 $\r$\n GEL: $1 $\r$\n "
99
  ;MessageBox MB_OK "Externals: $0 $\r$\n GEL: $1 $\r$\n "
82
 
100
 
83
  ${If} $Externals = 1
101
  ${If} $Externals = 1
84
    SetOutPath $INSTDIR\bin
102
    SetOutPath $INSTDIR\bin
85
    File externals\bin\*.dll 
103
    File externals\bin\*.dll 
86
   
104
   
87
    SetOutPath $INSTDIR\lib
105
    SetOutPath $INSTDIR\lib
88
    File externals\lib\*.lib 
106
    File externals\lib\*.lib 
89
 
107
 
90
    SetOutPath $INSTDIR
108
    SetOutPath $INSTDIR
91
    File /r externals\include
109
    File /r externals\include
92
  ${EndIf}
110
  ${EndIf}
93
 
111
 
94
  !macro GELModule mvar mstring
112
  !macro GELModule mvar mstring
95
    ${If} ${mvar} = 1
113
    ${If} ${mvar} = 1
96
      SetOutPath $INSTDIR\lib
114
      SetOutPath $INSTDIR\lib
97
      File current\lib\${mstring}.lib 
115
      File current\lib\${mstring}.lib 
98
 
116
 
99
      SetOutPath $INSTDIR\include
117
      SetOutPath $INSTDIR\include
100
      File /r current\include\${mstring}
118
      File /r current\include\${mstring}
101
    ${EndIf}
119
    ${EndIf}
102
  !macroend
120
  !macroend
103
 
121
 
104
  !insertmacro GELModule $CGLA "CGLA"
122
  !insertmacro GELModule $CGLA "CGLA"
105
  !insertmacro GELModule $Geometry "Geometry"
123
  !insertmacro GELModule $Geometry "Geometry"
106
  !insertmacro GELModule $GLGraphics "GLGraphics"
124
  !insertmacro GELModule $GLGraphics "GLGraphics"
107
  !insertmacro GELModule $HMesh "HMesh"
125
  !insertmacro GELModule $HMesh "HMesh"
108
  !insertmacro GELModule $LinAlg "LinAlg"
126
  !insertmacro GELModule $LinAlg "LinAlg"
109
  !insertmacro GELModule $Util "Util"
127
  !insertmacro GELModule $Util "Util"
110
 
128
 
111
  # Create Environment variables
129
  # Create Environment variables
112
  WriteRegExpandStr HKCU "Environment" "GEL_INCLUDE" "$INSTDIR\include"
-
 
113
  WriteRegExpandStr HKCU "Environment" "GEL_LIB" "$INSTDIR\lib"
-
 
114
  WriteRegExpandStr HKCU "Environment" "GEL_BIN" "$INSTDIR\bin"
-
 
115
 
130
 
-
 
131
  ReadINIStr $R2 "$PLUGINSDIR\custdir.ini" "Field 3" "State"
-
 
132
  ReadINIStr $R3 "$PLUGINSDIR\custdir.ini" "Field 4" "State"
-
 
133
 
-
 
134
  ${If} $R2 = 0
-
 
135
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_INCLUDE" "$INSTDIR\include"
-
 
136
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_LIB" "$INSTDIR\lib"
-
 
137
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_BIN" "$INSTDIR\bin"
-
 
138
 
-
 
139
  ${Else}
-
 
140
    WriteRegExpandStr 'HKCU' "Environment" "GEL_INCLUDE" "$INSTDIR\include"
-
 
141
    WriteRegExpandStr 'HKCU' "Environment" "GEL_LIB" "$INSTDIR\lib"
-
 
142
    WriteRegExpandStr 'HKCU' "Environment" "GEL_BIN" "$INSTDIR\bin"
-
 
143
 
-
 
144
  ${EndIf}
-
 
145
 
-
 
146
  
116
  # Add %GEL_BIN% to path
147
  # Add %GEL_BIN% to path
-
 
148
  
-
 
149
  ${If} $R2 = 0
-
 
150
    ReadRegStr $1 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
-
 
151
  ${Else}
117
  ReadRegStr $1 HKCU "Environment" "PATH"
152
    ReadRegStr $1 'HKCU' "Environment" "PATH"
-
 
153
  ${EndIf}
-
 
154
 
118
  StrCpy $2 $1 1 -1 # copy last char
155
  StrCpy $2 $1 1 -1 # copy last char
119
  StrCmp $2 ";" 0 +2 # if last char == ;
156
  StrCmp $2 ";" 0 +2 # if last char == ;
120
    StrCpy $1 $1 -1 # remove last char
157
    StrCpy $1 $1 -1 # remove last char
121
  StrCmp $1 "" AddToPath_NTdoIt
158
  StrCmp $1 "" AddToPath_NTdoIt
122
    StrCpy $0 "$1;%GEL_BIN%"
159
    StrCpy $0 "$1;%GEL_BIN%"
123
  AddToPath_NTdoIt:
160
  AddToPath_NTdoIt:
-
 
161
    ${If} $R2 = 0
-
 
162
      WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
-
 
163
    ${Else}
124
    WriteRegExpandStr HKCU "Environment" "PATH" $0
164
      WriteRegExpandStr 'HKCU' "Environment" "PATH" $0
-
 
165
    ${EndIf}
125
    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
166
    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
126
 
167
 
127
 
168
 
128
SectionEnd ; end the section
169
SectionEnd ; end the section
-
 
170
 
-
 
171
Function .onInit
-
 
172
 
-
 
173
  ;Extract InstallOptions files
-
 
174
  ;$PLUGINSDIR will automatically be removed when the installer closes
-
 
175
 
-
 
176
  InitPluginsDir
-
 
177
  File /oname=$PLUGINSDIR\custdir.ini "custdir.ini"
-
 
178
  WriteINIStr  "$PLUGINSDIR\custdir.ini" "Field 2" "State" $INSTDIR
-
 
179
 
-
 
180
 
-
 
181
FunctionEnd
-
 
182
 
-
 
183
Function SetCustom
-
 
184
 
-
 
185
  ;Display the InstallOptions dialog
-
 
186
 
-
 
187
  Push ${TEMP1}
-
 
188
 
-
 
189
    InstallOptions::dialog "$PLUGINSDIR\custdir.ini"
-
 
190
    Pop ${TEMP1}
-
 
191
 
-
 
192
  Pop ${TEMP1}
-
 
193
 
-
 
194
FunctionEnd
129
 
195