Skip to content

Commit

Permalink
Merge pull request #25 from duckduckgo/develop
Browse files Browse the repository at this point in the history
Make swift package
  • Loading branch information
jaceklyp authored Jun 23, 2023
2 parents 54e581a + ddf00bd commit 8076199
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 14 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Checks

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

jobs:
unit-tests:
name: Unit Tests
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Run tests
run: ./run_test.sh
shell: bash

- name: Run Swift build
run: |
swift build
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
cmake-build-debug
build
build
.swiftpm/
.DS_Store
27 changes: 27 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "BloomFilter",
platforms: [
.iOS(.v14),
.macOS(.v10_15)
],
products: [
.library(
name: "BloomFilter",
targets: ["BloomFilter"]
),
],
targets: [
.target(
name: "BloomFilter",
path: "src",
sources: ["BloomFilter.cpp"],
publicHeadersPath: "."
)
],
cxxLanguageStandard: .cxx11
)
10 changes: 6 additions & 4 deletions run_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
directory=`dirname $0`
mkdir $directory/build;
(cd $directory/build; cmake ..; make all;)
$directory/build/test/RunTests
#!/usr/bin/env bash

directory=$(dirname "$0")
mkdir "$directory"/build;
(cd "$directory"/build || exit; cmake ..; make all;)
"$directory"/build/test/RunTests
17 changes: 8 additions & 9 deletions utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
cmake_minimum_required(VERSION 3.5)

if(APPLE)
include_directories(/usr/local/opt/openssl/include)
link_directories(/usr/local/opt/openssl/lib)
if(EXISTS /usr/local/opt/openssl/)
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
elseif(EXISTS /opt/homebrew/opt/[email protected]/)
set(OPENSSL_ROOT_DIR /opt/homebrew/opt/[email protected])
endif()
endif()

link_libraries(crypto)
add_executable (GenerateFilter GenerateFilter.cpp)
find_package (OpenSSL REQUIRED)

if(APPLE)
target_link_libraries (GenerateFilter LINK_PUBLIC BloomFilter crypto)
else()
target_link_libraries (GenerateFilter LINK_PUBLIC BloomFilter)
endif()
add_executable (GenerateFilter GenerateFilter.cpp)
target_link_libraries (GenerateFilter LINK_PUBLIC BloomFilter OpenSSL::Crypto)

0 comments on commit 8076199

Please sign in to comment.