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 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742
|
# OpenSTA, Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required (VERSION 3.9)
project(STA VERSION 2.0.17)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules CACHE STRING "CMake module path")
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Disable compiler specific extensions like gnu++11.
set(CMAKE_CXX_EXTENSIONS OFF)
set(STA_HOME ${PROJECT_SOURCE_DIR})
message(STATUS "STA version: ${PROJECT_VERSION}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC STA_GIT_SHA1)
message(STATUS "STA git sha: ${STA_GIT_SHA1}")
# Default to bulding optimnized/release executable.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RELEASE)
endif()
# Compiler specific options.
# Note -Wno-deprecated-register is to suppress bison errors.
if (CMAKE_CXX_COMPILER_ID MATCHES AppleClang|Clang)
set(STA_COMPILE_OPTIONS -Wall -Wextra -pedantic -Wcast-qual -Wredundant-decls -Wformat-security -Wno-deprecated-register)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(STA_COMPILE_OPTIONS -Wall -Wextra -pedantic -Wcast-qual -Wredundant-decls -Wformat-security)
endif()
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build CXX_FLAGS: ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
message(STATUS "STA CXX_FLAGS: ${STA_COMPILE_OPTIONS}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
################################################################
#
# Source files.
#
################################################################
set(STA_SOURCE
app/StaMain.cc
app/TclInitVar.cc
app/StaApp_wrap.cc
dcalc/ArcDelayCalc.cc
dcalc/ArnoldiDelayCalc.cc
dcalc/ArnoldiReduce.cc
dcalc/DcalcAnalysisPt.cc
dcalc/DelayCalc.cc
dcalc/DmpCeff.cc
dcalc/DmpDelayCalc.cc
dcalc/GraphDelayCalc.cc
dcalc/GraphDelayCalc1.cc
dcalc/LumpedCapDelayCalc.cc
dcalc/NetCaps.cc
dcalc/RCDelayCalc.cc
dcalc/SimpleRCDelayCalc.cc
dcalc/UnitDelayCalc.cc
graph/DelayFloat.cc
graph/DelayNormal1.cc
graph/DelayNormal2.cc
graph/Graph.cc
graph/GraphCmp.cc
liberty/EquivCells.cc
liberty/FuncExpr.cc
liberty/InternalPower.cc
liberty/LeakagePower.cc
liberty/Liberty.cc
liberty/LibertyBuilder.cc
liberty/LibertyExpr.cc
liberty/LibertyExpr.hh
liberty/LibertyExprLex.cc
liberty/LibertyExprParse.cc
liberty/LibertyExprPvt.hh
liberty/LibertyLex.cc
liberty/LibertyParse.cc
liberty/LibertyParser.cc
liberty/LibertyReader.cc
liberty/LinearModel.cc
liberty/Sequential.cc
liberty/TableModel.cc
liberty/TimingArc.cc
liberty/TimingRole.cc
liberty/Transition.cc
liberty/Units.cc
liberty/Wireload.cc
network/ConcreteLibrary.cc
network/ConcreteNetwork.cc
network/HpinDrvrLoad.cc
network/Network.cc
network/NetworkCmp.cc
network/ParseBus.cc
network/PortDirection.cc
network/SdcNetwork.cc
network/VerilogNamespace.cc
parasitics/ConcreteParasitics.cc
parasitics/EstimateParasitics.cc
parasitics/NullParasitics.cc
parasitics/Parasitics.cc
parasitics/ReduceParasitics.cc
parasitics/SpefLex.cc
parasitics/SpefNamespace.cc
parasitics/SpefParse.cc
parasitics/SpefReader.cc
parasitics/SpefReaderPvt.hh
sdc/Clock.cc
sdc/ClockGatingCheck.cc
sdc/ClockGroups.cc
sdc/ClockInsertion.cc
sdc/ClockLatency.cc
sdc/CycleAccting.cc
sdc/DataCheck.cc
sdc/DeratingFactors.cc
sdc/DisabledPorts.cc
sdc/ExceptionPath.cc
sdc/InputDrive.cc
sdc/PinPair.cc
sdc/PortDelay.cc
sdc/PortExtCap.cc
sdc/RiseFallMinMax.cc
sdc/RiseFallValues.cc
sdc/Sdc.cc
sdc/SdcCmdComment.cc
sdc/WriteSdc.cc
sdf/ReportAnnotation.cc
sdf/SdfReader.cc
sdf/SdfParse.cc
sdf/SdfLex.cc
sdf/SdfWriter.cc
search/Bfs.cc
search/CheckMaxSkews.cc
search/CheckMinPeriods.cc
search/CheckMinPulseWidths.cc
search/CheckSlewLimits.cc
search/CheckTiming.cc
search/ClkInfo.cc
search/ClkSkew.cc
search/Corner.cc
search/Crpr.cc
search/FindRegister.cc
search/GatedClk.cc
search/Genclks.cc
search/Latches.cc
search/Levelize.cc
search/Path.cc
search/PathAnalysisPt.cc
search/PathEnd.cc
search/PathEnum.cc
search/PathEnumed.cc
search/PathExpanded.cc
search/PathGroup.cc
search/PathRef.cc
search/PathVertex.cc
search/PathVertexRep.cc
search/Power.cc
search/Property.cc
search/ReportPath.cc
search/Search.cc
search/SearchPred.cc
search/Sim.cc
search/Sta.cc
search/StaState.cc
search/Tag.cc
search/TagGroup.cc
search/VertexVisitor.cc
search/VisitPathEnds.cc
search/VisitPathGroupVertices.cc
search/WorstSlack.cc
search/WritePathSpice.cc
util/Debug.cc
util/DispatchQueue.cc
util/Error.cc
util/Fuzzy.cc
util/Hash.cc
util/Machine.cc
util/MinMax.cc
util/PatternMatch.cc
util/Report.cc
util/ReportStd.cc
util/ReportTcl.cc
util/Stats.cc
util/StringSeq.cc
util/StringSet.cc
util/StringUtil.cc
util/TokenParser.cc
verilog/VerilogReader.cc
verilog/VerilogLex.cc
verilog/VerilogParse.cc
verilog/VerilogWriter.cc
)
set(STA_HEADERS
app/StaMain.hh
dcalc/ArcDelayCalc.hh
dcalc/Arnoldi.hh
dcalc/ArnoldiDelayCalc.hh
dcalc/ArnoldiReduce.hh
dcalc/DelayCalc.hh
dcalc/DcalcAnalysisPt.hh
dcalc/DmpCeff.hh
dcalc/DmpDelayCalc.hh
dcalc/GraphDelayCalc.hh
dcalc/GraphDelayCalc1.hh
dcalc/LumpedCapDelayCalc.hh
dcalc/NetCaps.hh
dcalc/RCDelayCalc.hh
dcalc/SimpleRCDelayCalc.hh
dcalc/UnitDelayCalc.hh
graph/Delay.hh
graph/DelayFloat.hh
graph/DelayNormal1.hh
graph/DelayNormal2.hh
graph/Graph.hh
graph/GraphClass.hh
graph/GraphCmp.hh
liberty/EquivCells.hh
liberty/FuncExpr.hh
liberty/InternalPower.hh
liberty/LeakagePower.hh
liberty/Liberty.hh
liberty/LibertyBuilder.hh
liberty/LibertyClass.hh
liberty/LibertyParser.hh
liberty/LibertyReader.hh
liberty/LibertyReaderPvt.hh
liberty/LinearModel.hh
liberty/Sequential.hh
liberty/TableModel.hh
liberty/TimingArc.hh
liberty/TimingModel.hh
liberty/TimingRole.hh
liberty/Transition.hh
liberty/Units.hh
liberty/Wireload.hh
network/ConcreteLibrary.hh
network/ConcreteNetwork.hh
network/HpinDrvrLoad.hh
network/MakeConcreteNetwork.hh
network/Network.hh
network/NetworkClass.hh
network/NetworkCmp.hh
network/ParseBus.hh
network/PortDirection.hh
network/SdcNetwork.hh
network/VerilogNamespace.hh
parasitics/ConcreteParasitics.hh
parasitics/ConcreteParasiticsPvt.hh
parasitics/EstimateParasitics.hh
parasitics/MakeConcreteParasitics.hh
parasitics/NullParasitics.hh
parasitics/Parasitics.hh
parasitics/ParasiticsClass.hh
parasitics/ReduceParasitics.hh
parasitics/SpefNamespace.hh
parasitics/SpefReader.hh
sdc/Clock.hh
sdc/ClockGatingCheck.hh
sdc/ClockGroups.hh
sdc/ClockInsertion.hh
sdc/ClockLatency.hh
sdc/CycleAccting.hh
sdc/DataCheck.hh
sdc/DeratingFactors.hh
sdc/DisabledPorts.hh
sdc/ExceptionPath.hh
sdc/InputDrive.hh
sdc/MinMaxValues.hh
sdc/PinPair.hh
sdc/PortDelay.hh
sdc/PortExtCap.hh
sdc/RiseFallMinMax.hh
sdc/RiseFallValues.hh
sdc/Sdc.hh
sdc/SdcClass.hh
sdc/SdcCmdComment.hh
sdc/WriteSdc.hh
sdc/WriteSdcPvt.hh
sdf/ReportAnnotation.hh
sdf/Sdf.hh
sdf/SdfReader.hh
sdf/SdfWriter.hh
search/Bfs.hh
search/CheckMaxSkews.hh
search/CheckMinPeriods.hh
search/CheckMinPulseWidths.hh
search/CheckSlewLimits.hh
search/CheckTiming.hh
search/ClkInfo.hh
search/ClkSkew.hh
search/Corner.hh
search/Crpr.hh
search/FindRegister.hh
search/GatedClk.hh
search/Genclks.hh
search/Latches.hh
search/Levelize.hh
search/Path.hh
search/PathAnalysisPt.hh
search/PathEnd.hh
search/PathEnum.hh
search/PathEnumed.hh
search/PathExpanded.hh
search/PathRef.hh
search/PathGroup.hh
search/PathVertex.hh
search/PathVertexRep.hh
search/Power.hh
search/Property.hh
search/ReportPath.hh
search/Search.hh
search/SearchClass.hh
search/SearchPred.hh
search/Sim.hh
search/Sta.hh
search/StaState.hh
search/Tag.hh
search/TagGroup.hh
search/VertexVisitor.hh
search/VisitPathEnds.hh
search/VisitPathGroupVertices.hh
search/WorstSlack.hh
search/WritePathSpice.hh
util/Debug.hh
util/DispatchQueue.hh
util/DisallowCopyAssign.hh
util/EnumNameMap.hh
util/Error.hh
util/Fuzzy.hh
util/Hash.hh
util/HashSet.hh
util/Iterator.hh
util/Machine.hh
util/Map.hh
util/MinMax.hh
util/Mutex.hh
util/ObjectId.hh
util/ObjectTable.hh
util/PatternMatch.hh
util/Report.hh
util/ReportStd.hh
util/ReportTcl.hh
util/Set.hh
util/StaConfig.hh
util/Stats.hh
util/StringSeq.hh
util/StringSet.hh
util/StringUtil.hh
util/TokenParser.hh
util/UnorderedMap.hh
util/UnorderedSet.hh
util/Vector.hh
util/Zlib.hh
verilog/VerilogReaderPvt.hh
verilog/VerilogReader.hh
verilog/VerilogWriter.hh
)
# Source files.
set(STA_TCL_FILES
tcl/Util.tcl
tcl/Graph.tcl
tcl/Liberty.tcl
tcl/Link.tcl
tcl/Network.tcl
tcl/NetworkEdit.tcl
tcl/Sdc.tcl
tcl/Search.tcl
tcl/Cmds.tcl
tcl/Variables.tcl
tcl/Sta.tcl
tcl/Power.tcl
tcl/Splash.tcl
dcalc/DelayCalc.tcl
parasitics/Parasitics.tcl
sdf/Sdf.tcl
verilog/Verilog.tcl
)
set(STA_SWIG_FILES
tcl/NetworkEdit.i
tcl/StaException.i
sdf/Sdf.i
dcalc/DelayCalc.i
parasitics/Parasitics.i
verilog/Verilog.i
tcl/StaTcl.i
app/StaApp.i
)
################################################################
#
# Library dependencies
#
################################################################
# Zlib
include(FindZLIB)
# Translate cmake bool to StaConfig.h ifdef bool
if (ZLIB_FOUND)
set(ZLIB 1)
else()
set(ZLIB 0)
endif()
################################################################
#
# Locate CUDD bdd packagte
# -DCUDD=0 to not use CUDD.
# Look for library in CUDD/lib, CUDD/cudd/lib
# Look for header in CUDD/include, CUDD/cudd/include
#
if("${CUDD}" STREQUAL "" OR "${CUDD}" STREQUAL "0")
set(CUDD_INCLUDE "")
set(CUDD_LIB "")
set(CUDD_FOUND FALSE)
set(CUDD 0)
message(STATUS "CUDD library: not found")
else()
find_library(CUDD_LIB NAMES cudd PATHS ${CUDD}/lib ${CUDD}/lib/cudd)
if (CUDD_LIB)
message(STATUS "CUDD library: ${CUDD_LIB}")
get_filename_component(CUDD_LIB_DIR "${CUDD_LIB}" PATH)
get_filename_component(CUDD_LIB_PARENT1 "${CUDD_LIB_DIR}" PATH)
get_filename_component(CUDD_LIB_PARENT2 "${CUDD_LIB_PARENT1}" PATH)
find_file(CUDD_HEADER cudd.h
PATHS ${CUDD}/include ${CUDD_LIB_PARENT2}/include/cudd)
if (CUDD_HEADER)
get_filename_component(CUDD_INCLUDE "${CUDD_HEADER}" PATH)
message(STATUS "CUDD header: ${CUDD_HEADER}")
# CUDD referenced by StaConfig.hh.cmake
set(CUDD 1)
else()
message(STATUS "CUDD header: not found")
endif()
else()
set(CUDD_INCLUDE "")
set(CUDD_LIB "")
set(CUDD_FOUND FALSE)
set(CUDD 0)
message(STATUS "CUDD library: not found")
endif()
endif()
if("${SSTA}" STREQUAL "")
set(SSTA 0)
endif()
message(STATUS "SSTA: ${SSTA}")
# configure a header file to pass some of the CMake settins
configure_file(${STA_HOME}/util/StaConfig.hh.cmake
${STA_HOME}/util/StaConfig.hh
)
################################################################
#
# Locate TCL library.
#
# Note that the cmake findTcl module is hopeless for OSX
# because there doesn't appear to be a way to override
# searching OSX system directories before unix directories.
set(TCL_POSSIBLE_NAMES tcl87 tcl8.7
tcl86 tcl8.6
tcl85 tcl8.5
tcl84 tcl8.4
tcl83 tcl8.3
tcl82 tcl8.2
)
# tcl lib path guesses.
if (NOT TCL_LIB_PATHS)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(TCL_LIB_PATHS /usr/local/lib)
set(TCL_NO_DEFAULT_PATH TRUE)
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TCL_LIB_PATHS /usr/lib
/usr/local/lib
)
set(TCL_NO_DEFAULT_PATH FALSE)
endif()
if (NOT TCL_LIB)
# bagbiter cmake doesn't have a way to pass NO_DEFAULT_PATH as a parameter.
if (TCL_NO_DEFAULT_PATH)
find_library(TCL_LIB
NAMES tcl ${TCL_POSSIBLE_NAMES}
PATHS ${TCL_LIB_PATHS}
NO_DEFAULT_PATH
)
else()
find_library(TCL_LIB
NAMES tcl ${TCL_POSSIBLE_NAMES}
PATHS ${TCL_LIB_PATHS}
)
endif()
endif()
message(STATUS "TCL lib: ${TCL_LIB}")
get_filename_component(TCL_LIB_DIR "${TCL_LIB}" PATH)
get_filename_component(TCL_LIB_PARENT1 "${TCL_LIB_DIR}" PATH)
get_filename_component(TCL_LIB_PARENT2 "${TCL_LIB_PARENT1}" PATH)
# Locate tcl.h
if (NOT TCL_HEADER)
find_file(TCL_HEADER tcl.h
PATHS ${TCL_LIB_PARENT1} ${TCL_LIB_PARENT2}
PATH_SUFFIXES include include/tcl
NO_DEFAULT_PATH
)
endif()
message(STATUS "TCL header: ${TCL_HEADER}")
get_filename_component(TCL_HEADER_DIR "${TCL_HEADER}" PATH)
################################################################
#
# Flex/bison scanner/parsers
#
################################################################
find_package(FLEX)
find_package(BISON)
find_package(Readline REQUIRED)
# LibertyExpr scan/parse.
bison_target(LibertyExprParser liberty/LibertyExprParse.yy ${STA_HOME}/liberty/LibertyExprParse.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyExprParse.hh
COMPILE_FLAGS --name-prefix=LibertyExprParse_
)
flex_target(LibertyExprLex liberty/LibertyExprLex.ll ${STA_HOME}/liberty/LibertyExprLex.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyExprLex.hh
COMPILE_FLAGS --prefix=LibertyExprLex_
)
add_flex_bison_dependency(LibertyExprLex LibertyExprParser)
# Liberty scan/parse.
bison_target(LibertyParser liberty/LibertyParse.yy ${STA_HOME}/liberty/LibertyParse.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyParse.hh
COMPILE_FLAGS --name-prefix=LibertyParse_
)
flex_target(LibertyLex liberty/LibertyLex.ll ${STA_HOME}/liberty/LibertyLex.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyLex.hh
COMPILE_FLAGS --prefix=LibertyLex_
)
add_flex_bison_dependency(LibertyLex LibertyParser)
# Spef scan/parse.
bison_target(SpefParser parasitics/SpefParse.yy ${STA_HOME}/parasitics/SpefParse.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpefParse.hh
COMPILE_FLAGS --name-prefix=SpefParse_
)
flex_target(SpefLex parasitics/SpefLex.ll ${STA_HOME}/parasitics/SpefLex.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpefLex.hh
COMPILE_FLAGS --prefix=SpefLex_
)
add_flex_bison_dependency(SpefLex SpefParser)
# Verilog scan/parse.
bison_target(VerilogParser verilog/VerilogParse.yy ${STA_HOME}/verilog/VerilogParse.cc
DEFINES_FILE ${STA_HOME}/verilog/VerilogParse.hh
COMPILE_FLAGS --name-prefix=VerilogParse_
)
flex_target(VerilogLex verilog/VerilogLex.ll ${STA_HOME}/verilog/VerilogLex.cc
DEFINES_FILE ${STA_HOME}/verilog/VerilogLex.hh
COMPILE_FLAGS --prefix=VerilogLex_
)
add_flex_bison_dependency(VerilogLex VerilogParser)
# Sdf scan/parse.
bison_target(SdfParser sdf/SdfParse.yy ${STA_HOME}/sdf/SdfParse.cc
DEFINES_FILE ${STA_HOME}/sdf/SdfParse.hh
COMPILE_FLAGS --name-prefix=SdfParse_
)
flex_target(SdfLex sdf/SdfLex.ll ${STA_HOME}/sdf/SdfLex.cc
DEFINES_FILE ${STA_HOME}/sdf/SdfLex.hh
COMPILE_FLAGS --prefix=SdfLex_
)
add_flex_bison_dependency(SdfLex SdfParser)
################################################################
include(FindSWIG)
add_custom_command(OUTPUT ${STA_HOME}/app/StaApp_wrap.cc
COMMAND ${SWIG_EXECUTABLE} -tcl8 -c++ -namespace -prefix sta -I${STA_HOME}/tcl -I${STA_HOME}/sdf -I${STA_HOME}/dcalc -I${STA_HOME}/parasitics -I${STA_HOME}/verilog -o ${STA_HOME}/app/StaApp_wrap.cc ${STA_HOME}/app/StaApp.i
COMMAND ${STA_HOME}/etc/SwigCleanup.tcl ${STA_HOME}/app/StaApp_wrap.cc
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_SWIG_FILES}
)
################################################################
# TCL files included as part of the executable are shoved into TclInitVar.cc.
# These files are encoded and shipped as part of the executable
# so that they do not have to be installed on the client host.
add_custom_command(OUTPUT ${STA_HOME}/app/TclInitVar.cc
COMMAND etc/TclEncode.tcl app/TclInitVar.cc tcl_inits ${STA_TCL_FILES}
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_TCL_FILES} etc/TclEncode.tcl
)
################################################################
set(STA_INCLUDE_DIRS
app
dcalc
graph
liberty
network
parasitics
sdc
sdf
search
util
verilog
${TCL_HEADER_DIR}
${CUDD_INCLUDE}
)
###########################################################
# Library
###########################################################
# compatibility with configure
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${STA_HOME}/app)
add_library(OpenSTA ${STA_SOURCE})
target_include_directories(OpenSTA PUBLIC ${STA_INCLUDE_DIRS})
target_compile_features(OpenSTA
PUBLIC cxx_auto_type
)
target_compile_options(OpenSTA PUBLIC ${STA_COMPILE_OPTIONS})
###########################################################
# Executable
###########################################################
# compatibility with configure
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${STA_HOME}/app)
# Note executable and lib name cannot be the same because
# on osx something is case insensitive. Using STA for the
# lib name results in "No rule to make target ../depend.
add_executable(sta app/Main.cc)
target_link_libraries(sta
OpenSTA
${TCL_LIB}
${CUDD_LIB}
)
if (ZLIB_FOUND)
target_link_libraries(sta ${ZLIB_LIBRARIES})
endif()
target_link_libraries(sta ${Readline_LIBRARY})
message(STATUS "STA executable: ${STA_HOME}/app/sta")
# g++ std::thread apparently still needs -pthreads.
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(sta -pthread)
endif()
target_compile_options(sta PUBLIC ${STA_COMPILE_OPTIONS})
################################################################
# Install
# cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>
# executable
install(TARGETS sta DESTINATION bin)
# library
install(TARGETS OpenSTA DESTINATION lib)
# include
install(FILES ${STA_HEADERS} DESTINATION include)
################################################################
add_custom_target(tags etags -o TAGS ${STA_SOURCE} ${STA_HEADERS} ${STA_TCL_FILES} ${SWIG_TCL_FILES}
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_SOURCE} ${STA_HEADERS} ${STA_TCL_FILES} ${SWIG_TCL_FILES}
)
|