{
  "name": "@my-scope/{{ projectName }}",
  "version": "0.1.0",
  "description": "A source code Hello World semihosted application running on QEMU",
  "type": "module",
  "main": "",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/{{ githubId }}/{{ projectName }}.git"
  },
  "homepage": "https://github.com/{{ githubId }}/{{ projectName }}",
  "bugs": {
    "url": "https://github.com/{{ githubId }}/{{ projectName }}/issues"
  },
  "keywords": [
    "xpack"
  ],
  "author": {
    "name": "{{ author.name }}",
    "email": "{{ author.email }}",
    "url": "{{ author.url }}"
  },
{% if author.email != "ilg@livius.net" -%}
  "contributors": [
    {
      "name": "Liviu Ionescu",
      "email": "ilg@livius.net",
      "url": "https://github.com/ilg-ul"
    }
  ],
{% endif -%}
  "license": "MIT",
  "config": {},
  "engines": {
    "node": " >=16.14.0"
  },
  "dependencies": {},
  "bundledDependencies": [],
  "devDependencies": {},
  "xpack": {
    "minimumXpmRequired": "0.16.2",
    "dependencies": {
{% if target == "cortex-m0" -%}
      "@micro-os-plus/architecture-cortexm": "^6.3.0",
      "@micro-os-plus/devices-qemu-cortexm": "^4.1.1",
      "@xpack-3rd-party/arm-cmsis-core": "5.4.0-6",
{% elsif target == "cortex-m7f" -%}
      "@micro-os-plus/architecture-cortexm": "^6.3.0",
      "@micro-os-plus/devices-qemu-cortexm": "^4.1.1",
      "@xpack-3rd-party/arm-cmsis-core": "5.4.0-6",
{% elsif target == "cortex-a15" -%}
      "@micro-os-plus/architecture-aarch32": "^3.2.0",
      "@micro-os-plus/devices-qemu-aarch32": "^3.0.1",
{% elsif target == "cortex-a72" -%}
      "@micro-os-plus/architecture-aarch64": "^3.2.0",
      "@micro-os-plus/devices-qemu-aarch64": "^3.0.0",
{% elsif target == "riscv-rv32imac" -%}
      "@micro-os-plus/architecture-riscv": "^4.1.0",
      "@micro-os-plus/devices-qemu-riscv": "^1.0.1",
{% elsif target == "riscv-rv64imafdc" -%}
      "@micro-os-plus/architecture-riscv": "^4.1.0",
      "@micro-os-plus/devices-qemu-riscv": "^1.0.1",
{% endif -%}
      "@micro-os-plus/build-helper": "^2.13.0",
      "@micro-os-plus/diag-trace": "^4.2.0",
      "@micro-os-plus/semihosting": "^8.0.0",
      "@micro-os-plus/startup": "^5.2.0"
    },
    "devDependencies": {
{% if buildGenerator == "cmake" -%}
      "@xpack-dev-tools/cmake": "3.26.5-1.1",
{% elsif buildGenerator == "meson" -%}
      "@xpack-dev-tools/meson-build": "1.0.2-1.1",
{% endif -%}
      "@xpack-dev-tools/ninja-build": "1.11.1-3.1",
{% if target == "cortex-a72" -%}
      "@xpack-dev-tools/aarch64-none-elf-gcc": "12.3.1-2.1.1",
{% elsif target == "riscv-rv32imac" -%}
      "@xpack-dev-tools/riscv-none-elf-gcc": "13.2.0-2.1",
{% elsif target == "riscv-rv64imafdc" -%}
      "@xpack-dev-tools/riscv-none-elf-gcc": "13.2.0-2.1",
{% else -%}
      "@xpack-dev-tools/arm-none-eabi-gcc": "12.3.1-1.2.1",
{% endif -%}
{% if target == "riscv-rv32imac" -%}
      "@xpack-dev-tools/qemu-riscv": "7.2.5-1.1"
{% elsif target == "riscv-rv64imafdc" -%}
      "@xpack-dev-tools/qemu-riscv": "7.2.5-1.1"
{% else -%}
      "@xpack-dev-tools/qemu-arm": "7.2.5-1.1"
{% endif -%}
    },
    "properties": {
      {% raw %}"buildFolderRelativePath": "{{ 'build' | path_join: configuration.name | to_filename | downcase }}",
      "buildFolderRelativePathPosix": "{{ 'build' | path_posix_join: configuration.name | downcase }}",{% endraw %}
{% if buildGenerator == "cmake" -%}
      {% raw %}"commandCMakePrepare": "{{ properties.commandCMakeReconfigure }} --log-level=VERBOSE",
      "commandCMakePrepareWithToolchain": "{{ properties.commandCMakePrepare }} -D CMAKE_TOOLCHAIN_FILE=xpacks/@micro-os-plus/build-helper/cmake/toolchains/{{ properties.toolchainFileName }}",
      "commandCMakeReconfigure": "cmake -S . -B {{ properties.buildFolderRelativePathPosix }} -G Ninja -D CMAKE_BUILD_TYPE={{ properties.buildType }} -D PLATFORM_NAME={{ properties.platformName }} -D CMAKE_EXPORT_COMPILE_COMMANDS=ON",
      "commandCMakeBuild": "cmake --build {{ properties.buildFolderRelativePathPosix }}",
      "commandCMakeBuildVerbose": "cmake --build {{ properties.buildFolderRelativePathPosix }} --verbose",
      "commandCMakeClean": "cmake --build {{ properties.buildFolderRelativePathPosix }} --target clean",
      "commandCMakePerformTests": "cd {{ properties.buildFolderRelativePath }} && ctest -V"{% endraw %}
{% elsif buildGenerator == "meson" -%}
      {% raw %}"commandMesonPrepare": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} {{ properties.buildFolderRelativePathPosix }} .",
      "commandMesonPrepareWithToolchain": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} --native-file xpacks/@micro-os-plus/build-helper/meson/toolchains/{{ properties.toolchainFileName }} --native-file platform-{{ properties.platformName }}/meson/native.ini {{ properties.buildFolderRelativePathPosix }} .",
      "commandMesonPrepareCross": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} --cross xpacks/@micro-os-plus/build-helper/meson/toolchains/{{ properties.toolchainFileName }} --cross platform-{{ properties.platformName }}/meson/cross.ini {{ properties.buildFolderRelativePathPosix }} .",
      "commandMesonReconfigure": "meson setup --reconfigure {{ properties.buildFolderRelativePathPosix }} .",
      "commandMesonBuild": "meson compile -C {{ properties.buildFolderRelativePathPosix }}",
      "commandMesonBuildVerbose": "meson compile -C {{ properties.buildFolderRelativePathPosix }} --verbose",
      "commandMesonClean": "meson compile -C {{ properties.buildFolderRelativePathPosix }} --clean",
      "commandMesonPerformTests": "meson test -C {{ properties.buildFolderRelativePathPosix }} --verbose"{% endraw %}
{% endif -%}
    },
    "actions": {
      "test-{{ platform }}-{{ buildGenerator }}-debug": [
        "xpm run prepare --config {{ platform }}-{{ buildGenerator }}-debug",
        "xpm run build --config {{ platform }}-{{ buildGenerator }}-debug",
        "xpm run test --config {{ platform }}-{{ buildGenerator }}-debug"
      ],
      "test-{{ platform }}-{{ buildGenerator }}-release": [
        "xpm run prepare --config {{ platform }}-{{ buildGenerator }}-release",
        "xpm run build --config {{ platform }}-{{ buildGenerator }}-release",
        "xpm run test --config {{ platform }}-{{ buildGenerator }}-release"
      ],
      "test-all": [
        "xpm run test-{{ platform }}-{{ buildGenerator }}-debug",
        "xpm run test-{{ platform }}-{{ buildGenerator }}-release"
      ],
      "clean-all": [
        "xpm run clean --config {{ platform }}-{{ buildGenerator }}-debug",
        "xpm run clean --config {{ platform }}-{{ buildGenerator }}-release"
      ],
      "link-deps": [
{% if target == "cortex-m0" -%}
        "xpm link @xpack-3rd-party/arm-cmsis-core",
        "xpm link @micro-os-plus/architecture-cortexm",
        "xpm link @micro-os-plus/devices-qemu-cortexm",
        "xpm link @micro-os-plus/startup",
{% elsif target == "cortex-m7f" -%}
        "xpm link @xpack-3rd-party/arm-cmsis-core",
        "xpm link @micro-os-plus/architecture-cortexm",
        "xpm link @micro-os-plus/devices-qemu-cortexm",
        "xpm link @micro-os-plus/startup",
{% elsif target == "cortex-a15" -%}
        "xpm link @micro-os-plus/architecture-aarch32",
        "xpm link @micro-os-plus/devices-qemu-aarch32",
        "xpm link @micro-os-plus/startup",
{% elsif target == "cortex-a72" -%}
        "xpm link @micro-os-plus/architecture-aarch64",
        "xpm link @micro-os-plus/devices-qemu-aarch64",
        "xpm link @micro-os-plus/startup",
{% elsif target == "riscv-rv32imac" -%}
        "xpm link @micro-os-plus/architecture-riscv",
        "xpm link @micro-os-plus/devices-qemu-riscv",
        "xpm link @micro-os-plus/startup",
{% elsif target == "riscv-rv64imafdc" -%}
        "xpm link @micro-os-plus/architecture-riscv",
        "xpm link @micro-os-plus/devices-qemu-riscv",
        "xpm link @micro-os-plus/startup",
{% endif -%}
        "xpm link @micro-os-plus/build-helper",
        "xpm link @micro-os-plus/diag-trace",
        "xpm link @micro-os-plus/semihosting"
      ]
    },
{% if buildGenerator == "cmake" -%}
    "buildConfigurations": {
      "{{ platform }}-{{ buildGenerator }}-debug": {
        "properties": {
          "buildType": "Debug",
          "platformName": "{{ platform }}",
{% if target == "cortex-m0" -%}
          "toolchainFileName": "arm-none-eabi-gcc.cmake"
{% elsif target == "cortex-m7f" -%}
          "toolchainFileName": "arm-none-eabi-gcc.cmake"
{% elsif target == "cortex-a15" -%}
          "toolchainFileName": "arm-none-eabi-gcc.cmake"
{% elsif target == "cortex-a72" -%}
          "toolchainFileName": "aarch64-none-elf-gcc.cmake"
{% elsif target == "riscv-rv32imac" -%}
          "toolchainFileName": "riscv-none-elf-gcc.cmake"
{% elsif target == "riscv-rv64imafdc" -%}
          "toolchainFileName": "riscv-none-elf-gcc.cmake"
{% endif -%}
        },
        "actions": {
        {% raw %}"prepare": "{{ properties.commandCMakePrepareWithToolchain }}",
          "build": [
            "{{ properties.commandCMakeReconfigure }}",
            "{{ properties.commandCMakeBuild }}"
          ],
          "test": "{{ properties.commandCMakePerformTests }}",
          "clean": "{{ properties.commandCMakeClean }}"{% endraw %}
        }
      },
      "{{ platform }}-{{ buildGenerator }}-release": {
        "inherit": [
          "{{ platform }}-{{ buildGenerator }}-debug"
        ],
        "properties": {
          "buildType": "Release"
        }
      }
    }
{% elsif buildGenerator == "meson" -%}
    "buildConfigurations": {
      "{{ platform }}-{{ buildGenerator }}-debug": {
        "properties": {
          "buildType": "debug",
          "platformName": "{{ platform }}",
{% if target == "cortex-m0" -%}
        {% raw %}"toolchainFileName": "arm-none-eabi-gcc-{{ os.platform }}.ini"{% endraw %}
{% elsif target == "cortex-m7f" -%}
        {% raw %}"toolchainFileName": "arm-none-eabi-gcc-{{ os.platform }}.ini"{% endraw %}
{% elsif target == "cortex-a15" -%}
        {% raw %}"toolchainFileName": "arm-none-eabi-gcc-{{ os.platform }}.ini"{% endraw %}
{% elsif target == "cortex-a72" -%}
        {% raw %}"toolchainFileName": "aarch64-none-elf-gcc-{{ os.platform }}.ini"{% endraw %}
{% elsif target == "riscv-rv32imac" -%}
        {% raw %}"toolchainFileName": "riscv-none-elf-gcc-{{ os.platform }}.ini"{% endraw %}
{% elsif target == "riscv-rv64imafdc" -%}
        {% raw %}"toolchainFileName": "riscv-none-elf-gcc-{{ os.platform }}.ini"{% endraw %}
{% endif -%}
        },
        "actions": {
        {% raw %}"prepare": "{{ properties.commandMesonPrepareCross }}",
          "build": [
            "{{ properties.commandMesonReconfigure }}",
            "{{ properties.commandMesonBuild }}"
          ],
          "test": "{{ properties.commandMesonPerformTests }}",
          "clean": "{{ properties.commandMesonClean }}"{% endraw %}
        }
      },
      "{{ platform }}-{{ buildGenerator }}-release": {
        "inherit": [
          "{{ platform }}-{{ buildGenerator }}-debug"
        ],
        "properties": {
          "buildType": "minsize"
        }
      }
    }
{% endif -%}
  }
}
