修复unix操作系统的mapped_file编译错误,修复CMakeList文件管理错误
This commit is contained in:
parent
278390564d
commit
b6f91442bd
@ -17,7 +17,15 @@ function(is_current_platform platform is_match)
|
|||||||
set(matches TRUE)
|
set(matches TRUE)
|
||||||
endif()
|
endif()
|
||||||
elseif(platform STREQUAL "mac")
|
elseif(platform STREQUAL "mac")
|
||||||
if(APPLE)
|
if(APPLE AND NOT IOS)
|
||||||
|
set(matches TRUE)
|
||||||
|
endif()
|
||||||
|
elseif(platform STREQUAL "ios")
|
||||||
|
if(IOS)
|
||||||
|
set(matches TRUE)
|
||||||
|
endif()
|
||||||
|
elseif (platform STREQUAL "android")
|
||||||
|
if(ANDROID)
|
||||||
set(matches TRUE)
|
set(matches TRUE)
|
||||||
endif()
|
endif()
|
||||||
elseif(platform STREQUAL "mobile")
|
elseif(platform STREQUAL "mobile")
|
||||||
@ -25,7 +33,7 @@ function(is_current_platform platform is_match)
|
|||||||
set(matches TRUE)
|
set(matches TRUE)
|
||||||
endif()
|
endif()
|
||||||
elseif(platform STREQUAL "desktop")
|
elseif(platform STREQUAL "desktop")
|
||||||
if(WIN32 OR (UNIX AND NOT APPLE))
|
if(WIN32 OR (UNIX AND NOT APPLE) OR (APPLE AND NOT IOS))
|
||||||
set(matches TRUE)
|
set(matches TRUE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
@ -77,7 +85,7 @@ function(retrieve_files_custom path extension out_files)
|
|||||||
|
|
||||||
foreach(dir_name IN LISTS dir_components)
|
foreach(dir_name IN LISTS dir_components)
|
||||||
# 检查是否是平台相关目录
|
# 检查是否是平台相关目录
|
||||||
if(dir_name MATCHES "^(windows|linux|mac|mobile|desktop)$")
|
if(dir_name MATCHES "^(windows|linux|mac|ios|android|mobile|desktop)$")
|
||||||
set(found_platform_dir TRUE)
|
set(found_platform_dir TRUE)
|
||||||
is_current_platform(${dir_name} platform_matches)
|
is_current_platform(${dir_name} platform_matches)
|
||||||
if(NOT platform_matches)
|
if(NOT platform_matches)
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
project(mirage_core)
|
project(mirage_core)
|
||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 26)
|
||||||
|
|
||||||
find_package(harfbuzz REQUIRED)
|
find_package(HarfBuzz REQUIRED)
|
||||||
find_package(Eigen3 REQUIRED)
|
find_package(Eigen3 REQUIRED)
|
||||||
find_package(spdlog REQUIRED)
|
find_package(spdlog REQUIRED)
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
find_package(Freetype REQUIRED)
|
find_package(Freetype REQUIRED)
|
||||||
find_package(Vulkan REQUIRED)
|
find_package(Vulkan REQUIRED)
|
||||||
find_package(glfw3 REQUIRED)
|
|
||||||
|
|
||||||
set(RENDERER_SOURCES "")
|
set(RENDERER_SOURCES "")
|
||||||
retrieve_files(${CMAKE_CURRENT_SOURCE_DIR} RENDERER_SOURCES)
|
retrieve_files(${CMAKE_CURRENT_SOURCE_DIR} RENDERER_SOURCES)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} STATIC ${RENDERER_SOURCES})
|
add_library(${PROJECT_NAME} STATIC ${RENDERER_SOURCES})
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC Freetype::Freetype glfw harfbuzz Eigen3::Eigen spdlog::spdlog msdfgen-full Boost::boost Vulkan::Vulkan LLGL)
|
target_link_libraries(${PROJECT_NAME} PUBLIC Freetype::Freetype harfbuzz::harfbuzz Eigen3::Eigen spdlog::spdlog msdfgen-full Boost::boost Vulkan::Vulkan LLGL)
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE NOMINMAX)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE NOMINMAX)
|
||||||
add_os_definitions(${PROJECT_NAME})
|
add_os_definitions(${PROJECT_NAME})
|
||||||
|
@ -144,7 +144,7 @@ namespace mirage {
|
|||||||
throw std::runtime_error("Failed to open file");
|
throw std::runtime_error("Failed to open file");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct stat sb;
|
struct stat sb{};
|
||||||
if (fstat(fd, &sb) == -1) {
|
if (fstat(fd, &sb) == -1) {
|
||||||
cleanup();
|
cleanup();
|
||||||
throw std::runtime_error("Failed to get file size");
|
throw std::runtime_error("Failed to get file size");
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
namespace mirage {
|
namespace mirage {
|
||||||
|
#if MIRAGE_PLATFORM_WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
class mapped_file_win {
|
class mapped_file_win {
|
||||||
public:
|
public:
|
||||||
mapped_file_win();
|
mapped_file_win();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user