base:最基本的代码架子。

This commit is contained in:
taynpg 2024-12-26 09:48:47 +08:00
commit a82e60b58d
9 changed files with 200 additions and 0 deletions

17
.clang-format Normal file
View File

@ -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

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
build
.vs
.cache
cmake-*

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "ofen"]
path = ofen
url = https://www.sinxmiao.cn/taynpg/ofen

117
.vscode/settings.json vendored Normal file
View File

@ -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"
}
}

24
CMakeLists.txt Normal file
View File

@ -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)

5
MainFrame.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "MainFrame.h"
CMainFrame::CMainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title)
{
}

8
MainFrame.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include <wx/wx.h>
class CMainFrame : public wxFrame
{
public:
explicit CMainFrame(const wxString& title);
};

21
main.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "MainFrame.h"
#include <wx/wx.h>
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);

1
ofen Submodule

@ -0,0 +1 @@
Subproject commit 1d86de126afe83c7a9c934adca74006ca90ec65f