#  XCodeGen configuration file
name: tutasdk
options:
  schemePathPrefix: "../" # Recommended for workspace based projects by XCodeGen devs
settings:
  base:
    GCC_C_LANGUAGE_STANDARD: "gnu17"
    CLANG_CXX_LANGUAGE_STANDARD: "gnu++20"
    bundleIdPrefix: "de.tutao.tutanota"
# Include MUST come after settings because it depends on bundleIdPrefix
include:
    - path: "../../xcodegen_common.yml"
targets:
  tutasdk:
    type: "framework.static"
    platform: "iOS"
    sources: 
      # Excluding tutasdk.a stops the compiled SDK being included as an asset
      - path: "tutasdk/tutasdk.h"
      - path: "tutasdk/generated-src/headers/tutasdkFFI.h"
        optional: true # Generated by "Build Rust"
      - path: "tutasdk/generated-src/Sources/tutasdk.swift"
        optional: true # Generated by "Build Rust"
      - path: "tutasdk/generated-src/headers/tutasdkFFI.modulemap"
        optional: true # Generated by "Build Rust"
      - path: "build-scripts"
        buildPhase: "none"
    dependencies:
      - framework: "tutasdk/generated-src/tutasdk.a"
        link: true
    settings:
      base:
        ENABLE_USER_SCRIPT_SANDBOXING: "NO"
        INSTALL_PATH: "$(LOCAL_LIBRARY_DIR)/Frameworks"
        IPHONEOS_DEPLOYMENT_TARGET: "16.0"
        SKIP_INSTALL: "YES"
        DYLIB_COMPATIBILITY_VERSION: "1"
        DYLIB_CURRENT_VERSION: "1"
        DYLIB_INSTALL_NAME_BASE: "@rpath"
        LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
        MACH_O_TYPE: "staticlib"
        SWIFT_EMIT_LOC_STRINGS: "YES"
        DEFINES_MODULE: "YES"
        GENERATE_INFOPLIST_FILE: "YES"
        LIBRARY_SEARCH_PATHS: "$(inherited) $(PROJECT_DIR)/tutasdk/generated-src"
        CURRENT_PROJECT_VERSION: "1"
        MARKETING_VERSION: "1.0"
        PRODUCT_BUNDLE_IDENTIFIER: "de.tutao.tutanota.tutasdk"
        ENABLE_MODULE_VERIFIER: "YES"
        MODULE_VERIFIER_SUPPORTED_LANGUAGES: "objective-c objective-c++"
        MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS: "$(GCC_C_LANGUAGE_STANDARD) $(CLANG_CXX_LANGUAGE_STANDARD)"
      configs:
        Debug Development:
          DEVELOPMENT_TEAM: "JKCH89Z3M9" # Tutao GmbH
        Debug Staging:
          DEVELOPMENT_TEAM: "JKCH89Z3M9"
        Debug Production:
          DEVELOPMENT_TEAM: "JKCH89Z3M9"
        Release Development:
          DEVELOPMENT_TEAM: ""
          PROVISIONING_PROFILE_SPECIFIER: ""
        Release Staging:
          DEVELOPMENT_TEAM: ""
          PROVISIONING_PROFILE_SPECIFIER: ""
        Release Production:
          DEVELOPMENT_TEAM: ""
          PROVISIONING_PROFILE_SPECIFIER: ""
    preBuildScripts:
      - path: "build-scripts/make-tutasdk.sh"
        name: "Build Rust Binaries"
        shell: "/bin/sh"
        showEnvVars: true
        basedOnDependencyAnalysis: false
        outputFiles:
          [
            "$(SRCROOT)/tutasdk/generated-src/Sources/tutasdk.swift",
            "$(SRCROOT)/tutasdk/generated-src/tutasdk.a",
            "$(SRCROOT)/tutasdk/generated-src/headers/tutasdkFFI.h",
          ]
schemes:
  tutasdk:
    build:
      targets:
        tutasdk: "all"
