Platform dependence

Per-Platform Target Configuration

The following lists and sections of the target configuration can be specified individually per platform:

  • include_directories and public_include_directories
  • sources
  • flags

Available platforms are osx, linux and windows. The corresponding platform-specific lists are merged with the general lists, meaning that they are not overridden.


    target_type = "static library"
    public_include_directories = ["include"]
    sources = ["src/common.c"]


        include_directories = ["include/osx"]
        sources = ["src/osx/cocoa.m", "src/osx/handle.cpp"]

            compile = ["-DMYLIB_OSX"]
            link = ["-framework", "Cocoa"]

        include_directories = ["include/win"]
        sources = ["src/win/win32.cpp", "src/win/handle.cpp"]

            compile = ["-DMYLIB_WINDOWS", "-D_CRT_SECURE_NO_WARNINGS"]
            link = ["-luser32.lib"]