CMakeLists.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. #
  2. # Wrapping
  3. #
  4. PROJECT (Wrapping)
  5. # Disable cleaning of custom command outputs to preserve the hacks
  6. # used to generate the files using CONFIGURE_FILE.
  7. SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM 1)
  8. #
  9. # Lib and exe path
  10. #
  11. SET (LIBRARY_OUTPUT_PATH
  12. ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
  13. "Single output directory for building all libraries.")
  14. SET (EXECUTABLE_OUTPUT_PATH
  15. ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
  16. "Single output directory for building all executables.")
  17. #
  18. # Where will executable tests be written ?
  19. #
  20. IF (EXECUTABLE_OUTPUT_PATH)
  21. SET (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
  22. ELSE (EXECUTABLE_OUTPUT_PATH)
  23. SET (CXX_TEST_PATH .)
  24. ENDIF (EXECUTABLE_OUTPUT_PATH)
  25. #
  26. # Add exe
  27. #
  28. ADD_EXECUTABLE (wrapping wrapping.cxx)
  29. ADD_EXECUTABLE (Wrap Wrap.c)
  30. IF(WIN32)
  31. SET(EXE_EXT ".exe")
  32. ENDIF(WIN32)
  33. SET(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT})
  34. #
  35. # Test VTK wrappers
  36. #
  37. SET (SRCS
  38. vtkExcluded.cxx
  39. vtkIncluded.cxx
  40. )
  41. SET_SOURCE_FILES_PROPERTIES(vtkExcluded PROPERTIES WRAP_EXCLUDE 1)
  42. #
  43. # Specify (empty) VTK hint files
  44. #
  45. FIND_FILE(VTK_WRAP_HINTS hints ${Wrapping_SOURCE_DIR})
  46. #
  47. # Wrap VTK -> Tcl
  48. #
  49. SET (VTK_WRAP_TCL "On")
  50. SET (VTK_WRAP_TCL_EXE "${WRAP}")
  51. VTK_WRAP_TCL (wraplibTCL TCL_SRCS ${SRCS})
  52. ADD_CUSTOM_TARGET(wraplibTCL ALL
  53. ${CMAKE_COMMAND} -E echo "dummy target"
  54. )
  55. ADD_DEPENDENCIES(wraplibTCL Wrap)
  56. #
  57. # Wrap VTK -> Python
  58. #
  59. SET (VTK_WRAP_PYTHON "On")
  60. SET (VTK_WRAP_PYTHON_EXE "${WRAP}")
  61. VTK_WRAP_PYTHON (wraplibPython Python_SRCS ${SRCS})
  62. ADD_CUSTOM_TARGET(wraplibPython ALL
  63. ${CMAKE_COMMAND} -E echo "dummy target"
  64. )
  65. ADD_DEPENDENCIES(wraplibPython Wrap)
  66. #
  67. # Wrap VTK -> Java
  68. #
  69. # VTK_WRAP_JAVA puts dependencie between wraplibJavaJavaClasses (in ALL)
  70. # and each Java wrapped class (here, vtkIncluded, so let's create a dummy one
  71. # so that the build succeeds.
  72. #
  73. SET (VTK_WRAP_JAVA "On")
  74. SET (VTK_WRAP_JAVA_EXE "${WRAP}")
  75. SET (VTK_PARSE_JAVA_EXE "${WRAP}")
  76. SET (VTK_JAVA_HOME "${Wrapping_BINARY_DIR}/java")
  77. VTK_WRAP_JAVA (wraplibJava Java_SRCS ${SRCS})
  78. CONFIGURE_FILE(
  79. ${Wrapping_SOURCE_DIR}/dummy
  80. ${VTK_JAVA_HOME}/vtkIncluded.java
  81. COPYONLY IMMEDIATE)
  82. ADD_CUSTOM_TARGET(wraplibJava ALL
  83. ${CMAKE_COMMAND} -E echo "dummy target"
  84. )
  85. ADD_DEPENDENCIES(wraplibJava Wrap)
  86. #
  87. # QT Wrappers
  88. #
  89. SET (QT_WRAP_CPP "On")
  90. SET (QT_MOC_EXE "echo")
  91. INCLUDE( FindQt3 )
  92. IF (QT_FOUND AND QT_UIC_EXECUTABLE)
  93. INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
  94. INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
  95. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/foo.ui.in
  96. ${CMAKE_CURRENT_BINARY_DIR}/foo.ui IMMEDIATE)
  97. SET (QT_WRAP_UI "On")
  98. SET (QT_UIC_EXE "${QT_UIC_EXECUTABLE}")
  99. SET (QTUI_SRCS
  100. qtwrapping.ui
  101. ${CMAKE_CURRENT_BINARY_DIR}/foo.ui
  102. )
  103. QT_WRAP_UI (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS})
  104. QT_WRAP_CPP (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h)
  105. MESSAGE("QT files are ${QTUI_S_SRCS}")
  106. MESSAGE("QT other files are ${QTUI_H_SRCS}")
  107. ADD_DEFINITIONS(${QT_DEFINITIONS})
  108. ADD_LIBRARY(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS})
  109. ADD_EXECUTABLE (qtwrapping qtwrappingmain.cxx)
  110. TARGET_LINK_LIBRARIES(qtwrapping myqtlib)
  111. TARGET_LINK_LIBRARIES( qtwrapping ${QT_LIBRARIES} )
  112. ENDIF (QT_FOUND AND QT_UIC_EXECUTABLE)
  113. #
  114. # FLTK Wrappers
  115. #
  116. # Since FLTK_FLUID_EXE is supposed to create a .cxx/.h from a .fl/.fld,
  117. # create an empty one so that the dependencies can be met.
  118. #
  119. SET (FLTK_SRCS
  120. fltk1.fl
  121. )
  122. ADD_EXECUTABLE(fakefluid fakefluid.cxx)
  123. GET_TARGET_PROPERTY(FLUID_LOC fakefluid LOCATION)
  124. SET (FLTK_WRAP_UI "On")
  125. SET (FLTK_FLUID_EXECUTABLE "${FLUID_LOC}")
  126. FLTK_WRAP_UI (wraplibFLTK ${FLTK_SRCS})
  127. ADD_LIBRARY(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS})
  128. CONFIGURE_FILE(
  129. ${Wrapping_SOURCE_DIR}/fltk1.fl
  130. ${Wrapping_BINARY_DIR}/fltk1.cxx
  131. COPYONLY)
  132. ADD_DEPENDENCIES(wraplibFLTK fakefluid)
  133. ADD_DEPENDENCIES(fakefluid Wrap)
  134. #
  135. # Mangled Mesa
  136. #
  137. CONFIGURE_FILE(
  138. ${Wrapping_SOURCE_DIR}/dummy
  139. ${Wrapping_BINARY_DIR}/gl.h
  140. COPYONLY IMMEDIATE)
  141. USE_MANGLED_MESA (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa)
  142. #
  143. # Instantiator
  144. #
  145. VTK_MAKE_INSTANTIATOR(vtkWraplibInstantiator
  146. Instantiator_SRCS
  147. ${SRCS}
  148. EXPORT_MACRO VTK_WRAPLIB_EXPORT
  149. HEADER_LOCATION ${Wrapping_BINARY_DIR}
  150. GROUP_SIZE 5)