Skip to content

Commit

Permalink
Add architecture detection flags
Browse files Browse the repository at this point in the history
Summary: It can be useful to detect which architecture we're compiling for, as not every library is available for all architecture...

Differential Revision: D60302684

fbshipit-source-id: 61a96a50c160c94163b446946c38185bf5c2f1c1
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed Jul 29, 2024
1 parent 36b7855 commit fba44dc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions vrs/os/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,19 @@
#define IS_VRS_OSS_TARGET_PLATFORM() 0

#endif

#if defined(__i386__) || defined(__x86_64__)
#define IS_X86_PLATFORM() 1
#else
#define IS_X86_PLATFORM() 0
#endif

#if defined(__arm__) || defined(__aarch64__) || defined(__thumb__)
#define IS_ARM_PLATFORM() 1
#else
#define IS_ARM_PLATFORM() 0
#endif

#if IS_X86_PLATFORM() && IS_ARM_PLATFORM()
#error "Invalid dual-arch platform detected"
#endif

0 comments on commit fba44dc

Please sign in to comment.