Skip to content

Commit

Permalink
wrapped C library
Browse files Browse the repository at this point in the history
  • Loading branch information
ypopovych committed Aug 28, 2023
1 parent 3f100c1 commit 489c38d
Show file tree
Hide file tree
Showing 14 changed files with 8,827 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build & Tests
on: [push, pull_request]
jobs:
macos:
runs-on: macOS-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
- name: Build and Test SPM
run: swift test
- name: Update Cocoa Pods repo
run: pod repo update
- name: Build and Test CocoaPods
run: pod lib lint --allow-warnings --fail-fast
linux:
runs-on: ubuntu-latest
container:
image: swift:5.8
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build and Test
run: swift test
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish CocoaPods package
on:
release:
types: [created]
jobs:
publish:
runs-on: macOS-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
- name: Publish Pod
run: |
sed -i '' "s|[[:blank:]]*s\.version[[:blank:]].*|s.version = '${VERSION}'|g" *.podspec
pod trunk push --allow-warnings
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
VERSION: ${{ github.event.release.tag_name }}

10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

.DS_Store

## User settings
xcuserdata/

Expand Down Expand Up @@ -37,14 +39,14 @@ playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
Packages/
Package.pins
Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm
.swiftpm

.build/

Expand Down
22 changes: 22 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// swift-tools-version:5.4
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "xxHash",
platforms: [.macOS(.v10_13), .iOS(.v11), .tvOS(.v11), .watchOS(.v6)],
products: [
.library(
name: "xxHash",
targets: ["xxHash"])
],
dependencies: [],
targets: [
.target(name: "xxHash",
dependencies: ["CxxHash"]),
.target(name: "CxxHash"),
.testTarget(name: "xxHashTests",
dependencies: ["xxHash"])
]
)
26 changes: 26 additions & 0 deletions Sources/CxxHash/include/xxhash_swift.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// xxhash_swift.h
//
//
// Created by Yehor Popovych on 28/08/2023.
//

#ifndef __xxhash_swift_h__
#define __xxhash_swift_h__

#ifdef __BYTE_ORDER__
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define XXH_CPU_LITTLE_ENDIAN 1
#elif
#define XXH_CPU_LITTLE_ENDIAN 0
#endif
#else
#error "Byte order is unknown"
#endif

#define XXH_INLINE_ALL
#define XXH_STATIC_LINKING_ONLY

#include "../xxhash.h"

#endif /* __xxhash_swift_h__ */
4 changes: 4 additions & 0 deletions Sources/CxxHash/xxhash.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//#define XXH_INLINE_ALL
//#define XXH_STATIC_LINKING_ONLY

#include "xxhash_swift.h"

0 comments on commit 489c38d

Please sign in to comment.