import os
import sys
import argparse

import CMakeBuild
import CMakeConfigure
import CMakePresetUtils
import CMakeTest

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--path", required=True)
    parser.add_argument("--preset", required=True)
    args = parser.parse_args()

    path = os.path.abspath(args.path)
    preset = CMakePresetUtils.read_preset(os.path.join(path, "CMakePresets.json"), args.preset)

    CMakeConfigure.cmake_configure(path, preset)
    CMakeBuild.cmake_build(path, preset)
    CMakeTest.cmake_test(path, preset)

if __name__ == "__main__":
    try:
        main()
    except Exception as e:
        print(e, file=sys.stderr)
        exit(1)
import os
import sys
import argparse

import CMakeBuild
import CMakeConfigure
import CMakePresetUtils
import CMakeTest

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--path", required=True)
    parser.add_argument("--preset", required=True)
    args = parser.parse_args()

    path = os.path.abspath(args.path)
    preset = CMakePresetUtils.read_preset(os.path.join(path, "CMakePresets.json"), args.preset)

    CMakeConfigure.cmake_configure(path, preset)
    CMakeBuild.cmake_build(path, preset)
    CMakeTest.cmake_test(path, preset)

if __name__ == "__main__":
    try:
        main()
    except Exception as e:
        print(e, file=sys.stderr)
        exit(1)