Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Meson highs 1.7.x #1749

Open
wants to merge 24 commits into
base: latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cf3b536
MAINT: Silence -Wsign-compare
HaoZeke May 4, 2024
cb2556d
MAINT: Silence -Wmaybe-uninitialized
HaoZeke May 4, 2024
d226a6d
MAINT: Silence -Wcomment
HaoZeke May 4, 2024
e724f52
BLD: Reduce the silenced warnings
HaoZeke May 4, 2024
9407f71
BLD: Rework to harmonize with CMake
HaoZeke May 4, 2024
324f5c1
BLD: Rework and sort-lines in meson
HaoZeke May 4, 2024
749309b
BLD: Setup the newer python library in meson
HaoZeke May 5, 2024
d8fef70
MAINT: Switch back to meson-python
HaoZeke May 5, 2024
8ef97cb
MAINT: Lint and cleanup excess enum exports
HaoZeke May 5, 2024
c51941f
MAINT,BLD: Finish removing -Dwith_c for meson
HaoZeke May 5, 2024
fbf7d73
CI: Rework to have dependencies when building
HaoZeke May 5, 2024
0a4ed1e
BLD: Add pack cibuildwheel config
HaoZeke May 5, 2024
56a4335
BLD: Link with highs explicitly
HaoZeke May 5, 2024
f5c14c5
CI: Test only highs/tests/
HaoZeke May 5, 2024
62ab499
BLD: Fix C_API test
HaoZeke May 5, 2024
251590a
MAINT: Try to rebuild correctly on WIN
HaoZeke May 19, 2024
c01795e
MAINT: Remove unused build date
HaoZeke May 19, 2024
a0390a5
BLD,TMP: Try windows again
HaoZeke May 19, 2024
12ba85a
BLD: Rework meson slightly
HaoZeke Jul 14, 2024
7ed8ca2
BLD: Revert back to scikit-build
HaoZeke Jul 14, 2024
1ca6719
BLD: Export python sources via variable
HaoZeke Jul 20, 2024
8dc335e
BIND: Use module local scope for exports
HaoZeke Jul 20, 2024
cc65280
MAINT: Rework options for scipy
HaoZeke Jul 20, 2024
4097a89
BLD: Use newer script location
HaoZeke Jul 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions .github/workflows/build-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ jobs:

- name: Build sdist
run: |
python3 -m pip install build
python3 -m pip install build --user
python3 -m build --sdist

- name: Install sdist
run: |
ls dist
python3 -m pip install meson-python meson pybind11 ninja --user
python3 -m pip install dist/*.tar.gz

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --user
python3 -m pytest $GITHUB_WORKSPACE/tests

build_sdist_mac:
runs-on: macos-latest
Expand All @@ -34,18 +35,19 @@ jobs:

- name: Build sdist
run: |
python3 -m pip install build --break-system-packages
python3 -m pip install build --user --break-system-packages
python3 -m build --sdist

- name: Install sdist
run: |
ls dist
python3 -m pip install dist/*.tar.gz --break-system-packages
python3 -m pip install meson-python meson pybind11 ninja --user --break-system-packages
python3 -m pip install dist/*.tar.gz --user --break-system-packages

- name: Test highspy
run: |
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --user --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

build_sdist_win:
runs-on: windows-2019
Expand All @@ -59,19 +61,20 @@ jobs:

- name: Build sdist
run: |
python -m pip install build
python -m pip install build --user
python -m build --sdist

- name: Install sdist
run: |
python3 -m pip install meson-python meson pybind11 ninja --user
$item = Get-ChildItem dist
python -m pip install "$item"
python -m pip install "$item" --user
python -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python -m pip install pytest
python -m pytest
python -m pip install pytest --user
python -m pytest tests

build_wheel_linux:
# ubuntu 22 has a latest version of cmake, but setup-python
Expand Down Expand Up @@ -103,7 +106,7 @@ jobs:
- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pytest $GITHUB_WORKSPACE/tests


# macos 12 is Intel
Expand All @@ -122,20 +125,20 @@ jobs:

- name: Build wheel
run: |
python3 -m pip install cibuildwheel
python3 -m pip install cibuildwheel --break-system-packages
python3 -m cibuildwheel --only cp311-macosx_x86_64 $GITHUB_WORKSPACE

- name: Install wheel
run: |
ls wheelhouse
python3 --version
python3 -m pip install wheelhouse/*.whl
python3 -m pip install wheelhouse/*.whl --break-system-packages
python3 -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

# macos 13 is Intel
build_wheel_macos_13:
Expand All @@ -153,20 +156,20 @@ jobs:

- name: Build wheel
run: |
python3 -m pip install cibuildwheel
python3 -m pip install cibuildwheel --break-system-packages
python3 -m cibuildwheel --only cp311-macosx_x86_64 $GITHUB_WORKSPACE

- name: Install wheel
run: |
ls wheelhouse
python3 --version
python3 -m pip install wheelhouse/*.whl
python3 -m pip install wheelhouse/*.whl --break-system-packages
python3 -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

# macos 14 is M1 (beta)
build_wheel_macos_14:
Expand All @@ -184,20 +187,20 @@ jobs:

- name: Build wheel
run: |
python3 -m pip install cibuildwheel
python3 -m pip install cibuildwheel --break-system-packages
python3 -m cibuildwheel --only cp311-macosx_arm64 $GITHUB_WORKSPACE

- name: Install wheel
run: |
ls wheelhouse
python3 --version
python3 -m pip install wheelhouse/*.whl
python3 -m pip install wheelhouse/*.whl --break-system-packages
python3 -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

build_wheel_windows:
runs-on: windows-2019
Expand All @@ -224,5 +227,4 @@ jobs:
- name: Test highspy
run: |
python -m pip install pytest
python -m pytest

python -m pytest tests
32 changes: 27 additions & 5 deletions .github/workflows/test-python-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,34 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install build dependencies
run: python -m pip install numpy setuptools wheel pytest

- name: Test python install
run: python -m pip install numpy setuptools wheel pytest meson ninja delvewheel build
- name: Build project
run: |
python -m pip install .
pytest
meson setup bbdir --prefix=${{ github.workspace }}/local_install
meson compile -C bbdir

- name: Install project to custom directory
run: meson install -C bbdir

- name: Build Python package
run: python -m build

- name: Repair the wheel
shell: pwsh
run: |
$installedPath = "${{ github.workspace }}/local_install"
$wheels = Get-ChildItem -Path dist -Filter *.whl
foreach ($wheel in $wheels) {
delvewheel repair $wheel.FullName --add-path "$installedPath/bin;$installedPath/lib" -w repaired_wheels
}

- name: Install the repaired wheel
run: |
$wheels = Get-ChildItem -Path repaired_wheels -Filter *.whl
foreach ($wheel in $wheels){
pip install $wheel.FullName
}

- name: Test Python Examples
run: |
Expand Down
14 changes: 7 additions & 7 deletions check/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ foreach test : test_array
)
endforeach

if get_option('with_c')
test('test_capi',
executable('capi_unit_tests', 'TestCAPI.c',
include_directories: _incdirs,
link_with : highslib,
))
endif
test('test_capi',
executable('capi_unit_tests',
sources: ['TestCAPI.c', highs_conf_file],
include_directories: _incdirs,
link_with : highslib,
)
)
22 changes: 9 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,13 @@ is_mingw = is_windows and cc.get_id() == 'gcc'

# Conditional arguments
_args += cppc.get_supported_arguments([
'-Wno-return-type',
'-Wno-switch',
'-Wno-comment',
'-Wno-unused-variable',
'-Wno-unused-but-set-variable',
'-Wno-unused-const-variable',
'-Wno-unused-function',
'-Wno-unused-label',
])

if cppc.get_id() == 'msvc'
add_project_arguments(
_args += cppc.get_supported_arguments([
'/wd4018', # Disable warning: 'expression' : signed/unsigned mismatch
'/wd4061', # Disable warning: enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
'/wd4100', # Disable warning: 'identifier' : unreferenced formal parameter
Expand All @@ -53,9 +48,8 @@ if cppc.get_id() == 'msvc'
'/wd4514', # Disable warning: 'function' : unreferenced inline function has been removed
'/wd4701', # Disable warning: potentially uninitialized local variable 'name' used
'/wd4820', # Disable warning: 'bytes' bytes padding added after construct 'member_name'
language: 'cpp',
)
_args += '-D_CRT_SECURE_NO_WARNINGS'
])
_args += '-D_CRT_SECURE_NO_WARNINGS'
endif

cpu_family = host_machine.cpu_family()
Expand All @@ -69,13 +63,10 @@ endif

if is_mingw
# For mingw-w64, don't use LTO
add_project_arguments('-fno-use-linker-plugin', language: ['c', 'cpp'])
add_project_arguments(cppc.get_supported_arguments('-fno-use-linker-plugin'), language: ['c', 'cpp'])
endif

# --------------------- Dependencies
threads_dep = dependency('threads', required: false)
_deps += threads_dep

# Determine whether it is necessary to link libatomic. This could be the case
# e.g. on 32-bit platforms when atomic operations are used on 64-bit types.
# The check is copied from SciPy which in turn came from
Expand Down Expand Up @@ -115,6 +106,11 @@ endif

_deps += atomic_dep

threads_dep = null_dep
if not is_windows
threads_dep = dependency('threads', required: false)
endif
_deps += threads_dep
# Optional
zlib_dep = dependency('zlib',
required: get_option('use_zlib'))
Expand Down
3 changes: 0 additions & 3 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ option('with_fortran',
option('with_csharp',
type : 'boolean',
value : false)
option('with_c',
type : 'boolean',
value : false)
option('debug_sol',
type: 'boolean',
value: false)
Expand Down
10 changes: 10 additions & 0 deletions scripts/post_install_win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pip install delvewheel meson ninja

meson setup bbdir
meson compile -C bbdir

REM Repair the wheel using delvewheel
set destDir=%1
set wheel=%2

delvewheel repair --add-path c:/bin;c:/lib;c:/bin/src;c:/lib/src;D:/a/HiGHS/HiGHS/bbdir/src/ -w %destDir% %wheel%
1 change: 1 addition & 0 deletions src/HConfig.h.meson.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#mesondefine HIGHS_HAVE_MM_PAUSE
#mesondefine HIGHS_HAVE_BUILTIN_CLZ
#mesondefine HIGHS_HAVE_BITSCAN_REVERSE
#mesondefine HIGHS_NO_DEFAULT_THREADS

#define HIGHS_GITHASH "_HIGHS_GITHASH_"
#define HIGHS_VERSION_MAJOR @HIGHS_VERSION_MAJOR@
Expand Down
Loading
Loading