import os
from datetime import date
d = date.today()
  

header = open("include/rayscenes.hpp", "r")
headerText = header.readlines()
while headerText[0].startswith("//"):
    headerText.pop(0)

src = open("src/rayscenes.cpp", "r")
srcText = src.readlines()
while srcText[0].startswith("//"):
    srcText.pop(0)

out = open("rayscenes_sh.hpp", "w+")

out.write(
f"""//
// Autogenerated single header file for rayscenes
// Licensed under the Apache License, Version 2.0
// See the LICENSE file in the project root for more information
// © WinterSys/Vortetty 2021-{d.year}
//

#ifndef RAYSCENES_HEADER_ALREADY_DONE
#define RAYSCENES_HEADER_ALREADY_DONE
{"".join(headerText)}
#endif

#ifdef RAYSCENES_IMPLEMENTATION
#ifndef RAYSCENES_IMPLEMENTATION_ALREADY_DONE
#define RAYSCENES_IMPLEMENTATION_ALREADY_DONE
{"".join(srcText)}
#endif
#endif\n""".replace("#pragma once", "")
)

header.close()
src.close()
out.close()

os.system("clang-format -i rayscenes.hpp")
