From a82e60b58d5db8cdc547f009b0af1998a89faa10 Mon Sep 17 00:00:00 2001 From: taynpg Date: Thu, 26 Dec 2024 09:48:47 +0800 Subject: [PATCH] =?UTF-8?q?base=EF=BC=9A=E6=9C=80=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=E6=9E=B6=E5=AD=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .clang-format | 17 ++++++ .gitignore | 4 ++ .gitmodules | 3 ++ .vscode/settings.json | 117 ++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 24 +++++++++ MainFrame.cpp | 5 ++ MainFrame.h | 8 +++ main.cpp | 21 ++++++++ ofen | 1 + 9 files changed, 200 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .vscode/settings.json create mode 100644 CMakeLists.txt create mode 100644 MainFrame.cpp create mode 100644 MainFrame.h create mode 100644 main.cpp create mode 160000 ofen diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..402f22e --- /dev/null +++ b/.clang-format @@ -0,0 +1,17 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +PointerAlignment: Left +AccessModifierOffset: -4 +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true + AfterClass: true +Cpp11BracedListStyle: true +ReflowComments: true +SpacesBeforeTrailingComments: 3 +TabWidth: 4 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ColumnLimit: 80 +AllowShortBlocksOnASingleLine: Never +AllowShortFunctionsOnASingleLine: None +AllowShortEnumsOnASingleLine: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b861d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build +.vs +.cache +cmake-* \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f5e7bbc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ofen"] + path = ofen + url = https://www.sinxmiao.cn/taynpg/ofen diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2ef30be --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,117 @@ +{ + "files.autoSave": "onFocusChange", + "editor.fontSize": 14, + "editor.fontFamily": "'Source Code Pro', 'Courier New', monospace", + "cmake.configureOnOpen": true, + "cmake.debugConfig": { + "console": "integratedTerminal", + "setupCommands": [ + { + "description": "-gdb-set charset utf-8", + "text": "-gdb-set charset UTF-8" + }, + { + "description": "Enable gdb pretty-printing", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "args": [ + ] + }, + "cmake.configureSettings": { + "CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + }, + "cmake.options.statusBarVisibility": "visible", + "cmake.generator": "Ninja", + "C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json", + "C_Cpp.default.cppStandard": "c++17", + "editor.inlayHints.enabled": "off", + "editor.unicodeHighlight.allowedLocales": { + "ja": true, + "zh-hant": true, + "zh-hans": true + }, + "files.associations": { + "xstring": "cpp", + "algorithm": "cpp", + "chrono": "cpp", + "cmath": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "exception": "cpp", + "filesystem": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "memory": "cpp", + "new": "cpp", + "ostream": "cpp", + "ratio": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "utility": "cpp", + "vector": "cpp", + "xfacet": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocbuf": "cpp", + "xlocinfo": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xmemory0": "cpp", + "xstddef": "cpp", + "xtr1common": "cpp", + "xutility": "cpp", + "unordered_map": "cpp", + "xhash": "cpp", + "map": "cpp", + "xtree": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cctype": "cpp", + "charconv": "cpp", + "clocale": "cpp", + "compare": "cpp", + "concepts": "cpp", + "format": "cpp", + "forward_list": "cpp", + "fstream": "cpp", + "functional": "cpp", + "hash_map": "cpp", + "iterator": "cpp", + "optional": "cpp", + "sstream": "cpp", + "deque": "cpp", + "mutex": "cpp", + "stack": "cpp", + "stop_token": "cpp", + "thread": "cpp", + "array": "cpp", + "condition_variable": "cpp", + "coroutine": "cpp", + "future": "cpp", + "queue": "cpp", + "regex": "cpp" + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8655c44 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.16) + +project(BMonitor LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (MSVC) + add_compile_options(/source-charset:utf-8) +endif() + +add_definitions(-DUNICODE_OFSTR) +set(CMAKE_DEBUG_POSTFIX "d") + +message(STATUS "System: ${CMAKE_SYSTEM_NAME}") +message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}") + +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/) + +add_subdirectory(ofen) +find_package(wxWidgets CONFIG REQUIRED) +add_executable(BMonitor main.cpp MainFrame.h MainFrame.cpp) +target_link_libraries(BMonitor PRIVATE wx::core wx::base Ofen) +set_target_properties(BMonitor PROPERTIES WIN32_EXECUTABLE TRUE) \ No newline at end of file diff --git a/MainFrame.cpp b/MainFrame.cpp new file mode 100644 index 0000000..0a3fe4a --- /dev/null +++ b/MainFrame.cpp @@ -0,0 +1,5 @@ +#include "MainFrame.h" + +CMainFrame::CMainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) +{ +} \ No newline at end of file diff --git a/MainFrame.h b/MainFrame.h new file mode 100644 index 0000000..24463d5 --- /dev/null +++ b/MainFrame.h @@ -0,0 +1,8 @@ +#pragma once +#include + +class CMainFrame : public wxFrame +{ +public: + explicit CMainFrame(const wxString& title); +}; \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..33659e5 --- /dev/null +++ b/main.cpp @@ -0,0 +1,21 @@ +#include "MainFrame.h" +#include + +class CWxBMonitor : public wxApp +{ +public: + virtual bool OnInit() + { + wxString title = wxString::Format(wxT("")); + auto* f = new CMainFrame(title); + f->Show(true); + return true; + } + virtual int OnExit() + { + return wxApp::OnExit(); + } +}; + +IMPLEMENT_APP(CWxBMonitor); +DECLARE_APP(CWxBMonitor); \ No newline at end of file diff --git a/ofen b/ofen new file mode 160000 index 0000000..1d86de1 --- /dev/null +++ b/ofen @@ -0,0 +1 @@ +Subproject commit 1d86de126afe83c7a9c934adca74006ca90ec65f