Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add environment variables to windows system with nsis package.
[simgrid.git] / buildtools / Cmake / simgrid.nsi.in
index f079512..f6e38fe 100644 (file)
@@ -140,6 +140,16 @@ section
        createShortCut  "$SMPROGRAMS\SimGrid\Uninstall simgrid.lnk" "$INSTDIR\uninstaller@BIN_EXE@"\r
        createShortCut  "$SMPROGRAMS\SimGrid\Documentation.lnk" "$INSTDIR\doc\index.html"\r
        \r
+       # Include for some of the windows message defines\r
+       !include "winmessages.nsh"\r
+       # HKLM (all users) vs HKCU (current user) defines\r
+       !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'\r
+       !define env_hkcu 'HKCU "Environment"'\r
+       # Set Variables\r
+       WriteRegExpandStr ${env_hklm} SIMGRID_ROOT $INSTDIR\lib\r
+       WriteRegExpandStr ${env_hklm} GRAS_ROOT $INSTDIR\lib\r
+       WriteRegExpandStr ${env_hklm} SIMGRID_VERSION @SIMGRID_VERSION_MAJOR@.@SIMGRID_VERSION_MINOR@.@SIMGRID_VERSION_PATCH@\r
+\r
        MessageBox MB_OK "Installation was successful."\r
 \r
 # default section end\r
@@ -254,6 +264,11 @@ section "Uninstall"
        RMDir  /r "$INSTDIR\doc"\r
        RMDir  "$SMPROGRAMS\SimGrid"\r
        RMDir  "$PROGRAMFILES\SimGrid"\r
+       \r
+       # Delete variable\r
+       DeleteRegValue ${env_hklm} SIMGRID_ROOT\r
+       DeleteRegValue ${env_hklm} GRAS_ROOT\r
+       DeleteRegValue ${env_hklm} SIMGRID_VERSION\r
 \r
 # uninstall section end\r
 sectionEnd
\ No newline at end of file