Skip to content

Commit 33646e5

Browse files
authored
Merge pull request #4 from chinwobble/fix-ci
add github ci workflow
2 parents acf8b87 + d6fff1d commit 33646e5

2 files changed

Lines changed: 77 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: fastplong ci
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
jobs:
7+
build:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os:
12+
- ubuntu-24.04
13+
- macos-12
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- name: checkout scm
17+
uses: actions/checkout@v3
18+
19+
- name: Get number of CPU cores
20+
uses: SimenB/github-actions-cpu-cores@v1
21+
id: cpu-cores
22+
23+
- name: install build dependencies (Ubuntu)
24+
run: sudo apt update && sudo apt install -y build-essential nasm
25+
if: runner.os == 'Linux'
26+
27+
- name: install build dependencies (MacOS)
28+
run: brew install automake autoconf coreutils nasm
29+
if: runner.os == 'macOS'
30+
31+
- name: get deflate
32+
uses: actions/checkout@v3
33+
with:
34+
repository: ebiggers/libdeflate
35+
path: src/libs/deflate
36+
ref: v1.22
37+
38+
- name: build deflate
39+
run: |
40+
cd src/libs/deflate
41+
cmake -B build
42+
cmake --build build -j ${{ steps.cpu-cores.outputs.count }}
43+
sudo cmake --install build
44+
cd -
45+
46+
- name: get isa-l
47+
uses: actions/checkout@v3
48+
with:
49+
repository: intel/isa-l
50+
path: src/libs/isa-l
51+
ref: v2.31.0
52+
53+
- name: build isa-l
54+
run: |
55+
cd src/libs/isa-l
56+
./autogen.sh
57+
./configure --prefix=/usr/local
58+
make -j ${{ steps.cpu-cores.outputs.count }}
59+
sudo make install
60+
cd -
61+
62+
- name: make fatsp (MacOS)
63+
run: bash -c 'make -j $(nproc)'
64+
if: runner.os == 'macOS'
65+
66+
- name: make fastp static (Ubuntu)
67+
run: bash -c 'make -j $(nproc) static'
68+
if: runner.os == 'Linux'
69+
70+
- name: test
71+
run: chmod a+x ./fastplong && ./fastplong --version
72+

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TARGET := fastplong
1515
BIN_TARGET := ${TARGET}
1616

1717
CXX ?= g++
18-
CXXFLAGS := -std=c++11 -pthread -g -O3 -I${DIR_INC} $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) ${CXXFLAGS}
18+
CXXFLAGS := -std=c++11 -pthread -g -O3 -MP -MD -I${DIR_INC} $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) ${CXXFLAGS}
1919
LIBS := -lisal -ldeflate -lpthread
2020
STATIC_FLAGS := -static -Wl,--no-as-needed -pthread
2121
LD_FLAGS := $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(LIBS) $(LD_FLAGS)
@@ -35,15 +35,11 @@ ${DIR_OBJ}/%.o:${DIR_SRC}/%.cpp
3535
.PHONY:clean
3636
.PHONY:static
3737
clean:
38-
@if test -d $(DIR_OBJ) ; \
39-
then \
40-
find $(DIR_OBJ) -name *.o -delete; \
41-
fi
42-
@if test -e $(TARGET) ; \
43-
then \
44-
rm $(TARGET) ; \
45-
fi
38+
@rm -rf $(DIR_OBJ)
39+
@rm -f $(TARGET)
4640

4741
install:
4842
install $(TARGET) $(BINDIR)/$(TARGET)
4943
@echo "Installed."
44+
45+
-include $(OBJ:.o=.d)

0 commit comments

Comments
 (0)