update:更新进度。
This commit is contained in:
parent
ae0e878482
commit
bd18a7a907
25
.vscode/settings.json
vendored
25
.vscode/settings.json
vendored
@ -19,9 +19,9 @@
|
|||||||
"args": [
|
"args": [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"cmake.configureSettings": {
|
// "cmake.configureSettings": {
|
||||||
"CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
// "CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||||
},
|
// },
|
||||||
"cmake.options.statusBarVisibility": "visible",
|
"cmake.options.statusBarVisibility": "visible",
|
||||||
"cmake.generator": "Ninja",
|
"cmake.generator": "Ninja",
|
||||||
"C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json",
|
"C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json",
|
||||||
@ -101,6 +101,23 @@
|
|||||||
"set": "cpp",
|
"set": "cpp",
|
||||||
"stop_token": "cpp",
|
"stop_token": "cpp",
|
||||||
"thread": "cpp",
|
"thread": "cpp",
|
||||||
"xtree": "cpp"
|
"xtree": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"strstream": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"complex": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"source_location": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"typeindex": "cpp",
|
||||||
|
"variant": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,7 +22,7 @@ set(SOURCES_FILE
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS OFF)
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
find_package(Boost REQUIRED program_options)
|
find_package(Boost REQUIRED program_options filesystem)
|
||||||
include_directories(${Boost_INCLUDE_DIR})
|
include_directories(${Boost_INCLUDE_DIR})
|
||||||
|
|
||||||
add_executable(PackBinary ${SOURCES_FILE})
|
add_executable(PackBinary ${SOURCES_FILE})
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "cmd_parse.h"
|
#include "cmd_parse.h"
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
CCmdParse::CCmdParse()
|
CCmdParse::CCmdParse()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -9,9 +12,14 @@ bool CCmdParse::cmdParse(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
cmd::options_description desc("options");
|
cmd::options_description desc("options");
|
||||||
desc.add_options()("help,h", "produce help message")(
|
desc.add_options()("help,h", "produce help message")(
|
||||||
"dirs,d", cmd::value<std::vector<std::string>>()->multitoken(),
|
"dirs,d", cmd::value<std::vector<std::string>>(),
|
||||||
"set search dirs")("mode,m", cmd::value<int>()->default_value(-1),
|
"set search dirs")("mode,m", cmd::value<int>()->default_value(-1),
|
||||||
"设置执行模式,0-打包,1-安装");
|
"设置执行模式,0-打包,1-安装")(
|
||||||
|
"purpose,p", cmd::value<std::string>(),
|
||||||
|
"安装目标目录")("file,f", cmd::value<std::string>(), "二进制文件")(
|
||||||
|
"ico,i", cmd::value<std::string>(), "图标文件")(
|
||||||
|
"category,c", cmd::value<std::string>()->default_value("Utility"),
|
||||||
|
"分类名称,例如Utility。");
|
||||||
|
|
||||||
cmd::variables_map vm;
|
cmd::variables_map vm;
|
||||||
cmd::store(cmd::parse_command_line(argc, argv, desc), vm);
|
cmd::store(cmd::parse_command_line(argc, argv, desc), vm);
|
||||||
@ -25,8 +33,20 @@ bool CCmdParse::cmdParse(int argc, char* argv[])
|
|||||||
if (vm.count("mode")) {
|
if (vm.count("mode")) {
|
||||||
result_.mode = vm["mode"].as<int>();
|
result_.mode = vm["mode"].as<int>();
|
||||||
}
|
}
|
||||||
if (vm.count("dir")) {
|
if (vm.count("dirs")) {
|
||||||
result_.lib_dirs = vm["dir"].as<std::vector<std::string>>();
|
result_.lib_dirs = vm["dirs"].as<std::vector<std::string>>();
|
||||||
|
}
|
||||||
|
if (vm.count("purpose")) {
|
||||||
|
result_.purpose_dir = vm["purpose"].as<std::string>();
|
||||||
|
}
|
||||||
|
if (vm.count("file")) {
|
||||||
|
result_.binary = vm["file"].as<std::string>();
|
||||||
|
}
|
||||||
|
if (vm.count("ico")) {
|
||||||
|
result_.ico = vm["ico"].as<std::string>();
|
||||||
|
}
|
||||||
|
if (vm.count("category")) {
|
||||||
|
result_.category = vm["category"].as<std::string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -34,5 +54,32 @@ bool CCmdParse::cmdParse(int argc, char* argv[])
|
|||||||
|
|
||||||
bool CCmdParse::checkArgs()
|
bool CCmdParse::checkArgs()
|
||||||
{
|
{
|
||||||
|
std::cout << "信息 ==========================================>\n";
|
||||||
|
std::cout << "binary:" << result_.binary << "\n";
|
||||||
|
std::cout << "category:" << result_.category << "\n";
|
||||||
|
std::cout << "ico:" << result_.ico << "\n";
|
||||||
|
std::cout << "mode:" << result_.mode << "\n";
|
||||||
|
std::cout << "purpose_dir:" << result_.purpose_dir << "\n";
|
||||||
|
std::cout << "dirs:" << result_.lib_dirs.size() << "\n";
|
||||||
|
for (const auto& item : result_.lib_dirs) {
|
||||||
|
std::cout << ">>" << item << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
auto check_file_dir = [&](const std::string& path, bool is_file) -> bool {
|
||||||
|
std::string type = is_file ? "文件:" : "文件夹:";
|
||||||
|
fs::path tp(path);
|
||||||
|
if (!fs::exists(tp) || !fs::is_regular_file(tp)) {
|
||||||
|
std::cout << type << path << ",不存在\n";
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
std::cout << type << path << ",检查通过!\n";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::cout << "检查 ==========================================>\n";
|
||||||
|
check_file_dir(result_.binary, true);
|
||||||
|
check_file_dir(result_.ico, true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user