浏览代码

兼容xcode

tags/v2.9.7
tearshark 4 年前
父节点
当前提交
e0555c5668

+ 1
- 1
librf/librf.h 查看文件

@@ -32,7 +32,7 @@
#include <thread>
#include <iostream>
#include <assert.h>
#if defined(__clang__) && _WIN32
#if defined(__clang__) && (__APPLE__ || WIN32)
#include "src/unix/coroutine.h" //编译器内建的协程函数,MSVC和clang不一样
#else
#include <experimental/coroutine>

+ 0
- 1
librf/src/def.h 查看文件

@@ -38,7 +38,6 @@ RESUMEF_NS
template<typename _PromiseT = void>
using coroutine_handle = std::experimental::coroutine_handle<_PromiseT>;
using suspend_if = std::experimental::suspend_if;
using suspend_always = std::experimental::suspend_always;
using suspend_never = std::experimental::suspend_never;

+ 4
- 4
librf/src/generator.h 查看文件

@@ -22,7 +22,7 @@ RESUMEF_NS
coroutine_handle<promise_type> _Coro;
generator_iterator(nullptr_t) : _Coro(nullptr)
generator_iterator(std::nullptr_t) : _Coro(nullptr)
{
}
@@ -58,9 +58,9 @@ RESUMEF_NS
};
template <typename promise_type>
struct generator_iterator<nullptr_t, promise_type> : public generator_iterator<void, promise_type>
struct generator_iterator<std::nullptr_t, promise_type> : public generator_iterator<void, promise_type>
{
generator_iterator(nullptr_t) : generator_iterator<void, promise_type>(nullptr)
generator_iterator(std::nullptr_t) : generator_iterator<void, promise_type>(nullptr)
{
}
generator_iterator(coroutine_handle<promise_type> _CoroArg) : generator_iterator<void, promise_type>(_CoroArg)
@@ -75,7 +75,7 @@ RESUMEF_NS
using reference = _Ty const&;
using pointer = _Ty const*;
generator_iterator(nullptr_t) : generator_iterator<void, promise_type>(nullptr)
generator_iterator(std::nullptr_t) : generator_iterator<void, promise_type>(nullptr)
{
}
generator_iterator(coroutine_handle<promise_type> _CoroArg) : generator_iterator<void, promise_type>(_CoroArg)

+ 38
- 0
test_librf.cpp 查看文件

@@ -0,0 +1,38 @@

#include "librf/librf.h"
#include <iostream>

extern void resumable_main_yield_return();
extern void resumable_main_timer();
extern void resumable_main_suspend_always();
extern void resumable_main_sleep();
extern void resumable_main_routine();
extern void resumable_main_resumable();
extern void resumable_main_mutex();
extern void resumable_main_exception();
extern void resumable_main_event();
extern void resumable_main_event_v2();
extern void resumable_main_event_timeout();
extern void resumable_main_dynamic_go();
extern void resumable_main_channel();
extern void resumable_main_cb();
extern void resumable_main_modern_cb();
extern void resumable_main_multi_thread();
extern void resumable_main_channel_mult_thread();
extern void resumable_main_when_all();
extern void resumable_main_layout();
extern void resumable_main_switch_scheduler();

extern void resumable_main_benchmark_mem(bool wait_key);
extern void benchmark_main_channel_passing_next();
extern void resumable_main_benchmark_asio_server();
extern void resumable_main_benchmark_asio_client(intptr_t nNum);

int main(int argc, const char* argv[])
{
std::cout << __clang_major__ << std::endl;
(void)argc;
(void)argv;
return 0;
}

+ 0
- 83
vs_proj/librf.cpp 查看文件

@@ -1,83 +0,0 @@

#include "librf.h"
#include <optional>
#include <crtdbg.h>
//#define _WITH_LOCK_FREE_Q_KEEP_REAL_SIZE 1
#include "src/ring_queue.h"
#include "src/ring_queue_spinlock.h"
#include "src/ring_queue_lockfree.h"
#include "../tutorial/test_ring_queue.h"
extern void resumable_main_yield_return();
extern void resumable_main_timer();
extern void resumable_main_suspend_always();
extern void resumable_main_sleep();
extern void resumable_main_routine();
extern void resumable_main_resumable();
extern void resumable_main_mutex();
extern void resumable_main_exception();
extern void resumable_main_event();
extern void resumable_main_event_v2();
extern void resumable_main_event_timeout();
extern void resumable_main_dynamic_go();
extern void resumable_main_channel();
extern void resumable_main_cb();
extern void resumable_main_modern_cb();
extern void resumable_main_multi_thread();
extern void resumable_main_channel_mult_thread();
extern void resumable_main_when_all();
extern void resumable_main_layout();
extern void resumable_main_switch_scheduler();
extern void resumable_main_benchmark_mem(bool wait_key);
extern void benchmark_main_channel_passing_next();
extern void resumable_main_benchmark_asio_server();
extern void resumable_main_benchmark_asio_client(intptr_t nNum);
int main(int argc, const char* argv[])
{
//_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF);
(void)argc;
(void)argv;
//test_ring_queue_simple<resumef::ring_queue<int>>();
//test_ring_queue<resumef::ring_queue_spinlock<int, false, uint32_t>>();
//test_ring_queue<resumef::ring_queue_lockfree<int, uint64_t>>();
resumable_main_mutex();
return 0;
//if (argc > 1)
// resumable_main_benchmark_asio_client(atoi(argv[1]));
//else
// resumable_main_benchmark_asio_server();
resumable_main_cb(); _CrtCheckMemory();
resumable_main_layout(); _CrtCheckMemory();
resumable_main_modern_cb(); _CrtCheckMemory();
resumable_main_suspend_always(); _CrtCheckMemory();
resumable_main_yield_return(); _CrtCheckMemory();
resumable_main_resumable(); _CrtCheckMemory();
resumable_main_routine(); _CrtCheckMemory();
resumable_main_exception(); _CrtCheckMemory();
resumable_main_dynamic_go(); _CrtCheckMemory();
resumable_main_multi_thread(); _CrtCheckMemory();
resumable_main_timer(); _CrtCheckMemory();
resumable_main_benchmark_mem(false); _CrtCheckMemory();
resumable_main_mutex(); _CrtCheckMemory();
resumable_main_event(); _CrtCheckMemory();
resumable_main_event_v2(); _CrtCheckMemory();
resumable_main_event_timeout(); _CrtCheckMemory();
resumable_main_channel(); _CrtCheckMemory();
resumable_main_channel_mult_thread(); _CrtCheckMemory();
resumable_main_sleep(); _CrtCheckMemory();
resumable_main_when_all(); _CrtCheckMemory();
resumable_main_switch_scheduler(); _CrtCheckMemory();
std::cout << "ALL OK!" << std::endl;
benchmark_main_channel_passing_next(); //这是一个死循环测试
_CrtCheckMemory();
return 0;
}

+ 1
- 5
vs_proj/librf.vcxproj 查看文件

@@ -192,6 +192,7 @@
<ClCompile Include="..\librf\src\state.cpp" />
<ClCompile Include="..\librf\src\timer.cpp" />
<ClCompile Include="..\librf\src\when_v2.cpp" />
<ClCompile Include="..\test_librf.cpp" />
<ClCompile Include="..\tutorial\test_async_cb.cpp" />
<ClCompile Include="..\tutorial\test_async_channel.cpp" />
<ClCompile Include="..\tutorial\test_async_channel_mult_thread.cpp" />
@@ -212,11 +213,6 @@
<ClCompile Include="..\tutorial\test_async_timer.cpp" />
<ClCompile Include="..\tutorial\test_async_when_all.cpp" />
<ClCompile Include="..\tutorial\test_async_yield_return.cpp" />
<ClCompile Include="librf.cpp">
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</BasicRuntimeChecks>
<BufferSecurityCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</BufferSecurityCheck>
<SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</SDLCheck>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\librf\librf.h" />

+ 3
- 3
vs_proj/librf.vcxproj.filters 查看文件

@@ -22,9 +22,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="librf.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\librf\src\rf_task.cpp">
<Filter>librf\src</Filter>
</ClCompile>
@@ -124,6 +121,9 @@
<ClCompile Include="..\librf\src\mutex_v2.cpp">
<Filter>librf\src</Filter>
</ClCompile>
<ClCompile Include="..\test_librf.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\librf\librf.h">

+ 280
- 0
xcode_proj/librf.xcodeproj/project.pbxproj 查看文件

@@ -0,0 +1,280 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
B6BAB788242C879600566C2F /* test_librf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6BAB787242C879600566C2F /* test_librf.cpp */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
B6BAB77B242C870200566C2F /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
B6132286242C89BC003E7AB6 /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = ../librf/src; sourceTree = "<group>"; };
B6132287242C8A12003E7AB6 /* librf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = librf.h; path = ../librf/librf.h; sourceTree = "<group>"; };
B6132288242C8A12003E7AB6 /* librf_macro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = librf_macro.h; path = ../librf/librf_macro.h; sourceTree = "<group>"; };
B6BAB77D242C870200566C2F /* librf */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = librf; sourceTree = BUILT_PRODUCTS_DIR; };
B6BAB787242C879600566C2F /* test_librf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = test_librf.cpp; path = ../test_librf.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
B6BAB77A242C870200566C2F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
B6BAB774242C870200566C2F = {
isa = PBXGroup;
children = (
B6132288242C8A12003E7AB6 /* librf_macro.h */,
B6132287242C8A12003E7AB6 /* librf.h */,
B6132286242C89BC003E7AB6 /* src */,
B6BAB787242C879600566C2F /* test_librf.cpp */,
B6BAB77E242C870200566C2F /* Products */,
);
sourceTree = "<group>";
};
B6BAB77E242C870200566C2F /* Products */ = {
isa = PBXGroup;
children = (
B6BAB77D242C870200566C2F /* librf */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
B6BAB77C242C870200566C2F /* librf */ = {
isa = PBXNativeTarget;
buildConfigurationList = B6BAB784242C870200566C2F /* Build configuration list for PBXNativeTarget "librf" */;
buildPhases = (
B6BAB779242C870200566C2F /* Sources */,
B6BAB77A242C870200566C2F /* Frameworks */,
B6BAB77B242C870200566C2F /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = librf;
productName = librf;
productReference = B6BAB77D242C870200566C2F /* librf */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
B6BAB775242C870200566C2F /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1120;
ORGANIZATIONNAME = tearshark;
TargetAttributes = {
B6BAB77C242C870200566C2F = {
CreatedOnToolsVersion = 11.2.1;
};
};
};
buildConfigurationList = B6BAB778242C870200566C2F /* Build configuration list for PBXProject "librf" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = B6BAB774242C870200566C2F;
productRefGroup = B6BAB77E242C870200566C2F /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
B6BAB77C242C870200566C2F /* librf */,
);
};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
B6BAB779242C870200566C2F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B6BAB788242C879600566C2F /* test_librf.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
B6BAB782242C870200566C2F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++2a";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = ../librf;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
B6BAB783242C870200566C2F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++2a";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = ../librf;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
B6BAB785242C870200566C2F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
B6BAB786242C870200566C2F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
B6BAB778242C870200566C2F /* Build configuration list for PBXProject "librf" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B6BAB782242C870200566C2F /* Debug */,
B6BAB783242C870200566C2F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B6BAB784242C870200566C2F /* Build configuration list for PBXNativeTarget "librf" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B6BAB785242C870200566C2F /* Debug */,
B6BAB786242C870200566C2F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = B6BAB775242C870200566C2F /* Project object */;
}

+ 7
- 0
xcode_proj/librf.xcodeproj/project.xcworkspace/contents.xcworkspacedata 查看文件

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

+ 8
- 0
xcode_proj/librf.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist 查看文件

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

二进制
xcode_proj/librf.xcodeproj/project.xcworkspace/xcuserdata/tearshark.xcuserdatad/UserInterfaceState.xcuserstate 查看文件


+ 6
- 0
xcode_proj/librf.xcodeproj/xcuserdata/tearshark.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist 查看文件

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "8B91F1F2-7125-413C-9D3B-713185B6064E"
type = "1"
version = "2.0">
</Bucket>

+ 14
- 0
xcode_proj/librf.xcodeproj/xcuserdata/tearshark.xcuserdatad/xcschemes/xcschememanagement.plist 查看文件

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>librf.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>

正在加载...
取消
保存