From 7172beea177aa704f5943565230e4d07b6543481 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Sat, 4 Apr 2020 15:53:51 -0700 Subject: [PATCH] cmake CUDD_DIR option --- CMakeLists.txt | 25 +++++++++++-------------- README.md | 8 +++++--- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64eb23c4..14ce2eb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,8 @@ endif() project(STA VERSION 2.0.18) +option(CUDD_DIR "CUDD BDD package directory") + set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -560,15 +562,16 @@ endif() # # Locate CUDD bdd package. # +set(CUDD 0) find_library(CUDD_LIB - NAMES cudd - PATHS ENV CUDD + NAME cudd + PATHS ${CUDD_DIR} + PATH_SUFFIXES lib 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_LIB_PARENT1}/include ${CUDD_LIB_PARENT1}/include/cudd) if (CUDD_HEADER) @@ -580,10 +583,6 @@ if (CUDD_LIB) 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() @@ -611,7 +610,6 @@ set(STA_INCLUDE_DIRS search util verilog - ${CUDD_INCLUDE} ) ########################################################### @@ -642,7 +640,9 @@ add_library(OpenSTA ) target_include_directories(OpenSTA - PUBLIC ${STA_INCLUDE_DIRS} + PUBLIC + ${STA_INCLUDE_DIRS} + ${CUDD_INCLUDE} ${TCL_INCLUDE_PATH} ) @@ -675,13 +675,10 @@ target_link_libraries(sta OpenSTA sta_swig ${TCL_LIBRARY} - ${CUDD_LIB} + ZLIB + CUDD_LIB ) -if (ZLIB_FOUND) - target_link_libraries(sta ${ZLIB_LIBRARIES}) -endif() - message(STATUS "STA executable: ${STA_HOME}/app/sta") # g++ std::thread apparently still needs -pthreads. diff --git a/README.md b/README.md index 99e5ff68..1a2bc8b7 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,8 @@ or [here](https://sourceforge.net/projects/cudd-mirror/). Note that the file hierarchy of the CUDD installation changed with version 3.0. Some changes to CMakeLists.txt are required to support older versions. -The cmake file searchs in the normal places for the CUDD library. +Use the CUDD_DIR option to set the install directory if it is not in +one of the normal install directories. When building CUDD you may use the `--prefix ` option to `configure` to install in a location other than the default (`/usr/local/lib`). @@ -99,8 +100,9 @@ mkdir $HOME/cudd ./configure --prefix $HOME/cudd make make install -# export location of cudd for make to find it -export CUDD=$HOME/cudd/lib + +cd /build +cmake .. -DCUDD_DIR=$HOME/cudd ``` The Zlib library is an optional. If CMake finds libz, OpenSTA can