I have a project that has Cpp code and swift code and I m making some calls from swift to cpp. For this I m using the Cpp-swift interop mechanism introduced in swift 5.9 for making direct calls between swift and cpp.
I m using module.modulemap file to expose the cpp code to swift. I am facnig an error when I try to access a cpp header that are using the cpp compiler flags in some static assert statements. These methods are working fine in cpp however, when I try to access these methods from swift using the modulemap file, the compiler flags are not being identified by swift, and produces the below error
error: use of undeclared identifier 'TW_KERNEL_WINDOWS'.
This is my module.modulemap file:
module CoreModule {
header "ProcessStates.hpp" //cpp header that contains compiler flags
export *
}
below is the cpp header code that I m trying to access in swift:
#pragma once
// if the given condition is false – treat as an error
#define STATIC_CHECKFALSE(condition, message) static_assert (condition, message)
STATIC_CHECKFALSE ((TW_KERNEL_WINDOWS == 0) || (TW_KERNEL_WINDOWS == 1), "TW_KERNEL_WINDOWS can only be 0 or 1");
Can someone help, why is this happening and how to resolve this?