File: CMakeLists.txt

package info (click to toggle)
plplot 5.14.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 30,424 kB
  • sloc: ansic: 79,613; xml: 28,583; cpp: 20,037; ada: 19,456; tcl: 12,081; f90: 11,423; ml: 7,276; java: 6,863; python: 6,792; sh: 3,185; perl: 828; lisp: 75; makefile: 48; sed: 33; fortran: 5
file content (169 lines) | stat: -rw-r--r-- 5,996 bytes parent folder | download
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
# lib/qsastime/CMakeLists.txt for PLplot
# Copyright (C) 2009-2018 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

# Required to configure qsastimeP.h here and also for deciding whether
# to build test applications later.
option(
  TEST_QSASTIME
  "Build any of the provided libqsastime test applications."
  OFF
  )

configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/qsastimeP.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/qsastimeP.h
  )

configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/qsastimedll.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/qsastimedll.h
  )

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  )

# Routine for generating a header containing data to be used by the
# TAI-UTC transformation code.

if(NOT CMAKE_CROSSCOMPILING)
  add_executable(tai-utc-gen ${CMAKE_CURRENT_SOURCE_DIR}/tai-utc-gen.c)
  if(MATH_LIB)
    target_link_libraries(tai-utc-gen ${MATH_LIB})
  endif(MATH_LIB)
  add_executable(deltaT-gen ${CMAKE_CURRENT_SOURCE_DIR}/deltaT-gen.c ${CMAKE_CURRENT_SOURCE_DIR}/dspline.c)
  export(TARGETS tai-utc-gen FILE ${CMAKE_CURRENT_BINARY_DIR}/tai-utc-gen.cmake )
  export(TARGETS deltaT-gen FILE ${CMAKE_CURRENT_BINARY_DIR}/deltaT-gen.cmake )
else(NOT CMAKE_CROSSCOMPILING)
  # Generated by initial non-cross build above.
  include(${CMAKE_NATIVE_BINARY_DIR}/lib/qsastime/tai-utc-gen.cmake)
  include(${CMAKE_NATIVE_BINARY_DIR}/lib/qsastime/deltaT-gen.cmake)
endif(NOT CMAKE_CROSSCOMPILING)

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tai-utc.h
  COMMAND tai-utc-gen
  ${CMAKE_CURRENT_SOURCE_DIR}/tai-utc.dat
  ${CMAKE_CURRENT_BINARY_DIR}/tai-utc.h
  DEPENDS
  ${CMAKE_CURRENT_SOURCE_DIR}/tai-utc.dat
  tai-utc-gen
  )

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deltaT.h
  COMMAND deltaT-gen
  ${CMAKE_CURRENT_SOURCE_DIR}/deltaT.dat
  ${CMAKE_CURRENT_BINARY_DIR}/deltaT.h
  DEPENDS
  ${CMAKE_CURRENT_SOURCE_DIR}/deltaT.dat
  deltaT-gen
  )

# These target-level dependencies needed below.
add_custom_target(
  tai-utc.h_built
  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tai-utc.h
  )

add_custom_target(
  deltaT.h_built
  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/deltaT.h
  )

set(qsastime_LIB_SRCS
  qsastime.c dsplint.c
  )

configure_library_build(qsastime "" "${qsastime_LIB_SRCS}" "${MATH_LIB}")
add_dependencies(${WRITEABLE_TARGET}qsastime tai-utc.h_built deltaT.h_built)

set(qsastime_LIB_HDRS
  ${CMAKE_CURRENT_SOURCE_DIR}/qsastime.h
  ${CMAKE_CURRENT_BINARY_DIR}/qsastimedll.h
  )

install(FILES ${qsastime_LIB_HDRS} DESTINATION ${INCLUDE_DIR})

install(TARGETS ${WRITEABLE_TARGET}qsastime
  EXPORT export_plplot
  ARCHIVE DESTINATION ${LIB_DIR}
  LIBRARY DESTINATION ${LIB_DIR}
  RUNTIME DESTINATION ${BIN_DIR}
  )

# Build test routines if so desired.
if(TEST_QSASTIME)
  option(
    BUILD_QSASTIME_TESTLIB
    "Build qsastime_testlib application which is used to test the qsastime library against the C library time routines"
    OFF
    )
  # Don't bother with building qsastime_testlib on Windows because its
  # C library is incapable of providing useful time routines to act
  # as comparisons with qsastime library results.
  if(WIN32_OR_CYGWIN)
    set(BUILD_QSASTIME_TESTLIB OFF CACHE BOOL "Build qsastime_testlib application which is used to test the qsastime library against the C library time routines" FORCE)
  endif(WIN32_OR_CYGWIN)

  # qsastime_extra.[ch] provides helper functions for qsastime_test that should
  # not be part of the library.
  # Add in qsastime.c rather than use the library because don't want
  # to make the private library API visible.

  add_executable(qsastime_test qsastime_test.c qsastime_extra.c qsastime.c)
  add_dependencies(qsastime_test tai-utc.h_built)
  if(MATH_LIB)
    target_link_libraries(qsastime_test ${MATH_LIB})
  endif(MATH_LIB)

  # Routine for testing bhunt_search function in qsastime.c.
  add_executable(bhunt_search_test bhunt_search_test.c qsastime.c)
  add_dependencies(bhunt_search_test tai-utc.h_built)
  if(MATH_LIB)
    target_link_libraries(bhunt_search_test ${MATH_LIB})
  endif(MATH_LIB)

  # Routine for generating interpolated values for delta T (difference between
  # ephemeris time and GMT) on standard grid.
  # Add in dsplint.c rather than use the library because don't want
  # to make the private library API visible.
  add_executable(deltaT_test deltaT_test.c dsplint.c)
  add_dependencies(deltaT_test deltaT.h_built)

  # Routine for testing just the library functions against their library
  # inverses (to test self-consistency when such inverses exist) and also
  # equivalent C library routines.
  # N.B. the routine immediately errors out at run time if sizeof(time_t) < 8 or
  # sizeof(int) !=4.  The time_t constraint is because we want access to a large
  # C library date range to do the tests.  The int constraint is so we
  # emulate library results on 32-bit systems.
  # The test executable normally only passes these two criteria for
  # 64-bit platforms.
  # Add in qsastime.c rather than use the library because don't want
  # to make the private library API visible.

  if(BUILD_QSASTIME_TESTLIB)
    add_executable(qsastime_testlib qsastime_testlib.c qsastime.c)
    add_dependencies(qsastime_testlib tai-utc.h_built)
    if(MATH_LIB)
      target_link_libraries(qsastime_testlib ${MATH_LIB})
    endif(MATH_LIB)
  endif(BUILD_QSASTIME_TESTLIB)
endif(TEST_QSASTIME)