Browse Source

#修改编码

zxs 4 months ago
parent
commit
9197078eeb

+ 3 - 3
CMakeLists.txt

@@ -22,6 +22,6 @@ elseif(UNIX)
 endif()
 # 包含子项目。
 add_subdirectory ("robot")
-#add_subdirectory ("logger")
-#add_subdirectory ("drivers")
-#add_subdirectory ("generator")
+add_subdirectory ("logger")
+add_subdirectory ("drivers")
+add_subdirectory ("generator")

+ 1 - 0
generator/CMakeLists.txt

@@ -20,6 +20,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
 # Ìí¼Ó /bigobj Ñ¡Ïî
 if (MSVC)
     target_compile_options(code_generator_command PRIVATE /bigobj)
+    target_compile_options(code_generator_command PRIVATE /utf-8)
 endif()
 
 if (WIN32)

+ 7 - 11
generator/main.cpp

@@ -14,12 +14,7 @@ static std::string getCode(std::vector<class_view_info> classViews)
     ss << std::put_time(std::localtime(&now_c), "%F %T");
     //头文件
     code += "//生成时间 " + ss.str() + "\n";
-    code += "#ifndef __PROJECT_REFLECT_H__\n";
-    code += "#define __PROJECT_REFLECT_H__\n\n";
-    code += "#if defined(_MSC_VER) && (_MSC_VER >= 1200)\n";
     code += "#pragma once\n";
-    code += "#pragma execution_character_set(\"utf-8\")\n";
-    code += "#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)\n\n";
     code += "#include <rttr/registration>\n";
     for (auto& it : classViews) {
         code += "#include \"" + it.include + "\"\n";
@@ -239,18 +234,19 @@ static std::string getCode(std::vector<class_view_info> classViews)
     code += "   __soap_ioc_register__();\n";
     code += "}\n";
 
-    code += "#endif //!__PROJECT_REFLECT_H__\n";
-
     return code.c_str();
 }
 
 int main(int argc, char* argv[])
 {
-    if (argc != 2) {
-        std::cout << "项目路径错误!" << std::endl;
-        return 0;
+    if (argc <= 0) {
+        std::cout << "参数错误!" << std::endl;
+        return -1;
+    }
+    for (int i = 0; i < argc; ++i) {
+        std::cout << "参数:"<< argv[i] << std::endl;
     }
-    std::string project_path = argv[1];
+    std::string project_path = argv[argc - 1];
     std::string reflect_path;
     if (project_path[project_path.size() - 1] == '/' || project_path[project_path.size() - 1] == '\\') {
         reflect_path = project_path + "reflect.h";

BIN
lib/linux/logger/liblogger.so


BIN
lib/windows/logger/logger.dll


BIN
lib/windows/logger/logger.lib


+ 1 - 0
logger/CMakeLists.txt

@@ -21,6 +21,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
 # Ìí¼Ó /bigobj Ñ¡Ïî
 if (MSVC)
     target_compile_options(logger PRIVATE /bigobj)
+    target_compile_options(logger PRIVATE /utf-8)
 endif()
 
 if (WIN32)