// SPDX-FileCopyrightText: 2026 Progmasoft // SPDX-License-Identifier: MIT using System.Collections.Generic; using Progmasoft.Tazel.Dsl.Common; namespace Progmasoft.Tazel.Dsl.Build.Prelude; /// What Objective-C targets have beyond C and C++ ones. public interface IObjectiveCSettings { /// Files compiled without automatic reference counting; every other file has it. Files NonAutomaticReferenceCountingSources { get; } /// Whether Clang modules are on (-fmodules). bool EnableClangModules { get; } /// The name of the module this target is (-fmodule-name). string? ModuleName { get; } /// The module map of this target. string? ModuleMap { get; } } /// How an Objective-C test runs. public enum ObjectiveCTestRunner { /// The test is an XCTest bundle that xctest runs. XCTest, /// The test is an executable judged by its exit status. Executable, } /// A macOS application bundle (.app). public sealed class Bundle { /// The bundle identifier, such as com.example.greeter. public string Identifier { get; init; } = ""; /// The Info.plist of the bundle. public string? InfoPlist { get; init; } /// Files for Contents/Resources. public Files Resources { get; init; } = Files.None; /// The identity that signs the bundle; default: not signed. public string? CodeSigningIdentity { get; init; } } /// An Objective-C static library. public sealed class ObjectiveCStaticLibrarySettings : CCStaticLibrarySettings, IObjectiveCSettings { /// public Files NonAutomaticReferenceCountingSources { get; init; } = Files.None; /// public bool EnableClangModules { get; init; } /// public string? ModuleName { get; init; } /// public string? ModuleMap { get; init; } } /// An Objective-C shared library. public sealed class ObjectiveCSharedLibrarySettings : CCSharedLibrarySettings, IObjectiveCSettings { /// public Files NonAutomaticReferenceCountingSources { get; init; } = Files.None; /// public bool EnableClangModules { get; init; } /// public string? ModuleName { get; init; } /// public string? ModuleMap { get; init; } } /// An Objective-C executable, a plain program or an application bundle. public sealed class ObjectiveCExecutableSettings : CCExecutableSettings, IObjectiveCSettings { /// public Files NonAutomaticReferenceCountingSources { get; init; } = Files.None; /// public bool EnableClangModules { get; init; } /// public string? ModuleName { get; init; } /// public string? ModuleMap { get; init; } /// The application bundle; default: a plain program. public Bundle? Bundle { get; init; } } /// An Objective-C test. public sealed class ObjectiveCTestSettings : CCTestSettings, IObjectiveCSettings { /// public Files NonAutomaticReferenceCountingSources { get; init; } = Files.None; /// public bool EnableClangModules { get; init; } /// public string? ModuleName { get; init; } /// public string? ModuleMap { get; init; } /// How the test runs; default: . public ObjectiveCTestRunner TestRunner { get; init; } = ObjectiveCTestRunner.Executable; } /// The Objective-C targets have these defaults beyond those of C and C++. internal static class ObjectiveCDefaults { /// Where an Objective-C target builds when it names no platforms: the SDK frameworks are Apple's. public static IReadOnlyList Platforms { get; } = [Platform.MacOSArm64, Platform.MacOSX86_64]; }