Skip to content

Commit 8076199

Browse files
authored
Merge pull request #25 from duckduckgo/develop
Make swift package
2 parents 54e581a + ddf00bd commit 8076199

5 files changed

Lines changed: 72 additions & 14 deletions

File tree

.github/workflows/pr.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PR Checks
2+
3+
on:
4+
push:
5+
branches: [ "develop" ]
6+
pull_request:
7+
branches: [ "develop" ]
8+
9+
jobs:
10+
unit-tests:
11+
name: Unit Tests
12+
strategy:
13+
matrix:
14+
os: [ubuntu-20.04, macos-latest]
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: recursive
21+
22+
- name: Run tests
23+
run: ./run_test.sh
24+
shell: bash
25+
26+
- name: Run Swift build
27+
run: |
28+
swift build

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.idea
22
cmake-build-debug
3-
build
3+
build
4+
.swiftpm/
5+
.DS_Store

Package.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// swift-tools-version: 5.7
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "BloomFilter",
8+
platforms: [
9+
.iOS(.v14),
10+
.macOS(.v10_15)
11+
],
12+
products: [
13+
.library(
14+
name: "BloomFilter",
15+
targets: ["BloomFilter"]
16+
),
17+
],
18+
targets: [
19+
.target(
20+
name: "BloomFilter",
21+
path: "src",
22+
sources: ["BloomFilter.cpp"],
23+
publicHeadersPath: "."
24+
)
25+
],
26+
cxxLanguageStandard: .cxx11
27+
)

run_test.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
directory=`dirname $0`
2-
mkdir $directory/build;
3-
(cd $directory/build; cmake ..; make all;)
4-
$directory/build/test/RunTests
1+
#!/usr/bin/env bash
2+
3+
directory=$(dirname "$0")
4+
mkdir "$directory"/build;
5+
(cd "$directory"/build || exit; cmake ..; make all;)
6+
"$directory"/build/test/RunTests

utils/CMakeLists.txt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
cmake_minimum_required(VERSION 3.5)
22

33
if(APPLE)
4-
include_directories(/usr/local/opt/openssl/include)
5-
link_directories(/usr/local/opt/openssl/lib)
4+
if(EXISTS /usr/local/opt/openssl/)
5+
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
6+
elseif(EXISTS /opt/homebrew/opt/openssl@1.1/)
7+
set(OPENSSL_ROOT_DIR /opt/homebrew/opt/openssl@1.1)
8+
endif()
69
endif()
710

8-
link_libraries(crypto)
9-
add_executable (GenerateFilter GenerateFilter.cpp)
11+
find_package (OpenSSL REQUIRED)
1012

11-
if(APPLE)
12-
target_link_libraries (GenerateFilter LINK_PUBLIC BloomFilter crypto)
13-
else()
14-
target_link_libraries (GenerateFilter LINK_PUBLIC BloomFilter)
15-
endif()
13+
add_executable (GenerateFilter GenerateFilter.cpp)
14+
target_link_libraries (GenerateFilter LINK_PUBLIC BloomFilter OpenSSL::Crypto)

0 commit comments

Comments
 (0)