Windows installer updated

This commit is contained in:
Fernando Cacciola 2007-05-04 05:39:40 +00:00
parent 7787c1d456
commit f183bcfc19
7 changed files with 1207 additions and 0 deletions

3
.gitattributes vendored
View File

@ -2771,6 +2771,8 @@ Triangulation_3/doc_tex/Triangulation_3_ref/sidedim2.pdf -text svneol=unset#appl
Voronoi_diagram_2/demo/Voronoi_diagram_2/voronoi_diagram_2.vcproj eol=crlf Voronoi_diagram_2/demo/Voronoi_diagram_2/voronoi_diagram_2.vcproj eol=crlf
Voronoi_diagram_2/doc_tex/Voronoi_diagram_2/voronoi.png -text Voronoi_diagram_2/doc_tex/Voronoi_diagram_2/voronoi.png -text
iostream/test/iostream/data/io.cin -text iostream/test/iostream/data/io.cin -text
wininst/developer_scripts/TextLog.nsh -text
wininst/developer_scripts/WriteEnvStr.nsh -text
wininst/developer_scripts/examples/C2vcproj -text wininst/developer_scripts/examples/C2vcproj -text
wininst/developer_scripts/examples/master_71.vcproj -text wininst/developer_scripts/examples/master_71.vcproj -text
wininst/developer_scripts/examples/master_71_head.sln eol=crlf wininst/developer_scripts/examples/master_71_head.sln eol=crlf
@ -2778,5 +2780,6 @@ wininst/developer_scripts/examples/master_71_proj_line.sln eol=crlf
wininst/developer_scripts/examples/master_80.vcproj -text wininst/developer_scripts/examples/master_80.vcproj -text
wininst/developer_scripts/examples/master_80_head.sln eol=crlf wininst/developer_scripts/examples/master_80_head.sln eol=crlf
wininst/developer_scripts/examples/master_80_proj_line.sln eol=crlf wininst/developer_scripts/examples/master_80_proj_line.sln eol=crlf
wininst/developer_scripts/script_cgal_3_3.nsh -text
wininst/src/CGAL/cgallib_71.vcproj -text wininst/src/CGAL/cgallib_71.vcproj -text
wininst/src/CGAL/cgallib_80.vcproj -text wininst/src/CGAL/cgallib_80.vcproj -text

View File

@ -0,0 +1,68 @@
# TextLog.nsh v1.1 - 2005-12-26
# Written by Mike Schinkel [http://www.mikeschinkel.com/blog/]
Var /GLOBAL __TextLog_FileHandle
Var /GLOBAL __TextLog_FileName
Var /GLOBAL __TextLog_State
!define LogMsg '!insertmacro LogMsgCall'
!macro LogMsgCall _text
Call LogSetOn
Push "${_text}"
Call LogText
Call LogSetOff
!macroend
!define LogText '!insertmacro LogTextCall'
!macro LogTextCall _text
Push "${_text}"
Call LogText
!macroend
Function LogText
Exch $0 ; pABC -> 0ABC
FileWrite $__TextLog_FileHandle "$0$\r$\n"
Pop $0 ; 0ABC -> ABC
FunctionEnd
!define LogSetFileName '!insertmacro LogSetFileNameCall'
!macro LogSetFileNameCall _filename
Push "${_filename}"
Call LogSetFileName
!macroend
Function LogSetFileName
Exch $0 ; pABC -> 0ABC
StrCpy $__TextLog_FileName "$0"
StrCmp $__TextLog_State "open" +1 +3
Call LogSetOff
Call LogSetOn
Pop $0 ; 0ABC -> ABC
FunctionEnd
!define LogSetOn '!insertmacro LogSetOnCall'
!macro LogSetOnCall
Call LogSetOn
!macroend
Function LogSetOn
StrCmp $__TextLog_FileName "" +1 AlreadySet
StrCpy $__TextLog_FileName "$INSTDIR\install.log"
AlreadySet:
StrCmp $__TextLog_State "open" +2
FileOpen $__TextLog_FileHandle "$__TextLog_FileName" a
FileSeek $__TextLog_FileHandle 0 END
StrCpy $__TextLog_State "open"
FunctionEnd
!define LogSetOff '!insertmacro LogSetOffCall'
!macro LogSetOffCall
Call LogSetOff
!macroend
Function LogSetOff
StrCmp $__TextLog_State "open" +1 +2
FileClose $__TextLog_FileHandle
StrCpy $__TextLog_State ""
FunctionEnd

View File

@ -0,0 +1,161 @@
#
# Taken from http://nsis.sourceforge.net/Setting_Environment_Variables
#
!ifndef _WriteEnvStr_nsh
!define _WriteEnvStr_nsh
#
# Macro definition added by Fernando Cacciola
#
!define WriteEnvStr "!insertmacro WriteEnvStr"
!macro WriteEnvStr name value
Push ${name}
Push ${value}
Call WriteEnvStr
!macroend
!include WinMessages.nsh
!ifndef WriteEnvStr_RegKey
!ifdef ALL_USERS
!define WriteEnvStr_RegKey \
'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!else
!define WriteEnvStr_RegKey 'HKCU "Environment"'
!endif
!endif
#
# WriteEnvStr - Writes an environment variable
# Note: Win9x systems requires reboot
#
# Example:
# Push "HOMEDIR" # name
# Push "C:\New Home Dir\" # value
# Call WriteEnvStr
#
Function WriteEnvStr
Exch $1 ; $1 has environment variable value
Exch
Exch $0 ; $0 has environment variable name
Push $2
Call IsNT
Pop $2
StrCmp $2 1 WriteEnvStr_NT
; Not on NT
StrCpy $2 $WINDIR 2 ; Copy drive of windows (c:)
FileOpen $2 "$2\autoexec.bat" a
FileSeek $2 0 END
FileWrite $2 "$\r$\nSET $0=$1$\r$\n"
FileClose $2
SetRebootFlag true
Goto WriteEnvStr_done
WriteEnvStr_NT:
WriteRegExpandStr ${WriteEnvStr_RegKey} $0 $1
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
0 "STR:Environment" /TIMEOUT=5000
WriteEnvStr_done:
Pop $2
Pop $0
Pop $1
FunctionEnd
#
# un.DeleteEnvStr - Removes an environment variable
# Note: Win9x systems requires reboot
#
# Example:
# Push "HOMEDIR" # name
# Call un.DeleteEnvStr
#
Function un.DeleteEnvStr
Exch $0 ; $0 now has the name of the variable
Push $1
Push $2
Push $3
Push $4
Push $5
Call un.IsNT
Pop $1
StrCmp $1 1 DeleteEnvStr_NT
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" r
GetTempFileName $4
FileOpen $2 $4 w
StrCpy $0 "SET $0="
SetRebootFlag true
DeleteEnvStr_dosLoop:
FileRead $1 $3
StrLen $5 $0
StrCpy $5 $3 $5
StrCmp $5 $0 DeleteEnvStr_dosLoop
StrCmp $5 "" DeleteEnvStr_dosLoopEnd
FileWrite $2 $3
Goto DeleteEnvStr_dosLoop
DeleteEnvStr_dosLoopEnd:
FileClose $2
FileClose $1
StrCpy $1 $WINDIR 2
Delete "$1\autoexec.bat"
CopyFiles /SILENT $4 "$1\autoexec.bat"
Delete $4
Goto DeleteEnvStr_done
DeleteEnvStr_NT:
DeleteRegValue ${WriteEnvStr_RegKey} $0
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
0 "STR:Environment" /TIMEOUT=5000
DeleteEnvStr_done:
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
!ifndef IsNT_KiCHiK
!define IsNT_KiCHiK
#
# [un.]IsNT - Pushes 1 if running on NT, 0 if not
#
# Example:
# Call IsNT
# Pop $0
# StrCmp $0 1 +3
# MessageBox MB_OK "Not running on NT!"
# Goto +2
# MessageBox MB_OK "Running on NT!"
#
!macro IsNT UN
Function ${UN}IsNT
Push $0
ReadRegStr $0 HKLM \
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 IsNT_yes
; we are not NT.
Pop $0
Push 0
Return
IsNT_yes:
; NT!!!
Pop $0
Push 1
FunctionEnd
!macroend
!insertmacro IsNT ""
!insertmacro IsNT "un."
!endif ; IsNT_KiCHiK
!endif ; _WriteEnvStr_nsh

View File

@ -0,0 +1,93 @@
[Settings]
NumFields=11
[Field 1]
Type=GroupBox
Left=0
Right=-1
Top=0
Bottom=-5
Text=Select default variants
[Field 2]
Type=GroupBox
Left=5
Right=100
Top=10
Bottom=-10
Text=Compilers
[Field 3]
Type=GroupBox
Left=105
Right=-5
Top=10
Bottom=-10
Text=Variants
[Field 4]
Type=CheckBox
Left=10
Top=22
Right=95
Bottom=32
Text=Visual C++ 7.1
[Field 5]
Type=CheckBox
Left=10
Top=35
Right=95
Bottom=45
Text=Visual C++ 8.0
; -- Variants
[Field 6]
Type=CheckBox
Left=110
Top=22
Right=-10
Bottom=32
Text=Multithread Debug
[Field 7]
Type=CheckBox
Left=110
Right=-15
Top=35
Bottom=45
Text=Multithread
[Field 8]
Type=CheckBox
Left=110
Right=-10
Top=48
Bottom=58
Text=Multithread, static runtime
[Field 9]
Type=CheckBox
Left=110
Right=-10
Top=61
Bottom=71
Text=Multithread Debug, static runtime
[Field 10]
Type=CheckBox
Left=110
Right=-10
Top=74
Bottom=84
Text=Single thread, static runtime
[Field 11]
Type=CheckBox
Left=110
Right=-10
Top=87
Bottom=97
Text=Single thread Debug, static runtime

View File

@ -0,0 +1,134 @@
[Settings]
NumFields=15
[Field 1]
Type=GroupBox
Left=0
Right=-1
Top=0
Bottom=23
Text=Select user
[Field 2]
Type=RadioButton
Left=10
Right=60
Top=10
Bottom=20
Text=All users
State=1
[Field 3]
Type=RadioButton
Left=70
Right=120
Top=10
Bottom=20
Text=CurrentUser
[Field 4]
Type=GroupBox
Left=0
Right=-1
Top=25
Bottom=-5
Text=Select Enviroment Variables to Set
[Field 5]
Type=CheckBox
Left=10
Right=100
Top=45
Bottom=55
Text=CGAL_INC
State=1
[Field 6]
Type=CheckBox
Left=10
Right=100
Top=60
Bottom=70
Text=CGAL_LIB
State=1
[Field 7]
Type=CheckBox
Left=10
Right=100
Top=75
Bottom=85
Text=BOOSTROOT
State=0
[Field 8]
Type=CheckBox
Left=110
Right=200
Top=45
Bottom=55
Text=MPFR_INC
State=1
[Field 9]
Type=CheckBox
Left=110
Right=200
Top=60
Bottom=70
Text=MPFR_LIB
State=1
[Field 10]
Type=CheckBox
Left=110
Right=200
Top=75
Bottom=85
Text=GMP_INC
State=1
[Field 11]
Type=CheckBox
Left=110
Right=200
Top=90
Bottom=100
Text=GMP_LIB
State=1
[Field 12]
Type=CheckBox
Left=210
Right=-20
Top=45
Bottom=55
Text=TAUCS_INC
State=0
[Field 13]
Type=CheckBox
Left=210
Right=-20
Top=60
Bottom=70
Text=TAUCS_LIB
State=0
[Field 14]
Type=CheckBox
Left=210
Right=-20
Top=75
Bottom=85
Text=ZLIB_INC
State=0
[Field 15]
Type=CheckBox
Left=210
Right=-20
Top=90
Bottom=100
Text=ZLIB_LIB
State=0

View File

@ -0,0 +1,274 @@
;============================
; Copyright 2007 GeometryFactory (France)
; Author: Andreas Fabri (andreas.fabri@geometryfactrory.com), Fernando Cacciola (fernando.cacciola@geometryfactrory.com)
;============================
; Some portions of this file have been extracted/derived from "boost,.nsi", the Boost Windows Installer, contributed by www.boost-consulting.org.
;
; Copyright 2006 Daniel Wallin
; Copyright 2006 Eric Niebler
; Distributed under the Boost Software License, Version 1.0. (See
; accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;============================
Var no_default_compilers
Var no_default_variants
Var selected_libs
;--------------------------------
; Macros
;--------------------------------
!macro AddConfigFlag CFLAG ADDED
StrCmp $ADDED "y" Set
return
Set:
Push "#define CGAL_USE_${CFLAG} 1$\r$\n"
Call AppendLineToCompilerConfig
StrCpy $ADDED "y"
!macroend
!define MultiVariantSection "!insertmacro MultiVariantSection"
; Expands to a Section Group named "SecName" which contains all library variants.
; For each variant, the macro "Handler" is expanded with the variant name as argument
!macro MultiVariantSection SecName Handler Idx
SectionGroup "${SecName}" ${Idx}
SectionGroup "VC7.1"
Section /o "Multithread Debug"
!insertmacro "${Handler}" "vc71-mt-gd"
SectionEnd
Section /o "Multithread"
!insertmacro "${Handler}" "vc71-mt"
SectionEnd
Section /o "Multithread, static runtime"
!insertmacro "${Handler}" "vc71-mt-s"
SectionEnd
Section /o "Multithread Debug, static runtime"
!insertmacro "${Handler}" "vc71-mt-sgd"
SectionEnd
Section /o "Single thread, static runtime"
!insertmacro "${Handler}" "vc71-s"
SectionEnd
Section /o "Single thread Debug, static runtime"
!insertmacro "${Handler}" "vc71-sgd"
SectionEnd
SectionGroupEnd
SectionGroup "VC8.0"
Section /o "Multithread Debug"
!insertmacro "${Handler}" "vc80-mt-gd"
SectionEnd
Section /o "Multithread"
!insertmacro "${Handler}" "vc80-mt"
SectionEnd
Section /o "Multithread, static runtime"
!insertmacro "${Handler}" "vc80-mt-s"
SectionEnd
Section /o "Multithread Debug, static runtime"
!insertmacro "${Handler}" "vc80-mt-sgd"
SectionEnd
SectionGroupEnd
SectionGroupEnd
!macroend
!macro InstallThirdPartyLib SRC_MISC SRC_INC SRC_LIB TGT
SetOutPath "$INSTDIR\auxiliary\${TGT}"
FILE /r "${SRC_MISC}"
SetOutPath "$INSTDIR\auxiliary\${TGT}\include"
FILE /r "${SRC_INC}"
SetOutPath "$INSTDIR\auxiliary\${TGT}\lib"
FILE /r "${SRC_LIB}"
!macroend
!macro Install_CGAL_libs VARIANT
SetOutPath "$INSTDIR\lib"
FILE /r "${CGAL_SRC}\lib\cgal-${VARIANT}.lib"
FILE /r "${CGAL_SRC}\lib\CGALcore++-${VARIANT}.lib"
!macroend
!macro Install_GMP_MPFR VARIANT
!insertmacro InstallThirdPartyLib "${GMP_SRC}\README" "${GMP_SRC}\*.h" "${GMP_SRC}\*-${VARIANT}.lib" "gmp"
!macroend
!macro Install_TAUCS VARIANT
!insertmacro InstallThirdPartyLib "${TAUCS_SRC}\LICENSE" "${TAUCS_SRC}\*.h" "${TAUCS_SRC}\*-${VARIANT}.lib" "taucs"
!macroend
!macro Install_ZLIB VARIANT
!insertmacro InstallThirdPartyLib "${ZLIB_SRC}\*.txt" "${TAUCS_SRC}\*.h" "${TAUCS_SRC}\*-${VARIANT}.lib" "zlib"
!macroend
;--------------------------------
; Functions
;--------------------------------
# Appends "Line" to "compiler_config.h"
# Usage:
# Push Line
# Call AppendLineToCompilerConfig
Function AppendLineToCompilerConfig
Push "$INSTDIR\include\CGAL\config\msvc\CGAL\compiler_config.h"
Call AppendLineToFile
FunctionEnd
# Appends "Line" to "Fle"
# Usage:
# Push Line
# Push File
# Call AppendLineToFile
Function AppendLineToFile
Exch $0 # file
Exch
Exch $1 # line
Push $2 # handle
FileOpen $2 $0 a
IfErrors error
FileSeek $2 0 END
FileWrite $2 $1
FileClose $2
Goto done
error:
DetailPrint "ERROR: Unable to add line:$\r$\n $1 $\r$\nto file:$\r$\n $0 $\r$\n"
done:
Pop $2
Pop $1
Pop $0
FunctionEnd
Function initSelectionFlags
${LogText} "initSelectionFlags..."
StrCpy $selected_libs ""
ClearErrors
StrCpy $0 0
next:
SectionGetText $0 $1
IfErrors bail
${LogText} "Section $0 is '$1'"
StrCpy $2 $1 "" -4
StrCmp $2 "libs" 0 not_lib
${LogText} "Section $0 is a libray"
Push $0
call SelectDefaultVariants
StrCpy $selected_libs "$selected_libs1"
not_lib:
IntOp $0 $0 + 1
goto next
bail:
FunctionEnd
; Stack 0: compiler name
; Stack 1: variant name
; Stack 2: section
Function MaybeSelectVariant
Exch $2
; c, v, r2
Exch
; c, r2, v
Exch $1
; c, r2, r1
Exch
; c, r1, r2
Exch 2
; r2, r1, c
Exch $0
; r2, r1, r0
Exch 2
; r0, r1, r2
${LogText} "MaybeSelectVariant comp=$0 variant=$1 section=$2"
Push $3
Push $4
${If} $0 == "VC7.1"
!insertmacro MUI_INSTALLOPTIONS_READ $3 "default_variants.ini" "Field 4" "State"
${Else}
!insertmacro MUI_INSTALLOPTIONS_READ $3 "default_variants.ini" "Field 5" "State"
${EndIf}
StrCpy $5 0
${If} $3 != 0
${LogText} "$0 is checked. Looking for variant in selection."
StrCpy $3 6
next:
!insertmacro MUI_INSTALLOPTIONS_READ $4 "default_variants.ini" "Field $3" "Text"
IfErrors bail
${If} $4 == $1
!insertmacro MUI_INSTALLOPTIONS_READ $5 "default_variants.ini" "Field $3" "State"
${LogText} "variant found. selected=$5"
goto bail
${EndIf}
IntOp $3 $3 + 1
goto next
bail:
${If} $3 == 12
${LogText} "ERROR!! variant NOT found in selection"
${EndIf}
${EndIf}
${If} $5 == 0
!insertmacro SelectSection $2
${Else}
!insertmacro UnselectSection $2
${EndIf}
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
; Stack 0: top level section index
Function SelectDefaultVariants
Exch $0
Push $1
Push $2
Push $3
Push $4
${LogText} "SelectDefaultVariants for section $0"
IntOp $0 $0 + 1
StrCpy $1 0 ; Last section was group end
StrCpy $4 "" ; Current compiler
next:
SectionGetFlags $0 $2
IfErrors bail
IntOp $3 $2 & ${SF_SECGRPEND}
StrCmp $3 0 not_end
StrCmp $1 0 0 bail ; two groups in a row means we are backing out
not_end:
StrCpy $1 $3
IntOp $3 $2 & 6
StrCmp $3 0 0 not_variant
SectionGetText $0 $2
Push $4
Push $2
Push $0
call MaybeSelectVariant
goto variant
not_variant:
SectionGetText $0 $4
variant:
IntOp $0 $0 + 1
goto next
bail:
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd

View File

@ -0,0 +1,474 @@
;============================
; Copyright 2007 GeometryFactory (France)
; Author: Andreas Fabri (andreas.fabri@geometryfactrory.com), Fernando Cacciola (fernando.cacciola@geometryfactrory.com)
;============================
; Some portions of this file have been extracted/derived from "boost,.nsi", the Boost Windows Installer, contributed by www.boost-consulting.org.
;
; Copyright 2006 Daniel Wallin
; Copyright 2006 Eric Niebler
; Distributed under the Boost Software License, Version 1.0. (See
; accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;============================
;Include Modern UI
!include "MUI.nsh"
!include "WriteEnvStr.nsh"
!include "StrFunc.nsh"
!include "Sections.nsh"
!include "LogicLib.nsh"
!include "TextLog.nsh"
!include "script_cgal_3_3.nsh"
;-------------------------------------------------------------------------------------------------------
;
; -= SOURCES =-
;
;
; The following defintions specify the source folders for the files to install.
; ALL the variants for the precompiled libraries for ALL dependencies must exist in the source folders.
;
; These are:
; LIB-vc71-mt-gd.lib
; LIB-vc71-mt-s.lib
; LIB-vc71-mt-sgd.lib
; LIB-vc71-mt.lib
; LIB-vc71-s.lib
; LIB-vc71-sgd.lib
; LIB-vc80-mt-gd.lib
; LIB-vc80-mt-s.lib
; LIB-vc80-mt-sgd.lib
; LIB-vc80-mt.lib
;
; where LIB is: cgal,CGALcore++,gmp,mpfr,taucs and zlib
;
; Since the files for third-party libraries MPFR-GMP,TAUCS and ZLIB are accessed during NSIS compilation
; only to add them to the installer package, this script searches for files related to a given third party library
; in the single defined here (so all of .h, .lib, .txt etc must be in the same folder)
;--------------------------------
!define CGAL_SRC "CGAL-3.3"
!define GMP_SRC "gmp-4.1.2-gladman"
!define TAUCS_SRC "taucs_precompiled"
!define ZLIB_SRC "zlib123"
;--------------------------------
; General
;--------------------------------
;Name and file
Name "CGAL-3.3"
OutFile "CGAL-3.3-Setup.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\CGAL-3.3"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\CGAL-3.3" ""
;--------------------------------
; Variables
;--------------------------------
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
; Interface Settings
;--------------------------------
!define MUI_ICON "cgal-16.ico"
!define MUI_UNICON "cgal-16.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_BITMAP "cgal_very_small_FFFFFF.bmp" ; optional
!define MUI_ABORTWARNING
!define MUI_WELCOMEFINISHPAGE_BITMAP zirkel.bmp
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
; !define MUI_PAGE_HEADER_TEXT "page header text"
!define MUI_WELCOMEPAGE_TEXT "This installs CGAL-3.3 on your machine, precompiled with .Net 2003 and 2005 (VC 7.1 and 8.0)."
!define MUI_FINISHPAGE_TITLE "Installation Not Finished Yet!!!"
!define MUI_FINISHPAGE_TEXT "CGAL needs part of the Boost Library which you must download yourself (from www.boost.org or www.boost-consulting.com/download.html).\r\n\r\nThe vcproj files in the example and demo subdirectories do not specify where the header files and libraries for CGAL, boost, GMP, zlib, Qt, and Taucs are located. \r\n\r\nFor .net 2003 (VC++ 7.1) the installer already modified the Developer Studio settings for the CGAL libraries and the third party libraries GMP, Taucs, and Zlib.\r\n\r\nFor Boost and Qt you can add these paths for Developer Studio in Tools->Options->Projects->VC++Directories in the tab 'Show Directories' for 'Include Files' and 'Library Files'.\r\n\r\nVC 8.0 users must go to the CGAL-3.3/src directory and recompile the libraries."
!define MUI_FINISHPAGE_LINK "More information about CGAL and Visual C++"
!define MUI_FINISHPAGE_LINK_LOCATION http://www.cgal.org/platforms_frame.html
;--------------------------------
; Pages
;--------------------------------
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${CGAL_SRC}\LICENSE"
; A page were the user can specify a default variant configuration (taken from the boost installer)
Page custom defaultVariantsPage
!insertmacro MUI_PAGE_COMPONENTS
; A page were the user can check/uncheck the enviroment variables
; used to specify paths in vproj files to be added.
Page custom envarsPage
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "CGAL-3.3"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
; Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; Sections
;--------------------------------
;--------------------------------
Section "!Main CGAL" MAIN_Idx
SectionIn RO
SetOutPath "$INSTDIR\auxiliary"
FILE /r "${CGAL_SRC}\auxiliary\*.*"
SetOutPath "$INSTDIR\config"
FILE /r "${CGAL_SRC}\config\*.*"
SetOutPath "$INSTDIR\include"
FILE /r "${CGAL_SRC}\include\*.*"
SetOutPath "$INSTDIR\make"
FILE /r "${CGAL_SRC}\make\*.*"
SetOutPath "$INSTDIR\src"
FILE /r "${CGAL_SRC}\src\*.*"
SetOutPath "$INSTDIR\examples"
FILE /r "${CGAL_SRC}\examples\*.*"
SetOutPath "$INSTDIR\scripts"
FILE /r "${CGAL_SRC}\scripts\*.*"
SetOutPath "$INSTDIR"
FILE "${CGAL_SRC}\Changes"
FILE "${CGAL_SRC}\Install"
FILE "${CGAL_SRC}\INSTALL.win32"
FILE "${CGAL_SRC}\install_cgal"
FILE "${CGAL_SRC}\License"
FILE "${CGAL_SRC}\LICENSE.LGPL"
FILE "${CGAL_SRC}\LICENSE.QPL"
FILE "${CGAL_SRC}\LICENSE.Free_Use"
FILE "${CGAL_SRC}\Readme"
FILE ".\cgal.ico"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;--------------------------------
Section "CGAL Demos" DEMOS_Idx
SetOutPath "$INSTDIR\demo"
FILE /r "${CGAL_SRC}\demo\*.*"
SectionEnd
;--------------------------------
;--------------------------------
; Multi Variant Sections
; Each of the sections below is a group enclosing all the variants for a given set of precomp libraries
; NOTE: The variant selection code uses the trailing "libs" in the group name to identify components.
; DO NOT change the trailing "libs" in the section name.
;
${MultiVariantSection} "CGAL precomp libs" Install_CGAL_libs CGAL_Idx
${MultiVariantSection} "GMP and MPFR headers and precomp libs" Install_GMP_MPFR GMP_Idx
${MultiVariantSection} "TAUCS headers and precomp libs" Install_TAUCS TAUCS_Idx
${MultiVariantSection} "Zlib headers and precomp libs" Install_ZLIB ZLIB_Idx
;--------------------------------
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\CGAL-3.3"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_MAIN ${LANG_ENGLISH} "The main components of the CGAL Library."
LangString DESC_DEMOS ${LANG_ENGLISH} "The CGAL demos, for which you will need Qt 3 in order to build them."
LangString DESC_CGAL ${LANG_ENGLISH} "The precompiled CGAL libraries."
LangString DESC_GMP ${LANG_ENGLISH} "The precompiled GMP and MPFR libraries, which provide exact number types."
LangString DESC_TAUCS ${LANG_ENGLISH} "The precompiled TAUCS library which provides a solver for sparse matrices that can be used together with the surface parametrization package."
LangString DESC_ZLIB ${LANG_ENGLISH} "The precompiled ZLIB library which provides compression algorithms that are used in examples of the surface mesher package."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${MAIN_Idx} $(DESC_MAIN)
!insertmacro MUI_DESCRIPTION_TEXT ${DEMOS_Idx} $(DESC_DEMOS)
!insertmacro MUI_DESCRIPTION_TEXT ${CGAL_Idx} $(DESC_CGAL)
!insertmacro MUI_DESCRIPTION_TEXT ${GMP_Idx} $(DESC_GMP)
!insertmacro MUI_DESCRIPTION_TEXT ${TAUCS_Idx} $(DESC_TAUCS)
!insertmacro MUI_DESCRIPTION_TEXT ${ZLIB_Idx} $(DESC_ZLIB)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
;--------------------------------
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\CGAL-3.3"
SectionEnd
;--------------------------------
; Functions
;--------------------------------
Function .onInit
${LogSetFileName} "install_log.txt"
${LogSetOn}
${LogText} "CGAL Installer started"
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp ".\CGAL.bmp"
advsplash::show 1000 600 400 -1 $PLUGINSDIR\splash
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "default_variants.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "enviroment_variables.ini"
#Call initSelectionFlags
FunctionEnd
Function .onSelChange
${LogText} "onSelChange. Old selected_libs=$selected_libs"
ClearErrors
StrCpy $0 0 ; Section index
StrCpy $1 0 ; Lib index
next:
SectionGetText $0 $2
${LogText} "Section $0 is '$2'"
IfErrors bail
StrCpy $3 $2 "" -4
StrCmp $3 "libs" 0 not_lib
${LogText} " Section $0 is a library"
StrCpy $3 $selected_libs 1 $1 ; $3 == old flag
${LogText} " Old selection state $3"
SectionGetFlags $0 $4 ; $4 == flag
IntOp $5 $4 & 65
${LogText} " New selection state $5"
StrCmp $5 0 not_true
StrCpy $5 1
not_true:
StrCmp $3 $5 not_toggled 0
${LogText} " Selection state CHANGED"
StrCpy $6 $selected_libs $1 ; Before
IntOp $7 $1 + 1
StrCpy $7 $selected_libs "" $7 ; After
StrCpy $selected_libs "$6$5$7"
StrCmp $5 1 0 not_selected
; -- New library was selected, select default variants
Push $0
call SelectDefaultVariants
not_selected:
not_toggled:
IntOp $1 $1 + 1
not_lib:
IntOp $0 $0 + 1
goto next
bail:
FunctionEnd
Function defaultVariantsPage
!insertmacro MUI_HEADER_TEXT "Select Default Variants" "Choose which binary variants that will be default selected for libraries."
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "default_variants.ini"
Pop $0
!insertmacro MUI_INSTALLOPTIONS_SHOW
Pop $0
!insertmacro MUI_INSTALLOPTIONS_READ $0 "default_variants.ini" "Field 4" "State"
${If} $0 == 0
!insertmacro MUI_INSTALLOPTIONS_READ $0 "default_variants.ini" "Field 5" "State"
${EndIf}
IntOp $0 $0 !
StrCpy $no_default_compilers $0
StrCpy $0 6
StrCpy $1 0
ClearErrors
next:
!insertmacro MUI_INSTALLOPTIONS_READ $2 "default_variants.ini" "Field $0" "State"
IfErrors bail
IntOp $1 $1 || $2
IntOp $0 $0 + 1
goto next
bail:
IntOp $1 $1 !
StrCpy $no_default_variants $1
${LogText} "no_default_compilers=$no_default_compilers"
${LogText} "no_default_variants=$no_default_variants"
call initSelectionFlags
FunctionEnd
# Disables the env var checkbox # FN
!macro DisableEnvStrCB FN
!insertmacro MUI_INSTALLOPTIONS_WRITE "enviroment_variables.ini" "Field ${FN}" "State" "0"
!insertmacro MUI_INSTALLOPTIONS_WRITE "enviroment_variables.ini" "Field ${FN}" "Flags" "DISABLED"
!macroend
!macro ProcessEnvStrCB ALLUSERS FN VALUE
!insertmacro MUI_INSTALLOPTIONS_READ $8 "enviroment_variables.ini" "Field ${FN}" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $9 "enviroment_variables.ini" "Field ${FN}" "Text"
${If} $8 = 1
${If} ${ALLUSERS} = 1
${LogText} "Setting enviroment variable $9='${VALUE}' for All Users."
${Else}
${LogText} "Setting enviroment variable $9='${VALUE}' for Current User Only."
${Endif}
${EndIF}
!macroend
Function envarsPage
!insertmacro MUI_HEADER_TEXT "Setting Enviroment Variables" "Choose which enviroment variables to set and for which users."
# INITIALIZATION - Disables checkboxes corresponding to env vars that cannot be set
# either because they are already defined in the system or because the corresponding library
# was not installed.
${For} $1 5 15
# The text of the checkbox matches exactly the enviroment variable to be set
!insertmacro MUI_INSTALLOPTIONS_READ $2 "enviroment_variables.ini" "Field $1" "Text"
# Disable the checkbox if the envar is alreadyc defined
ReadEnvStr $3 $2
${If} $3 != ""
!insertmacro DisableEnvStrCB $1
${Endif}
# Disable checkboxes corresponding to optional components that might have not be installed
StrCpy $4 $2 1
${Select} $4
${Case} "C" # checkboxes for CGAL libs
${Unless} ${SectionIsSelected} ${CGAL_Idx}
${AndUnless} ${SectionIsPartiallySelected} ${CGAL_Idx}
!insertmacro DisableEnvStrCB $1
${EndUnless}
${Case2} "M" "G" # checkboxes for MPFR and GMP
${Unless} ${SectionIsSelected} ${GMP_Idx}
${AndUnless} ${SectionIsPartiallySelected} ${GMP_Idx}
!insertmacro DisableEnvStrCB $1
${EndUnless}
${Case} "T" # checkboxes for TAUCS
${Unless} ${SectionIsSelected} ${TAUCS_Idx}
${AndUnless} ${SectionIsPartiallySelected} ${TAUCS_Idx}
!insertmacro DisableEnvStrCB $1
${EndUnless}
${Case} "Z" # checkboxes for ZLIB
${Unless} ${SectionIsSelected} ${ZLIB_Idx}
${AndUnless} ${SectionIsPartiallySelected} ${ZLIB_Idx}
!insertmacro DisableEnvStrCB $1
${EndUnless}
${EndSelect}
${Next}
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "enviroment_variables.ini"
Pop $0
!insertmacro MUI_INSTALLOPTIONS_SHOW
Pop $0
# PROCESSING - Installs selected enviroment variables
!insertmacro MUI_INSTALLOPTIONS_READ $1 "enviroment_variables.ini" "Field 2" "State" # $1=Is ALL USERS selected
!insertmacro ProcessEnvStrCB $1 5 "$INSTDIR\include"
!insertmacro ProcessEnvStrCB $1 6 "$INSTDIR\lib"
!insertmacro ProcessEnvStrCB $1 7 "boost-root"
!insertmacro ProcessEnvStrCB $1 8 "$INSTDIR\auxiliary\gmp\include"
!insertmacro ProcessEnvStrCB $1 9 "$INSTDIR\auxiliary\gmp\lib"
!insertmacro ProcessEnvStrCB $1 10 "$INSTDIR\auxiliary\gmp\include"
!insertmacro ProcessEnvStrCB $1 11 "$INSTDIR\auxiliary\gmp\lib"
!insertmacro ProcessEnvStrCB $1 12 "$INSTDIR\auxiliary\taucs\include"
!insertmacro ProcessEnvStrCB $1 13 "$INSTDIR\auxiliary\taucs\lib"
!insertmacro ProcessEnvStrCB $1 14 "$INSTDIR\auxiliary\zlib\include"
!insertmacro ProcessEnvStrCB $1 15 "$INSTDIR\auxiliary\zlib\lib"
FunctionEnd