diff --git a/.gitignore b/.gitignore index bf8edd2..11f3b21 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.sdf # --- 编译产物 --- +bin/ *.o *.a *.so @@ -47,4 +48,10 @@ Thumbs.db *.pdb *.exp *.manifest -*.lib \ No newline at end of file +*.lib + +#reportlog.log +reportlog.log + +#QTlog +QTlog/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 81c2c75..bef39df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,11 +12,14 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRel)" FORCE) endif() set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0") # Debug模式:禁用优化,包含调试符号 -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") # Release模式:最大优化[2,6](@ref) + if(MSVC) #add_compile_options(/W4 /WX) # Windows: 开启所有警告并视警告为错误 add_compile_options(/utf-8) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Od /Zi /Fd${CMAKE_CURRENT_SOURCE_DIR}/bin/Release/DPS.pdb") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG") + + else() add_compile_options(-Wall -Wextra -Wpedantic -Werror) # Linux/macOS: 严格警告[1](@ref) endif() @@ -41,6 +44,9 @@ include_directories(include) file(GLOB_RECURSE SOURCES "DataPlatform/*.cpp" "DataPlatform/*.c" "DataPlatform/*.cc") # 自动收集源码,建议手动指定关键文件 file(GLOB_RECURSE HEADERS "DataPlatform/*.hpp" "DataPlatform/*.h") +#设置可执行文件的输出路径 +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) + add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) # 链接 Qt 模块 @@ -70,6 +76,38 @@ elseif(UNIX AND NOT APPLE) # 明确排除 macOS message(STATUS "Configuring for Linux") endif() +# 拷贝库文件到输出目录 +if(WIN32) + set(MY_DLLS + WebQt.dll + CCSReport.dll + ODI_Common.dll + ODI_DPS.dll + CodeGenerator.dll + xlnt.dll + SqlcipherTool.dll + DBPService.dll + libeay32.dll + SqliteDBI.dll + ) + foreach(dll ${MY_DLLS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_SOURCE_DIR}/3th/release/${dll}" + "$/${dll}" + ) + endforeach() +endif() + +# 拷贝资源文件到输出目录 +if(WIN32) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_SOURCE_DIR}/DataPlatform/html" + "$/html" + ) +endif() + install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib diff --git a/DataPlatform/mainwindow.cpp b/DataPlatform/mainwindow.cpp index 1792e10..d90d059 100644 --- a/DataPlatform/mainwindow.cpp +++ b/DataPlatform/mainwindow.cpp @@ -100,7 +100,8 @@ MainWindow::MainWindow(QWidget* parent) _webView = new WebEngineView(QUrl(BaseUrl + "#/debug/SearchEditModule/save-data-to-file"), this); #else - _webView = new WebEngineView(QUrl(BaseUrl), this); + QString indexHtmlPath = QCoreApplication::applicationDirPath() + "/" + "html/index.html"; + _webView = new WebEngineView(QUrl::fromLocalFile(indexHtmlPath), this); #endif // WEBDEGUB this->setCentralWidget(_webView); _eventModule = new SignalEventModule("MainWindow");