File size: 5,375 Bytes
5cdf637
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
include("openroad")

set(TEST_LIBS
  web
  odb
  utl_lib
  lodepng
  tst
  gui_descriptors
  GTest::gtest
  GTest::gtest_main
)

# A test that constructs a WebServer pulls in web.cpp.o, which references
# WebServer::initLogger() in web_serve.cpp, which in turn references
# gui::Gui::{get,setHeadlessViewer,setChartFactory}.  Compile the headless gui
# stub into those tests -- the Qt gui library would drag in the whole
# application -- mirroring the Bazel targets' gui_stub dependency.  `web`
# itself links only gui_descriptors, so nothing else defines these symbols and
# there is no clash in either a Qt or a non-Qt build.
#
# The stub's initGui() calls DescriptorRegistry::initDescriptors(), so the
# descriptor implementations come along too.  gui_descriptors deliberately
# holds only the registry, to keep these out of the web library; they compile
# without Qt here, as they do in the CLI-only gui library.
set(GUI_STUB_SRCS
  ${OPENROAD_HOME}/src/gui/src/stub.cpp
  ${OPENROAD_HOME}/src/gui/src/init_descriptors.cpp
  ${OPENROAD_HOME}/src/gui/src/dbDescriptors.cpp
  ${OPENROAD_HOME}/src/gui/src/staDescriptors.cpp
)

set(GUI_STUB_INCLUDES
  ${OPENROAD_HOME}/src/gui/src
  ${TCL_INCLUDE_PATH}
)

add_executable(TestTileGenerator TestTileGenerator.cpp)

target_link_libraries(TestTileGenerator ${TEST_LIBS})

target_include_directories(TestTileGenerator
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestTileGenerator
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestRequestHandler TestRequestHandler.cpp)

target_link_libraries(TestRequestHandler ${TEST_LIBS})

target_include_directories(TestRequestHandler
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestRequestHandler
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestSaveReport TestSaveReport.cpp ${GUI_STUB_SRCS})

target_link_libraries(TestSaveReport ${TEST_LIBS})

target_include_directories(TestSaveReport
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
    ${GUI_STUB_INCLUDES}
)

gtest_discover_tests(TestSaveReport
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestDebugGraphics TestDebugGraphics.cpp)

target_link_libraries(TestDebugGraphics ${TEST_LIBS})

target_include_directories(TestDebugGraphics
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestDebugGraphics
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestGlyphCache TestGlyphCache.cpp)

target_link_libraries(TestGlyphCache ${TEST_LIBS})

target_include_directories(TestGlyphCache
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestGlyphCache
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestClockTreeReport TestClockTreeReport.cpp)

target_link_libraries(TestClockTreeReport ${TEST_LIBS})

target_include_directories(TestClockTreeReport
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestClockTreeReport
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestSaveImage TestSaveImage.cpp)

target_link_libraries(TestSaveImage ${TEST_LIBS})

target_include_directories(TestSaveImage
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestSaveImage
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestSnap TestSnap.cpp)

target_link_libraries(TestSnap ${TEST_LIBS})

target_include_directories(TestSnap
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestSnap
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestTimingCone TestTimingCone.cpp)

target_link_libraries(TestTimingCone ${TEST_LIBS})

target_include_directories(TestTimingCone
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestTimingCone
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestCharts TestCharts.cpp)

target_link_libraries(TestCharts ${TEST_LIBS})

target_include_directories(TestCharts
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestCharts
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestLabels TestLabels.cpp)

target_link_libraries(TestLabels ${TEST_LIBS})

target_include_directories(TestLabels
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
)

gtest_discover_tests(TestLabels
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestSaveDisplayControls
  TestSaveDisplayControls.cpp
  ${GUI_STUB_SRCS}
)

target_link_libraries(TestSaveDisplayControls ${TEST_LIBS})

target_include_directories(TestSaveDisplayControls
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
    ${GUI_STUB_INCLUDES}
)

gtest_discover_tests(TestSaveDisplayControls
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_executable(TestGif TestGif.cpp ${GUI_STUB_SRCS})

target_link_libraries(TestGif ${TEST_LIBS})

target_include_directories(TestGif
  PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../../src
    ${GUI_STUB_INCLUDES}
)

gtest_discover_tests(TestGif
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_dependencies(build_and_test
  TestTileGenerator
  TestRequestHandler
  TestSaveReport
  TestDebugGraphics
  TestGlyphCache
  TestClockTreeReport
  TestSaveImage
  TestSnap
  TestTimingCone
  TestCharts
  TestLabels
  TestSaveDisplayControls
  TestGif
)