Subversion Repositories gelsvn

Rev

Rev 253 | Rev 286 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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