Compare commits

...

3 Commits

Author SHA1 Message Date
ws 990c1d202a update cmakelist 2025-04-21 23:15:03 +08:00
ws b3a969176e update cmakelists 2025-04-21 22:33:09 +08:00
ws 5e28c17115 update cmakelist 2025-04-21 22:26:07 +08:00
7 changed files with 122 additions and 6 deletions

5
.gitignore vendored
View File

@ -2,4 +2,7 @@
.vs/*
x64/*
*/bin/*
*/obj/*
*/obj/*
.fake
.DS_Store
bin/*

View File

@ -0,0 +1,27 @@
{
"configurations": [
{
"name": "Mac",
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64",
"includePath": [
"/"
]
},
{
"name": "mloc",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
}

16
ArgsParser/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.10)
project(ArgsParser CXX)
set(CMAKE_PREFIX_PATH "~/Qt5.12.4/5.12.4/clang_64/lib/cmake")
find_package(Qt5 COMPONENTS Core REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_library(ArgsParser argsparser.cpp)
set(CMAKE_CXX_STANDARD 20)
target_link_libraries(ArgsParser Qt5::Core)

View File

@ -107,10 +107,18 @@ bool FloatOption::parse(const QList<QString> args) {
MatchMode::MatchMode(int mode_code, const QString& mode)
:_means_explain(mode), code_store(mode_code) { }
/**
* @brief
* @return
*/
#include <QtCore/QByteArray>
class inner_exception : public std::exception {
private:
QByteArray _message;
public:
inner_exception(const QString &msg)
:_message(msg.toUtf8()){}
virtual const char* what() const noexcept{
return _message.data();
}
};
MatchMode& MatchMode::operator<<(std::shared_ptr<IArgvPack> unit) {
if(unit->paramType() == ParamType::FloatParam){
@ -119,7 +127,7 @@ MatchMode& MatchMode::operator<<(std::shared_ptr<IArgvPack> unit) {
if (u_exist->paramType() == ParamType::FloatParam) {
auto u_cast = std::dynamic_pointer_cast<__FloatArgvImpls>(u_exist);
if (u_cast->bindKey() == unit_in->bindKey())
throw new std::exception("重复设置选项");
throw new inner_exception("重复设置选项");
}
}
}

22
CMakeLists.txt Normal file
View File

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.10)
project(WsNovelParser)
set(CMAKE_PREFIX_PATH "~/Qt5.12.4/5.12.4/clang_64/lib/cmake")
add_subdirectory(./ArgsParser)
add_library(libArgsParserIn SHARED IMPORTED)
target_include_directories(libArgsParserIn INTERFACE "${SOLUTION_DIR}/ArgsParser")
set_target_properties(libArgsParserIn PROPERTIES
IMPORTED_IMPLIB_DEBUG "${SOLUTION_DIR}/bin/lib/ArgsParser.0.lib"
IMPORTED_IMPLIB_RELEASE "${SOLUTION_DIR}/bin/lib/ArgsParser.1.lib"
)
add_subdirectory(./libWords)
add_executable(nsc
./WsNovelParser/main.cpp
./WsNovelParser/astprint.cpp
./WsNovelParser/novelparser.cpp
)

24
libSyntax/CMakeLists.txt Normal file
View File

@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.10)
project(libSyntax)
set(CMAKE_PREFIX_PATH "~/Qt5.12.4/5.12.4/clang_64/lib/cmake")
find_package(Qt5 COMPONENTS Core REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_library(libSyntax
libsyntax.cpp
ast_basic.cpp
ast_gen.cpp
ast_novel.cpp
libtokens.cpp
syntax_novel.cpp
tokens_novel.cpp
)
set(CMAKE_CXX_STANDARD 20)
target_link_libraries(libSyntax Qt5::Core)

16
libWords/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.10)
project(libWords)
set(CMAKE_PREFIX_PATH "~/Qt5.12.4/5.12.4/clang_64/lib/cmake")
find_package(Qt5 COMPONENTS Core REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_library(libWords libwords.cpp)
set(CMAKE_CXX_STANDARD 20)
target_link_libraries(libWords Qt5::Core)