~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/bindings/gnome2/python/CMakeLists.txt

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# bindings/gnome2/python/CMakeLists.txt
 
2
### Process this file with cmake to produce Makefile
 
3
###
 
4
# Copyright (C) 2006 Alan W. Irwin
 
5
#
 
6
# This file is part of PLplot.
 
7
#
 
8
# PLplot is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU Library General Public License as published
 
10
# by the Free Software Foundation; version 2 of the License.
 
11
#
 
12
# PLplot is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU Library General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU Library General Public License
 
18
# along with PLplot; if not, write to the Free Software
 
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 
20
 
 
21
if(ENABLE_pygcw)
 
22
 
 
23
  execute_process(
 
24
    COMMAND
 
25
    ${PKG_CONFIG_EXECUTABLE}
 
26
    pygtk-2.0 --variable=defsdir
 
27
    OUTPUT_VARIABLE PYGTK_DEFS
 
28
    OUTPUT_STRIP_TRAILING_WHITESPACE
 
29
    )
 
30
  #message("PYGTK_DEFS = ${PYGTK_DEFS}")
 
31
 
 
32
  ### Prepare gcwmodule_SRCS.
 
33
  # Use sed to rename PLINT, PLFLT and PLUNICODE so that h2def.py knows what to do.
 
34
  add_custom_command(
 
35
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcw.defs
 
36
    COMMAND ${PYTHON_EXECUTABLE}
 
37
    ${codegen}/h2def.py
 
38
    ${CMAKE_SOURCE_DIR}/include/gcw.h
 
39
    | sed -e s/PLINT/gint32/ -e s/PLFLT/double/ -e s/PLUNICODE/guint32/
 
40
    > ${CMAKE_CURRENT_BINARY_DIR}/gcw.defs
 
41
    )
 
42
 
 
43
  add_custom_command(
 
44
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcw.c
 
45
    COMMAND pygtk-codegen-2.0
 
46
    --prefix gcw --override 
 
47
    ${CMAKE_CURRENT_SOURCE_DIR}/gcw.override
 
48
    ${CMAKE_CURRENT_BINARY_DIR}/gcw.defs
 
49
    | sed -e s/\\"gcw_/\\"/ 
 
50
    > ${CMAKE_CURRENT_BINARY_DIR}/gcw.c
 
51
    DEPENDS
 
52
    ${CMAKE_CURRENT_SOURCE_DIR}/gcw.override
 
53
    ${CMAKE_CURRENT_BINARY_DIR}/gcw.defs
 
54
    )
 
55
 
 
56
  set(gcwmodule_SRCS
 
57
    ${CMAKE_CURRENT_BINARY_DIR}/gcw.c
 
58
    gcwmodule.c
 
59
    )
 
60
  ### gcwmodule_SRCS is now prepared.
 
61
 
 
62
  ### Prepare cplplotcanvasmodule_SRCS
 
63
  # First strip out visibility macros so h2def.py can interpret header file
 
64
  add_custom_command(
 
65
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_strip.h
 
66
    COMMAND sed -e s/PLDLLIMPEXP_GNOME2\ // ${CMAKE_SOURCE_DIR}/include/plplotcanvas.h
 
67
    > ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_strip.h
 
68
    DEPENDS 
 
69
    ${CMAKE_SOURCE_DIR}/include/plplotcanvas.h
 
70
    )
 
71
  # Use sed to rename PLINT, PLFLT and PLUNICODE so that h2def.py knows what to do.
 
72
  add_custom_command(
 
73
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.defs
 
74
    COMMAND ${PYTHON_EXECUTABLE}
 
75
    ${codegen}/h2def.py
 
76
    ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_strip.h
 
77
    | sed -e s/PLINT/gint32/ -e s/PLFLT/double/ -e s/PLUNICODE/guint32/
 
78
    > ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.defs
 
79
    DEPENDS 
 
80
    ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_strip.h
 
81
    )
 
82
 
 
83
  add_custom_command(
 
84
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cplplotcanvas.c
 
85
    COMMAND pygtk-codegen-2.0
 
86
    --prefix cplplotcanvas
 
87
    --register ${PYGTK_DEFS}/gdk.defs
 
88
    --register ${PYGTK_DEFS}/gtk.defs
 
89
    --register ${PYGTK_DEFS}/gnome.defs
 
90
    --register ${PYGTK_DEFS}/canvas.defs
 
91
    --override ${CMAKE_CURRENT_SOURCE_DIR}/cplplotcanvas.override
 
92
    ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.defs
 
93
    > ${CMAKE_CURRENT_BINARY_DIR}/cplplotcanvas.c
 
94
    DEPENDS 
 
95
    ${CMAKE_CURRENT_SOURCE_DIR}/cplplotcanvas.override
 
96
    ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_strip.h
 
97
    ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.defs
 
98
    )
 
99
 
 
100
  set(cplplotcanvasmodule_SRCS
 
101
    ${CMAKE_CURRENT_BINARY_DIR}/cplplotcanvas.c
 
102
    cplplotcanvasmodule.c
 
103
    )
 
104
  ### cplplotcanvasmodule_SRCS now prepared.
 
105
 
 
106
  set_source_files_properties(
 
107
    ${gcwmodule_SRCS} ${cplplotcanvasmodule_SRCS}
 
108
    PROPERTIES COMPILE_FLAGS 
 
109
    "${gcw_COMPILE_FLAGS} ${PYGCW_CFLAGS} -DUSINGDLL"
 
110
    )
 
111
 
 
112
  include_directories(
 
113
    ${CMAKE_SOURCE_DIR}/include
 
114
    ${CMAKE_SOURCE_DIR}/lib/qsastime
 
115
    ${CMAKE_BINARY_DIR}
 
116
    ${CMAKE_BINARY_DIR}/include
 
117
    ${PYTHON_INCLUDE_PATH}
 
118
    ${NUMERIC_INCLUDE_PATH}
 
119
    )
 
120
 
 
121
  ### Build and install the gcw module
 
122
  add_library(gcwmodule MODULE ${gcwmodule_SRCS})
 
123
 
 
124
  target_link_libraries(
 
125
    gcwmodule
 
126
    plplot${LIB_TAG}
 
127
    plplotgnome2${LIB_TAG}
 
128
    ${gcw_LINK_FLAGS}
 
129
    ${PYGCW_LIBS}
 
130
    )
 
131
 
 
132
  if(USE_RPATH)
 
133
    get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH)
 
134
    set_target_properties(
 
135
      gcwmodule
 
136
      PROPERTIES 
 
137
      PREFIX ""
 
138
      INSTALL_RPATH "${LIB_INSTALL_RPATH}"
 
139
      )
 
140
  else(USE_RPATH)
 
141
    set_target_properties(
 
142
      gcwmodule
 
143
      PROPERTIES 
 
144
      PREFIX ""
 
145
      )
 
146
  endif(USE_RPATH)
 
147
 
 
148
  install(
 
149
    TARGETS gcwmodule
 
150
    EXPORT export_plplot
 
151
    LIBRARY 
 
152
    DESTINATION ${PYTHON_INSTDIR}
 
153
    )
 
154
  ### gcw module has now been built and installed
 
155
 
 
156
  ### Build and install the cplplotcanvas module
 
157
  add_library(cplplotcanvasmodule MODULE ${cplplotcanvasmodule_SRCS})
 
158
 
 
159
  target_link_libraries(
 
160
    cplplotcanvasmodule
 
161
    plplot${LIB_TAG}
 
162
    plplotgnome2${LIB_TAG}
 
163
    ${gcw_LINK_FLAGS}
 
164
    ${PYGCW_LIBS}
 
165
    )
 
166
 
 
167
  if(USE_RPATH)
 
168
    set_target_properties(
 
169
      cplplotcanvasmodule
 
170
      PROPERTIES 
 
171
      PREFIX ""
 
172
      INSTALL_RPATH "${LIB_INSTALL_RPATH}"
 
173
      )
 
174
  else(USE_RPATH)
 
175
    set_target_properties(
 
176
      cplplotcanvasmodule
 
177
      PROPERTIES 
 
178
      PREFIX ""
 
179
      )
 
180
  endif(USE_RPATH)
 
181
 
 
182
  install(
 
183
    TARGETS cplplotcanvasmodule
 
184
    EXPORT export_plplot
 
185
    LIBRARY 
 
186
    DESTINATION ${PYTHON_INSTDIR}
 
187
    )
 
188
  ### cplplotcanvas module has now been built and installed
 
189
 
 
190
  set(PERM_SCRIPTS
 
191
    OWNER_READ
 
192
    OWNER_WRITE
 
193
    OWNER_EXECUTE
 
194
    GROUP_READ
 
195
    GROUP_EXECUTE
 
196
    WORLD_READ
 
197
    WORLD_EXECUTE
 
198
    )
 
199
  install(
 
200
    FILES plplotcanvas.py
 
201
    DESTINATION ${PYTHON_INSTDIR}
 
202
    )
 
203
 
 
204
  # So pygcw will work in build tree.
 
205
  if(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
 
206
    configure_file(
 
207
      ${CMAKE_CURRENT_SOURCE_DIR}/plplotcanvas.py
 
208
      ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.py
 
209
      COPYONLY
 
210
      )
 
211
  endif(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
 
212
 
 
213
endif(ENABLE_pygcw)