[amdgpu-arch] Guard hsa.h with __has_include

This patch is suppose to fix the issue of hsa.h not found.
Issue was reported in D99949

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D102067
This commit is contained in:
Pushpinder Singh 2021-05-07 11:56:46 +00:00
parent 6db0cedd23
commit c711aa0f6f
1 changed files with 20 additions and 1 deletions

View File

@ -11,7 +11,24 @@
//
//===----------------------------------------------------------------------===//
#include <hsa.h>
#if defined(__has_include)
#if __has_include("hsa.h")
#define HSA_HEADER_FOUND 1
#include "hsa.h"
#elif __has_include("hsa/hsa.h")
#define HSA_HEADER_FOUND 1
#include "hsa/hsa.h"
#else
#define HSA_HEADER_FOUND 0
#endif
#else
#define HSA_HEADER_FOUND 0
#endif
#if !HSA_HEADER_FOUND
int main() { return 1; }
#else
#include <string>
#include <vector>
@ -57,3 +74,5 @@ int main() {
hsa_shut_down();
return 0;
}
#endif