Improve Module Map File

This commit makes several changes:

1. It adds modules for the dictionary builder and errors headers.
2. It captures all of the macros that are used to configure these headers.
   When the headers are imported as modules and one of these macros is defined
   the compiler issues a warning that it needs to be defined on the CLI.
3. It promotes the modulemap file into the root of the lib directory.
   Experimentation shows that clang's `-fimplicit-module-maps` will find the
   modulemap when placed here, but not when it's put in a subdirectory.
This commit is contained in:
W. Felix Handte 2021-12-23 14:57:16 -05:00
parent 7e679511a8
commit 8dd943e42c
2 changed files with 25 additions and 4 deletions

25
lib/module.modulemap Normal file
View File

@ -0,0 +1,25 @@
module libzstd [extern_c] {
header "zstd.h"
export *
config_macros [exhaustive] /* zstd.h */ \
ZSTD_STATIC_LINKING_ONLY, \
ZSTDLIB_VISIBLE, \
ZSTD_DLL_EXPORT, \
ZSTDLIB_STATIC_API, \
ZSTD_DISABLE_DEPRECATE_WARNINGS, \
ZSTD_CLEVEL_DEFAULT, \
/* zdict.h */ ZDICT_STATIC_LINKING_ONLY, \
ZDICTLIB_VISIBILITY, \
ZDICT_DISABLE_DEPRECATE_WARNINGS, \
/* zstd_errors.h */ ZSTDERRORLIB_VISIBILITY
module dictbuilder [extern_c] {
header "zdict.h"
export *
}
module errors [extern_c] {
header "zstd_errors.h"
export *
}
}

View File

@ -1,4 +0,0 @@
module libzstd [extern_c] {
header "../zstd.h"
export *
}