Skip to content

Commit 173740c

Browse files
authored
Enable macOS builds for AnchorWave (#43452)
* Enable macOS builds for AnchorWave * Bump build number and add run_exports for Anchorwave * Use lowercase name for AnchorWave in metadata * Patch in upstream macOS-x86 support * Patch CMakeLists.txt directly Because of conda/conda-build#4241, new files aren't properly patched in with conda-build, so patch the existing CMakeLists.txt instead of adding a new one and symlinking.
1 parent 3b67a21 commit 173740c

File tree

3 files changed

+84
-49
lines changed

3 files changed

+84
-49
lines changed

recipes/anchorwave/build.sh

+58-45
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,61 @@
22

33
set -eux
44

5-
mkdir -p build/{sse2,sse4.1,avx2,avx512}
6-
7-
# SSE2
8-
rm CMakeLists.txt
9-
ln -s CMakeLists_sse2.txt CMakeLists.txt
10-
cd build/sse2
11-
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
12-
make -j"${CPU_COUNT}"
13-
make install
14-
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_sse2"
15-
cd ../..
16-
17-
# SSE4.1
18-
rm CMakeLists.txt
19-
ln -s CMakeLists_sse4.1.txt CMakeLists.txt
20-
cd build/sse4.1
21-
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
22-
make -j"${CPU_COUNT}"
23-
make install
24-
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_sse4.1"
25-
cd ../..
26-
27-
# AVX2
28-
rm CMakeLists.txt
29-
ln -s CMakeLists_avx2.txt CMakeLists.txt
30-
cd build/avx2
31-
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
32-
make -j"${CPU_COUNT}"
33-
make install
34-
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_avx2"
35-
cd ../..
36-
37-
# AVX512
38-
rm CMakeLists.txt
39-
ln -s CMakeLists_avx512.txt CMakeLists.txt
40-
cd build/avx512
41-
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
42-
make -j"${CPU_COUNT}"
43-
make install
44-
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_avx512"
45-
cd ../..
46-
47-
# wrapper script
48-
cp "${RECIPE_DIR}/anchorwave" "${PREFIX}/bin/anchorwave"
49-
chmod +x "${PREFIX}/bin/anchorwave"
5+
if [ $TARGET_PLATFORM = "Linux" ]; then
6+
mkdir -p build/{sse2,sse4.1,avx2,avx512}
7+
8+
# SSE2
9+
rm CMakeLists.txt
10+
ln -s CMakeLists_sse2.txt CMakeLists.txt
11+
cd build/sse2
12+
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
13+
make -j"${CPU_COUNT}"
14+
make install
15+
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_sse2"
16+
cd ../..
17+
18+
# SSE4.1
19+
rm CMakeLists.txt
20+
ln -s CMakeLists_sse4.1.txt CMakeLists.txt
21+
cd build/sse4.1
22+
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
23+
make -j"${CPU_COUNT}"
24+
make install
25+
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_sse4.1"
26+
cd ../..
27+
28+
# AVX2
29+
rm CMakeLists.txt
30+
ln -s CMakeLists_avx2.txt CMakeLists.txt
31+
cd build/avx2
32+
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
33+
make -j"${CPU_COUNT}"
34+
make install
35+
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_avx2"
36+
cd ../..
37+
38+
# AVX512
39+
rm CMakeLists.txt
40+
ln -s CMakeLists_avx512.txt CMakeLists.txt
41+
cd build/avx512
42+
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
43+
make -j"${CPU_COUNT}"
44+
make install
45+
mv "${PREFIX}/bin/anchorwave" "${PREFIX}/bin/anchorwave_avx512"
46+
cd ../..
47+
48+
# wrapper script
49+
cp "${RECIPE_DIR}/anchorwave" "${PREFIX}/bin/anchorwave"
50+
chmod +x "${PREFIX}/bin/anchorwave"
51+
elif [ $TARGET_PLATFORM = "macOS" ]; then
52+
mkdir -p build/macOS
53+
54+
# macOS (SSE4.1)
55+
cd build/macOS
56+
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" ../..
57+
make -j"${CPU_COUNT}"
58+
make install
59+
else
60+
echo "TARGET_PLATFORM must be Linux or macOS" >&2
61+
exit 1
62+
fi

recipes/anchorwave/meta.yaml

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
{% set name = "AnchorWave" %}
1+
{% set name = "anchorwave" %}
22
{% set version = "1.2.1" %}
33
{% set tag = "v1.2.1" %}
44
{% set sha256 = "0e64f7b62579bbf9106a7a2f13330b8e16846176d6423db648d79b74b3dff2e7" %}
55

66
package:
7-
name: {{ name | lower }}
7+
name: {{ name }}
88
version: {{ version }}
99

1010
source:
1111
url: https://github.com/baoxingsong/AnchorWave/archive/refs/tags/{{ tag }}.tar.gz
1212
sha256: {{ sha256 }}
13+
patches:
14+
- patches/01-macOS-x86-build.patch # [osx]
1315

1416
build:
15-
number: 1
16-
skip: True # [not linux]
17+
number: 2
18+
script_env:
19+
- TARGET_PLATFORM=macOS # [osx]
20+
- TARGET_PLATFORM=Linux # [linux]
21+
run_exports:
22+
- {{ pin_subpackage(name, max_pin="x") }}
23+
skip: True # [not unix]
1724

1825
requirements:
1926
build:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index f94dda8..c9f52c3 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -12,8 +12,8 @@ set(CMAKE_CXX_STANDARD 14)
6+
7+
find_package(ZLIB)
8+
9+
-set(CMAKE_CXX_FLAGS " -lm -lz -Wall -g3 -O3 -funroll-all-loops -msse4.1 -msse4.2 -I ./ -std=gnu++14 -pthread -lrt") # the -mavx* is for GNU compiler and xCORE* are for intel compiler
10+
-set(CMAKE_C_FLAGS " -lm -lz -Wall -g3 -O3 -funroll-all-loops -msse4.1 -msse4.2 -I ./ -pthread -lrt")
11+
+set(CMAKE_CXX_FLAGS " -lm -lz -Wall -g3 -O3 -funroll-all-loops -msse4.1 -msse4.2 -I ./ -std=gnu++14 -pthread") # the -mavx* is for GNU compiler and xCORE* are for intel compiler
12+
+set(CMAKE_C_FLAGS " -lm -lz -Wall -g3 -O3 -funroll-all-loops -msse4.1 -msse4.2 -I ./ -pthread")
13+
14+
15+
#for google unit test

0 commit comments

Comments
 (0)