解决方案
Source files can be added to a Vivado project and assigned a library that references that file. The library can be assigned on an individual file basis, or by selecting several signals at once and assigning a common library to that group of signals. The following sections describe the actions for each method.
Single File Library Assignment:
To assign a library to a single file perform the following actions in the Vivado GUI:
- Open the "Add Sources" Dialog
- Select the HDL file you would like to add to the project
- Select the file you would like to change the library of
- Click the "Library" field of that file and modify the name as shown in the image below

Multiple File Library Assignment:
To assign a common library to multiple HDL source files, perform the following actions in the GUI:
- Open the "Add Sources" Dialog
- Select the HDL files you would like to add to the project
- Select all of the HDL files you would like to assign to a new library
- Right click the selected signals and select "Change Source Properties" in the dialog box that appears as shown below

- Change the name of the library as shown in the dialog image below:

Files can also be added to a project in a specific library using the read_vhdl Tcl command.
For example:
read_vhdl -library myLib /tmp/src/lib_src1.vhd
Note that the same source cannot be added to multiple libraries. For example, the second command below will fail.
read_vhdl -library myLib /tmp/src/lib_src1.vhd
read_vhdl -library work /tmp/src/lib_src1.vhd