CMakeLists.txt 2.61 KB
Newer Older
1
2
3
#
# Wrapping
#
Ken Martin's avatar
Ken Martin committed
4
cmake_minimum_required (VERSION 2.6)
5
project (Wrapping)
6

7
8
# Disable cleaning of custom command outputs to preserve the hacks
# used to generate the files using CONFIGURE_FILE.
9
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1)
10

11
12
13
#
# Lib and exe path
#
14
set (LIBRARY_OUTPUT_PATH
15
  ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
16
  "Single output directory for building all libraries.")
17

18
set (EXECUTABLE_OUTPUT_PATH
19
  ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
20
  "Single output directory for building all executables.")
21
22
23
24

#
# Where will executable tests be written ?
#
25
26
if (EXECUTABLE_OUTPUT_PATH)
  set (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
27
else ()
28
  set (CXX_TEST_PATH .)
29
endif ()
30

Sebastien Barre's avatar
Sebastien Barre committed
31
32
33
#
# Add exe
#
34
add_executable (wrapping wrapping.cxx)
35

36
37
38
add_executable (Wrap Wrap.c)
if(WIN32)
  set(EXE_EXT ".exe")
39
endif()
40
set(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT})
41

42
#
43
# Qt Wrappers
44
#
Franck Bettinger's avatar
Franck Bettinger committed
45

46
47
48
set (QT_WRAP_CPP "On")
set (QT_MOC_EXE "echo")
include( FindQt3 )
49

50
if (QT_FOUND AND QT_WRAP_UI)
51
  message("found Qt 3 test it...")
52
53
  include_directories( ${QT_INCLUDE_DIR} )
  include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
54

Franck Bettinger's avatar
Franck Bettinger committed
55

56
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/foo.ui.in
57
    ${CMAKE_CURRENT_BINARY_DIR}/foo.ui)
Franck Bettinger's avatar
Franck Bettinger committed
58

59
60
  set (QT_WRAP_UI "On")
  set (QT_UIC_EXE "${QT_UIC_EXECUTABLE}")
Andy Cedilnik's avatar
Andy Cedilnik committed
61
62


63
  set (QTUI_SRCS
64
65
66
    qtwrapping.ui
    ${CMAKE_CURRENT_BINARY_DIR}/foo.ui
    )
67
68
  qt_wrap_ui (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS})
  qt_wrap_cpp (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h)
69

70
71
  message("Qt files are ${QTUI_S_SRCS}")
  message("Qt other files are ${QTUI_H_SRCS}")
72
73
74
75
  add_definitions(${QT_DEFINITIONS})
  add_library(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS})
  add_executable (qtwrapping qtwrappingmain.cxx)
  target_link_libraries(qtwrapping myqtlib)
76

77
  target_link_libraries( qtwrapping ${QT_LIBRARIES} )
78
else ()
79
  add_executable (qtwrapping qtnoqtmain.cxx)
80
endif ()
81

82
83
84
85
86
87
#
# FLTK Wrappers
#
# Since FLTK_FLUID_EXE is supposed to create a .cxx/.h from a .fl/.fld,
# create an empty one so that the dependencies can be met.
#
88
89
add_executable(fakefluid fakefluid.cxx)
set (FLTK_WRAP_UI "On")
90
set (FLTK_FLUID_EXECUTABLE fakefluid)
91
fltk_wrap_ui (wraplibFLTK fltk1.fl)
92
93
94
add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS})
add_dependencies(wraplibFLTK fakefluid)
add_dependencies(fakefluid Wrap)
95
fltk_wrap_ui (wrapFLTK fltk2.fl)
96
add_executable(wrapFLTK wrapFLTK.cxx ${wrapFLTK_FLTK_UI_SRCS})
97
98
99
target_link_libraries(wrapFLTK wraplibFLTK)
add_dependencies(wrapFLTK fakefluid)

100
101
102
#
# Mangled Mesa
#
103
configure_file(
104
105
  ${Wrapping_SOURCE_DIR}/dummy
  ${Wrapping_BINARY_DIR}/gl.h
106
  COPYONLY)
107
use_mangled_mesa (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa)
108