]> Creatis software - creaToolsTools.git/blob - Install_ThirdParty/cmake/crea_ThirdParty_Libraries/install/CMakeLists.txt
2017 SQLite Debug in version CreaTools win64 RELEASE
[creaToolsTools.git] / Install_ThirdParty / cmake / crea_ThirdParty_Libraries / install / CMakeLists.txt
1
2
3
4
5
6 #-----------------------------------------------------------------------------
7 # CPACK+NSIS PACKAGING
8 #-----------------------------------------------------------------------------
9
10 #---Documentation-------------
11 #http://www.cmake.org/Wiki/CMake:Packaging_With_CPack
12 #http://www.cmake.org/Wiki/CMake:CPackConfiguration
13 #http://www.cmake.org/Wiki/CMake:Install_Commands
14
15
16 INCLUDE(InstallRequiredSystemLibraries)
17
18 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME} - CREATIS")
19 SET(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}-${CREATOOLS_BUILDTYPE}")
20 SET(CPACK_PACKAGE_VENDOR "CREATIS")
21 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.txt")
22 SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
23 SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_MAJOR_VERSION})
24 SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_MINOR_VERSION})
25 SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_BUILD_VERSION})
26
27
28
29
30
31
32   SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CreaTools\\\\${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
33   IF(WIN32)
34     SET(CMAKE_INSTALL_PREFIX C:/CreaTools/${PROJECT_NAME})
35   ENDIF(WIN32)
36
37
38
39
40
41 IF(WIN32 AND NOT UNIX)
42   # There is a bug in NSI that does not handle full unix paths properly. Make
43   # sure there is at least one set of four (4) backlasshes.
44 #EED  SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/kernel/install/gnome/bbi-icon2.bmp")
45 #  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin/BBI_EXE.exe")
46   SET(CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME}")
47   SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/creatools/${PROJECT_NAME}")
48   SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/creatools/${PROJECT_NAME}")
49   SET(CPACK_NSIS_CONTACT "info-dev@creatis.insa-lyon.fr")
50   SET(CPACK_NSIS_MODIFY_PATH OFF)
51
52
53   set  (CREA_BOOST_LYBRARY      boost)
54   set  (CREA_GDCM_LYBRARY       gdcm13 )
55   set  (CREA_ITK_LYBRARY        itk )
56   set  (CREA_QT_LYBRARY         qt )
57   set  (CREA_VTK_LYBRARY        vtk )  
58   set  (CREA_WXWIN_LYBRARY      wxWidgets)
59   set  (CREA_XERCES_LYBRARY     xerces)
60   set  (CREA_SQLITE_LYBRARY     sqlite)
61   #DFCH -- set  (CREA_MIKATEX_LYBRARY miktex)
62   
63   #set  (CREA_KWWIDGETS_LYBRARY   KWWidgets-090109 )
64   
65   set  (MessageLibraryPath "CREA_LIBRARY_DESTINATION_PATH (itk,vtk,gdcm,wx,KWWidgets,tth,MikTex)")
66   set  (CREA_LIBRARY_SOURCE_PATH  "" CACHE PATH ${MessageLibraryPath} )
67   set  (CREA_LIBRARY_DESTINATION_PATH "Library")
68   set  (CREA_BIN_DESTINATION_PATH "bin")
69
70   
71   IF(NOT CREA_LIBRARY_SOURCE_PATH)
72     MESSAGE(FATAL_ERROR "${MessageLibraryPath}  not found")
73   ENDIF(NOT CREA_LIBRARY_SOURCE_PATH)
74   
75   
76
77 ELSE(WIN32 AND NOT UNIX)
78 #  SET(CPACK_STRIP_FILES "bin/bbi")
79   SET(CPACK_SOURCE_STRIP_FILES "")
80 ENDIF(WIN32 AND NOT UNIX)
81 #SET(CPACK_PACKAGE_EXECUTABLES "TestWxGimmickDialog" "Gimmick!")
82   
83   
84
85 # Aditional INSTALL for CPACK mecanism.
86 IF (WIN32)
87
88         # tth
89         FILE(GLOB LST_FILE_TTH "${CREA_LIBRARY_SOURCE_PATH}/tth/*.*")
90         FOREACH( iLST  ${LST_FILE_TTH} )
91            INSTALL( 
92                  FILES ${iLST}
93                  DESTINATION bin/tth/
94            )
95         ENDFOREACH(iLST)        
96         
97          #DFCH -- INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_MIKATEX_LYBRARY}      DESTINATION ${CREA_BIN_DESTINATION_PATH} )
98         INSTALL(FILES ${${CMAKE_PROJECT_NAME}_BINARY_DIR}/Version.txt DESTINATION . )
99         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_BOOST_LYBRARY}  DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
100         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_GDCM_LYBRARY}   DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
101         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_ITK_LYBRARY}    DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
102         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_QT_LYBRARY}             DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
103         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_VTK_LYBRARY}    DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
104         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_WXWIN_LYBRARY}  DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
105         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_XERCES_LYBRARY} DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
106         INSTALL(DIRECTORY ${CREA_LIBRARY_SOURCE_PATH}\\\\${CREA_SQLITE_LYBRARY} DESTINATION ${CREA_LIBRARY_DESTINATION_PATH} )
107
108         
109          #DFCH -- SET(MIKTEX_INSTALL_DIR "$INSTDIR\\\\bin\\\\MiKTeX-2.9\\\\miktex\\\\bin")
110          #DFCH -- SET(CREATIS_THIRDPARTYLIBRARIES_DIRS ";${MIKTEX_INSTALL_DIR}")
111          SET(CREATPL_DIRBIN "$INSTDIR")
112          SET(CREATIS_THIRDPARTYLIBRARIES_DIRS ";") #DFCH
113
114         SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS  "        
115                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'TTH' '$INSTDIR\\\\bin\\\\tth' 
116
117                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'CREATIS_THIRDPARTYLIBRARIES_DIRS' '${CREATIS_THIRDPARTYLIBRARIES_DIRS}' 
118                 !define Install_ReadEnvStr_RegKey 'HKCU \\\"Environment\\\"'
119                 ReadRegStr $0 \\\${Install_ReadEnvStr_RegKey} 'PATH'            
120                 Push '$0;'
121                 Push '%CREATIS_THIRDPARTYLIBRARIES_DIRS%'
122                 Call StrStr
123                 Pop $2
124                 StrCmp $2 '' '' AddToPath_doneEED
125         StrCpy $0 \\\"$0;%CREATIS_THIRDPARTYLIBRARIES_DIRS%\\\"
126         WriteRegExpandStr \\\${Install_ReadEnvStr_RegKey} 'PATH' $0
127                 
128                 AddToPath_doneEED:
129                 
130                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'BOOST_ROOT' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_BOOST_LYBRARY}' 
131                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'GDCM_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_GDCM_LYBRARY}\\\\lib\\\\gdcm' 
132                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'ITK_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_ITK_LYBRARY}\\\\lib\\\\InsightToolkit' 
133                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'QTDIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_QT_LYBRARY}' 
134                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'VTK_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_VTK_LYBRARY}\\\\lib\\\\vtk-5.10' 
135                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'WXWIN' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_WXWIN_LYBRARY}' 
136                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'XERCES_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_XERCES_LYBRARY}' 
137                 WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'SQLITE_DIR' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_SQLITE_LYBRARY}' 
138                 #WriteRegStr HKLM 'SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment' 'KWWidgets_dir' '$INSTDIR\\\\${CREA_LIBRARY_DESTINATION_PATH}\\\\${CREA_KWWIDGETS_LYBRARY}\\\\lib\\\\KWWidgets' 
139
140                 CreateShortCut  '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Version.txt.lnk'  '${CREATPL_DIRBIN}\\\\Version.txt' 
141                 
142                 SendMessage \\\${HWND_BROADCAST} \\\${WM_WININICHANGE} 0 'STR:Environment' /TIMEOUT=5000 
143         ")
144                 
145                 
146         SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS  "
147         
148                             !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
149                         Delete '$SMPROGRAMS\\\\$MUI_TEMP\\\\Version.txt.lnk'
150                         
151                         StrCpy $MUI_TEMP '$SMPROGRAMS\\\\$MUI_TEMP'
152                         RMDir /r $MUI_TEMP
153
154                         !define Uninstall_EnvStr_RegKey 'HKLM \\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"'                 
155                         WriteRegExpandStr \\\${Uninstall_EnvStr_RegKey} 'CREATIS_THIRDPARTYLIBRARIES_DIRS' ''           
156                         SendMessage \\\${HWND_BROADCAST} \\\${WM_WININICHANGE} 0 'STR:Environment' /TIMEOUT=5000 
157                 ")
158         
159     INCLUDE(CPack)
160
161         
162 ENDIF (WIN32)
163
164
165