Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
77180e84
Commit
77180e84
authored
7 years ago
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all examples can be compiled in MacOSX
parent
68190988
master
0.9.8-rc01
0.9.7
0.9.7-rc03
0.9.7-rc02
0.9.7-rc01
0.9.6
0.9.6-rc03
0.9.6-rc02
0.9.6-rc01
0.9.5
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
14 deletions
+117
-14
CMakeLists.txt
example/redis_c++/CMakeLists.txt
+26
-2
redis_press.cpp
example/redis_c++/redis_press.cpp
+2
-2
CMakeLists.txt
example/selective_echo_c++/CMakeLists.txt
+26
-2
client.cpp
example/selective_echo_c++/client.cpp
+2
-2
CMakeLists.txt
example/session_data_and_thread_local/CMakeLists.txt
+33
-2
client.cpp
example/session_data_and_thread_local/client.cpp
+2
-2
CMakeLists.txt
example/streaming_echo_c++/CMakeLists.txt
+26
-2
No files found.
example/redis_c++/CMakeLists.txt
View file @
77180e84
...
...
@@ -71,16 +71,40 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB))
endif
()
include_directories
(
${
LEVELDB_INCLUDE_PATH
}
)
find_library
(
SSL_LIB NAMES ssl
)
if
(
NOT SSL_LIB
)
message
(
FATAL_ERROR
"Fail to find ssl"
)
endif
()
find_library
(
CRYPTO_LIB NAMES crypto
)
if
(
NOT CRYPTO_LIB
)
message
(
FATAL_ERROR
"Fail to find crypto"
)
endif
()
set
(
DYNAMIC_LIB
${
CMAKE_THREAD_LIBS_INIT
}
${
GFLAGS_LIBRARY
}
${
PROTOBUF_LIBRARIES
}
${
LEVELDB_LIB
}
ssl
crypto
${
SSL_LIB
}
${
CRYPTO_LIB
}
dl
)
if
(
CMAKE_SYSTEM_NAME STREQUAL
"Darwin"
)
set
(
DYNAMIC_LIB
${
DYNAMIC_LIB
}
pthread
"-framework CoreFoundation"
"-framework CoreGraphics"
"-framework CoreData"
"-framework CoreText"
"-framework Security"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
endif
()
add_executable
(
redis_cli redis_cli.cpp
)
add_executable
(
redis_press redis_press.cpp
)
...
...
This diff is collapsed.
Click to expand it.
example/redis_c++/redis_press.cpp
View file @
77180e84
...
...
@@ -151,7 +151,7 @@ int main(int argc, char* argv[]) {
args
[
i
].
base_index
=
i
*
FLAGS_batch
;
args
[
i
].
redis_channel
=
&
channel
;
if
(
!
FLAGS_use_bthread
)
{
if
(
pthread_create
(
&
tids
[
i
],
NULL
,
sender
,
&
args
[
i
])
!=
0
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
tids
[
i
],
NULL
,
sender
,
&
args
[
i
])
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
...
...
@@ -174,7 +174,7 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"redis_client is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
tids
[
i
],
NULL
);
pthread_join
(
(
pthread_t
)
tids
[
i
],
NULL
);
}
else
{
bthread_join
(
tids
[
i
],
NULL
);
}
...
...
This diff is collapsed.
Click to expand it.
example/selective_echo_c++/CMakeLists.txt
View file @
77180e84
...
...
@@ -71,16 +71,40 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB))
endif
()
include_directories
(
${
LEVELDB_INCLUDE_PATH
}
)
find_library
(
SSL_LIB NAMES ssl
)
if
(
NOT SSL_LIB
)
message
(
FATAL_ERROR
"Fail to find ssl"
)
endif
()
find_library
(
CRYPTO_LIB NAMES crypto
)
if
(
NOT CRYPTO_LIB
)
message
(
FATAL_ERROR
"Fail to find crypto"
)
endif
()
set
(
DYNAMIC_LIB
${
CMAKE_THREAD_LIBS_INIT
}
${
GFLAGS_LIBRARY
}
${
PROTOBUF_LIBRARIES
}
${
LEVELDB_LIB
}
ssl
crypto
${
SSL_LIB
}
${
CRYPTO_LIB
}
dl
)
if
(
CMAKE_SYSTEM_NAME STREQUAL
"Darwin"
)
set
(
DYNAMIC_LIB
${
DYNAMIC_LIB
}
pthread
"-framework CoreFoundation"
"-framework CoreGraphics"
"-framework CoreData"
"-framework CoreText"
"-framework Security"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
endif
()
add_executable
(
selective_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
selective_echo_server server.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
This diff is collapsed.
Click to expand it.
example/selective_echo_c++/client.cpp
View file @
77180e84
...
...
@@ -201,7 +201,7 @@ int main(int argc, char* argv[]) {
tids
.
resize
(
FLAGS_thread_num
);
if
(
!
FLAGS_use_bthread
)
{
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
&
tids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
tids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
...
...
@@ -225,7 +225,7 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
tids
[
i
],
NULL
);
pthread_join
(
(
pthread_t
)
tids
[
i
],
NULL
);
}
else
{
bthread_join
(
tids
[
i
],
NULL
);
}
...
...
This diff is collapsed.
Click to expand it.
example/session_data_and_thread_local/CMakeLists.txt
View file @
77180e84
...
...
@@ -71,16 +71,47 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB))
endif
()
include_directories
(
${
LEVELDB_INCLUDE_PATH
}
)
find_path
(
LEVELDB_INCLUDE_PATH NAMES leveldb/db.h
)
find_library
(
LEVELDB_LIB NAMES leveldb
)
if
((
NOT LEVELDB_INCLUDE_PATH
)
OR
(
NOT LEVELDB_LIB
))
message
(
FATAL_ERROR
"Fail to find leveldb"
)
endif
()
include_directories
(
${
LEVELDB_INCLUDE_PATH
}
)
find_library
(
SSL_LIB NAMES ssl
)
if
(
NOT SSL_LIB
)
message
(
FATAL_ERROR
"Fail to find ssl"
)
endif
()
find_library
(
CRYPTO_LIB NAMES crypto
)
if
(
NOT CRYPTO_LIB
)
message
(
FATAL_ERROR
"Fail to find crypto"
)
endif
()
set
(
DYNAMIC_LIB
${
CMAKE_THREAD_LIBS_INIT
}
${
GFLAGS_LIBRARY
}
${
PROTOBUF_LIBRARIES
}
${
LEVELDB_LIB
}
ssl
crypto
${
SSL_LIB
}
${
CRYPTO_LIB
}
dl
)
if
(
CMAKE_SYSTEM_NAME STREQUAL
"Darwin"
)
set
(
DYNAMIC_LIB
${
DYNAMIC_LIB
}
pthread
"-framework CoreFoundation"
"-framework CoreGraphics"
"-framework CoreData"
"-framework CoreText"
"-framework Security"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
endif
()
add_executable
(
session_data_and_thread_local_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
session_data_and_thread_local_server server.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
This diff is collapsed.
Click to expand it.
example/session_data_and_thread_local/client.cpp
View file @
77180e84
...
...
@@ -112,7 +112,7 @@ int main(int argc, char* argv[]) {
tids
.
resize
(
FLAGS_thread_num
);
if
(
!
FLAGS_use_bthread
)
{
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
pthread_create
(
&
tids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
if
(
pthread_create
(
(
pthread_t
*
)
&
tids
[
i
],
NULL
,
sender
,
&
channel
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to create pthread"
;
return
-
1
;
}
...
...
@@ -136,7 +136,7 @@ int main(int argc, char* argv[]) {
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
for
(
int
i
=
0
;
i
<
FLAGS_thread_num
;
++
i
)
{
if
(
!
FLAGS_use_bthread
)
{
pthread_join
(
tids
[
i
],
NULL
);
pthread_join
(
(
pthread_t
)
tids
[
i
],
NULL
);
}
else
{
bthread_join
(
tids
[
i
],
NULL
);
}
...
...
This diff is collapsed.
Click to expand it.
example/streaming_echo_c++/CMakeLists.txt
View file @
77180e84
...
...
@@ -66,16 +66,40 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB))
endif
()
include_directories
(
${
LEVELDB_INCLUDE_PATH
}
)
find_library
(
SSL_LIB NAMES ssl
)
if
(
NOT SSL_LIB
)
message
(
FATAL_ERROR
"Fail to find ssl"
)
endif
()
find_library
(
CRYPTO_LIB NAMES crypto
)
if
(
NOT CRYPTO_LIB
)
message
(
FATAL_ERROR
"Fail to find crypto"
)
endif
()
set
(
DYNAMIC_LIB
${
CMAKE_THREAD_LIBS_INIT
}
${
GFLAGS_LIBRARY
}
${
PROTOBUF_LIBRARIES
}
${
LEVELDB_LIB
}
ssl
crypto
${
SSL_LIB
}
${
CRYPTO_LIB
}
dl
)
if
(
CMAKE_SYSTEM_NAME STREQUAL
"Darwin"
)
set
(
DYNAMIC_LIB
${
DYNAMIC_LIB
}
pthread
"-framework CoreFoundation"
"-framework CoreGraphics"
"-framework CoreData"
"-framework CoreText"
"-framework Security"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
endif
()
add_executable
(
streaming_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
streaming_echo_server server.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment