Skip to content

Commit b486850

Browse files
markreidvfxMichaelPlug
authored andcommitted
Add basic mingw_x86_64 build support (AcademySoftwareFoundation#1354)
* Add basic mingw_x86_64 build support * Add mingw64 testing to CI * Add mingw64 to py_build matrix and reduced MSYS2 dependencies Signed-off-by: Mark Reid <[email protected]> Signed-off-by: Michele Spina <[email protected]>
1 parent 3be3f72 commit b486850

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

.github/workflows/python-package.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ jobs:
8888
matrix:
8989
os: [ubuntu-latest, windows-latest, macos-latest]
9090
python-version: ['2.7', '3.7', '3.8', '3.9', '3.10']
91+
include:
92+
- { os: ubuntu-latest, shell: bash }
93+
- { os: macos-latest, shell: bash }
94+
- { os: windows-latest, shell: pwsh }
95+
- { os: windows-latest, shell: msys2, python-version: 'mingw64' }
96+
97+
defaults:
98+
run:
99+
shell: '${{ matrix.shell }} {0}'
91100

92101
env:
93102
OTIO_CXX_COVERAGE_BUILD: ON
@@ -97,7 +106,20 @@ jobs:
97106
- uses: actions/checkout@v3
98107
with:
99108
submodules: 'recursive'
109+
- name: Set up MSYS2
110+
if: matrix.python-version == 'mingw64'
111+
uses: msys2/setup-msys2@v2
112+
with:
113+
msystem: mingw64
114+
install: >-
115+
mingw-w64-x86_64-python
116+
mingw-w64-x86_64-python-pip
117+
mingw-w64-x86_64-gcc
118+
mingw-w64-x86_64-cmake
119+
make
120+
git
100121
- name: Set up Python ${{ matrix.python-version }}
122+
if: matrix.python-version != 'mingw64'
101123
uses: actions/setup-python@v3
102124
with:
103125
python-version: ${{ matrix.python-version }}

setup.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def build(self):
7575
self.cmake_generate()
7676
self.cmake_install()
7777

78+
def is_windows(self):
79+
return platform.system() == "Windows"
80+
81+
def is_mingw(self):
82+
return self.plat_name.startswith('mingw')
83+
7884
def generate_cmake_arguments(self):
7985
# Use the provided build dir so setuptools will be able to locate and
8086
# either install to the correct location or package.
@@ -99,9 +105,11 @@ def generate_cmake_arguments(self):
99105
# Python modules wil be installed by setuptools.
100106
'-DOTIO_INSTALL_PYTHON_MODULES:BOOL=OFF',
101107
]
102-
103-
if platform.system() == "Windows":
104-
cmake_args += ["-A", PLAT_TO_CMAKE[self.plat_name]]
108+
if self.is_windows():
109+
if self.is_mingw():
110+
cmake_args += ['-G Unix Makefiles']
111+
else:
112+
cmake_args += ["-A", PLAT_TO_CMAKE[self.plat_name]]
105113

106114
cxx_coverage = bool(os.environ.get("OTIO_CXX_COVERAGE_BUILD"))
107115
if cxx_coverage and not os.environ.get("OTIO_CXX_BUILD_TMP_DIR"):
@@ -159,7 +167,7 @@ def cmake_generate(self):
159167

160168
def cmake_install(self):
161169
self.announce('running cmake build', level=2)
162-
if platform.system() == "Windows":
170+
if self.is_windows() and not self.is_mingw():
163171
multi_proc = '/m'
164172
else:
165173
multi_proc = '-j{}'.format(multiprocessing.cpu_count())

tests/test_plugin_detection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TestSetuptoolsPlugin(unittest.TestCase):
4040
def setUp(self):
4141
# Get the location of the mock plugin module metadata
4242
mock_module_path = os.path.join(
43-
baseline_reader.path_to_baseline_directory(),
43+
os.path.normpath(baseline_reader.path_to_baseline_directory()),
4444
'plugin_module',
4545
)
4646
self.mock_module_manifest_path = os.path.join(

tests/test_url_conversions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_roundtrip_rel(self):
4949
result = otio.url_utils.filepath_from_url(MEDIA_EXAMPLE_PATH_URL_REL)
5050

5151
# should have reconstructed it by this point
52-
self.assertEqual(result, MEDIA_EXAMPLE_PATH_REL)
52+
self.assertEqual(os.path.normpath(result), MEDIA_EXAMPLE_PATH_REL)
5353

5454

5555
if __name__ == "__main__":

0 commit comments

Comments
 (0)