Browse Source

兼容新版本的clang

3.0.0
tearshark 8 months ago
parent
commit
fd4fb92378

+ 28
- 0
cmake/SelectDynamicLibrary.cmake View File

@@ -1,5 +1,33 @@
include(SelectLibraryConfigurations)

if(NOT DEFINED CMAKE_PROCESSOR_ALIAS)
MESSAGE(STATUS "operation system is ${CMAKE_CXX_PLATFORM_ID}")
MESSAGE(STATUS "processor is ${CMAKE_HOST_SYSTEM_PROCESSOR}")

if((${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "i386") OR (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64") OR (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64"))
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_PROCESSOR_ALIAS "x86" CACHE STRING "Alias of processor")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_PROCESSOR_ALIAS "x64" CACHE STRING "Alias of processor")
else()
message(FATAL_ERROR "Unknown processor")
endif()
elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "aarch64")
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_PROCESSOR_ALIAS "arm" CACHE STRING "Alias of processor")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_PROCESSOR_ALIAS "arm64" CACHE STRING "Alias of processor")
else()
message(FATAL_ERROR "Unknown processor")
endif()
else()
message(FATAL_ERROR "Unknown processor")
endif()

message(STATUS "CMAKE_PROCESSOR_ALIAS=${CMAKE_PROCESSOR_ALIAS}")
endif()


macro(_acl_copy_dynamic_library_build_type basename build_type)

if(${build_type} STREQUAL "Debug")

+ 8
- 1
include/librf/librf.h View File

@@ -33,10 +33,12 @@
#include <optional>
#include <thread>
#include <cassert>
#include <utility>

#if __cpp_impl_coroutine
#include <coroutine>
#ifdef _MSC_VER
#ifndef __clang__
extern "C" size_t _coro_frame_size();
extern "C" void* _coro_frame_ptr();
extern "C" void _coro_init_block();
@@ -56,11 +58,16 @@ extern "C" void _coro_resume_block();
#pragma intrinsic(_coro_suspend)
#pragma intrinsic(_coro_cancel)
#pragma intrinsic(_coro_resume_block)
#else
#include "src/unix/clang_builtin.h"
#endif
#endif
#elif defined(__clang__)
#include "src/unix/coroutine.h"
#else
#elif __has_include(<experimental/coroutine>)
#include <experimental/coroutine>
#else
#include "src/unix/coroutine.h"
#endif

#include "src/stop_token.h"

+ 2
- 2
include/librf/src/unix/clang_builtin.h View File

@@ -40,13 +40,13 @@ extern "C" bool __builtin_coro_alloc();
//extern "C" void* __builtin_coro_begin(void* memory);
//extern "C" void* __builtin_coro_end(void* coro_frame, bool unwind);
extern "C" char __builtin_coro_suspend(bool final);
extern "C" bool __builtin_coro_param(void* original, void* copy);
//extern "C" bool __builtin_coro_param(void* original, void* copy);
#pragma intrinsic(__builtin_coro_id)
#pragma intrinsic(__builtin_coro_alloc)
//#pragma intrinsic(__builtin_coro_begin)
//#pragma intrinsic(__builtin_coro_end)
#pragma intrinsic(__builtin_coro_suspend)
#pragma intrinsic(__builtin_coro_param)
//#pragma intrinsic(__builtin_coro_param)

#ifdef __clang__
#define _coro_frame_size() __builtin_coro_size()

+ 3
- 0
tutorial/CMakeLists.txt View File

@@ -10,4 +10,7 @@ foreach(TUTORIAL_FILE_PATH ${TUTORIAL_FILES})
target_compile_definitions(${TUTORIAL_FILE_NAME}
PRIVATE LIBRF_TUTORIAL_STAND_ALONE=1
)
if(UNIX)
set_target_properties(${TUTORIAL_FILE_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN/")
endif(UNIX)
endforeach(TUTORIAL_FILE_PATH)

Loading…
Cancel
Save