Download chips/yosys/cmake/Condition.cmake from STAR-future/Trinity-SciData: direct link, hf CLI and curl.
- Browser
- Download file 932 Bytes
-
https://huggingface.co/datasets/STAR-future/Trinity-SciData/resolve/main/chips/yosys/cmake/Condition.cmake
- Command line
-
hf download hf://datasets/STAR-future/Trinity-SciData/chips/yosys/cmake/Condition.cmake
-
curl -L -o Condition.cmake https://huggingface.co/datasets/STAR-future/Trinity-SciData/resolve/main/chips/yosys/cmake/Condition.cmake
932 Bytes
| # Syntax: | |
| # | |
| # condition(<var> <expr>...) | |
| # | |
| # If `<expr>...` is truthful (evaluated as in `if()`) then assigns 1 to `<var>`, else assigns 0. | |
| # The assigned value is `0`/`1` rather than `TRUE`/`FALSE` for ease of use in generator expressions. | |
| # Note that `<expr>...` *must* be unquoted. | |
| # | |
| # To understand how a certain outcome is reached, reconfigure the project with `--log-level VERBOSE`. | |
| # | |
| # Believe it or not, CMake doesn't have this built in! | |
| # | |
| macro(condition var) | |
| if (${ARGN}) | |
| set(${var} 1) | |
| else() | |
| set(${var} 0) | |
| endif() | |
| set(_debug_expr) | |
| foreach (token ${ARGN}) | |
| if (DEFINED ${token}) | |
| if (${${token}}) | |
| list(APPEND _debug_expr "${token}:1") | |
| else() | |
| list(APPEND _debug_expr "${token}:0") | |
| endif() | |
| else() | |
| list(APPEND _debug_expr "${token}") | |
| endif() | |
| endforeach() | |
| string(JOIN " " _debug_expr ${_debug_expr}) | |
| message(VERBOSE " ${var} = ${${var}} (${_debug_expr})") | |
| unset(_debug_expr) | |
| endmacro() | |