换用库。

This commit is contained in:
2026-04-28 16:06:36 +08:00
parent cef4d8c1de
commit e85b89e86a
4 changed files with 7 additions and 12 deletions

View File

@@ -31,7 +31,7 @@
"-Wno-dev" "-Wno-dev"
], ],
"cmake.configureSettings": { "cmake.configureSettings": {
"CMAKE_PREFIX_PATH": "C:/local/boost_1_90_0" "CMAKE_PREFIX_PATH": "C:/local"
}, },
// "cmake.environment": { // "cmake.environment": {
// "PATH": "${env:PATH};C:/Qt/Qt5.14.2/5.14.2/msvc2017_64/bin;D:/env/ctf-win-bin/ctf/bin/Debug;R:/ctf/bin/Debug;", // "PATH": "${env:PATH};C:/Qt/Qt5.14.2/5.14.2/msvc2017_64/bin;D:/env/ctf-win-bin/ctf/bin/Debug;R:/ctf/bin/Debug;",

View File

@@ -16,13 +16,8 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/)
add_definitions(-DFMT_HEADER_ONLY) add_definitions(-DFMT_HEADER_ONLY)
find_package(cxxLibrary CONFIG REQUIRED)
set(Boost_NO_WARN_NEW_VERSIONS 1)
set(Boost_USE_STATIC_LIBS ON)
include_directories(${Boost_INCLUDE_DIR})
find_package(Boost COMPONENTS filesystem locale process)
include_directories(thirdparty) include_directories(thirdparty)
add_executable(cmake-vsenv main.cpp read_config.h read_config.cpp exec_cmd.h exec_cmd.cpp) add_executable(cmake-vsenv main.cpp read_config.h read_config.cpp exec_cmd.h exec_cmd.cpp)
target_link_libraries(cmake-vsenv PRIVATE ${Boost_LIBRARIES} ntdll) target_link_libraries(cmake-vsenv PRIVATE cxxLibrary::cxxLibrary ntdll)

View File

@@ -7,13 +7,13 @@
#include <boost/asio/streambuf.hpp> #include <boost/asio/streambuf.hpp>
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/locale.hpp>
#include <boost/process.hpp> #include <boost/process.hpp>
#include <boost/process/start_dir.hpp> #include <boost/process/start_dir.hpp>
#include <boost/system/error_code.hpp> #include <boost/system/error_code.hpp>
#include <fmt/format.h> #include <fmt/format.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <zoost/zoost.h>
namespace proc = boost::process; namespace proc = boost::process;
namespace asio = boost::asio; namespace asio = boost::asio;
@@ -51,7 +51,7 @@ int ExecCMD::ExecuteCmd(const std::string& exe, std::vector<std::string>& args,
break; break;
} else { } else {
#if defined(_WIN32) #if defined(_WIN32)
std::cerr << boost::locale::conv::between(ec.message(), "UTF-8", "GBK") << std::endl; std::cerr << zoostCommon::ToU8Copy(ec.message()) << std::endl;
#else #else
std::cerr << ec.message() << std::endl; std::cerr << ec.message() << std::endl;
#endif #endif
@@ -64,7 +64,7 @@ int ExecCMD::ExecuteCmd(const std::string& exe, std::vector<std::string>& args,
} catch (const std::exception& e) { } catch (const std::exception& e) {
#if defined(_WIN32) #if defined(_WIN32)
std::cerr << "异常: " << boost::locale::conv::between(e.what(), "UTF-8", "GBK") << std::endl; std::cerr << "异常: " << zoostCommon::ToU8Copy(e.what()) << std::endl;
#else #else
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
#endif #endif

View File

@@ -103,7 +103,7 @@ int main(int argc, char** argv)
CLI11_PARSE(app, argc, argv); CLI11_PARSE(app, argc, argv);
fs::path p(rootDir); fs::path p(rootDir);
p.append("cmake-vsenv.json"); p.append("cmake-vsenv");
if (!fs::exists(p)) { if (!fs::exists(p)) {
std::cerr << "不存在=>" << p.string() << std::endl; std::cerr << "不存在=>" << p.string() << std::endl;
return 2; return 2;