Skip to content

Commit 3646840

Browse files
committed
[feature] zmq config ON
1 parent 0f1ac98 commit 3646840

File tree

5 files changed

+124
-33
lines changed

5 files changed

+124
-33
lines changed

CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ FetchContent_MakeAvailable(Kuku)
162162
# else()
163163
message(STATUS "Flatbuffers: found")
164164
# get_target_property(FLATBUFFERS_FLATC_PATH flatbuffers::flatc IMPORTED_LOCATION_RELEASE)
165-
set(FLATBUFFERS_FLATC_PATH "/usr/local/bin/flatc")
165+
set(FLATBUFFERS_FLATC_PATH "/opt/homebrew/bin/flatc")
166166
message(STATUS "flatc path: ${FLATBUFFERS_FLATC_PATH}")
167167
include(CompileSchemaCXX)
168168
# endif()
@@ -196,9 +196,10 @@ endif()
196196

197197
# [Option] APSI_USE_ZMQ (default: ON)
198198
set(APSI_USE_ZMQ_OPTION_STR "Use ZeroMQ for networking")
199-
option(APSI_USE_ZMQ ${APSI_USE_ZMQ_OPTION_STR} OFF)
200-
set(APSI_USE_ZMQ OFF)
199+
option(APSI_USE_ZMQ ${APSI_USE_ZMQ_OPTION_STR} ON)
200+
# set(APSI_USE_ZMQ OFF)
201201
if(APSI_USE_ZMQ)
202+
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
202203
# ZeroMQ base
203204
find_package(ZeroMQ REQUIRED)
204205
if(NOT ZeroMQ_FOUND)
@@ -231,7 +232,7 @@ endif()
231232
# [Option] APSI_BUILD_CLI (default: OFF)
232233
set(APSI_BUILD_CLI_OPTION_STR "Build example command line interface applications")
233234
cmake_dependent_option(APSI_BUILD_CLI ${APSI_BUILD_CLI_OPTION_STR} OFF "APSI_USE_ZMQ;APSI_USE_LOG4CPLUS" OFF)
234-
set(APSI_BUILD_CLI OFF)
235+
set(APSI_BUILD_CLI ON)
235236
if (APSI_BUILD_CLI)
236237
# TCLAP
237238
find_path(TCLAP_INCLUDE_DIRS "tclap/Arg.h")
@@ -268,7 +269,8 @@ apsi_set_version_filename(apsi)
268269
apsi_set_language(apsi)
269270
target_include_directories(apsi PUBLIC
270271
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/common>
271-
$<INSTALL_INTERFACE:${APSI_INCLUDES_INSTALL_DIR}>)
272+
$<INSTALL_INTERFACE:${APSI_INCLUDES_INSTALL_DIR}>
273+
/opt/homebrew/Cellar/flatbuffers/2.0.6/include/)
272274
target_include_directories(apsi PUBLIC
273275
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/sender>
274276
$<INSTALL_INTERFACE:${APSI_INCLUDES_INSTALL_DIR}>)
@@ -298,7 +300,7 @@ if(APSI_USE_LOG4CPLUS)
298300
target_link_libraries(apsi PUBLIC log4cplus::log4cplus)
299301
endif()
300302
if(APSI_USE_ZMQ)
301-
target_link_libraries(apsi PUBLIC libzmq-static cppzmq-static)
303+
target_link_libraries(apsi PUBLIC libzmq cppzmq)
302304
endif()
303305

304306
# Configurations for FourQlib: system, arch, SIMD, and assembler
@@ -432,6 +434,9 @@ endif()
432434
##########################
433435

434436
if(APSI_BUILD_CLI)
437+
link_directories(
438+
/opt/homebrew/Cellar/flatbuffers/2.0.6/lib
439+
/Users/chb/Projects/deps/APSI/build/lib)
435440
add_library(common_cli OBJECT)
436441
add_subdirectory(cli/common)
437442
target_include_directories(common_cli PUBLIC cli)
@@ -451,14 +456,14 @@ if(APSI_BUILD_CLI)
451456

452457
add_executable(sender_cli)
453458
add_subdirectory(cli/sender)
454-
target_link_libraries(sender_cli PUBLIC common_cli apsi)
459+
target_link_libraries(sender_cli PUBLIC common_cli apsi flatbuffers jsoncpp)
455460
if (APPLE)
456461
target_compile_options(common_cli PUBLIC -DHAVE_LONG_LONG)
457462
endif()
458463

459464
add_executable(receiver_cli)
460465
add_subdirectory(cli/receiver)
461-
target_link_libraries(receiver_cli PUBLIC common_cli apsi)
466+
target_link_libraries(receiver_cli PUBLIC common_cli apsi flatbuffers jsoncpp)
462467

463468
add_executable(pd_tool)
464469
add_subdirectory(cli/pd_tool)

FIndZeroMQ.cmake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
2+
find_package(PkgConfig)
3+
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
4+
5+
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
6+
7+
find_path(ZeroMQ_INCLUDE_DIR zmq.h
8+
PATHS ${ZeroMQ_DIR}/include
9+
${PC_LIBZMQ_INCLUDE_DIRS})
10+
11+
find_library(ZeroMQ_LIBRARY
12+
NAMES zmq
13+
PATHS ${ZeroMQ_DIR}/lib
14+
${PC_LIBZMQ_LIBDIR}
15+
${PC_LIBZMQ_LIBRARY_DIRS})
16+
17+
if(ZeroMQ_LIBRARY)
18+
set(ZeroMQ_FOUND ON)
19+
endif()
20+
21+
set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
22+
set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )
23+
24+
if(NOT TARGET libzmq)
25+
add_library(libzmq UNKNOWN IMPORTED)
26+
set_target_properties(libzmq PROPERTIES
27+
IMPORTED_LOCATION ${ZeroMQ_LIBRARIES}
28+
INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
29+
endif()
30+
31+
include ( FindPackageHandleStandardArgs )
32+
# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE
33+
# if all listed variables are TRUE
34+
find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS )

README.md

Lines changed: 71 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,76 @@
11
# APSI: C++ library for Asymmetric PSI
22

3-
- [Introduction](#introduction)
4-
- [(Unlabeled) PSI and Labeled PSI](#(unlabeled)-psi-and-labeled-psi)
5-
- [Sender and Receiver](#sender-and-receiver)
6-
- [How APSI Works](#how-apsi-works)
7-
- [Homomorphic Encryption](#homomorphic-encryption)
8-
- [Theory](#theory)
9-
- [Practice](#practice)
10-
- [Labeled Mode](#labeled-mode)
11-
- [Using APSI](#using-apsi)
12-
- [Receiver](#receiver)
13-
- [Request, Response, and ResultPart](#request--response--and-resultpart)
14-
- [Sender](#sender)
15-
- [SenderDB](#senderdb)
16-
- [PSIParams](#psiparams)
17-
- [Query Powers](#query-powers)
18-
- [Thread Control](#thread-control)
19-
- [Logging](#logging)
20-
- [Building APSI](#building-apsi)
21-
- [Command-Line Interface (CLI)](#command-line-interface-(cli))
22-
- [Common Arguments](#common-arguments)
23-
- [Receiver](#receiver-1)
24-
- [Sender](#sender-1)
25-
- [Test Data](#test-data)
26-
- [Acknowledgments](#acknowledgments)
27-
- [Questions](#questions)
3+
## 编译注意
4+
安装以下依赖
5+
1. 安装zmq,macOS为例:
6+
```bash
7+
brew install cppzmq zeromq
8+
```
9+
2. flatbuffers
10+
```bash
11+
brew install flatbuffers
12+
```
13+
然后手工修改CMakefile中与flatbuffers相关的Include 和library路径
14+
15+
3. cmake & make
16+
```bash
17+
mkdir build && cd build
18+
cmake ..
19+
make all -j
20+
```
21+
22+
- [APSI: C++ library for Asymmetric PSI](#apsi-c-library-for-asymmetric-psi)
23+
- [编译注意](#编译注意)
24+
- [Introduction](#introduction)
25+
- [(Unlabeled) PSI and Labeled PSI](#unlabeled-psi-and-labeled-psi)
26+
- [Sender and Receiver](#sender-and-receiver)
27+
- [How APSI Works](#how-apsi-works)
28+
- [Homomorphic Encryption](#homomorphic-encryption)
29+
- [Computation on Encrypted Data](#computation-on-encrypted-data)
30+
- [Noise Budget](#noise-budget)
31+
- [Encryption Parameters](#encryption-parameters)
32+
- [Theory](#theory)
33+
- [Naive Idea](#naive-idea)
34+
- [Lowering the Depth](#lowering-the-depth)
35+
- [Cuckoo Hashing](#cuckoo-hashing)
36+
- [Large Items](#large-items)
37+
- [OPRF](#oprf)
38+
- [Paterson-Stockmeyer](#paterson-stockmeyer)
39+
- [False Positives](#false-positives)
40+
- [Practice](#practice)
41+
- [Labeled Mode](#labeled-mode)
42+
- [Basic Idea](#basic-idea)
43+
- [Large Labels](#large-labels)
44+
- [Label Encryption](#label-encryption)
45+
- [Partial Item Collisions](#partial-item-collisions)
46+
- [Using APSI](#using-apsi)
47+
- [Receiver](#receiver)
48+
- [Request, Response, and ResultPart](#request-response-and-resultpart)
49+
- [Sender](#sender)
50+
- [SenderDB](#senderdb)
51+
- [PSIParams](#psiparams)
52+
- [SEALParams](#sealparams)
53+
- [ItemParams](#itemparams)
54+
- [TableParams](#tableparams)
55+
- [QueryParams](#queryparams)
56+
- [PSIParams Constructor](#psiparams-constructor)
57+
- [Loading from JSON](#loading-from-json)
58+
- [False Positives](#false-positives-1)
59+
- [Query Powers](#query-powers)
60+
- [Thread Control](#thread-control)
61+
- [Logging](#logging)
62+
- [Building APSI](#building-apsi)
63+
- [Requirements](#requirements)
64+
- [Building and Installing APSI with vcpkg](#building-and-installing-apsi-with-vcpkg)
65+
- [Building and Installing APSI Manually](#building-and-installing-apsi-manually)
66+
- [Note on Microsoft SEAL and Intel HEXL](#note-on-microsoft-seal-and-intel-hexl)
67+
- [Command-Line Interface (CLI)](#command-line-interface-cli)
68+
- [Common Arguments](#common-arguments)
69+
- [Receiver](#receiver-1)
70+
- [Sender](#sender-1)
71+
- [Test Data](#test-data)
72+
- [Acknowledgments](#acknowledgments)
73+
- [Contributing](#contributing)
2874

2975
## Introduction
3076

cli/sender/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT license.
3+
# link_directories(/opt/homebrew/Cellar/flatbuffers/2.0.6/lib)
34

45
target_sources(sender_cli
56
PRIVATE
67
${CMAKE_CURRENT_LIST_DIR}/sender.cpp
78
${CMAKE_CURRENT_LIST_DIR}/sender_utils.cpp
89
)
10+
# target_link_libraries(sender_cli flatbuffers)

common/apsi/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT license.
33

4+
# include_directories(
5+
# SYSTEM /opt/homebrew/Cellar/flatbuffers/2.0.6/include/
6+
# )
7+
48
# Source files in this directory
59
set(APSI_SOURCE_FILES ${APSI_SOURCE_FILES}
610
${CMAKE_CURRENT_LIST_DIR}/item.cpp

0 commit comments

Comments
 (0)