File: CMakeLists.txt

package info (click to toggle)
plplot 5.10.0%2Bdfsg2-0.4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 25,792 kB
  • ctags: 13,517
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,208; makefile: 210; lisp: 75; sed: 25; fortran: 7
file content (224 lines) | stat: -rw-r--r-- 7,382 bytes parent folder | download | duplicates (2)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# bindings/octave/CMakeLists.txt for PLplot
###
### Process this file with cmake to produce Makefile
###
# Copyright (C) 2006 Alan W. Irwin
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# PLplot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

# Build and install octave interface to PLplot and octave PLplot examples.
if(ENABLE_octave)

  add_subdirectory(PLplot)
  add_subdirectory(misc)

  # Install renamed documentation files.
  set(docfiles
    BUGS
    FGA
    INSTALL
    README
    ToDo
    USAGE
    )
  foreach(doc ${docfiles})
    install(FILES ${doc} DESTINATION ${DOC_DIR} RENAME ${doc}.octave)
  endforeach(doc ${docfiles})

  # This is a representative generated (or prebuilt) octave documentation file.
  # There are more than a hundred of these *.txt files.  If the (unlikely)
  # event that the plinit command is no longer part of the PLplot API, this
  # representative file would have to be changed.
  set(rep_doc plinit.txt)

  if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plplot_octave_txt/${rep_doc})
    # Octave documentation has been prebuilt in the (tarball) source tree.
    # Copy it to the build tree if that tree is different from source tree.
    if(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
      add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/${rep_doc}
	COMMAND ${CMAKE_COMMAND} -E copy_directory
	${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt
	${CMAKE_BINARY_DIR}/bindings/octave/plplot_octave_txt
	)
    endif(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
    set(make_documentation_DEPENDS
      ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/${rep_doc}
      )
  else(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plplot_octave_txt/${rep_doc})
    # Generate full on-line help for plplot_octave
    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt)
    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/plplot.doc
      COMMAND ${CMAKE_COMMAND} -E copy
      ${CMAKE_CURRENT_SOURCE_DIR}/etc/plplot.doc
      ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/plplot.doc
      DEPENDS
      ${CMAKE_CURRENT_SOURCE_DIR}/etc/plplot.doc
      )
    if(PERL_XML_DOM AND PERL_XML_PARSER)
      add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/${rep_doc}
	COMMAND ${PERL_EXECUTABLE}
	${CMAKE_SOURCE_DIR}/doc/docbook/bin/api2text.pl
	${CMAKE_SOURCE_DIR}/doc/docbook/src/plplotdoc.xml.in
	${CMAKE_SOURCE_DIR}/doc/docbook/src/api.xml
	DEPENDS 
	${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/plplot.doc
	${CMAKE_SOURCE_DIR}/doc/docbook/bin/api2text.pl
	${CMAKE_SOURCE_DIR}/doc/docbook/src/plplotdoc.xml.in
	${CMAKE_SOURCE_DIR}/doc/docbook/src/api.xml
	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt
	)
      
      set(make_documentation_DEPENDS
	${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/${rep_doc}
	)
    else(PERL_XML_DOM AND PERL_XML_PARSER)
      message(STATUS 
	"WARNING: Perl modules XML::Parser and/or XML::DOM not available\n"
	"   so cannot generate full online help for plplot_octave"
	)
      set(make_documentation_DEPENDS
	${CMAKE_CURRENT_BINARY_DIR}/plplot_octave_txt/plplot.doc
	)
    endif(PERL_XML_DOM AND PERL_XML_PARSER)
  endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plplot_octave_txt/${rep_doc})

  add_custom_target(
    make_documentation ALL
    DEPENDS ${make_documentation_DEPENDS}
    )

  # Configure source code for octave interface to PLplot.
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/plplot_octave.h.in
    ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave.h
    @ONLY
    )
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/octave_version.pl.in
    ${CMAKE_CURRENT_BINARY_DIR}/octave_version.pl
    @ONLY
    )
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/octaverc.in
    ${CMAKE_CURRENT_BINARY_DIR}/.octaverc
    @ONLY
    )

  # Build octave interface.
  add_custom_command(
    OUTPUT 
    ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m
    COMMAND ${CMAKE_COMMAND} -E copy
    ${CMAKE_CURRENT_SOURCE_DIR}/plplot_stub_hand_crafted.m
    ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m
    DEPENDS
    ${CMAKE_CURRENT_SOURCE_DIR}/plplot_stub_hand_crafted.m
    )

  add_custom_target(
    plplot_stub.m_built ALL
    DEPENDS
    ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m
    )

  set(octave_interface_INCLUDE_PATHS
    ${CMAKE_SOURCE_DIR}/include
    ${CMAKE_SOURCE_DIR}/lib/qsastime
    ${CMAKE_BINARY_DIR}
    ${CMAKE_BINARY_DIR}/include
    ${CMAKE_CURRENT_BINARY_DIR}
    ${OCTAVE_INCLUDE_PATH}
    ${CMAKE_SOURCE_DIR}/bindings/swig-support
    )
  include_directories(${octave_interface_INCLUDE_PATHS})
  set(CMAKE_SWIG_FLAGS -DSWIG_OCTAVE)
  set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})

  set_source_files_properties(plplot_octave.i 
    PROPERTIES 
    SWIG_MODULE_NAME plplot_octave
    CPLUSPLUS ON
    )

  set(SWIG_MODULE_plplot_octave_EXTRA_DEPS
    ${CMAKE_SOURCE_DIR}/bindings/swig-support/swig_documentation.i
    ${CMAKE_SOURCE_DIR}/bindings/swig-support/plplotcapi.i
    )

  # Set up swig + c wrapper.
  swig_add_module(plplot_octave octave plplot_octave.i)
  swig_link_libraries(
    plplot_octave 
    plplot${LIB_TAG}
    "${OCTAVE_LIBRARIES}"
    "${OCTINTERP_LIBRARIES}"
    )

  # Make sure plplot_stub.m is copied to build tree before plplot_octave
  # is created so can use plplot_octave in normal way.
  add_dependencies(plplot_octave plplot_stub.m_built)

  # Need access elsewhere (examples/octave) to the file depends of
  # this custom target.
  set_property(GLOBAL PROPERTY 
    FILES_plplot_stub.m_built
    ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m
    )

  install(FILES 
    ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m
    DESTINATION ${PLPLOT_OCTAVE_DIR}
    )

  if(USE_RPATH)
    get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH)
    # (Reasonable) assumption here is that OCTAVE_LIBRARIES and
    # OCTINTERP_LIBRARIES have the same path.
    get_filename_component(OCTAVE_INSTALL_RPATH "${OCTAVE_LIBRARIES}" PATH)
    set(LIB_INSTALL_RPATH ${LIB_INSTALL_RPATH} ${OCTAVE_INSTALL_RPATH})
    set_target_properties(
      plplot_octave
      PROPERTIES
      PREFIX "" 
      SUFFIX ".oct"
      INSTALL_RPATH "${LIB_INSTALL_RPATH}"
      INSTALL_NAME_DIR "${OCTAVE_OCT_DIR}"
      )
  else(USE_RPATH)
    set_target_properties(
      plplot_octave
      PROPERTIES
      PREFIX "" 
      SUFFIX ".oct"
      INSTALL_NAME_DIR "${OCTAVE_OCT_DIR}"
      )
  endif(USE_RPATH)

  # Have to be specific about permissions for some reason (probably
  # oct suffix).  Use SO_PERMISSIONS to be consistent with permissions
  # used for other shared objects created by the add_library command.

  install(TARGETS plplot_octave
    EXPORT export_plplot
    LIBRARY
    DESTINATION ${OCTAVE_OCT_DIR}
    PERMISSIONS ${SO_PERMISSIONS}
    )

endif(ENABLE_octave)