#!/usr/bin/env python3

# Cobalt Build System - 0.0.4
# Copyright (C) 2020, 2021 Ayush Bardhan Tripathy.
# This project is licensed under MIT License (See LICENSE.md).

# Version info (change-log)
#
# 0.0.4 - Support for C++ projects. New command: generate. Run command can now pass on args. Bug fixes. Removed
#         the installation Makefile
# 0.0.3 - Improved dependency loading and project defaults. Defaulted build path to 'builddir', using relative paths.
#         New commands: clean, rebuild
# 0.0.2 - Switched to generating Ninja files instead of building itself. Bug fixes. Added a Makefile for
#         system wide installation
# 0.0.1 - Initial public release

import os, sys, subprocess;
cobalt_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tools", "cobalt");
if not os.path.isdir(cobalt_path):
    gitlink = "https://github.com/iddev5/cobalt.git";
    print("Cobalt build system not found. Cloning from", gitlink);
    subprocess.call(["git", "clone", gitlink, cobalt_path]);
sys.path.insert(0, cobalt_path);
try:
    from src import main;
except ImportError:
    print("Cannot use Cobalt build system");
    sys.exit(-1);
if __name__ == "__main__":
    main.run(sys.argv);
