From 8dd943e42c13ca33d07ead274e07defd1e2114c5 Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Thu, 23 Dec 2021 14:57:16 -0500 Subject: [PATCH] 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. --- lib/module.modulemap | 25 +++++++++++++++++++++++++ lib/modulemap/module.modulemap | 4 ---- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 lib/module.modulemap delete mode 100644 lib/modulemap/module.modulemap diff --git a/lib/module.modulemap b/lib/module.modulemap new file mode 100644 index 000000000..bbb939782 --- /dev/null +++ b/lib/module.modulemap @@ -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 * + } +} diff --git a/lib/modulemap/module.modulemap b/lib/modulemap/module.modulemap deleted file mode 100644 index eeda69885..000000000 --- a/lib/modulemap/module.modulemap +++ /dev/null @@ -1,4 +0,0 @@ -module libzstd [extern_c] { - header "../zstd.h" - export * -} -- 2.47.2