summaryrefslogtreecommitdiffstats
path: root/Tests/Wrapping/CMakeLists.txt
blob: 7d9a4c67f326318247eb991c4aa44dff5161f2b5 (plain)
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
#
# Wrapping
#
cmake_minimum_required (VERSION 2.6)
project (Wrapping)

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

#
# Lib and exe path
#
set (LIBRARY_OUTPUT_PATH
  ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
  "Single output directory for building all libraries.")

set (EXECUTABLE_OUTPUT_PATH
  ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
  "Single output directory for building all executables.")

#
# Where will executable tests be written ?
#
if (EXECUTABLE_OUTPUT_PATH)
  set (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
else ()
  set (CXX_TEST_PATH .)
endif ()

#
# Add exe
#
add_executable (wrapping wrapping.cxx)

add_executable (Wrap Wrap.c)
if(WIN32)
  set(EXE_EXT ".exe")
endif()
set(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT})

#
# Qt Wrappers
#

set (QT_WRAP_CPP "On")
set (QT_MOC_EXE "echo")
include( FindQt3 )

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


  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/foo.ui.in
    ${CMAKE_CURRENT_BINARY_DIR}/foo.ui)

  set (QT_WRAP_UI "On")
  set (QT_UIC_EXE "${QT_UIC_EXECUTABLE}")


  set (QTUI_SRCS
    qtwrapping.ui
    ${CMAKE_CURRENT_BINARY_DIR}/foo.ui
    )
  qt_wrap_ui (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS})
  qt_wrap_cpp (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h)

  message("Qt files are ${QTUI_S_SRCS}")
  message("Qt other files are ${QTUI_H_SRCS}")
  add_definitions(${QT_DEFINITIONS})
  add_library(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS})
  add_executable (qtwrapping qtwrappingmain.cxx)
  target_link_libraries(qtwrapping myqtlib)

  target_link_libraries( qtwrapping ${QT_LIBRARIES} )
else ()
  add_executable (qtwrapping qtnoqtmain.cxx)
endif ()

#
# 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.
#
add_executable(fakefluid fakefluid.cxx)
set (FLTK_WRAP_UI "On")
set (FLTK_FLUID_EXECUTABLE fakefluid)
fltk_wrap_ui (wraplibFLTK fltk1.fl)
add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS})
add_dependencies(wraplibFLTK fakefluid)
add_dependencies(fakefluid Wrap)
fltk_wrap_ui (wrapFLTK fltk2.fl)
add_executable(wrapFLTK wrapFLTK.cxx ${wrapFLTK_FLTK_UI_SRCS})
target_link_libraries(wrapFLTK wraplibFLTK)
add_dependencies(wrapFLTK fakefluid)

#
# Mangled Mesa
#
configure_file(
  ${Wrapping_SOURCE_DIR}/dummy
  ${Wrapping_BINARY_DIR}/gl.h
  COPYONLY)
use_mangled_mesa (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa)