Skip to content

Commit fdeb4cb

Browse files
committed
Add github actions tests for unstable ABI
1 parent dd6322d commit fdeb4cb

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

.github/workflows/ci.yml

+18
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,24 @@ jobs:
144144
if: "!(runner.os == 'Windows' && (matrix.python == 3.8 || matrix.python == 3.9 || matrix.python == '3.10-dev'))"
145145
run: cmake --build build2 --target cpptest
146146

147+
# Third build - C++17 mode with unstable ABI
148+
- name: Configure (unstable ABI)
149+
run: >
150+
cmake -S . -B build3
151+
-DPYBIND11_WERROR=ON
152+
-DDOWNLOAD_CATCH=ON
153+
-DDOWNLOAD_EIGEN=ON
154+
-DCMAKE_CXX_STANDARD=17
155+
-DPYBIND11_INTERNALS_VERSION=10000000
156+
"-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"
157+
${{ matrix.args }}
158+
159+
- name: Build (unstable ABI)
160+
run: cmake --build build3 -j 2
161+
162+
- name: Python tests (unstable ABI)
163+
run: cmake --build build3 --target pytest
164+
147165
- name: Interface test
148166
run: cmake --build build2 --target test_cmake_build
149167

CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ endif()
8989
option(PYBIND11_INSTALL "Install pybind11 header files?" ${PYBIND11_MASTER_PROJECT})
9090
option(PYBIND11_TEST "Build pybind11 test suite?" ${PYBIND11_MASTER_PROJECT})
9191
option(PYBIND11_NOPYTHON "Disable search for Python" OFF)
92+
set(PYBIND11_INTERNALS_VERSION
93+
""
94+
CACHE STRING "Override the ABI version, may be used to enable the unstable ABI.")
9295

9396
cmake_dependent_option(
9497
USE_PYTHON_INCLUDE_DIR
@@ -183,6 +186,10 @@ if(NOT TARGET pybind11_headers)
183186

184187
target_compile_features(pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
185188
cxx_right_angle_brackets)
189+
if(NOT "${PYBIND11_INTERNALS_VERSION}" STREQUAL "")
190+
target_compile_definitions(
191+
pybind11_headers INTERFACE "PYBIND11_INTERNALS_VERSION=${PYBIND11_INTERNALS_VERSION}")
192+
endif()
186193
else()
187194
# It is invalid to install a target twice, too.
188195
set(PYBIND11_INSTALL OFF)

0 commit comments

Comments
 (0)