| This is a simple windows_dll_library rule for builing a DLL Windows |
| that can be depended on by other cc rules. |
| hdrs = ["hello-library.h"], |
| # Define COMPILING_DLL to export symbols during compiling the DLL. |
| copts = ["/DCOMPILING_DLL"], |
| load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_import", "cc_library") |
| """A simple windows_dll_library rule for builing a DLL Windows.""" |
| import_lib_name = name + "_import_lib" |
| import_target_name = name + "_dll_import" |
| # Build the shared library |
| # Get the import library for the dll |
| output_group = "interface_library", |
| # Because we cannot directly depend on cc_binary from other cc rules in deps attribute, |
| # we use cc_import as a bridge to depend on the dll. |
| name = import_target_name, |
| interface_library = ":" + import_lib_name, |
| shared_library = ":" + dll_name, |
| # Create a new cc_library to also include the headers needed for the shared library |
| ":" + import_target_name, |