Skip to content

Commit c0defbf

Browse files
committed
arm64 packaging
1 parent 60c7811 commit c0defbf

File tree

6 files changed

+77
-22
lines changed

6 files changed

+77
-22
lines changed

.travis.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@ language: cpp
44
matrix:
55
include:
66
- os: osx
7-
env: COMPILER=clang
7+
env:
8+
- COMPILER=clang
9+
- ARCH=x86_64
810
osx_image: xcode10.1
11+
- os: osx
12+
env:
13+
- COMPILER=clang
14+
- ARCH=arm64
15+
osx_image: xcode14.2
916
- os: linux
1017
sudo: required
1118
dist: trusty
1219
services: docker
1320

21+
addons:
22+
homebrew:
23+
update: false
24+
1425
#https://github.com/travis-ci/travis-ci/issues/6893
1526
if: tag IS present
1627

@@ -43,6 +54,11 @@ branches:
4354
# fi
4455

4556
before_script:
57+
- export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
58+
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
59+
brew install cmake;
60+
/usr/local/bin/pip3 install --upgrade pip;
61+
fi
4662
# specifically for pypi deployment
4763
- export README_BASE_URL="https://github.com/devsim/symdiff/blob/${TRAVIS_TAG}"
4864

@@ -51,7 +67,6 @@ script:
5167
./scripts/build_docker_manylinux2014.sh ${TRAVIS_TAG};
5268
fi
5369
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
54-
source ./scripts/install_miniconda_macos.sh;
5570
if [ "$COMPILER" == "gcc" ]; then
5671
./scripts/build_macos.sh $COMPILER "${TRAVIS_TAG}";
5772
elif [ "$COMPILER" == "clang" ]; then

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ SET (SUBDIRS
1414
# superlu stuff
1515
SITE_NAME(HOSTNAME)
1616
MESSAGE("Hostname: ${HOSTNAME}")
17-
ADD_DEFINITIONS(-DSYMDIFF_VERSION_STRING=\"1.2.5\")
18-
ADD_DEFINITIONS(-DSYMDIFF_COPYRIGHT_YEAR=\"2010-2022\")
17+
ADD_DEFINITIONS(-DSYMDIFF_VERSION_STRING=\"1.2.6\")
18+
ADD_DEFINITIONS(-DSYMDIFF_COPYRIGHT_YEAR=\"2010-2023\")
1919

2020
set(PROJECT_BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
2121
set(PROJECT_SCRIPTS_DIR ${PROJECT_SOURCE_DIR}/scripts)

bdist_wheel/fix_macos_arch.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import wheel
2+
import wheel.bdist_wheel
3+
import sys
4+
5+
try:
6+
plat = wheel.bdist_wheel.get_platform('')
7+
except TypeError:
8+
#TypeError: get_platform() takes 0 positional arguments but 1 was given
9+
plat = wheel.bdist_wheel.get_platform()
10+
#
11+
#print(plat)
12+
13+
for i in 'x86_64', 'arm64':
14+
p = plat.find(i)
15+
if p != -1:
16+
prefix = plat[0:p]
17+
break
18+
19+
print(prefix+ sys.argv[1])
20+
#
21+
#
22+
#

bdist_wheel/setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[bdist_wheel]
22
py-limited-api = cp36
3+
#plat-name=
34
[metadata]
4-
version = 1.2.5
5+
version = 1.2.6
56
classifiers =
67
Development Status :: 5 - Production/Stable
78
Intended Audience :: Science/Research

scripts/build_macos.sh

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,52 @@ else
4040
fi
4141

4242

43-
#minimal conda environments to prevent linking against the wrong libraries
44-
if [ "${1}" = "gcc" ]
45-
then
46-
# now opt for explicit dll load of mkl
47-
conda create -y --name python3_symdiff_build python=3 cmake nomkl
48-
fi
49-
50-
#This version does not use pardiso
51-
if [ "${1}" = "clang" ]
52-
then
53-
conda create -y --name python3_symdiff_build python=3 cmake nomkl
54-
fi
55-
source activate python3_symdiff_build
43+
##minimal conda environments to prevent linking against the wrong libraries
44+
#if [ "${1}" = "gcc" ]
45+
#then
46+
## now opt for explicit dll load of mkl
47+
#conda create -y --name python3_symdiff_build python=3 cmake nomkl
48+
#fi
49+
#
50+
##This version does not use pardiso
51+
#if [ "${1}" = "clang" ]
52+
#then
53+
#conda create -y --name python3_symdiff_build python=3 cmake nomkl
54+
#fi
55+
#source activate python3_symdiff_build
5656

57-
export PYTHON3_BIN=python
58-
export PYTHON3_INCLUDE=$(python -c "from sysconfig import get_paths as gp; print(gp()['include'])")
57+
export PYTHON3_BIN=/usr/local/bin/python3
58+
export PIP_BIN=/usr/local/bin/pip3
59+
${PIP_BIN} install wheel
60+
export PYTHON3_INCLUDE=$(${PYTHON3_BIN} -c "from sysconfig import get_paths as gp; print(gp()['include'])")
5961
export PYTHON3_ARCHIVE=""
6062

63+
6164
# SYMDIFF build
6265
if [ "${1}" = "gcc" ]
6366
then
6467
(bash scripts/symdiff_macos.sh && cd osx_release && make -j4 && make test)
6568
elif [ "${1}" = "clang" ]
6669
then
67-
(bash scripts/symdiff_macos.sh && cd osx_release && make -j4 && make test)
70+
if [ ! -z "${ARCH}" ]
71+
then
72+
export ARCH_ARG="-DCMAKE_OSX_ARCHITECTURES=\"${ARCH}\""
73+
fi;
74+
#TODO test arch
75+
(bash scripts/symdiff_macos.sh && cd osx_release && make -j4)
76+
if [ $ARCH == $(uname -m) ]
77+
then
78+
(cd osx_release && make test)
79+
fi
80+
#(bash scripts/symdiff_macos.sh && cd osx_release && make -j4 && make test)
6881
fi
6982

7083
(rsync -avP --exclude __pycache__ lib/symdiff bdist_wheel/)
7184
(rsync -avP --exclude __pycache__ LICENSE NOTICE README.md examples doc bdist_wheel)
72-
(cd bdist_wheel && pip wheel .)
85+
FULL_PLAT_NAME=$(${PYTHON3_BIN} bdist_wheel/fix_macos_arch.py ${ARCH})
86+
echo PACKAGING $FULL_PLAT_NAME
87+
(cd bdist_wheel && perl -p -i -e "s/^#plat-name.*/plat-name = ${FULL_PLAT_NAME}/" setup.cfg)
88+
(cd bdist_wheel && ${PIP_BIN} wheel .)
7389
(mv bdist_wheel/*.whl .)
7490

7591

scripts/symdiff_macos.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ for TYPE in debug release; do
44
NAME=osx_${TYPE}
55
mkdir ${NAME}
66
(cd $NAME; ${CMAKE} \
7+
${ARCH_ARG} \
78
-DCMAKE_CXX_FLAGS:STRING="${CMAKE_CXX_FLAGS}" \
89
-DCMAKE_BUILD_TYPE=${TYPE} \
910
-DCMAKE_CXX_COMPILER=${CXX} \

0 commit comments

Comments
 (0)