From ad139b7118474fdecf1afb4c2684929ce417f167 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 18 Jun 2026 12:57:10 +0200 Subject: [PATCH] Add option to build without slang --- CMakeLists.txt | 2 ++ frontends/slang/CMakeLists.txt | 4 +++- libs/CMakeLists.txt | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a37b52ebe..dad7277f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ option(YOSYS_WITHOUT_ZLIB "Disable zlib integration" OFF) option(YOSYS_WITHOUT_LIBFFI "Disable libffi integration" OFF) option(YOSYS_WITHOUT_READLINE "Disable readline integration" OFF) 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) @@ -308,6 +309,7 @@ condition(YOSYS_ENABLE_EDITLINE editline_FOUND AND NOT YOSYS_WITHOUT_EDITLINE AN condition(YOSYS_ENABLE_TCL tcl_FOUND AND libtommath_FOUND AND NOT YOSYS_WITHOUT_TCL) condition(YOSYS_ENABLE_PYTHON Python3Devel_FOUND AND PyosysEnv_FOUND AND YOSYS_WITH_PYTHON) condition(YOSYS_ENABLE_VERIFIC YOSYS_VERIFIC_DIR AND zlib_FOUND) +condition(YOSYS_ENABLE_SLANG NOT YOSYS_WITHOUT_SLANG) # Describe dependencies and features # CMake 4.0 would let us use proper conditions, but that's too new for now. diff --git a/frontends/slang/CMakeLists.txt b/frontends/slang/CMakeLists.txt index da50e2494..850b8d26f 100644 --- a/frontends/slang/CMakeLists.txt +++ b/frontends/slang/CMakeLists.txt @@ -26,10 +26,12 @@ yosys_frontend(slang lib/src/variables.cc lib/src/variables.h ${CMAKE_CURRENT_BINARY_DIR}/version.h + ENABLE_IF + YOSYS_ENABLE_SLANG INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} LIBRARIES - slang::slang + $<${YOSYS_ENABLE_SLANG}:slang::slang> fmt::fmt ) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 6e09fbc3e..126635687 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -17,6 +17,8 @@ FetchContent_Declare( SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fmt ) FetchContent_MakeAvailable(fmt) -set(SLANG_USE_MIMALLOC OFF) -add_subdirectory(slang) +if (NOT YOSYS_WITHOUT_SLANG) + set(SLANG_USE_MIMALLOC OFF) + add_subdirectory(slang) +endif() set(BUILD_SHARED_LIBS "${_old_BUILD_SHARED_LIBS}")