diff --git a/.vscode/settings.json b/.vscode/settings.json index 6ce4f97..32f0e1c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,9 +19,9 @@ "args": [ ] }, - // "cmake.configureSettings": { - // "CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - // }, + "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", @@ -31,5 +31,57 @@ "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" } } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eeb1f8..ecd1474 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,11 +11,14 @@ endif() message(STATUS "System: ${CMAKE_SYSTEM_NAME}") message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}") -set(SRC_FILES - include/of_path.h src/of_path.cpp - include/of_str.h src/of_str.cpp -) +# find_package(GTest CONFIG REQUIRED) +set(SRC_FILES + src/of_path.cpp src/of_str.cpp +) include_directories(include) + +add_subdirectory(test) + add_library(Ofen STATIC ${SRC_FILES}) target_include_directories(Ofen PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) \ No newline at end of file diff --git a/include/of_def.hpp b/include/of_def.hpp new file mode 100644 index 0000000..f51be16 --- /dev/null +++ b/include/of_def.hpp @@ -0,0 +1,14 @@ +#ifndef OFEN_DEFINE +#define OFEN_DEFINE + +#include + +#ifdef UNICODE_OFSTR +using ofString = std::wstring; +#define ofT(text) L##text +#else +using ofString = std::string; +#define ofT(text) text +#endif + +#endif \ No newline at end of file diff --git a/include/of_path.h b/include/of_path.h index cf5196e..ed8fdd1 100644 --- a/include/of_path.h +++ b/include/of_path.h @@ -1,7 +1,7 @@ #ifndef OFEN_PATH_HEADER #define OFEN_PATH_HEADER -#include +#include "of_def.hpp" namespace ofen { class COfPath @@ -11,7 +11,7 @@ public: ~COfPath(); public: - static bool is_same_path(const std::string& pa, const std::string& pb); + static bool is_same_path(const ofString& pa, const ofString& pb); }; }; // namespace ofen #endif \ No newline at end of file diff --git a/include/of_str.h b/include/of_str.h index 3d82864..a684329 100644 --- a/include/of_str.h +++ b/include/of_str.h @@ -1,7 +1,7 @@ #ifndef OFEN_STRING_HEADER #define OFEN_STRING_HEADER -#include +#include "of_def.hpp" namespace ofen { class COfStr diff --git a/src/of_path.cpp b/src/of_path.cpp index 0577ad1..bec68e4 100644 --- a/src/of_path.cpp +++ b/src/of_path.cpp @@ -11,7 +11,7 @@ COfPath::~COfPath() { } -bool COfPath::is_same_path(const std::string& pa, const std::string& pb) +bool COfPath::is_same_path(const ofString& pa, const ofString& pb) { return false; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..d5a60fd --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.16) + +project(ofen LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (MSVC) + add_compile_options(/source-charset:utf-8) +endif() + + +add_executable(ofTest main.cpp) +target_link_libraries(ofTest PRIVATE Ofen) \ No newline at end of file