diff --git a/CMakeLists.txt b/CMakeLists.txt index 75daf019..582fdfc9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ add_subdirectory(tools/uniter EXCLUDE_FROM_ALL) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cista.h COMMAND uniter + ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include/cista/mmap.h ${CMAKE_CURRENT_SOURCE_DIR}/include/cista/serialization.h diff --git a/LICENSE b/LICENSE index e76e2c49..495d1410 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018 Felix Gündling +Copyright (c) 2018-2021 Felix Gündling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tools/uniter/uniter.cc b/tools/uniter/uniter.cc index f6a1798d..dcf05d5e 100644 --- a/tools/uniter/uniter.cc +++ b/tools/uniter/uniter.cc @@ -40,15 +40,26 @@ void write_file(std::string const& include_path, std::string const& path, } int main(int argc, char const** argv) { - if (argc < 3) { - printf("usage: %s include_path file0, [file1, [file2, ...]]\n", argv[0]); + if (argc < 4) { + printf("usage: %s license include_path file0, [file1, [file2, ...]]\n", argv[0]); return 1; } - auto const include_path = std::string{argv[1]}; - std::set included; + auto const license_path = std::string{argv[1]}; + auto const include_path = std::string{argv[2]}; + + std::cout << "/*\n"; + std::ifstream f{license_path.c_str()}; + f.exceptions(std::ifstream::failbit | std::ifstream::badbit); + std::string line; + while (!f.eof() && f.peek() != EOF && std::getline(f, line)) { + std::cout << line << "\n"; + } + std::cout << "*/\n\n"; + std::cout << "#pragma once\n\n"; - for (int i = 2; i < argc; ++i) { + std::set included; + for (int i = 3; i < argc; ++i) { write_file(include_path, argv[i], included); } } \ No newline at end of file