]> Creatis software - bbtk.git/blob - kernel/cmake/BBTKFindLibraries.cmake
*** empty log message ***
[bbtk.git] / kernel / cmake / BBTKFindLibraries.cmake
1 #-----------------------------------------------------------------------------
2 #OPTION(USE_VTK "Build VTK-based black boxes" OFF)
3 IF(USE_VTK)
4   # Search VTK
5   FIND_PACKAGE(VTK)
6   # If vtk found
7   IF(VTK_FOUND)
8     MESSAGE ( STATUS "VTK FOUND - VERSION = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
9     INCLUDE(${VTK_USE_FILE})
10     ADD_DEF( _USE_VTK_ )
11     SET(BBTK_VTK_LIBRARIES
12       #     vtkCommon 
13       vtkImaging  vtkGraphics vtkRendering vtkFiltering vtkCommon vtkWidgets
14       # LG : removed vtkIO because conflict with itktiff lib in ITKIO 
15       ) 
16     MARK_AS_ADVANCED(VTK_DIR)
17   ENDIF(VTK_FOUND)
18 ENDIF(USE_VTK)
19 #-----------------------------------------------------------------------------
20
21
22 #-----------------------------------------------------------------------------
23 #OPTION(USE_ITK "Build ITK-based black boxes" OFF)
24 IF(USE_ITK)
25   # Search ITK
26   FIND_PACKAGE(ITK)
27   # If itk found
28   IF(ITK_FOUND)
29      MESSAGE ( STATUS "ITK FOUND - VERSION = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
30     INCLUDE(${ITK_USE_FILE})
31     ADD_DEF( _USE_ITK_ )
32     SET(BBTK_ITK_LIBRARIES
33       ITKCommon ITKIO ITKBasicFilters ITKAlgorithms
34       )  
35     MARK_AS_ADVANCED(ITK_DIR)
36    # images compilation option 
37     OPTION ( itk_IMAGE_DIM_2 "itk : Compile 2D images" ON)
38     OPTION ( itk_IMAGE_DIM_3 "itk : Compile 3D images" ON)
39     OPTION ( itk_IMAGE_DIM_4 "itk : Compile 4D images" ON)
40     OPTION ( itk_IMAGE_TYPE_CHAR "itk : Compile char images" ON)
41     OPTION ( itk_IMAGE_TYPE_UCHAR "itk : Compile unsigned char images" ON)
42     OPTION ( itk_IMAGE_TYPE_SHORT "itk : Compile short images" ON)
43     OPTION ( itk_IMAGE_TYPE_USHORT "itk : Compile unsigned short images" ON)
44     OPTION ( itk_IMAGE_TYPE_INT "itk : Compile int images" ON)
45     OPTION ( itk_IMAGE_TYPE_UINT "itk : Compile unsigned int images" ON)
46     OPTION ( itk_IMAGE_TYPE_FLOAT "itk : Compile float images" ON)
47     OPTION ( itk_IMAGE_TYPE_DOUBLE "itk : Compile double images" ON)
48     
49     IF ( itk_IMAGE_DIM_2 ) 
50       ADD_DEF( BBTK_ITK_IMAGE_DIM_2 )
51     ENDIF ( itk_IMAGE_DIM_2 )
52     
53     IF ( itk_IMAGE_DIM_3 ) 
54       ADD_DEF( BBTK_ITK_IMAGE_DIM_3 )
55     ENDIF ( itk_IMAGE_DIM_3 )
56     
57     IF ( itk_IMAGE_DIM_4 ) 
58       ADD_DEF( BBTK_ITK_IMAGE_DIM_4 )
59     ENDIF ( itk_IMAGE_DIM_4 )
60
61     IF ( itk_IMAGE_TYPE_CHAR ) 
62       ADD_DEF( BBTK_ITK_IMAGE_TYPE_int8_t )
63     ENDIF ( itk_IMAGE_TYPE_CHAR )
64
65     IF ( itk_IMAGE_TYPE_UCHAR ) 
66       ADD_DEF( BBTK_ITK_IMAGE_TYPE_uint8_t )
67     ENDIF ( itk_IMAGE_TYPE_UCHAR )
68     
69     IF ( itk_IMAGE_TYPE_SHORT ) 
70       ADD_DEF( BBTK_ITK_IMAGE_TYPE_int16_t )
71     ENDIF ( itk_IMAGE_TYPE_SHORT )
72     
73     IF ( itk_IMAGE_TYPE_USHORT ) 
74       ADD_DEF( BBTK_ITK_IMAGE_TYPE_uint16_t )
75     ENDIF ( itk_IMAGE_TYPE_USHORT )
76     
77     IF ( itk_IMAGE_TYPE_INT ) 
78       ADD_DEF( BBTK_ITK_IMAGE_TYPE_int32_t )
79     ENDIF ( itk_IMAGE_TYPE_INT )
80     
81     IF ( itk_IMAGE_TYPE_UINT ) 
82       ADD_DEF( BBTK_ITK_IMAGE_TYPE_uint32_t )
83     ENDIF ( itk_IMAGE_TYPE_UINT )
84     
85     IF ( itk_IMAGE_TYPE_FLOAT ) 
86       ADD_DEF( BBTK_ITK_IMAGE_TYPE_float )
87     ENDIF ( itk_IMAGE_TYPE_FLOAT )
88     
89     IF ( itk_IMAGE_TYPE_DOUBLE ) 
90       ADD_DEF( BBTK_ITK_IMAGE_TYPE_double )
91     ENDIF ( itk_IMAGE_TYPE_DOUBLE )
92   ENDIF(ITK_FOUND)
93 ENDIF(USE_ITK)
94 #-----------------------------------------------------------------------------
95
96 #-----------------------------------------------------------------------------
97 #OPTION(USE_GDCM "Build GDCM-based black boxes" OFF)
98 IF(USE_GDCM)
99   # Search GDCM
100   FIND_PACKAGE(GDCM)
101   # If gdcm found
102   IF(GDCM_FOUND)
103     INCLUDE(${GDCM_USE_FILE})
104     ADD_DEF( _USE_GDCM_ )
105     
106     SET(BBTK_GDCM_LIBRARIES
107 # TO DO : USE GDCM LINK LIBRARIES !!!
108       libgdcm libgdcmjpeg8 libgdcmjpeg12libgdcmjpeg16
109       )
110   ENDIF(GDCM_FOUND)
111 ENDIF(USE_GDCM)
112 #-----------------------------------------------------------------------------
113
114 #-----------------------------------------------------------------------------
115 #OPTION(USE_WXWIDGETS "Build wxWidgets-based black boxes" OFF)
116 IF(USE_WXWIDGETS)
117
118 IF(WIN32)
119   # Search WXWIDGETS
120
121   #  WXWINDOWS_LIBRARY         = full path to the wxWindows library and linker flags on unix
122   #  CMAKE_WX_CXX_FLAGS        = compiler flags for building wxWindows 
123   #  WXWINDOWS_INCLUDE_PATH    = include path of wxWindows
124   SET(WXWINDOWS_USE_GL 1)
125
126   #wxWidgets build related stuff
127   SET(WXW_USE_DEBUG ON)
128   SET(WXW_USE_UNICODE OFF)
129   SET(WXW_USE_SHARED ON)
130   SET(WXW_USE_UNIV OFF)
131   SET(WXW_USE_MONO OFF)
132   SET(WXW_FILE_VERSION "28")
133   SET(WXW_VERSION "2.8")
134
135   #CMake Options
136   # Why forcing verbosity ?
137   # SET(CMAKE_VERBOSE_MAKEFILE TRUE)
138
139   INCLUDE (${BBTK_DIR}/BBTKFindWX_WIN.cmake)
140   #
141   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WXWIDGETS_CXX_FLAGS}")
142   SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}${WXWIDGETS_EXE_LINKER_FLAGS}")
143   ADD_DEFINITIONS( ${WXWIDGETS_DEFINITIONS}  )
144   #
145   INCLUDE_DIRECTORIES(${WXWIDGETS_INCLUDE_DIR})
146   LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} )
147   SET(THE_WXWIDGETS_LIBRARIES
148     ${WXWIDGETS_LIBRARIES}     
149     debug msvcrtd
150     debug msvcprtd
151     optimized msvcrt
152     optimized msvcprt
153     )
154 ENDIF(WIN32)
155 IF(UNIX)
156   # GTK2
157   INCLUDE(${BBTK_DIR}/BBTKFindGTK2.cmake)
158   INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
159   LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
160   LINK_LIBRARIES(${GTK2_LIBRARIES})
161   # WX
162   # LG : Do not force but use what is installed !
163   # SET(wxWidgets_USE_LIBS base core gl)
164   FIND_PACKAGE( wxWidgets REQUIRED) 
165   INCLUDE( ${wxWidgets_USE_FILE} )
166   MARK_AS_ADVANCED(wxWidgets_CONFIG_EXECUTABLE)
167   SET(THE_WXWIDGETS_LIBRARIES
168     ${GTK2_LIBRARIES}
169     ${wxWidgets_LIBRARIES}
170    )
171 ENDIF(UNIX)
172
173 ADD_DEF( _USE_WXWIDGETS_ )
174 SET(BBTK_WXWIDGETS_LIBRARIES
175   ${THE_WXWIDGETS_LIBRARIES}
176   )
177
178 ENDIF(USE_WXWIDGETS)
179 #-----------------------------------------------------------------------------
180
181
182
183 #-----------------------------------------------------------------------------
184 IF(USE_DOXYGEN) 
185   FIND_PACKAGE(Doxygen REQUIRED)
186 #  MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
187   #  IF(DOXYGEN)
188 #    
189 #  ELSE(DOXYGEN)
190 #    MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
191 #  ENDIF(DOXYGEN)
192 ENDIF(USE_DOXYGEN)
193 #-----------------------------------------------------------------------------
194
195
196 #-----------------------------------------------------------------------------
197 IF(USE_LATEX) 
198   FIND_PACKAGE(LATEX REQUIRED)
199   MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
200 ENDIF(USE_LATEX) 
201 #-----------------------------------------------------------------------------
202
203 #-----------------------------------------------------------------------------
204 IF(USE_TTH) 
205   FIND_FILE(LATEX_tth_CONVERTER NAME tth tth.exe PATHS . c:/Creatis/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux)
206   IF (NOT LATEX_tth_CONVERTER)
207     MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
208   ELSE (NOT LATEX_tth_CONVERTER)
209     MESSAGE(STATUS "Looking for tth... - found ${LATEX_tth_CONVERTER}")
210   ENDIF(NOT LATEX_tth_CONVERTER)
211   MARK_AS_ADVANCED(LATEX_tth_CONVERTER)
212 ENDIF(USE_TTH)
213 #-----------------------------------------------------------------------------