Files
yosys/cmake/UseHomebrew.cmake
tangxifan 02dc5a82d7 [core] add a cmake option to disable unit test during compilation; Use cmake_current_source for submodule integration
[core] debug yosys version extraction

[core] debug

[core] now cache the cmake source dir

[core] debug

[core] debug kernel dependencies

[core] debug common include directories

[core] debug

[core] debug simlib_help.inc

[core] debug pmgen py path in cmake

[core] syntax

[core] debug flex source

[core] restore

[core] debug executable output as it now shows linking to .

[core] debug yosys-abc directory

[core] debug cmake share directory

[core] debug yosys abc

[core] restore shared directory location as yosys requires fixed location

[core] rework link target to yosys sub dir under build

[core] fixed the bug on yosys-config.install location for install

[core] cmake syntax

[core] correct the location for share directory

[core] debug

[core] debug

[core] debug

[core] enforce internal attributes; rename the YOSYS_ENABLE_UNIT_TESTS; use YOSYS_CMAKE_BINARY_DIR for all

[core] apply review comments

[core] rename

[core] change all the CMAKE_BINARY_DIR to YOSYS_CMAKE_BINARY_DIR

[core] replace CMAKE_SOURCE_DIR to YOSYS_CMAKE_SOURCE_DIR
2026-08-21 12:09:04 -07:00

38 lines
956 B
CMake

# Syntax:
#
# use_homebrew([ROOT <root>])
#
# Includes all packages installed in `<root>` (output of brew --prefix if not
# specified) in `CMAKE_FIND_ROOT_PATH`.
#
function(use_homebrew)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "ROOT" "")
if (NOT arg_ROOT)
execute_process(
COMMAND brew --prefix
WORKING_DIRECTORY ${YOSYS_CMAKE_SOURCE_DIR}
RESULT_VARIABLE brew_prefix_result
OUTPUT_VARIABLE brew_prefix_out
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if (${brew_prefix_result} EQUAL 0)
set (arg_ROOT "${brew_prefix_out}/Cellar")
endif()
endif()
if (NOT arg_ROOT)
# unset and no brew binary available
return()
endif()
file(GLOB package_roots ${arg_ROOT}/*/*) # e.g. `/opt/homebrew/Cellar/bison/3.8.2/`
foreach (package_root ${package_roots})
if (IS_DIRECTORY ${package_root})
list(APPEND CMAKE_FIND_ROOT_PATH ${package_root})
endif()
endforeach()
return(PROPAGATE CMAKE_FIND_ROOT_PATH)
endfunction()