Skip to content

Commit

Permalink
Validate halide build on Windows
Browse files Browse the repository at this point in the history
Configure meson build system to scan for msvc compiler toolchain.
Compile everything. Run unit tests.
  • Loading branch information
antonysigma committed Jul 18, 2024
1 parent 8d68f49 commit c8dc50e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
33 changes: 14 additions & 19 deletions .github/workflows/compile-halide-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Compile Halide C++ on Windows/Linux

on:
push:
branches: [ master ]
branches: [ master, validate-halide-compile-windows ]
pull_request:
types: [edited, submitted]

Expand All @@ -16,28 +16,22 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest, windows-latest, macos-latest]
# TODO(Antony): add Python 3.9 to test the Meson build system support
python-version: [3.8]
python-version: ["3.10"]

steps:
- name: Fetch sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install gcc toolchain
run: sudo apt-get install build-essential
if: startsWith(matrix.os, 'ubuntu') == true

- name: Install MSVC toolchain
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
if: startsWith(matrix.os, 'windows') == true

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -49,18 +43,19 @@ jobs:
key: ${{ runner.os }}-meson-cache
path: proximal/halide/subprojects/packagecache/

- name: Resolve C++ build dependencies
- name: Resolve C++ build dependencies (non-Windows)
run: meson setup proximal/halide proximal/halide/build
if: startsWith(matrix.os, 'window') == false

- name: Resolve C++ build dependencies (msvc toolchain)
run: meson setup --vsenv proximal/halide proximal/halide/build
if: startsWith(matrix.os, 'window') == true

- name: Build ProxImaL-codegen
run: ninja -C proximal/halide/build ladmm-runtime
# TODO(Antony): Resolve "missing DLLs" in Windows Docker environment.
if: startsWith(matrix.os, 'window') == false
run: meson compile -C proximal/halide/build ladmm-runtime:alias

- name: Build Python interfaces
run: ninja -C proximal/halide/build python_interface
if: startsWith(matrix.os, 'window') == false
run: meson compile -C proximal/halide/build python_interface

- name: Run test suite
run: ninja -C proximal/halide/build test
if: startsWith(matrix.os, 'window') == false
run: meson test -C proximal/halide/build --suite codegen
6 changes: 4 additions & 2 deletions proximal/halide/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ if get_option('build_nlm')
}
endif


if build_machine.system() == 'windows'
env = { 'PATH': halide_library_path }
env = { 'PATH': [
halide_toolchain.get_variable('halide_dll_path'),
halide_library_path,
]}
object_file_ext = 'obj'
statlib_file_ext = 'lib'
else
Expand Down
4 changes: 2 additions & 2 deletions proximal/halide/src/user-problem/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ solver_bin = custom_target(
'ladmm_iter.' + statlib_file_ext,
'ladmm_iter.h',
],
input: solver_generator,
env: env,
input: solver_generator,
command: [
solver_generator,
'-o', meson.current_build_dir(),
'-g', 'ladmm_iter',
'-e', 'static_library,h,stmt_html',
'-e', 'static_library,h',
'target=' + halide_target,

'-p', 'autoschedule_mullapudi2016',
Expand Down
3 changes: 3 additions & 0 deletions proximal/halide/subprojects/packagefiles/halide/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ halide_inc = include_directories('include')

if build_machine.system() == 'windows'
halide_library_path = meson.current_source_dir() / 'lib/Release'
# Halide.dll is in a different path, why?
halide_dll_path = meson.current_source_dir() / 'bin/Release'
else
halide_library_path = meson.current_source_dir() / 'lib'
endif

halide_lib = cc.find_library('Halide', dirs: halide_library_path)

halide_generator_dep = declare_dependency(
Expand Down

0 comments on commit c8dc50e

Please sign in to comment.