diff --git a/cmake/project_cpp_standard.cmake b/cmake/project_cpp_standard.cmake index 8b698fb..4b6bc31 100644 --- a/cmake/project_cpp_standard.cmake +++ b/cmake/project_cpp_standard.cmake @@ -21,7 +21,7 @@ function(set_cpp_standard standard) set(CMAKE_CXX_EXTENSIONS OFF PARENT_SCOPE) # --- 平台特定设置 --- - if(WIN32) + if(WIN32 OR CYGWIN) # 为 Windows 定义 UNICODE 宏 add_definitions(-DUNICODE -D_UNICODE) # 可选:添加 WIN32_LEAN_AND_MEAN 以减少 Windows 头文件包含,加快编译速度 diff --git a/src/mirage_core/src/misc/mapped_file/windows/mapped_file.cpp b/src/mirage_core/src/misc/mapped_file/windows/mapped_file.cpp index 627080b..541f9c5 100644 --- a/src/mirage_core/src/misc/mapped_file/windows/mapped_file.cpp +++ b/src/mirage_core/src/misc/mapped_file/windows/mapped_file.cpp @@ -3,6 +3,8 @@ #include #include +#include "utf8.h" + class mapped_file_win : public mapped_file { public: mapped_file_win(); @@ -71,8 +73,8 @@ mapped_file_win& mapped_file_win::operator=(mapped_file_win&& other) noexcept { bool mapped_file_win::map_file(const std::filesystem::path& filename) { cleanup(); - file_handle_ = CreateFile( - filename.c_str(), + file_handle_ = CreateFileW( + filename.generic_wstring().c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, diff --git a/src/mirage_render/src/platform_window/windows/windows_window.cpp b/src/mirage_render/src/platform_window/windows/windows_window.cpp index 38509e9..8de014a 100644 --- a/src/mirage_render/src/platform_window/windows/windows_window.cpp +++ b/src/mirage_render/src/platform_window/windows/windows_window.cpp @@ -126,8 +126,8 @@ platform_window::platform_window(int32_t in_width, int32_t in_height, const wcha wc.hInstance = GetModuleHandle(nullptr); wc.lpszClassName = L"mirage_window_class"; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); + wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO); RegisterClass(&wc); RECT rect = { 0, 0, in_width, in_height }; diff --git a/src/sokol/CMakeLists.txt b/src/sokol/CMakeLists.txt index 9589ff8..1caad0a 100644 --- a/src/sokol/CMakeLists.txt +++ b/src/sokol/CMakeLists.txt @@ -6,7 +6,7 @@ retrieve_files(${CMAKE_CURRENT_SOURCE_DIR} SRC_FILES) add_library(${PROJECT_NAME} STATIC ${SRC_FILES}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -if (WIN32) +if (WIN32 OR CYGWIN) target_compile_definitions(${PROJECT_NAME} PUBLIC -DSOKOL_D3D11) target_link_libraries(${PROJECT_NAME} PUBLIC d3d11 dxgi) elseif (UNIX)