Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
capnproto
Commits
215e44ab
Commit
215e44ab
authored
Oct 14, 2017
by
Harris Hancock
Committed by
Harris Hancock
Nov 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build as much of the samples as possible in lite-mode
parent
fc27d354
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
CMakeLists.txt
c++/samples/CMakeLists.txt
+10
-7
addressbook.c++
c++/samples/addressbook.c++
+8
-1
No files found.
c++/samples/CMakeLists.txt
View file @
215e44ab
...
...
@@ -26,10 +26,13 @@ add_executable(addressbook addressbook.c++ ${addressbookSources})
target_link_libraries
(
addressbook CapnProto::capnp
)
target_include_directories
(
addressbook PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
capnp_generate_cpp
(
calculatorSources calculatorHeaders calculator.capnp
)
add_executable
(
calculator-client calculator-client.c++
${
calculatorSources
}
)
add_executable
(
calculator-server calculator-server.c++
${
calculatorSources
}
)
target_link_libraries
(
calculator-client CapnProto::capnp-rpc
)
target_link_libraries
(
calculator-server CapnProto::capnp-rpc
)
target_include_directories
(
calculator-client PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
target_include_directories
(
calculator-server PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
# Don't build the rpc sample if find_package() found an installation of Cap'n Proto lite.
if
(
TARGET CapnProto::capnp-rpc
)
capnp_generate_cpp
(
calculatorSources calculatorHeaders calculator.capnp
)
add_executable
(
calculator-client calculator-client.c++
${
calculatorSources
}
)
add_executable
(
calculator-server calculator-server.c++
${
calculatorSources
}
)
target_link_libraries
(
calculator-client CapnProto::capnp-rpc
)
target_link_libraries
(
calculator-server CapnProto::capnp-rpc
)
target_include_directories
(
calculator-client PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
target_include_directories
(
calculator-server PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
endif
()
c++/samples/addressbook.c++
View file @
215e44ab
...
...
@@ -113,6 +113,8 @@ void printAddressBook(int fd) {
}
}
#if !CAPNP_LITE
#include "addressbook.capnp.h"
#include <capnp/message.h>
#include <capnp/serialize-packed.h>
...
...
@@ -260,8 +262,9 @@ void dynamicPrintMessage(int fd, StructSchema schema) {
std
::
cout
<<
std
::
endl
;
}
#endif // !CAPNP_LITE
int
main
(
int
argc
,
char
*
argv
[])
{
StructSchema
schema
=
Schema
::
from
<
AddressBook
>
();
if
(
argc
!=
2
)
{
std
::
cerr
<<
"Missing arg."
<<
std
::
endl
;
return
1
;
...
...
@@ -269,10 +272,14 @@ int main(int argc, char* argv[]) {
writeAddressBook
(
1
);
}
else
if
(
strcmp
(
argv
[
1
],
"read"
)
==
0
)
{
printAddressBook
(
0
);
#if !CAPNP_LITE
}
else
if
(
strcmp
(
argv
[
1
],
"dwrite"
)
==
0
)
{
StructSchema
schema
=
Schema
::
from
<
AddressBook
>
();
dynamicWriteAddressBook
(
1
,
schema
);
}
else
if
(
strcmp
(
argv
[
1
],
"dread"
)
==
0
)
{
StructSchema
schema
=
Schema
::
from
<
AddressBook
>
();
dynamicPrintMessage
(
0
,
schema
);
#endif
}
else
{
std
::
cerr
<<
"Invalid arg: "
<<
argv
[
1
]
<<
std
::
endl
;
return
1
;
...
...
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