Search code examples
c++buck

What are the common platform names in Buck?


I would like to build a cross-platform cxx_library with . I have different cpp files for the different platforms. According to the docs, I can handle this using platform_srcs, which is:

...a list of pairs where the first element is an un-anchored regex (in java.util.regex.Pattern syntax) against which the platform name is matched".

  • What do these platform names look like?
  • What are some example regexes I could use for OSX, Windows and Linux?

Solution

  • I am using the following:

    • Android: android.*
    • iPhone: iphoneos.*
    • iPhone Simulator: iphonesimulator*
    • Linux: linux.*
    • macOS: macos.*
    • Windows: windows.*

    Don't forget to turn on should_remap_host_platform in order to avoid 'default' platform weirdness. In your .buckconfig:

    [cxx]
      should_remap_host_platform = true
    

    See: https://github.com/facebook/buck/issues/2073