38 lines
920 B
C++
38 lines
920 B
C++
|
#include "vs_json.h"
|
||
|
#define VS_GENERATE_VERSION "v1.0"
|
||
|
|
||
|
int main(int argc, char** argv) {
|
||
|
//
|
||
|
if (argc != 5) {
|
||
|
std::string help(VS_GENERATE_VERSION);
|
||
|
help.append("\n");
|
||
|
help.append(
|
||
|
"vs_generate [xx.sln或xxx.vcxproj] [Debug|x64] [xxxx.json] "
|
||
|
"[expect:xxx;ccc;]");
|
||
|
help.append("\n expect选项没有则:后空着即可。");
|
||
|
std::cout << help << std::endl;
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
std::string sln_path(argv[1]);
|
||
|
VsParseSln sln;
|
||
|
if (!sln.parse(sln_path)) {
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
VsParsePro pro{};
|
||
|
auto projs = sln.get_project();
|
||
|
for (auto& item : projs) {
|
||
|
if (!pro.parse(&item, std::string(argv[2]))) {
|
||
|
continue;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
JsonCommand command{};
|
||
|
command.set_expect(std::string(argv[4]));
|
||
|
command.set_out(std::string(argv[3]));
|
||
|
command.generate(projs);
|
||
|
|
||
|
return 0;
|
||
|
}
|