mirror of https://github.com/YosysHQ/yosys.git
CMake: Add some basic configuration options
This commit is contained in:
parent
a7620a3538
commit
04740034d1
104
CMakeLists.txt
104
CMakeLists.txt
|
@ -2,6 +2,41 @@ cmake_minimum_required(VERSION 3.13)
|
|||
project(yosys LANGUAGES CXX C)
|
||||
set(YOSYS_VER "0.50+1")
|
||||
|
||||
# features (the more the better)
|
||||
|
||||
option(ENABLE_TCL "Enable TCL library usage" ON)
|
||||
option(ENABLE_ABC "Enable building ABC" ON)
|
||||
option(LINK_ABC "Enable linking ABC as library" OFF)
|
||||
option(ENABLE_GLOB "Enable usage of glob.h" ON)
|
||||
option(ENABLE_PLUGINS "Enable plugins support" ON)
|
||||
option(ENABLE_READLINE "Enable readline library usage" ON)
|
||||
option(ENABLE_EDITLINE "Enable editline library usage" OFF)
|
||||
option(ENABLE_GHDL "Enable building with GHDL plugin" OFF)
|
||||
option(ENABLE_VERIFIC "Enable Verific library" OFF)
|
||||
option(ENABLE_VERIFIC_SYSTEMVERILOG "Enable Verific SystemVerilog support" ON)
|
||||
option(ENABLE_VERIFIC_VHDL "Enable Verific VHDL support" ON)
|
||||
option(ENABLE_VERIFIC_HIER_TREE "Enable Verific hierarchy tree support" ON)
|
||||
option(ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS "Enable Verific YosysHQ specific extension" OFF)
|
||||
option(ENABLE_VERIFIC_EDIF "Enable Verific EDIF support " OFF)
|
||||
option(ENABLE_VERIFIC_LIBERTY "Enable Verific Liberty support" OFF)
|
||||
option(ENABLE_COVER "Enable internal coverage" ON)
|
||||
option(ENABLE_LIBYOSYS "Enable building Yosys as library" OFF)
|
||||
option(ENABLE_ZLIB "Enable zlib library usage" ON)
|
||||
|
||||
# python wrappers
|
||||
option(ENABLE_PYOSYS "Enable building Yosys Python wrapper" OFF)
|
||||
|
||||
# other configuration flags
|
||||
option(ENABLE_GCOV "Enable gcov build" OFF)
|
||||
option(ENABLE_GPROF "Enable profiler build" OFF)
|
||||
option(ENABLE_DEBUG "Enable debug build" OFF)
|
||||
option(ENABLE_LTO "Enable LTO build" OFF)
|
||||
option(ENABLE_CCACHE "Enable building with CCACHE" OFF)
|
||||
# sccache is not always a drop-in replacement for ccache in practice
|
||||
option(ENABLE_SCCACHE "Enable building with SCACHE" OFF)
|
||||
option(ENABLE_FUNCTIONAL_TESTS "Enable functional tests" OFF)
|
||||
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
@ -17,22 +52,68 @@ set(CMAKE_C_EXTENSIONS OFF)
|
|||
find_package(FLEX 2.6 REQUIRED)
|
||||
find_package(BISON 3.0 REQUIRED)
|
||||
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(Readline REQUIRED)
|
||||
#find_package(Editline REQUIRED)
|
||||
find_package(TCL 8.6 REQUIRED)
|
||||
|
||||
add_executable(yosys)
|
||||
#target_include_directories(yosys PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
#target_include_directories(yosys PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
#target_compile_definitions(yosys PRIVATE _YOSYS_)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_compile_definitions(_YOSYS_)
|
||||
add_compile_definitions(YOSYS_ENABLE_READLINE)
|
||||
#add_compile_definitions(YOSYS_ENABLE_EDITLINE)
|
||||
|
||||
add_compile_definitions(YOSYS_ENABLE_TCL)
|
||||
target_include_directories(yosys PRIVATE ${TCL_INCLUDE_PATH})
|
||||
add_compile_definitions(_YOSYS_)
|
||||
|
||||
if (ENABLE_READLINE AND ENABLE_EDITLINE)
|
||||
message(FATAL_ERROR "Not possible to enable both ENABLE_READLINE and ENABLE_EDITLINE")
|
||||
endif()
|
||||
|
||||
if (ENABLE_READLINE)
|
||||
find_package(Readline REQUIRED)
|
||||
add_compile_definitions(YOSYS_ENABLE_READLINE)
|
||||
target_link_libraries(yosys PRIVATE ${READLINE_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (ENABLE_EDITLINE)
|
||||
find_package(Editline REQUIRED)
|
||||
add_compile_definitions(YOSYS_ENABLE_EDITLINE)
|
||||
target_link_libraries(yosys PRIVATE ${EDITLINE_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (ENABLE_TCL)
|
||||
find_package(TCL 8.6 REQUIRED)
|
||||
add_compile_definitions(YOSYS_ENABLE_TCL)
|
||||
target_include_directories(yosys PRIVATE ${TCL_INCLUDE_PATH})
|
||||
target_link_libraries(yosys PRIVATE ${TCL_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (ENABLE_ZLIB)
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_link_libraries(yosys PRIVATE ZLIB::ZLIB)
|
||||
endif()
|
||||
|
||||
if (ENABLE_COVER)
|
||||
add_compile_definitions(YOSYS_ENABLE_COVER)
|
||||
endif()
|
||||
|
||||
if (ENABLE_CCACHE)
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if (CCACHE_FOUND)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ccache)
|
||||
message(STATUS "Enabling ccache")
|
||||
else()
|
||||
message(STATUS "Failed to enabling ccache")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (ENABLE_SCCACHE)
|
||||
find_program(SCCACHE_FOUND sccache)
|
||||
if (SCCACHE_FOUND)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER sccache)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER sccache)
|
||||
message(STATUS "Enabling sccache")
|
||||
else()
|
||||
message(STATUS "Failed to enabling sccache")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
add_subdirectory(kernel)
|
||||
add_subdirectory(libs)
|
||||
|
@ -101,7 +182,4 @@ add_subdirectory(techlibs/quicklogic)
|
|||
add_subdirectory(techlibs/sf2)
|
||||
add_subdirectory(techlibs/xilinx)
|
||||
|
||||
target_link_libraries(yosys PRIVATE ZLIB::ZLIB)
|
||||
target_link_libraries(yosys PRIVATE ${READLINE_LIBRARY})
|
||||
#target_link_libraries(yosys PRIVATE ${EDITLINE_LIBRARY})
|
||||
target_link_libraries(yosys PRIVATE ${TCL_LIBRARY})
|
||||
set_property(SOURCE kernel/log.cc APPEND PROPERTY COMPILE_DEFINITIONS YOSYS_SRC="${PROJECT_SOURCE_DIR}")
|
||||
|
|
Loading…
Reference in New Issue