<commit_before># 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/>.

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/src/cmake")

include("openroad")

if(USE_SYSTEM_OPENSTA)
  if(NOT OPENSTA_HOME)
    message(FATAL_ERROR "Please set external OPENSTA_HOME path.")
  endif()
else()
  set(OPENSTA_HOME ${PROJECT_SOURCE_DIR}/src/sta)
endif()

set(ODB_HOME ${PROJECT_SOURCE_DIR}/src/odb)
set(DBSTA_HOME ${PROJECT_SOURCE_DIR}/src/dbSta)
set(RESIZER_HOME ${PROJECT_SOURCE_DIR}/src/rsz)
set(PAD_HOME ${OPENROAD_HOME}/src/pad)

set(OPENROAD_SOURCE
  Design.cc
  Tech.cc
  OpenRoad.cc
  Main.cc
  )

if(USE_SYSTEM_BOOST)
  set(Boost_USE_STATIC_LIBS OFF)
else()
  set(Boost_USE_STATIC_LIBS ON)
endif()

if(USE_SYSTEM_OPENSTA)
  if(NOT OPENSTA_LIBRARY)
    find_library(OPENSTA_LIBRARY NAMES OpenSTA
                 PATHS
                 /usr/lib
                 /usr/lib64
                 /usr/local/lib
                 /usr/local/lib64)
    if(OPENSTA_LIBRARY)
      message(STATUS "Found OpenSTA: ${OPENSTA_LIBRARY}")
    else()
      message(FATAL_ERROR "OpenSTA not found, set the OPENSTA_LIBRARY manually.")
    endif()
  endif()
  if(NOT OPENSTA_INCLUDE_DIR)
    set(OPENSTA_INCLUDE_DIR "/usr/include/sta")
  endif()
  include_directories(${OPENSTA_INCLUDE_DIR})
  message(STATUS "Using OPENSTA_INCLUDE_DIR=${OPENSTA_INCLUDE_DIR}")
else()
  # local build of opensta
  set(OPENSTA_LIBRARY "sta_swig")
endif()

if(USE_SYSTEM_ABC)
  if(NOT ABC_LIBRARY)
    find_library(ABC_LIBRARY NAMES abc
                 PATHS
                 /usr/lib
                 /usr/lib64
                 /usr/local/lib
                 /usr/local/lib64)
    if(ABC_LIBRARY)
      message(STATUS "Found ABC: ${ABC_LIBRARY}")
      # make sure link dl symbols
      list(APPEND ABC_LIBRARY "dl")
    else()
      message(FATAL_ERROR "ABC not found, set the ABC_LIBRARY manually.")
    endif()
  endif()
  if(NOT ABC_INCLUDE_DIR)
    set(ABC_INCLUDE_DIR "/usr/include/abc")
  endif()
  add_definitions(-DABC_USE_STDINT_H=1)
  include_directories(${ABC_INCLUDE_DIR})
  message(STATUS "Using ABC_INCLUDE_DIR=${ABC_INCLUDE_DIR}")
else()
  # local build of abc
  set(ABC_LIBRARY "libabc")
endif()

################################################################

# OSX tcl is deprecated and prints a warning, so look for a user installed
# version before using the system version.
# I tried to override the library search order instead but failed.
# CMAKE_FIND_FRAMEWORK LAST bypasses the version in the framework directory
# but not the one in /usr/lib.
# This calls cmake/FindTCL.cmake
# Do not use REQUIRED because it also requires TK.
find_package(TCL)

# check for tclReadline
set(TCL_READLINE_POSSIBLE_NAMES tclreadline-2.1.0
    tclreadline-2.3.2 tclreadline-2.3.6 tclreadline-2.3.7 tclreadline-2.3.8
    )
find_library(TCL_READLINE_LIBRARY
  NAMES tclreadline ${TCL_READLINE_POSSIBLE_NAMES}
  PATHS ${TCL_LIB_PATHS}
  )
if (TCL_READLINE_LIBRARY)
  message(STATUS "TCL readline library: ${TCL_READLINE_LIBRARY}")
endif()

find_path(TCL_READLINE_H tclreadline.h)
if (TCL_READLINE_H)
  message(STATUS "TCL readline header: ${TCL_READLINE_H}")
endif()

option(BUILD_TCLX "Build with tclX included" ON)
if (BUILD_TCLX AND TCLX_LIBRARY)
  message(STATUS "TclX library: ${TCLX_LIBRARY}")
endif()
if (BUILD_TCLX AND TCLX_H)
  message(STATUS "TclX header: ${TCLX_H}")
endif()

find_package(SWIG 3.0 REQUIRED)
include(UseSWIG)

find_package(Boost REQUIRED)
find_package(Python3 COMPONENTS Development REQUIRED)
option(BUILD_PYTHON "Build the Python3 interface" ON)

option(ALLOW_WARNINGS "Flag to allow compilation with compiler warnings: on by default" ON)
if (NOT ALLOW_WARNINGS)
  add_compile_options(
    $<$<CXX_COMPILER_ID:GNU>:-Werror>
  )
endif()

add_compile_options(
  -Wall
  -Wredundant-decls
  -Wformat-security<commit_msg>Print boost version during cmake<commit_after># 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/>.

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/src/cmake")

include("openroad")

if(USE_SYSTEM_OPENSTA)
  if(NOT OPENSTA_HOME)
    message(FATAL_ERROR "Please set external OPENSTA_HOME path.")
  endif()
else()
  set(OPENSTA_HOME ${PROJECT_SOURCE_DIR}/src/sta)
endif()

set(ODB_HOME ${PROJECT_SOURCE_DIR}/src/odb)
set(DBSTA_HOME ${PROJECT_SOURCE_DIR}/src/dbSta)
set(RESIZER_HOME ${PROJECT_SOURCE_DIR}/src/rsz)
set(PAD_HOME ${OPENROAD_HOME}/src/pad)

set(OPENROAD_SOURCE
  Design.cc
  Tech.cc
  OpenRoad.cc
  Main.cc
  )

if(USE_SYSTEM_BOOST)
  set(Boost_USE_STATIC_LIBS OFF)
else()
  set(Boost_USE_STATIC_LIBS ON)
endif()

if(USE_SYSTEM_OPENSTA)
  if(NOT OPENSTA_LIBRARY)
    find_library(OPENSTA_LIBRARY NAMES OpenSTA
                 PATHS
                 /usr/lib
                 /usr/lib64
                 /usr/local/lib
                 /usr/local/lib64)
    if(OPENSTA_LIBRARY)
      message(STATUS "Found OpenSTA: ${OPENSTA_LIBRARY}")
    else()
      message(FATAL_ERROR "OpenSTA not found, set the OPENSTA_LIBRARY manually.")
    endif()
  endif()
  if(NOT OPENSTA_INCLUDE_DIR)
    set(OPENSTA_INCLUDE_DIR "/usr/include/sta")
  endif()
  include_directories(${OPENSTA_INCLUDE_DIR})
  message(STATUS "Using OPENSTA_INCLUDE_DIR=${OPENSTA_INCLUDE_DIR}")
else()
  # local build of opensta
  set(OPENSTA_LIBRARY "sta_swig")
endif()

if(USE_SYSTEM_ABC)
  if(NOT ABC_LIBRARY)
    find_library(ABC_LIBRARY NAMES abc
                 PATHS
                 /usr/lib
                 /usr/lib64
                 /usr/local/lib
                 /usr/local/lib64)
    if(ABC_LIBRARY)
      message(STATUS "Found ABC: ${ABC_LIBRARY}")
      # make sure link dl symbols
      list(APPEND ABC_LIBRARY "dl")
    else()
      message(FATAL_ERROR "ABC not found, set the ABC_LIBRARY manually.")
    endif()
  endif()
  if(NOT ABC_INCLUDE_DIR)
    set(ABC_INCLUDE_DIR "/usr/include/abc")
  endif()
  add_definitions(-DABC_USE_STDINT_H=1)
  include_directories(${ABC_INCLUDE_DIR})
  message(STATUS "Using ABC_INCLUDE_DIR=${ABC_INCLUDE_DIR}")
else()
  # local build of abc
  set(ABC_LIBRARY "libabc")
endif()

################################################################

# OSX tcl is deprecated and prints a warning, so look for a user installed
# version before using the system version.
# I tried to override the library search order instead but failed.
# CMAKE_FIND_FRAMEWORK LAST bypasses the version in the framework directory
# but not the one in /usr/lib.
# This calls cmake/FindTCL.cmake
# Do not use REQUIRED because it also requires TK.
find_package(TCL)

# check for tclReadline
set(TCL_READLINE_POSSIBLE_NAMES tclreadline-2.1.0
    tclreadline-2.3.2 tclreadline-2.3.6 tclreadline-2.3.7 tclreadline-2.3.8
    )
find_library(TCL_READLINE_LIBRARY
  NAMES tclreadline ${TCL_READLINE_POSSIBLE_NAMES}
  PATHS ${TCL_LIB_PATHS}
  )
if (TCL_READLINE_LIBRARY)
  message(STATUS "TCL readline library: ${TCL_READLINE_LIBRARY}")
endif()

find_path(TCL_READLINE_H tclreadline.h)
if (TCL_READLINE_H)
  message(STATUS "TCL readline header: ${TCL_READLINE_H}")
endif()

option(BUILD_TCLX "Build with tclX included" ON)
if (BUILD_TCLX AND TCLX_LIBRARY)
  message(STATUS "TclX library: ${TCLX_LIBRARY}")
endif()
if (BUILD_TCLX AND TCLX_H)
  message(STATUS "TclX header: ${TCLX_H}")
endif()

find_package(SWIG 3.0 REQUIRED)
include(UseSWIG)

find_package(Boost REQUIRED)
message(STATUS "boost: ${Boost_VERSION}")
find_package(Python3 COMPONENTS Development REQUIRED)
option(BUILD_PYTHON "Build the Python3 interface" ON)

option(ALLOW_WARNINGS "Flag to allow compilation with compiler warnings: on by default" ON)
if (NOT ALLOW_WARNINGS)
  add_compile_options(
    $<$<CXX_COMPILER_ID:GNU>:-Werror>
  )
endif()

add_compile_options(
  -Wall
  -Wredundant-decls
  -Wformat-security
{'fraction_non_alphanumeric': 0.10790324378553115, 'fraction_numerical': 0.0073570393490134875, 'mean_word_length': 4.121004566210046, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2712925', 'n_tokens_mistral': 3305, 'n_tokens_neox': 3075, 'n_words': 796}