11# OpenSTA, Static Timing Analyzer
2- # Copyright (c) 2024 , Parallax Software, Inc.
2+ # Copyright (c) 2025 , Parallax Software, Inc.
33#
44# This program is free software: you can redistribute it and/or modify
55# it under the terms of the GNU General Public License as published by
1313#
1414# You should have received a copy of the GNU General Public License
1515# along with this program. If not, see <https://www.gnu.org/licenses/>.
16+ #
17+ # The origin of this software must not be misrepresented; you must not
18+ # claim that you wrote the original software.
19+ #
20+ # Altered source versions must be plainly marked as such, and must not be
21+ # misrepresented as being the original software.
22+ #
23+ # This notice may not be removed or altered from any source distribution.
1624
1725cmake_minimum_required (VERSION 3.10 )
1826if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
@@ -265,59 +273,60 @@ set(STA_TCL_FILES
265273find_package (FLEX )
266274find_package (BISON )
267275
276+ # Liberty scan/parse.
277+ flex_target (LibertyLex ${STA_HOME} /liberty/LibertyLex.ll
278+ ${CMAKE_CURRENT_BINARY_DIR} /LibertyLex.cc )
279+ bison_target (LibertyParse ${STA_HOME} /liberty/LibertyParse.yy
280+ ${CMAKE_CURRENT_BINARY_DIR} /LibertyParse.cc
281+ # centos7 bison 3.0.4 < 3.3.0 uses parser_class_name instead of api.parsr.class
282+ COMPILE_FLAGS "-Wno-deprecated" )
283+ add_flex_bison_dependency (LibertyLex LibertyParse )
284+
268285# LibertyExpr scan/parse.
269- flex_target (LibertyExprLex ${STA_HOME} /liberty/LibertyExprLex.ll ${CMAKE_CURRENT_BINARY_DIR} /LibertyExprLex.cc
286+ flex_target (LibertyExprLex ${STA_HOME} /liberty/LibertyExprLex.ll
287+ ${CMAKE_CURRENT_BINARY_DIR} /LibertyExprLex.cc
270288 COMPILE_FLAGS --prefix=LibertyExprLex_ )
271- bison_target (LibertyExprParser ${STA_HOME} /liberty/LibertyExprParse.yy ${CMAKE_CURRENT_BINARY_DIR} /LibertyExprParse.cc
289+ bison_target (LibertyExprParse ${STA_HOME} /liberty/LibertyExprParse.yy
290+ ${CMAKE_CURRENT_BINARY_DIR} /LibertyExprParse.cc
272291 COMPILE_FLAGS --name-prefix=LibertyExprParse_
273292 )
274- add_flex_bison_dependency (LibertyExprLex LibertyExprParser )
275-
276- # Liberty scan/parse.
277- flex_target (LibertyLex ${STA_HOME} /liberty/LibertyLex.ll ${CMAKE_CURRENT_BINARY_DIR} /LibertyLex.cc
278- COMPILE_FLAGS --prefix=LibertyLex_
279- )
280- bison_target (LibertyParser ${STA_HOME} /liberty/LibertyParse.yy ${CMAKE_CURRENT_BINARY_DIR} /LibertyParse.cc
281- COMPILE_FLAGS "--name-prefix=LibertyParse_ -v"
282- )
283- add_flex_bison_dependency (LibertyLex LibertyParser )
293+ add_flex_bison_dependency (LibertyExprLex LibertyExprParse )
284294
285295# Spef scan/parse.
286296flex_target (SpefLex ${STA_HOME} /parasitics/SpefLex.ll ${CMAKE_CURRENT_BINARY_DIR} /SpefLex.cc
287297 COMPILE_FLAGS --prefix=SpefLex_
288298 )
289- bison_target (SpefParser ${STA_HOME} /parasitics/SpefParse.yy ${CMAKE_CURRENT_BINARY_DIR} /SpefParse.cc
299+ bison_target (SpefParse ${STA_HOME} /parasitics/SpefParse.yy ${CMAKE_CURRENT_BINARY_DIR} /SpefParse.cc
290300 COMPILE_FLAGS --name-prefix=SpefParse_
291301 )
292- add_flex_bison_dependency (SpefLex SpefParser )
302+ add_flex_bison_dependency (SpefLex SpefParse )
293303
294304# Verilog scan/parse.
295- flex_target (VerilogLex ${STA_HOME} /verilog/VerilogLex.ll ${CMAKE_CURRENT_BINARY_DIR} /VerilogLex.cc
296- COMPILE_FLAGS --prefix=VerilogLex_
297- )
298- bison_target ( VerilogParser ${STA_HOME} /verilog/VerilogParse.yy ${CMAKE_CURRENT_BINARY_DIR} /VerilogParse.cc
299- COMPILE_FLAGS --name-prefix=VerilogParse_
300- )
301- add_flex_bison_dependency (VerilogLex VerilogParser )
305+ flex_target (VerilogLex ${STA_HOME} /verilog/VerilogLex.ll
306+ ${CMAKE_CURRENT_BINARY_DIR} /VerilogLex.cc )
307+ bison_target ( VerilogParse ${STA_HOME} /verilog/VerilogParse.yy
308+ ${CMAKE_CURRENT_BINARY_DIR} /VerilogParse.cc
309+ # centos7 bison 3.0.4 < 3.3.0 uses parser_class_name instead of api.parsr.class
310+ COMPILE_FLAGS "-Wno-deprecated" )
311+ add_flex_bison_dependency (VerilogLex VerilogParse )
302312
303313# Sdf scan/parse.
304- flex_target (SdfLex ${STA_HOME} /sdf/SdfLex.ll ${CMAKE_CURRENT_BINARY_DIR} /SdfLex.cc
305- COMPILE_FLAGS --prefix=SdfLex_
306- )
307- bison_target (SdfParser ${STA_HOME} /sdf/SdfParse.yy ${CMAKE_CURRENT_BINARY_DIR} /SdfParse.cc
308- COMPILE_FLAGS --name-prefix=SdfParse_
309- )
310- add_flex_bison_dependency (SdfLex SdfParser )
311-
314+ flex_target (SdfLex ${STA_HOME} /sdf/SdfLex.ll
315+ ${CMAKE_CURRENT_BINARY_DIR} /SdfLex.cc )
316+ bison_target (SdfParse ${STA_HOME} /sdf/SdfParse.yy
317+ ${CMAKE_CURRENT_BINARY_DIR} /SdfParse.cc
318+ # centos7 bison 3.0.4 < 3.3.0 uses parser_class_name instead of api.parsr.class
319+ COMPILE_FLAGS "-Wno-deprecated" )
320+ add_flex_bison_dependency (SdfLex SdfParse )
312321
313322# Saif scan/parse.
314323flex_target (SaifLex ${STA_HOME} /power/SaifLex.ll ${CMAKE_CURRENT_BINARY_DIR} /SaifLex.cc
315324 COMPILE_FLAGS --prefix=SaifLex_
316325 )
317- bison_target (SaifParser ${STA_HOME} /power/SaifParse.yy ${CMAKE_CURRENT_BINARY_DIR} /SaifParse.cc
326+ bison_target (SaifParse ${STA_HOME} /power/SaifParse.yy ${CMAKE_CURRENT_BINARY_DIR} /SaifParse.cc
318327 COMPILE_FLAGS --name-prefix=SaifParse_
319328 )
320- add_flex_bison_dependency (SaifLex SaifParser )
329+ add_flex_bison_dependency (SaifLex SaifParse )
321330
322331################################################################
323332
@@ -489,21 +498,21 @@ target_sources(OpenSTA
489498 ${STA_TCL_INIT}
490499
491500 ${FLEX_LibertyExprLex_OUTPUTS}
492- ${BISON_LibertyExprParser_OUTPUTS }
501+ ${BISON_LibertyExprParse_OUTPUTS }
493502 ${FLEX_LibertyLex_OUTPUTS}
494- ${BISON_LibertyParser_OUTPUTS }
503+ ${BISON_LibertyParse_OUTPUTS }
495504
496505 ${FLEX_SpefLex_OUTPUTS}
497- ${BISON_SpefParser_OUTPUTS }
506+ ${BISON_SpefParse_OUTPUTS }
498507
499508 ${FLEX_SdfLex_OUTPUTS}
500- ${BISON_SdfParser_OUTPUTS }
509+ ${BISON_SdfParse_OUTPUTS }
501510
502511 ${FLEX_VerilogLex_OUTPUTS}
503- ${BISON_VerilogParser_OUTPUTS }
512+ ${BISON_VerilogParse_OUTPUTS }
504513
505514 ${FLEX_SaifLex_OUTPUTS}
506- ${BISON_SaifParser_OUTPUTS }
515+ ${BISON_SaifParse_OUTPUTS }
507516)
508517
509518target_link_libraries (OpenSTA
@@ -521,11 +530,14 @@ target_include_directories(OpenSTA
521530 PUBLIC
522531 include
523532 ${TCL_INCLUDE_PATH}
533+ ${FLEX_INCLUDE_DIRS}
524534
525535 PRIVATE
526536 include /sta
527537 ${STA_HOME}
528538 ${CUDD_INCLUDE}
539+ # For flex to find location.hh
540+ ${CMAKE_CURRENT_BINARY_DIR}
529541 )
530542
531543if (TCL_READLINE)
0 commit comments