1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
|
# Macro to set the module prefix
macro(itk_wrap_modules_set_prefix)
if(EXTERNAL_WRAP_ITK_PROJECT)
set(module_prefix ${itk-module})
else()
set(module_prefix ITK)
endif()
endmacro()
###############################################################################
# the macros in charge of dispatching to the language specific macros
macro(itk_wrap_modules_all_generators)
#! if(${module_prefix}_WRAP_JAVA AND WRAPPER_LIBRARY_JAVA)
#! INIT_itk_wrap_module_java()
#! endif()
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_PYTHON)
itk_wrap_modules_python()
endif()
if(${module_prefix}_WRAP_TCL)
itk_wrap_modules_tcl()
endif()
if(${module_prefix}_WRAP_JAVA)
itk_wrap_modules_java()
endif()
if(${module_prefix}_WRAP_RUBY)
itk_wrap_modules_ruby()
endif()
endmacro()
macro(itk_end_wrap_modules_all_generators)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_PYTHON)
itk_end_wrap_modules_python()
endif()
if(${module_prefix}_WRAP_TCL)
itk_end_wrap_modules_tcl()
endif()
if(${module_prefix}_WRAP_JAVA)
itk_end_wrap_modules_java()
endif()
if(${module_prefix}_WRAP_RUBY)
itk_end_wrap_modules_ruby()
endif()
endmacro()
macro(itk_wrap_module_all_generators library_name)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_EXPLICIT)
itk_wrap_module_explicit("${library_name}")
endif()
if(${module_prefix}_WRAP_CASTXML)
itk_wrap_module_castxml("${library_name}")
endif()
if(${module_prefix}_WRAP_SWIGINTERFACE)
itk_wrap_module_swig_interface("${library_name}")
endif()
if(${module_prefix}_WRAP_DOC)
itk_wrap_module_DOC("${library_name}")
endif()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_wrap_module_python("${library_name}")
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_wrap_module_tcl("${library_name}")
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_wrap_module_ruby("${library_name}")
endif()
if(${module_prefix}_WRAP_JAVA AND WRAPPER_LIBRARY_JAVA)
itk_wrap_module_java("${library_name}")
endif()
endmacro()
macro(itk_end_wrap_module_all_generators)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_EXPLICIT)
itk_end_wrap_module_explicit()
endif()
if(${module_prefix}_WRAP_CASTXML)
itk_end_wrap_module_castxml()
endif()
if(${module_prefix}_WRAP_SWIGINTERFACE)
itk_end_wrap_module_swig_interface()
endif()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_end_wrap_module_python()
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_end_wrap_module_tcl()
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_end_wrap_module_ruby()
endif()
if(${module_prefix}_WRAP_JAVA AND WRAPPER_LIBRARY_JAVA)
itk_end_wrap_module_java()
endif()
if(${module_prefix}_WRAP_DOC)
itk_end_wrap_module_DOC()
endif()
endmacro()
macro(itk_wrap_submodule_all_generators module)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_EXPLICIT)
itk_wrap_submodule_explicit("${module}")
endif()
if(${module_prefix}_WRAP_CASTXML)
itk_wrap_submodule_castxml("${module}")
endif()
if(${module_prefix}_WRAP_SWIGINTERFACE)
itk_wrap_submodule_swig_interface("${module}")
endif()
if(${module_prefix}_WRAP_DOC)
itk_wrap_submodule_DOC("${module}")
endif()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_wrap_submodule_python("${module}")
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_wrap_submodule_tcl("${module}")
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_wrap_submodule_ruby("${module}")
endif()
if(${module_prefix}_WRAP_JAVA AND WRAPPER_LIBRARY_JAVA)
itk_wrap_submodule_java("${module}")
endif()
endmacro()
macro(itk_end_wrap_submodule_all_generators module)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_EXPLICIT)
itk_end_wrap_submodule_explicit("${module}")
endif()
if(${module_prefix}_WRAP_CASTXML)
itk_end_wrap_submodule_castxml("${module}")
endif()
if(${module_prefix}_WRAP_SWIGINTERFACE)
itk_end_wrap_submodule_swig_interface("${module}")
endif()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_end_wrap_submodule_python("${module}")
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_end_wrap_submodule_tcl("${module}")
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_end_wrap_submodule_ruby("${module}")
endif()
if(${module_prefix}_WRAP_JAVA AND WRAPPER_LIBRARY_JAVA)
itk_end_wrap_submodule_java("${module}")
endif()
if(${module_prefix}_WRAP_DOC)
itk_end_wrap_submodule_DOC()
endif()
endmacro()
macro(itk_wrap_class_all_generators class)
endmacro()
macro(itk_wrap_named_class_all_generators class swig_name)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_wrap_named_class_python("${class}" "${swig_name}")
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_wrap_named_class_tcl("${class}" "${swig_name}")
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_wrap_named_class_ruby("${class}" "${swig_name}")
endif()
if(${module_prefix}_WRAP_DOC)
itk_wrap_named_class_DOC("${class}" "${swig_name}")
endif()
endmacro()
macro(itk_end_wrap_class_all_generators)
endmacro()
macro(itk_wrap_simple_class_all_generators class)
endmacro()
macro(itk_wrap_named_simple_class_all_generators class)
endmacro()
macro(itk_wrap_include_all_generators inc)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_EXPLICIT)
itk_wrap_include_explicit("${inc}")
endif()
if(${module_prefix}_WRAP_CASTXML)
itk_wrap_include_castxml("${inc}")
endif()
if(${module_prefix}_WRAP_SWIGINTERFACE)
itk_wrap_include_swig_interface("${inc}")
endif()
endmacro()
macro(itk_wrap_template_all_generators name types)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_wrap_template_python("${name}" "${types}")
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_wrap_template_tcl("${name}" "${types}")
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_wrap_template_ruby("${name}" "${types}")
endif()
endmacro()
macro(itk_wrap_one_type_all_generators wrap_method wrap_class swig_name template_params)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_EXPLICIT)
itk_wrap_one_type_explicit("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
if(${module_prefix}_WRAP_CASTXML)
itk_wrap_one_type_castxml("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
if(${module_prefix}_WRAP_SWIGINTERFACE)
itk_wrap_one_type_swig_interface("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
if(${module_prefix}_WRAP_DOC)
itk_wrap_one_type_DOC("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_wrap_one_type_python("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_wrap_one_type_tcl("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_wrap_one_type_ruby("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
if(${module_prefix}_WRAP_JAVA AND WRAPPER_LIBRARY_JAVA)
itk_wrap_one_type_java("${wrap_method}" "${wrap_class}" "${swig_name}" "${template_params}")
endif()
endmacro()
macro(itk_wrap_simple_type_all_generators wrap_class swig_name)
itk_wrap_modules_set_prefix()
if(${module_prefix}_WRAP_CASTXML)
itk_wrap_simple_type_castxml("${wrap_class}" "${swig_name}")
endif()
if(${module_prefix}_WRAP_PYTHON AND WRAPPER_LIBRARY_PYTHON)
itk_wrap_simple_type_python("${wrap_class}" "${swig_name}")
endif()
if(${module_prefix}_WRAP_TCL AND WRAPPER_LIBRARY_TCL)
itk_wrap_simple_type_tcl("${wrap_class}" "${swig_name}")
endif()
if(${module_prefix}_WRAP_RUBY AND WRAPPER_LIBRARY_RUBY)
itk_wrap_simple_type_ruby("${wrap_class}" "${swig_name}")
endif()
if(${module_prefix}_WRAP_JAVA AND WRAPPER_LIBRARY_JAVA)
itk_wrap_simple_type_java("${wrap_class}" "${swig_name}")
endif()
endmacro()
###############################################################################
# ccache management. This option is shared by most of generators, so put it here.
option(ITK_USE_CCACHE "Use ccache to cache swig/castxml/... output and speedup the rebuild." OFF)
mark_as_advanced(ITK_USE_CCACHE)
if(ITK_USE_CCACHE)
find_program(CCACHE_EXECUTABLE NAMES ccache-swig ccache DOC "ccache executable.")
endif()
###############################################################################
# build the generators list
itk_wrap_modules_set_prefix()
if(EXTERNAL_WRAP_ITK_PROJECT)
# generators there have been turned on while building wrapitk
set(default OFF)
else()
if(DEFINED ITK_WRAP_GCCXML)
# Keep ITK_WRAP_GCCXML for backward compatibility.
set(${module_prefix}_WRAP_CASTXML "${ITK_WRAP_GCCXML}" CACHE STRING "Build xml files.")
else()
set(${module_prefix}_WRAP_CASTXML ON CACHE BOOL "Build xml files.")
endif()
option(${module_prefix}_WRAP_SWIGINTERFACE "Build swig interfaces." ON)
set(default OFF)
mark_as_advanced(${module_prefix}_WRAP_CASTXML ${module_prefix}_WRAP_SWIGINTERFACE)
endif()
set(WRAP_ITK_GENERATORS CACHE INTERNAL "Internal generators list.")
set(WRAP_ITK_UNUSED_GENERATORS CACHE INTERNAL "Internal unused generators list.")
file(GLOB local_files *)
# filter and reorder the list
set(generators )
foreach(f ${local_files})
file(RELATIVE_PATH lang "${CMAKE_CURRENT_SOURCE_DIR}" "${f}")
if(IS_DIRECTORY "${f}")
if("${lang}" MATCHES "^CastXML$|^SwigInterface$|^Doc$")
# put those generators before the others
set(generators ${lang} ${generators})
else()
list(APPEND generators ${lang})
endif()
endif()
endforeach()
foreach(lang ${generators})
string(TOUPPER "${lang}" lang_upper)
# add the language to the options
if(NOT DEFINED ${module_prefix}_WRAP_${lang_upper})
option(${module_prefix}_WRAP_${lang_upper} "Build swig ${lang} wrapper support." ${default})
endif()
# add the language to the list, if the user have turn it on, and include
# the subdirectory
if(${module_prefix}_WRAP_${lang_upper})
set(WRAP_ITK_GENERATORS ${WRAP_ITK_GENERATORS} "${lang}")
add_subdirectory("${lang}")
else()
set(WRAP_ITK_UNUSED_GENERATORS ${WRAP_ITK_UNUSED_GENERATORS} "${lang}")
endif()
endforeach()
mark_as_advanced(${module_prefix}_WRAP_EXPLICIT ${module_prefix}_WRAP_DOC)
set(WRAP_ITK_GENERATORS ${WRAP_ITK_GENERATORS} CACHE INTERNAL "Internal generators list.")
set(WRAP_ITK_UNUSED_GENERATORS ${WRAP_ITK_UNUSED_GENERATORS} CACHE INTERNAL "Internal unused generators list.")
# The include_directories are added here to be used by
# Wrapping/ConfigureWrapping.cmake
foreach(lang ${generators})
string(TOUPPER "${lang}" lang_upper)
if(${module_prefix}_WRAP_${lang_upper})
get_directory_property(inc DIRECTORY "${lang}" INCLUDE_DIRECTORIES)
include_directories(${inc})
endif()
endforeach()
|