Merge branch 'master' of https://gitee.com/lveyou/dl
# Conflicts: # dl/base/dl_concept.h # dl/system/dl_infoware.h
This commit is contained in:
+22
-3
@@ -58,7 +58,9 @@ endif()
|
||||
|
||||
# 使用C++最新标准
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -lc++abi")
|
||||
endif()
|
||||
# CentOs无默认源,暂还是使用stdlibc++
|
||||
# Clang 使用 libc++ 标准库
|
||||
#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
@@ -68,6 +70,10 @@ set(CMAKE_CXX_STANDARD 23)
|
||||
# add_link_options(-stdlib=libc++ -lc++abi)
|
||||
#endif()
|
||||
|
||||
if (APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
endif()
|
||||
|
||||
message("------------------第三方库option------------------")
|
||||
if(DEFINED BUILD_DOCS)
|
||||
unset(BUILD_DOCS CACHE)
|
||||
@@ -85,6 +91,9 @@ endif()
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
option(ALSOFT_INSTALL "解决安卓openal报错" OFF)
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
option(ALSOFT_INSTALL "解决安卓openal报错" OFF)
|
||||
endif()
|
||||
|
||||
if(DEFINED CURL_USE_OPENSSL)
|
||||
unset(CURL_USE_OPENSSL CACHE)
|
||||
@@ -140,7 +149,16 @@ message("------------------flac 音频格式库-----------")
|
||||
add_subdirectory ("third/flac")
|
||||
message("------------------openal-soft 音频库-----------")
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
add_subdirectory ("third/openal-soft")
|
||||
# Mac系统(Darwin)下,先修复openal-soft的dl依赖问题
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
# 定义CMAKE_DL_LIBS(Mac下指向系统dl库),避免openal-soft找不到dl目标
|
||||
set(CMAKE_DL_LIBS "-ldl")
|
||||
# 强制跳过openal-soft的export/install(核心报错点)
|
||||
set(OPENAL_BUILD_INSTALL OFF CACHE BOOL "Disable OpenAL install" FORCE)
|
||||
set(OPENAL_BUILD_EXAMPLES OFF CACHE BOOL "Disable OpenAL examples" FORCE)
|
||||
endif()
|
||||
# 再添加openal-soft子目录
|
||||
add_subdirectory ("third/openal-soft")
|
||||
endif()
|
||||
message("------------------rtmidi midi库-----------")
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
@@ -161,10 +179,11 @@ message("------------------lua 脚本语言库-----------")
|
||||
add_subdirectory ("third/lua")
|
||||
add_subdirectory ("third/LuaBridge3")
|
||||
message("------------------infoware 硬件信息库-----------")
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "AMD64")
|
||||
set(INFOWARE_PCI_IDS_PATH ${CMAKE_SOURCE_DIR}/third/infoware/pci.ids CACHE FILEPATH "使用本地piiids" FORCE)
|
||||
add_subdirectory ("third/infoware")
|
||||
endif()
|
||||
|
||||
message("------------------wcwidth 字符宽度检测-----------")
|
||||
add_subdirectory ("third/wcwidth")
|
||||
message("------------------simde 向量化计算-----------")
|
||||
|
||||
+21
-5
@@ -138,6 +138,10 @@ endif()
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
#include_directories(${CMAKE_SOURCE_DIR}/third/libiconv/include)
|
||||
#target_link_libraries(${PROJECT_NAME} PRIVATE Libiconv)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
# 查找 iconv 库(兼容系统/新版)
|
||||
find_library(ICONV_LIBRARY NAMES iconv libiconv)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${ICONV_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (NOT DL_DISABLE_RENDER)
|
||||
@@ -159,7 +163,8 @@ if (NOT DL_DISABLE_AUDIO)
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libopenal.so)
|
||||
find_package(OpenAL REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL)
|
||||
endif()
|
||||
endif()
|
||||
#rtmidi
|
||||
@@ -247,11 +252,22 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
Crypt32.lib)
|
||||
endif()
|
||||
endif()
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libcrypto.so)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libssl.so)
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
find_package(OpenSSL REQUIRED)
|
||||
# 链接 libcrypto
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENSSL_CRYPTO_LIBRARY}) # 显式链接 libcrypto
|
||||
endif()
|
||||
if (APPLE)
|
||||
# Apple Silicon
|
||||
set(OPENSSL_ROOT_DIR "/opt/homebrew/opt/openssl@3")
|
||||
# Intel Mac 替换为:set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl@3")
|
||||
|
||||
# 添加头文件路径
|
||||
include_directories(${OPENSSL_ROOT_DIR}/include)
|
||||
# 添加库路径
|
||||
link_directories(${OPENSSL_ROOT_DIR}/lib)
|
||||
endif()
|
||||
|
||||
# asio
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/asio/include)
|
||||
# sqlite
|
||||
|
||||
@@ -82,3 +82,86 @@ concept IsEnum = std::is_enum<T>::value;
|
||||
#endif
|
||||
|
||||
}
|
||||
/**
|
||||
* @file dl_concept.h
|
||||
* @brief 用于模板限定,更好的报错信息
|
||||
*
|
||||
*
|
||||
* @version 1.0
|
||||
* @author lveyou
|
||||
* @date 21-08-12
|
||||
*
|
||||
* @note
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "system/dl_platform.h"
|
||||
|
||||
|
||||
#include <concepts>
|
||||
|
||||
namespace dl
|
||||
{
|
||||
#if ((DL_PLATFORM != DL_PLATFORM_ANDROID) && (DL_PLATFORM != DL_PLATFORM_APPLE))//标准库为小写下划线命名,我们使用大写开头
|
||||
template<typename T>
|
||||
concept PopFrontAble = requires(T x) { x.pop_front(); };
|
||||
|
||||
template<typename T>
|
||||
concept IsUnsigned = std::is_unsigned<T>::value;
|
||||
|
||||
template<typename T>
|
||||
concept IsSigned = std::is_signed<T>::value;
|
||||
|
||||
template<typename T>
|
||||
concept IsInteger = std::is_integral<T>::value;
|
||||
|
||||
template<typename T>
|
||||
concept IsReal = std::is_floating_point<T>::value;
|
||||
|
||||
//标准布局
|
||||
template<typename T>
|
||||
concept IsStandardLayout = std::is_standard_layout<T>::value;
|
||||
|
||||
//平凡类型,比is_standard_layout严格
|
||||
template<typename T>
|
||||
concept IsTrivial = std::is_trivial<T>::value;
|
||||
|
||||
//标准布局 与 平凡类型 的组合
|
||||
template<typename T>
|
||||
concept IsPod = std::is_pod<T>::value;
|
||||
|
||||
template<typename T>
|
||||
concept IsNotPod = !std::is_pod<T>::value;
|
||||
|
||||
//! 平凡可复制 唯一可以使用std::memcpy和fstream::write/read的类型
|
||||
template<typename T>
|
||||
concept IsCopyable = std::is_trivially_copyable<T>::value;
|
||||
|
||||
//! 是内置数据类型
|
||||
template<typename T>
|
||||
concept IsBase = std::is_fundamental<T>::value;
|
||||
|
||||
//! 是指针类型
|
||||
template<typename T>
|
||||
concept IsPointer = std::is_pointer<T>::value;
|
||||
|
||||
//! 是枚举类型
|
||||
template<typename T>
|
||||
concept IsEnum = std::is_enum<T>::value;
|
||||
#else
|
||||
#define PopFrontAble typename
|
||||
#define IsUnsigned typename
|
||||
#define IsSigned typename
|
||||
#define IsInteger typename
|
||||
#define IsReal typename
|
||||
#define IsStandardLayout typename
|
||||
#define IsTrivial typename
|
||||
#define IsPod typename
|
||||
#define IsNotPod typename
|
||||
#define IsCopyable typename
|
||||
#define IsBase typename
|
||||
#define IsPointer typename
|
||||
#define IsEnum typename
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
+1158
-1094
File diff suppressed because it is too large
Load Diff
@@ -843,6 +843,21 @@ struct FileImp
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if DL_PLATFORM == DL_PLATFORM_APPLE
|
||||
struct FileImp
|
||||
{
|
||||
std::string _pathFilesDir;
|
||||
std::string _pathExternalFilesDir;
|
||||
std::string _pathExternalStorageDirectory;
|
||||
void Build()
|
||||
{
|
||||
_pathFilesDir = "/Users/zego/code/dl/out/";
|
||||
_pathExternalFilesDir = _pathFilesDir;
|
||||
_pathExternalStorageDirectory = _pathFilesDir;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
FileImp g_fileImp;
|
||||
|
||||
void InitFileSystem()
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <asio.hpp>
|
||||
|
||||
#include "system/dl_time.h"
|
||||
|
||||
namespace dl
|
||||
{
|
||||
Network* g_net;
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ public:
|
||||
void SetCbDisconnect(CbDisconnect func);
|
||||
|
||||
|
||||
template<IsEnum E, IsPod T>
|
||||
template<IsEnum E, IsPod T, std::enable_if_t<std::is_pod_v<T>, bool> = true>
|
||||
void Send(int sokect_id, E msg_id, const T& a)
|
||||
{
|
||||
BufferView buf = CreateBufferView(a);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "io/dl_log.h"
|
||||
#include "base/dl_string.h"
|
||||
|
||||
#if DL_PLATFORM != DL_PLATFORM_ANDROID
|
||||
#if DL_PLATFORM != DL_PLATFORM_ANDROID && DL_PLATFORM != DL_PLATFORM_APPLE
|
||||
|
||||
namespace dl::Infoware
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "dl_platform.h"
|
||||
|
||||
#include <string>
|
||||
#if DL_PLATFORM != DL_PLATFORM_ANDROID
|
||||
#ifdef __x86_64__
|
||||
#include <infoware/infoware.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define DL_PLATFORM_WIN32 1
|
||||
#define DL_PLATFORM_LINUX 2
|
||||
#define DL_PLATFORM_ANDROID 3
|
||||
#define DL_PLATFORM_APPLE 4
|
||||
|
||||
#define DL_PLATFORM DL_PLATFORM_ERROR
|
||||
|
||||
@@ -33,6 +34,11 @@
|
||||
#define DL_PLATFORM DL_PLATFORM_ANDROID
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#undef DL_PLATFORM
|
||||
#define DL_PLATFORM DL_PLATFORM_APPLE
|
||||
#endif
|
||||
|
||||
//! 是否64位
|
||||
consteval bool is_x64()
|
||||
{
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
|
||||
#ifndef ASIO_DETAIL_CONFIG_HPP
|
||||
#define ASIO_DETAIL_CONFIG_HPP
|
||||
|
||||
#define ASIO_HAS_STD_EXCEPTION_PTR 0
|
||||
// boostify: non-boost code starts here
|
||||
#if !defined(ASIO_STANDALONE)
|
||||
# if !defined(ASIO_ENABLE_BOOST)
|
||||
@@ -173,7 +173,7 @@
|
||||
# define ASIO_HAS_STD_FUTURE 1
|
||||
# define ASIO_HAS_STD_TUPLE 1
|
||||
# define ASIO_HAS_STD_IOSTREAM_MOVE 1
|
||||
# define ASIO_HAS_STD_EXCEPTION_PTR 1
|
||||
# define ASIO_HAS_STD_EXCEPTION_PTR 0
|
||||
# define ASIO_HAS_STD_NESTED_EXCEPTION 1
|
||||
# define ASIO_HAS_STD_HASH 1
|
||||
#endif // !defined(ASIO_DISABLE_CXX11_MACROS)
|
||||
|
||||
Reference in New Issue
Block a user