Description
E.g. if my xcode project - using modules, which is the default now - I have a C file containing the following:
#define CGLM_FORCE_DEPTH_ZERO_TO_ONE 1
#define CGLM_FORCE_LEFT_HANDED 1
#include <cglm/cglm.h>
#include <cglm/cam.h>
and cglm is depended on as a swift package, then those CGLM_FORCE_*
macros will do nothing at all.
From the clang docs on modules:
Headers that vend multiple APIs at different times
Some systems have headers that contain a number of different kinds of API definitions, only some of which are made available with a given include. For example, the header may vend size_t only when the macro __need_size_t is defined before that header is included, and also vend wchar_t only when the macro __need_wchar_t is defined. Such headers are often included many times in a single translation unit, and will have no include guards. There is no sane way to map this header to a submodule. One can either eliminate the header (e.g., by splitting it into separate headers, one per actual API) or simply exclude it in the module map.
Given that & how cglm works, I think the simplest thing to do is to delete include/module.modulemap
(works for me). But I am no expert on either Xcode, clang modules or cglm internals, so I can't say for sure.