1
# bindings/gnome2/python/CMakeLists.txt
2
### Process this file with cmake to produce Makefile
4
# Copyright (C) 2006 Alan W. Irwin
6
# This file is part of PLplot.
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.
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.
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
25
${PKG_CONFIG_EXECUTABLE}
26
pygtk-2.0 --variable=defsdir
27
OUTPUT_VARIABLE PYGTK_DEFS
28
OUTPUT_STRIP_TRAILING_WHITESPACE
30
#message("PYGTK_DEFS = ${PYGTK_DEFS}")
32
### Prepare gcwmodule_SRCS.
33
# Use sed to rename PLINT, PLFLT and PLUNICODE so that h2def.py knows what to do.
35
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcw.defs
36
COMMAND ${PYTHON_EXECUTABLE}
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
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
52
${CMAKE_CURRENT_SOURCE_DIR}/gcw.override
53
${CMAKE_CURRENT_BINARY_DIR}/gcw.defs
57
${CMAKE_CURRENT_BINARY_DIR}/gcw.c
60
### gcwmodule_SRCS is now prepared.
62
### Prepare cplplotcanvasmodule_SRCS
63
# First strip out visibility macros so h2def.py can interpret header file
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
69
${CMAKE_SOURCE_DIR}/include/plplotcanvas.h
71
# Use sed to rename PLINT, PLFLT and PLUNICODE so that h2def.py knows what to do.
73
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.defs
74
COMMAND ${PYTHON_EXECUTABLE}
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
80
${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_strip.h
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
95
${CMAKE_CURRENT_SOURCE_DIR}/cplplotcanvas.override
96
${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_strip.h
97
${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.defs
100
set(cplplotcanvasmodule_SRCS
101
${CMAKE_CURRENT_BINARY_DIR}/cplplotcanvas.c
102
cplplotcanvasmodule.c
104
### cplplotcanvasmodule_SRCS now prepared.
106
set_source_files_properties(
107
${gcwmodule_SRCS} ${cplplotcanvasmodule_SRCS}
108
PROPERTIES COMPILE_FLAGS
109
"${gcw_COMPILE_FLAGS} ${PYGCW_CFLAGS} -DUSINGDLL"
113
${CMAKE_SOURCE_DIR}/include
114
${CMAKE_SOURCE_DIR}/lib/qsastime
116
${CMAKE_BINARY_DIR}/include
117
${PYTHON_INCLUDE_PATH}
118
${NUMERIC_INCLUDE_PATH}
121
### Build and install the gcw module
122
add_library(gcwmodule MODULE ${gcwmodule_SRCS})
124
target_link_libraries(
127
plplotgnome2${LIB_TAG}
133
get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH)
134
set_target_properties(
138
INSTALL_RPATH "${LIB_INSTALL_RPATH}"
141
set_target_properties(
152
DESTINATION ${PYTHON_INSTDIR}
154
### gcw module has now been built and installed
156
### Build and install the cplplotcanvas module
157
add_library(cplplotcanvasmodule MODULE ${cplplotcanvasmodule_SRCS})
159
target_link_libraries(
162
plplotgnome2${LIB_TAG}
168
set_target_properties(
172
INSTALL_RPATH "${LIB_INSTALL_RPATH}"
175
set_target_properties(
183
TARGETS cplplotcanvasmodule
186
DESTINATION ${PYTHON_INSTDIR}
188
### cplplotcanvas module has now been built and installed
200
FILES plplotcanvas.py
201
DESTINATION ${PYTHON_INSTDIR}
204
# So pygcw will work in build tree.
205
if(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
207
${CMAKE_CURRENT_SOURCE_DIR}/plplotcanvas.py
208
${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas.py
211
endif(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")