Skip to content

Commit

Permalink
add license to single file version
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Oct 13, 2021
1 parent 545c642 commit 951cb8d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 16 additions & 5 deletions tools/uniter/uniter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> 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<std::string> included;
for (int i = 3; i < argc; ++i) {
write_file(include_path, argv[i], included);
}
}

0 comments on commit 951cb8d

Please sign in to comment.