Skip to content

Commit

Permalink
compile c++ and fortran examples for darwin/arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
jborbely committed May 6, 2024
1 parent 4e0be2a commit e706455
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [windows-latest, ubuntu-latest, macos-13]
os: [windows-latest, ubuntu-latest, macos-13, macos-latest]
architecture: [x64, x86]
exclude:
- os: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion conftest.py
@@ -1,4 +1,5 @@
import os
import platform
import sys

import pytest
Expand Down Expand Up @@ -70,11 +71,14 @@ def doctest_skipif(doctest_namespace):
if IS_PYTHON_64BIT:
bit64 = lambda: pytest.skip('requires 32-bit Python')
bit32 = lambda: None
readme_all = lambda: None
else:
bit64 = lambda: None
bit32 = lambda: pytest.skip('requires 64-bit Python')

if not IS_PYTHON_64BIT or (sys.platform == 'darwin' and platform.machine() == 'arm64'):
readme_all = lambda: pytest.skip('skipped all tests')
else:
readme_all = lambda: None

if IS_PYTHON_64BIT and has_labview_runtime():
no_labview64 = lambda: None
Expand Down
Binary file added msl/examples/loadlib/cpp_libarm64.dylib
Binary file not shown.
Binary file added msl/examples/loadlib/fortran_libarm64.dylib
Binary file not shown.
17 changes: 13 additions & 4 deletions tests/test_loadlib.py
@@ -1,6 +1,7 @@
import math
import os
import pathlib
import platform
from ctypes import POINTER
from ctypes import byref
from ctypes import c_bool
Expand Down Expand Up @@ -117,8 +118,12 @@ def test_mono_bitness_independent(filename):


def test_cpp():
bitness = '64' if IS_PYTHON_64BIT else '32'
path = os.path.join(EXAMPLES_DIR, 'cpp_lib' + bitness)
if platform.system() == 'Darwin' and platform.machine() == 'arm64':
suffix = 'arm64'
else:
suffix = '64' if IS_PYTHON_64BIT else '32'

path = os.path.join(EXAMPLES_DIR, f'cpp_lib{suffix}')
cpp = LoadLibrary(path)

lib = cpp.lib
Expand Down Expand Up @@ -180,8 +185,12 @@ def test_cpp():


def test_fortran():
bitness = '64' if IS_PYTHON_64BIT else '32'
path = os.path.join(EXAMPLES_DIR, 'fortran_lib' + bitness)
if platform.system() == 'Darwin' and platform.machine() == 'arm64':
suffix = 'arm64'
else:
suffix = '64' if IS_PYTHON_64BIT else '32'

path = os.path.join(EXAMPLES_DIR, f'fortran_lib{suffix}')
fortran = LoadLibrary(path)

lib = fortran.lib
Expand Down

0 comments on commit e706455

Please sign in to comment.