---
title: llarp/constants/platform.hpp

---

# llarp/constants/platform.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::platform](Namespaces/namespacellarp_1_1platform.md)** <br>namespace for platform feature detection constexprs  |




## Source code

```cpp
#pragma once

namespace llarp::platform
{
  inline constexpr bool is_linux =
#ifdef __linux__
      true
#else
      false
#endif
      ;

  inline constexpr bool with_systemd =
#ifdef WITH_SYSTEMD
      true
#else
      false
#endif
      ;

  inline constexpr bool is_freebsd =
#ifdef __FreeBSD__
      true
#else
      false
#endif
      ;

  inline constexpr bool is_windows =
#ifdef _WIN32
      true
#else
      false
#endif
      ;

  inline constexpr bool is_apple =
#ifdef __APPLE__
      true
#else
      false
#endif
      ;

  inline constexpr bool is_apple_sysex =
#ifdef MACOS_SYSTEM_EXTENSION
      true
#else
      false
#endif
      ;

  inline constexpr bool is_android =
#ifdef ANDROID
      true
#else
      false
#endif
      ;

  inline constexpr bool is_iphone =
#ifdef IOS
      true
#else
      false
#endif
      ;

  inline constexpr bool is_simulation =
#ifdef LOKINET_HIVE
      true
#else
      false
#endif
      ;
  // on cross compiles sometimes weird permutations of target and host make this value not correct,
  // this ensures it always is
  inline constexpr bool has_systemd = is_linux and with_systemd and not(is_android or is_windows);

  inline constexpr bool is_macos = is_apple and not is_iphone;

  inline constexpr bool is_mobile = is_android or is_iphone;

  // TODO: make windows support ipv6
  inline constexpr bool supports_ipv6 = not is_windows;
}  // namespace llarp::platform
```


-------------------------------

Updated on 2023-01-06 at 19:35:06 +0000
