| 676 | #define US_PROG_NAME "usResourceCompiler3" |
| 677 | |
| 678 | int |
| 679 | main(int argc, char** argv) |
| 680 | { |
| 681 | // Deterministic build things to set |
| 682 | #if (defined(_WIN32) || defined(_WIN64)) && defined(US_USE_DETERMINISTIC_BUNDLE_BUILDS) |
| 683 | setlocale(LC_ALL, "C.UTF-8"); |
| 684 | #endif |
| 685 | |
| 686 | us_nowide::args _(argc, argv); |
| 687 | |
| 688 | int const BUNDLE_MANIFEST_VALIDATION_ERROR_CODE(2); |
| 689 | constexpr int MIN_COMPRESSION_LEVEL = 0; |
| 690 | constexpr int MAX_COMPRESSION_LEVEL = 9; |
| 691 | int compressionLevel = MZ_DEFAULT_LEVEL; // default compression level |
| 692 | int return_code = EXIT_SUCCESS; |
| 693 | std::string bundleName; |
| 694 | |
| 695 | // CLI11 options |
| 696 | CLI::App app { "usResourceCompiler3: Resource and manifest zip utility" }; |
| 697 | |
| 698 | bool verbose = false; |
| 699 | app.add_flag("-V,--verbose", verbose, "Run in verbose mode"); |
| 700 | |
| 701 | std::string cli_bundleName; |
| 702 | auto bundle_name_opt = app.add_option("-n,--bundle-name", |
| 703 | cli_bundleName, |
| 704 | "The bundle name as specified in the US_BUNDLE_NAME compile definition."); |
| 705 | |
| 706 | int cli_compressionLevel = MZ_DEFAULT_LEVEL; |
| 707 | app.add_option("-c,--compression-level", |
| 708 | cli_compressionLevel, |
| 709 | "Compression level used for zip. Value range is 0 to 9. Default value is 6.") |
| 710 | ->check(CLI::Range(MIN_COMPRESSION_LEVEL, MAX_COMPRESSION_LEVEL)); |
| 711 | |
| 712 | std::string outFile; |
| 713 | auto out_file_opt = app.add_option("-o,--out-file", |
| 714 | outFile, |
| 715 | "Path to output zip file. If the file exists it will be overwritten. If this " |
| 716 | "option is not provided, a temporary zip file will be created."); |
| 717 | |
| 718 | std::vector<std::string> resAdd; |
| 719 | app.add_option("-r,--res-add", resAdd, "Path to a resource file, relative to the current working directory.") |
| 720 | ->take_all(); |
| 721 | |
| 722 | std::vector<std::string> zipAdd; |
| 723 | app.add_option("-z,--zip-add", |
| 724 | zipAdd, |
| 725 | "Path to a file containing a zip archive to be merged into the output zip file.") |
| 726 | ->take_all(); |
| 727 | |
| 728 | std::vector<std::string> manifestAdd; |
| 729 | app.add_option("-m,--manifest-add", |
| 730 | manifestAdd, |
| 731 | "Path to a bundle manifest file. Multiple bundle manifests will be concatenated together into one.") |
| 732 | ->take_all(); |
| 733 | |
| 734 | std::string bundleFile; |
| 735 | auto bundle_file_opt |
nothing calls this directly
no test coverage detected