File: CMakeLists.txt

package info (click to toggle)
plplot 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,280 kB
  • ctags: 13,512
  • 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,210; makefile: 199; lisp: 75; sed: 25; fortran: 7
file content (289 lines) | stat: -rw-r--r-- 8,751 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# examples/tk/CMakeLists.txt
### Process this file with cmake to produce Makefile
###
# Copyright (C) 2006, 2007, 2008, 2009, 2010 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

# N.B. This file is used for both the core build (which installs the examples
# and optionally [depending on BUILD_TEST} builds them) and the installed
# examples build.  The core build has BUILD_TEST OFF or ON at user option
# and CORE_BUILD always ON.  The installed examples build always has
# BUILD_TEST ON and CORE_BUILD OFF.

set(tk_STRING_INDICES
  "00"
  "01"
  "02"
  "03"
  "04"
  "05"
  "06"
  "07"
  "08"
  "09"
  "10"
  "11"
  "12"
  "13"
  "14"
  "15"
  "16"
  "17"
  "18"
  "19"
  "20"
  "21"
  "22"
  "23"
  "24"
  "25"
  "26"
  "27"
  "28"
  "29"
  "30"
  "31"
  "33"
  )

set(tk_SRC_FILES
  README.tkdemos
  runAllDemos.tcl
  runExtendedDemos.tcl
  tkdemos.tcl
  )

# Copy files to the binary directory (if different) for generating tclIndex
# This ensures no files are created in the source tree.
set(tk_FILES)
foreach(_file ${tk_SRC_FILES})
  add_custom_command(
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}
    COMMAND ${CMAKE_COMMAND}
    -E copy_if_different
    ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
    ${CMAKE_CURRENT_BINARY_DIR}/${_file}
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
    )
  set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file})
endforeach(_file ${tk_SRC_FILES})

if(CORE_BUILD)
  set(tcl_EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/examples/tcl)
else(CORE_BUILD)
  set(tcl_EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/tcl)
endif(CORE_BUILD)

foreach(STRING_INDEX ${tk_STRING_INDICES})
  set(_file x${STRING_INDEX}.tcl)
  add_custom_command(
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}
    COMMAND ${CMAKE_COMMAND}
    -E copy_if_different
    ${tcl_EXAMPLES_DIR}/${_file}
    ${CMAKE_CURRENT_BINARY_DIR}/${_file}
    DEPENDS ${tcl_EXAMPLES_DIR}/${_file}
    )
  set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file})
endforeach(STRING_INDEX ${tk_STRING_INDICES})

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl
  COMMAND ${CMAKE_COMMAND}
  -E copy_if_different
  ${tcl_EXAMPLES_DIR}/plgrid.tcl
  ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl
  DEPENDS ${tcl_EXAMPLES_DIR}/plgrid.tcl
  )
set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl)

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex
  COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS}
  DEPENDS ${tk_FILES}
  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  )

add_custom_target(tclIndex_examples_tk ALL
  DEPENDS ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex
  )

set(tk_SRC)
if(ENABLE_tkX)
  list(APPEND tk_SRC xtk01.c)
endif(ENABLE_tkX)

# The third example is run using a configured shell script which invokes
# plserver so there is no source code to be compiled.

# The second and fourth Tk examples depend on Itk to work.
if(ENABLE_itkX)
  list(APPEND tk_SRC xtk02.c xtk04.c)
endif(ENABLE_itkX)

# The first, second, and fourth tk examples depend on configured bang
# scripts to work which depends directly on the executables, xtk01,
# xtk02, and xtk04.

# The third example is run with the configured shell script, tk03, which
# invokes plserver.

# plgrid is a configured shell script that runs the plgrid.tcl example
# (N.B., in the tcl directory) using plserver.

# plserver_standard_examples is a configured shell script that runs
# all the standard examples under plserver.
set(tk_SCRIPTS
  tk01
  tk03
  plgrid
  plserver_standard_examples
  wish_standard_examples
  )
# These examples depend on Itk to work.
if(ENABLE_itkX)
  list(APPEND tk_SCRIPTS 
    tk02
    tk04
    plserver_runAllDemos
    wish_runAllDemos
    )
endif(ENABLE_itkX)

if(BUILD_TEST)
  if(CORE_BUILD)
    include_directories(
      ${TCL_INCLUDE_PATH}
      ${TK_INCLUDE_PATH}
      ${CMAKE_SOURCE_DIR}/bindings/tcl
      ${CMAKE_SOURCE_DIR}/bindings/tk
      ${CMAKE_SOURCE_DIR}/include
      ${CMAKE_BINARY_DIR}/include
      )
  else(CORE_BUILD)
    include_directories(
      ${TCL_INCLUDE_PATH}
      ${TK_INCLUDE_PATH}
      ${INCLUDE_DIR}
      )
  endif(CORE_BUILD)

  set_property(GLOBAL PROPERTY TARGETS_examples_tk)
  foreach(TK_SRC_FILE ${tk_SRC})
    string(REGEX REPLACE ".c$" "" TK_EXE ${TK_SRC_FILE})
    add_executable(${TK_EXE} ${TK_SRC_FILE})
    if(BUILD_SHARED_LIBS AND CORE_BUILD)
      set_source_files_properties(${TK_SRC_FILE}
        PROPERTIES COMPILE_FLAGS "-DUSINGDLL" )
    endif(BUILD_SHARED_LIBS AND CORE_BUILD)
    target_link_libraries(${TK_EXE} plplottcltk_Main${LIB_TAG} plplottcltk${LIB_TAG} tclmatrix${LIB_TAG} plplot${LIB_TAG} ${TK_LIBRARY} ${TCL_LIBRARY} ${MATH_LIB})
    set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk ${TK_EXE})
  endforeach(TK_SRC_FILE ${tk_SRC})
  set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk tclIndex_examples_tk)

  # Provide locations for several tk-related targets that will be used
  # to configure the tk_SCRIPTS.

  # wish_standard_examples is a configured shell script that runs all
  # the standard examples under wish using a TEA-based approach.
  # pkgIndex_LOCATION is the directory where the relevant pkgIndex.tcl
  # file is located.  In the Plplotter package case two build-tree
  # locations must be given, and we use the pkgIndex_LOCATIONS variable
  # to configure that case.
  if(CORE_BUILD)
    set(pkgIndex_LOCATION ${CMAKE_BINARY_DIR}/bindings/tk)
    set(pkgIndex_LOCATIONS "${CMAKE_BINARY_DIR}/bindings/tk ${CMAKE_BINARY_DIR}/bindings/tk-x-plat")
  else(CORE_BUILD)
    set(pkgIndex_LOCATION ${DATA_DIR})
    set(pkgIndex_LOCATIONS ${DATA_DIR})
  endif(CORE_BUILD)

  foreach(tk_related_target xtk01 plserver xtk02 xtk04)
    if(TARGET ${tk_related_target})
      get_target_property(${tk_related_target}_LOCATION
	${tk_related_target} LOCATION
	)
    endif(TARGET ${tk_related_target})
  endforeach(tk_related_target xtk01 plserver xtk02 xtk04)

  # Configure the tk_SCRIPTS
  foreach(tk_SCRIPT ${tk_SCRIPTS})
    configure_file(
      ${CMAKE_CURRENT_SOURCE_DIR}/${tk_SCRIPT}.in 
      ${CMAKE_CURRENT_BINARY_DIR}/${tk_SCRIPT}
      @ONLY
      )
  endforeach(tk_SCRIPT ${tk_SCRIPTS})
endif(BUILD_TEST)

if(CORE_BUILD)
  # Provide install locations for several tk-related targets that will
  # be used to configure the tk_SCRIPTS used in the traditional
  # Makefile+pkg-config build system for the installed examples.
  foreach(tk_related_target xtk01 plserver xtk02 xtk04)
    if(tk_related_target STREQUAL "plserver")
      set(install_dir ${BIN_DIR})
    else(tk_related_target STREQUAL "plserver")
      set(install_dir ${DATA_DIR}/examples/tk)
    endif(tk_related_target STREQUAL "plserver")
    set(${tk_related_target}_LOCATION 
      ${install_dir}/${tk_related_target}${EXEEXT}
      )
  endforeach(tk_related_target xtk01 plserver xtk02 xtk04)

  foreach(tk_SCRIPT ${tk_SCRIPTS})
    # Configure and install the tk_SCRIPTS used for the traditional build.
    configure_file(
      ${CMAKE_CURRENT_SOURCE_DIR}/${tk_SCRIPT}.in 
      ${CMAKE_CURRENT_BINARY_DIR}/install_${tk_SCRIPT}
      @ONLY
      )
    install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/install_${tk_SCRIPT}
      DESTINATION ${DATA_DIR}/examples/tk
      RENAME ${tk_SCRIPT}
      )
    # install the template files used to configure tk_SCRIPTS for the
    # new installed examples build system.
    install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${tk_SCRIPT}.in
      DESTINATION ${DATA_DIR}/examples/tk
      )
  endforeach(tk_SCRIPT ${tk_SCRIPTS})
endif(CORE_BUILD)

if(CORE_BUILD)
  install(FILES ${tk_FILES} DESTINATION ${DATA_DIR}/examples/tk)

  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tclIndex DESTINATION ${DATA_DIR}/examples/tk)

  install(FILES ${tk_SRC} DESTINATION ${DATA_DIR}/examples/tk)

  set(CC ${CMAKE_C_COMPILER})

  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in
    ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples
    )

  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples
    DESTINATION ${DATA_DIR}/examples/tk
    RENAME Makefile
    )

  install(FILES CMakeLists.txt
    DESTINATION ${DATA_DIR}/examples/tk
    )
endif(CORE_BUILD)