Skip to content

Commit

Permalink
fix: better build options
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Mar 31, 2024
1 parent 8162a43 commit 0ea96c2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: python3 -m pip install setuptools_scm --break-system-packages

- name: Configure
run: cmake -S . -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*"
run: cmake -S. -Bbuild -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*"

- name: Build
run: cmake --build build -j 2
Expand Down Expand Up @@ -80,10 +80,10 @@ jobs:
allow-prereleases: true

- name: Install python tools
run: python -m pip install -r dev-requirements.txt pytest-github-actions-annotate-failures numpy>=2.0a1
run: python -m pip install -r dev-requirements.txt pytest-github-actions-annotate-failures numpy>=2.0.0rc1

- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBOOST_HISTOGRAM_ERRORS=ON ${{ matrix.cmake-extras }}
run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DBOOST_HISTOGRAM_ERRORS=ON ${{ matrix.cmake-extras }}

- name: Build
run: cmake --build build -j 2
Expand All @@ -98,7 +98,17 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019, macos-13, macos-14]
include:
- os: ubuntu-latest
build: cp312-manylinux_x86_64
- os: windows-2019
build: cp38-win32
- os: windows-2019
build: cp37-win_amd64
- os: macos-13
build: cp39-macosx_x86_64
- os: macos-14
build: cp39-macosx_arm64

steps:
- uses: actions/checkout@v4
Expand All @@ -112,7 +122,7 @@ jobs:

- uses: pypa/[email protected]
env:
CIBW_BUILD: cp38-win32 cp37-win_amd64 cp312-manylinux_x86_64 cp39-macosx_*
CIBW_BUILD: "${{ matrix.build }}"
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ target_include_directories(

# Support older Windows from newer MSVC
target_compile_options(_core PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/d2FH4->)

# Better error messages
target_compile_definitions(_core PRIVATE PYBIND11_DETAILED_ERROR_MESSAGES)

Expand Down
7 changes: 4 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ pybind11_find_import(numpy)
pybind11_find_import(pytest)
pybind11_find_import(pytest-benchmark)

# Much better test target on CMake 3.29+
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)

# Support for running from build directory
file(WRITE "${PROJECT_BINARY_DIR}/pytest.ini" "[pytest]\n" "addopts = --benchmark-disable\n"
"testpaths = ${CMAKE_CURRENT_SOURCE_DIR}\n")
Expand All @@ -18,8 +21,6 @@ foreach(TEST_FILE IN LISTS BOOST_HIST_PY_TESTS)
get_filename_component(TEST_NAME "${TEST_FILE}" NAME_WE)
add_test(
NAME ${TEST_NAME}
COMMAND ${PYTHON_EXECUTABLE} -m pytest "${TEST_FILE}" --rootdir=.
COMMAND ${Python_EXECUTABLE} -m pytest "${TEST_FILE}" --rootdir=.
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}")
endforeach()

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose)

0 comments on commit 0ea96c2

Please sign in to comment.