3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-14 19:25:40 +00:00

CMake: Support distro-packaged dependencies

When packaging for a distro, allow using pre-packaged dependencies
instead of vendored submodules by enabling `YOSYS_WITH_PKG_DEPS`.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
This commit is contained in:
Gabriel Somlo 2026-07-12 10:41:18 -04:00
parent 0e82bbefe5
commit 2b0493e022
2 changed files with 45 additions and 42 deletions

View file

@ -56,6 +56,7 @@ option(YOSYS_WITHOUT_EDITLINE "Disable editline integration" OFF)
option(YOSYS_WITHOUT_SLANG "Disable Slang integration" OFF)
option(YOSYS_WITHOUT_TCL "Disable Tcl integration" OFF)
option(YOSYS_WITH_PYTHON "Enable Python integration" OFF)
option(YOSYS_WITH_PKG_DEPS "Disable bundled/vendored dependencies" OFF)
set(YOSYS_VERIFIC_DIR "" CACHE FILEPATH "Path to the Verific source code (empty to disable)")
set(YOSYS_VERIFIC_COMPONENTS "" CACHE STRING

View file

@ -7,50 +7,52 @@ add_subdirectory(json11)
add_subdirectory(minisat)
add_subdirectory(sha1)
add_subdirectory(subcircuit)
block()
set(BUILD_SHARED_LIBS OFF)
include(FetchContent)
set(FETCHCONTENT_FULLY_DISCONNECTED ON)
if (NOT YOSYS_WITH_PKG_DEPS)
block()
set(BUILD_SHARED_LIBS OFF)
include(FetchContent)
set(FETCHCONTENT_FULLY_DISCONNECTED ON)
option(FMT_INSTALL OFF)
FetchContent_Declare(
fmt
EXCLUDE_FROM_ALL
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fmt
)
FetchContent_MakeAvailable(fmt)
option(FMT_INSTALL OFF)
FetchContent_Declare(
fmt
EXCLUDE_FROM_ALL
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fmt
)
FetchContent_MakeAvailable(fmt)
FetchContent_Declare(
tomlplusplus
EXCLUDE_FROM_ALL
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tomlplusplus
)
FetchContent_MakeAvailable(tomlplusplus)
FetchContent_Declare(
tomlplusplus
EXCLUDE_FROM_ALL
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tomlplusplus
)
FetchContent_MakeAvailable(tomlplusplus)
FetchContent_Declare(
boost_regex
EXCLUDE_FROM_ALL
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boost_regex
SOURCE_SUBDIR _no_build_
)
FetchContent_MakeAvailable(boost_regex)
FetchContent_Declare(
boost_regex
EXCLUDE_FROM_ALL
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boost_regex
SOURCE_SUBDIR _no_build_
)
FetchContent_MakeAvailable(boost_regex)
if (NOT YOSYS_WITHOUT_SLANG)
set(SLANG_USE_MIMALLOC OFF)
add_subdirectory(slang)
# Headers autodetect based on <boost/config.hpp> but when version
# does exist but does not match requirements it becomes problematic
if(NOT Boost_FOUND)
target_compile_definitions(slang_slang PRIVATE BOOST_REGEX_STANDALONE)
if (NOT YOSYS_WITHOUT_SLANG)
set(SLANG_USE_MIMALLOC OFF)
add_subdirectory(slang)
# Headers autodetect based on <boost/config.hpp> but when version
# does exist but does not match requirements it becomes problematic
if(NOT Boost_FOUND)
target_compile_definitions(slang_slang PRIVATE BOOST_REGEX_STANDALONE)
endif()
if (SLANG_INCLUDE_TOOLS)
# Temporary to prevent build issues
set_target_properties(slang_tidy_obj_lib PROPERTIES YOSYS_IS_ABC ON)
install(TARGETS slang_driver RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS slang_hier RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS slang_reflect RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS slang_tidy RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
if (SLANG_INCLUDE_TOOLS)
# Temporary to prevent build issues
set_target_properties(slang_tidy_obj_lib PROPERTIES YOSYS_IS_ABC ON)
install(TARGETS slang_driver RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS slang_hier RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS slang_reflect RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS slang_tidy RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
endblock()
endblock()
endif()