mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-11 13:40:53 +00:00
Add and use ENABLE_HELP_SOURCE
Conditionally include help source tracking to preserve ABI. Docs builds can (and should) use `ENABLE_HELP_SOURCE` so that the generated sphinx docs can perform default grouping and link to source files. Regular user-builds don't need the source tracking.
This commit is contained in:
parent
7fe4ae45fd
commit
891a907a30
4 changed files with 26 additions and 14 deletions
1
.github/workflows/prepare-docs.yml
vendored
1
.github/workflows/prepare-docs.yml
vendored
|
@ -47,6 +47,7 @@ jobs:
|
|||
echo "ENABLE_VERIFIC_LIBERTY := 1" >> Makefile.conf
|
||||
echo "ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS := 1" >> Makefile.conf
|
||||
echo "ENABLE_CCACHE := 1" >> Makefile.conf
|
||||
echo "ENABLE_HELP_SOURCE := 1" >> Makefile.conf
|
||||
make -j$procs ENABLE_LTO=1
|
||||
|
||||
- name: Prepare docs
|
||||
|
|
5
Makefile
5
Makefile
|
@ -24,6 +24,7 @@ ENABLE_VERIFIC_LIBERTY := 0
|
|||
ENABLE_COVER := 1
|
||||
ENABLE_LIBYOSYS := 0
|
||||
ENABLE_ZLIB := 1
|
||||
ENABLE_HELP_SOURCE := 0
|
||||
|
||||
# python wrappers
|
||||
ENABLE_PYOSYS := 0
|
||||
|
@ -109,6 +110,10 @@ PLUGIN_LINKFLAGS += -L"$(LIBDIR)"
|
|||
PLUGIN_LIBS := -lyosys_exe
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_HELP_SOURCE),1)
|
||||
CXXFLAGS += -DYOSYS_ENABLE_HELP_SOURCE
|
||||
endif
|
||||
|
||||
PKG_CONFIG ?= pkg-config
|
||||
SED ?= sed
|
||||
BISON ?= bison
|
||||
|
|
|
@ -276,3 +276,9 @@ From the root of the repository, run `make docs`. This will build/rebuild yosys
|
|||
as necessary before generating the website documentation from the yosys help
|
||||
commands. To build for pdf instead of html, call
|
||||
`make docs DOC_TARGET=latexpdf`.
|
||||
|
||||
It is recommended to use the `ENABLE_HELP_SOURCE` make option for Yosys builds
|
||||
that will be used to build the documentation. This option enables source
|
||||
location tracking for passes and improves the command reference through grouping
|
||||
related commands and allowing for the documentation to link to the corresponding
|
||||
source files.
|
||||
|
|
|
@ -23,22 +23,22 @@
|
|||
#include "kernel/yosys_common.h"
|
||||
#include "kernel/yosys.h"
|
||||
|
||||
#include <version>
|
||||
#if __cpp_lib_source_location == 201907L
|
||||
#include <source_location>
|
||||
using std::source_location;
|
||||
#elif defined(__has_include)
|
||||
# if __has_include(<experimental/source_location>)
|
||||
#include <experimental/source_location>
|
||||
using std::experimental::source_location;
|
||||
# else
|
||||
#define SOURCE_FALLBACK
|
||||
# endif
|
||||
#else
|
||||
#define SOURCE_FALLBACK
|
||||
#ifdef YOSYS_ENABLE_HELP_SOURCE
|
||||
#include <version>
|
||||
# if __cpp_lib_source_location == 201907L
|
||||
#include <source_location>
|
||||
using std::source_location;
|
||||
#define HAS_SOURCE_LOCATION
|
||||
# elif defined(__has_include)
|
||||
# if __has_include(<experimental/source_location>)
|
||||
#include <experimental/source_location>
|
||||
using std::experimental::source_location;
|
||||
#define HAS_SOURCE_LOCATION
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef SOURCE_FALLBACK
|
||||
#ifndef HAS_SOURCE_LOCATION
|
||||
struct source_location { // dummy placeholder
|
||||
int line() const { return 0; }
|
||||
int column() const { return 0; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue