]> Creatis software - bbtk.git/blob - kernel/cmake/BBTKConfigurePackage2.cmake
#3391 BBTK Feature New Normal - PlugPackage.bat windows
[bbtk.git] / kernel / cmake / BBTKConfigurePackage2.cmake
1  # ---------------------------------------------------------------------
2  #
3  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4  #                        pour la SantÈ)
5  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8  #
9  #  This software is governed by the CeCILL-B license under French law and
10  #  abiding by the rules of distribution of free software. You can  use,
11  #  modify and/ or redistribute the software under the terms of the CeCILL-B
12  #  license as circulated by CEA, CNRS and INRIA at the following URL
13  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14  #  or in the file LICENSE.txt.
15  #
16  #  As a counterpart to the access to the source code and  rights to copy,
17  #  modify and redistribute granted by the license, users are provided only
18  #  with a limited warranty  and the software's author,  the holder of the
19  #  economic rights,  and the successive licensors  have only  limited
20  #  liability.
21  #
22  #  The fact that you are presently reading this means that you have had
23  #  knowledge of the CeCILL-B license and that you accept its terms.
24  # ------------------------------------------------------------------------ */
25
26
27 # ==================================
28 #           W A R N I N G !
29 # ==================================
30 #
31 # This file is a copy of BBTKConfigurePackage.cmake
32 #
33 # Only ONE commented out line differs
34 # :-(
35 # In case of modification, mind to modify BBTKConfigurePackage.cmake as well!
36 #
37
38 MESSAGE(STATUS "")
39 MESSAGE(STATUS "=======================================")
40 MESSAGE(STATUS "CONFIGURING BBTK PACKAGE ${BBTK_PACKAGE_NAME}")
41
42 #---------------------------------------------------------------------------
43 SET(${BBTK_PACKAGE_NAME}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
44 #---------------------------------------------------------------------------
45
46 #---------------------------------------------------------------------------
47 IF(NOT BBTK_CORE_PACKAGE)
48   #---------------------------------------------------------------------------
49   SET(BBTK_PACKAGE_LIBS 
50     ${BBTK_PACKAGE_LIBS}
51     ${BBTK_LIBRARIES})
52   MARK_AS_ADVANCED(BBTK_DIR)
53   #-------------------------------------------------------------------------
54   # If not a core package must include necessary cmake scripts
55   INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackagePaths.cmake)
56   INCLUDE(${BBTK_CMAKE_DIR}/BBTKBuildAllOption.cmake)
57   #  INCLUDE(${BBTK_CMAKE_DIR}/BBTKMacros.cmake)
58   
59 # ==================================
60 #           W A R N I N G !
61 # ==================================
62 #
63 # Hereafter is commented out line :
64   
65   #INCLUDE(${BBTK_CMAKE_DIR}/BBTKFindLibraries.cmake) # JPR
66   
67   #-------------------------------------------------------------------------
68   # Configure bbtk_config_build.xml.in for bbi to find the bbs
69   INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigureBbtkConfigXmlForBuildTree.cmake)
70   #------------------------------------------------------------------------- 
71   # WARNING : 
72   # FOR THE MOMENT ONLY ONE BBTK PACKAGE PER PROJECT ALLOWED!!!
73   # 
74   SET(${BBTK_PACKAGE_NAME}_BINARY_DIR  ${PROJECT_BINARY_DIR})
75   # ${CMAKE_CURRENT_BINARY_DIR})
76   #------------------------------------------------------------------------- 
77   #---------------------------------------------------------------------------
78   # CREATES THE bbtkPackage TEXT FILE
79   CONFIGURE_FILE(
80     ${BBTK_CMAKE_DIR}/bbtkPackage.in
81     ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/bbtkPackage
82     @ONLY
83     )
84   IF (WIN32)
85     CONFIGURE_FILE(
86                 ${BBTK_CMAKE_DIR}/PlugPackage.bat.in
87                 ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.bat
88                 COPYONLY
89     )
90     INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/bbtkPackage      DESTINATION  "." )
91     INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.bat  DESTINATION  "." )
92   ENDIF (WIN32)
93   #---------------------------------------------------------------------------
94 ELSE(NOT BBTK_CORE_PACKAGE)
95   SET(${BBTK_PACKAGE_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR})
96 ENDIF(NOT BBTK_CORE_PACKAGE)
97 #---------------------------------------------------------------------------
98
99
100
101
102
103 #----------------------------------------------------------------------------
104 # USER DEFINED ADDITIONAL INCLUDE DIRS
105 INCLUDE_DIRECTORIES(${${BBTK_PACKAGE_NAME}_INCLUDE_DIRS})
106 #----------------------------------------------------------------------------
107
108
109 #---------------------------------------------------------------------------
110 # Package dependencies
111 SET(${BBTK_PACKAGE_NAME}_DEPS bb${BBTK_PACKAGE_NAME})
112 STRING(REGEX MATCH "${${BBTK_PACKAGE_NAME}_DEPS}" 
113   ${BBTK_PACKAGE_NAME}_IN_DEPS
114   "${BBTK_PACKAGES_DEPS}")
115 #---------------------------------------------------------------------------
116 #SET(BBTK_PACKAGES_DEPS "" CACHE INTERNAL "bbtk packages dependencies" FORCE)
117
118
119
120 #----------------------------------------------------------------------------
121 # VARS CONFIGURED IN bbPackage.h AND IN doc/bbdoc/header.html.in
122 SET(BBTK_PACKAGE_AUTHOR        "${${BBTK_PACKAGE_NAME}_AUTHOR}")
123 SET(BBTK_PACKAGE_DESCRIPTION   "${${BBTK_PACKAGE_NAME}_DESCRIPTION}")
124 SET(BBTK_PACKAGE_MAJOR_VERSION ${${BBTK_PACKAGE_NAME}_MAJOR_VERSION})
125 SET(BBTK_PACKAGE_MINOR_VERSION ${${BBTK_PACKAGE_NAME}_MINOR_VERSION})
126 SET(BBTK_PACKAGE_BUILD_VERSION ${${BBTK_PACKAGE_NAME}_BUILD_VERSION})
127 SET(BBTK_PACKAGE_VERSION 
128   "\"${${BBTK_PACKAGE_NAME}_MAJOR_VERSION}.${${BBTK_PACKAGE_NAME}_MINOR_VERSION}.${${BBTK_PACKAGE_NAME}_BUILD_VERSION}\"")
129 #----------------------------------------------------------------------------
130
131
132 #---------------------------------------------------------------------------
133 # If package deps not in global deps : add them
134 IF(NOT ${BBTK_PACKAGE_NAME}_IN_DEPS)
135   SET(BBTK_PACKAGES_DEPS "${${BBTK_PACKAGE_NAME}_DEPS};${BBTK_PACKAGES_DEPS}"
136     CACHE INTERNAL "bbtk packages dependencies" FORCE)
137   #   MESSAGE(STATUS "Packages=${BBTK_PACKAGES_DEPS}")
138 ENDIF(NOT ${BBTK_PACKAGE_NAME}_IN_DEPS)
139 #---------------------------------------------------------------------------
140
141 #---------------------------------------------------------------------------
142 # Package dependencies
143 IF(${BBTK_PACKAGE_NAME}_USE_VTK)
144   SET(USE_VTK ON CACHE BOOL "Use VTK" FORCE)
145   SET(${BBTK_PACKAGE_NAME}_LIBS
146     ${${BBTK_PACKAGE_NAME}_LIBS}
147     ${VTK_LIBRARIES}
148     )
149 ENDIF(${BBTK_PACKAGE_NAME}_USE_VTK)
150
151 IF(${BBTK_PACKAGE_NAME}_USE_ITK)
152   SET(USE_ITK ON CACHE BOOL "Use ITK" FORCE)
153   SET(${BBTK_PACKAGE_NAME}_LIBS
154     ${${BBTK_PACKAGE_NAME}_LIBS}
155     ${ITK_LIBRARIES}
156     )
157 ENDIF(${BBTK_PACKAGE_NAME}_USE_ITK)
158
159 IF(${BBTK_PACKAGE_NAME}_USE_QT)
160   SET(USE_QT4 ON CACHE BOOL "Use QT" FORCE)
161   SET(${BBTK_PACKAGE_NAME}_LIBS
162     ${${BBTK_PACKAGE_NAME}_LIBS}
163     ${QT_LIBRARIES}
164     )
165 ENDIF(${BBTK_PACKAGE_NAME}_USE_QT)
166
167 #----------
168
169 IF(${BBTK_PACKAGE_NAME}_USE_GDCM)
170   SET(USE_GDCM ON CACHE BOOL "Use GDCM" )
171   SET(USE_GDCM2 OFF CACHE BOOL "Use GDCM2" )
172   SET(USE_GDCM_VTK ON CACHE BOOL "Use GDCM_VTK" FORCE)
173   SET(${BBTK_PACKAGE_NAME}_LIBS
174     ${${BBTK_PACKAGE_NAME}_LIBS}
175     ${GDCM_LIBRARIES}
176     )
177         IF(USE_GDCM)
178                 IF(USE_GDCM2)
179                 message(FATAL_ERROR "You cannot select both GDCM and GDCM2 (DICOM library readers)")
180                 ENDIF(USE_GDCM2)
181         ENDIF(USE_GDCM)
182 ENDIF(${BBTK_PACKAGE_NAME}_USE_GDCM)
183
184 #----------
185
186 IF(${BBTK_PACKAGE_NAME}_USE_GDCM2)
187   SET(USE_GDCM2 ON CACHE BOOL "Use GDCM2" FORCE)
188   SET(USE_GDCM2_VTK ON CACHE BOOL "Use GDCM2_VTK" FORCE)
189   SET(${BBTK_PACKAGE_NAME}_LIBS
190     ${${BBTK_PACKAGE_NAME}_LIBS}
191     ${GDCM2_LIBRARIES}
192     )
193         IF(USE_GDCM2)
194                 IF(USE_GDCM)
195                 message(FATAL_ERROR "You cannot select both GDCM and GDCM2 (DICOM library readers)")
196                 ENDIF(USE_GDCM)
197         ENDIF(USE_GDCM2)
198 ENDIF(${BBTK_PACKAGE_NAME}_USE_GDCM2)
199
200 #----------
201
202 IF(${BBTK_PACKAGE_NAME}_USE_GSMIS)
203   SET(USE_GSMIS ON CACHE BOOL "Use GSMIS" FORCE)
204   SET(${BBTK_PACKAGE_NAME}_LIBS
205     ${${BBTK_PACKAGE_NAME}_LIBS}
206     ${GSMIS_LIBRARIES}
207     )
208 ENDIF(${BBTK_PACKAGE_NAME}_USE_GSMIS)
209
210 IF(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS)
211   IF(BBTK_CORE_PACKAGE)
212     SET(BBTK_USE_WXWIDGETS ON CACHE BOOL "Use wxWidgets" FORCE)
213     MESSAGE(STATUS "BBTK_USE_WXWIDGETS forced to ON by the compilation of the package ${BBTK_PACKAGE_NAME}")
214     # bbtk already links against wx ...
215     IF(WIN32)
216       SET(${BBTK_PACKAGE_NAME}_LIBS
217         ${${BBTK_PACKAGE_NAME}_LIBS}
218         ${WXWIDGETS_LIBRARIES}
219         )
220     ENDIF(WIN32)
221   ELSE(BBTK_CORE_PACKAGE)
222     # If linking against a non-wx bbtk : problem
223     IF(NOT BBTK_BUILT_WITH_WX)
224       MESSAGE(FATAL_ERROR "The bbtk package ${BBTK_PACKAGE_NAME} needs wxWidgets however the bbtk library which was found on your system was not compiled with wxWidgets : recompile it and rebuild the package.")
225     ELSE(NOT BBTK_BUILT_WITH_WX)
226       SET(USE_WXWIDGETS ON CACHE BOOL "Use wxWidgets" FORCE)
227       # bbtk already links against wx ...
228       IF(WIN32)
229         SET(${BBTK_PACKAGE_NAME}_LIBS
230           ${${BBTK_PACKAGE_NAME}_LIBS}
231           ${WXWIDGETS_LIBRARIES}
232           )
233       ENDIF(WIN32)
234     ENDIF(NOT BBTK_BUILT_WITH_WX)
235   ENDIF(BBTK_CORE_PACKAGE)
236 ENDIF(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS)
237
238
239 #---------------------------------------------------------------------------
240
241 MESSAGE(STATUS "")
242 MESSAGE(STATUS "=======================================")
243 MESSAGE(STATUS "${BBTK_PACKAGE_NAME} link libraries:")
244 MESSAGE(STATUS "${${BBTK_PACKAGE_NAME}_LIBS}")
245 MESSAGE(STATUS "=======================================")
246 MESSAGE(STATUS "")
247
248 #---------------------------------------------------------------------------
249 # Recurse into ADD_SUBDIRECTORY
250 ADD_SUBDIRECTORY(src)
251 ADD_SUBDIRECTORY(doc)
252 ADD_SUBDIRECTORY(bbs)
253 ADD_SUBDIRECTORY(data)
254 #---------------------------------------------------------------------------
255
256 MESSAGE(STATUS "=======================================")
257 MESSAGE(STATUS "")
258
259 #-----------------------------------------------------------------------------
260 # EOF
261 #-----------------------------------------------------------------------------
262
263
264
265