Skip to content

Commit 2ecf012

Browse files
authored
Merge pull request #222 from mayeut/cmake-test-suite
fix: build with CMAKE_CXX_STANDARD:STRING=11 on linux
2 parents 308fb0f + 0a46b56 commit 2ecf012

File tree

4 files changed

+54
-7
lines changed

4 files changed

+54
-7
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@ jobs:
4040
include:
4141
- os: ubuntu-20.04
4242
arch: "x86_64"
43-
build: ""
43+
build: "manylinux_"
44+
use_qemu: false
45+
- os: ubuntu-20.04
46+
arch: "x86_64"
47+
build: "musllinux_"
4448
use_qemu: false
4549
- os: ubuntu-20.04
4650
arch: "i686"
47-
build: ""
51+
build: "manylinux_"
52+
use_qemu: false
53+
- os: ubuntu-20.04
54+
arch: "i686"
55+
build: "musllinux_"
4856
use_qemu: false
4957
- os: ubuntu-20.04
5058
arch: "aarch64"

.travis.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,22 @@ matrix:
1212
- arch: arm64-graviton2
1313
virt: vm
1414
group: edge
15+
env: CIBW_BUILD="cp39-manylinux_aarch64"
16+
- arch: arm64-graviton2
17+
virt: vm
18+
group: edge
19+
env: CIBW_BUILD="cp39-musllinux_aarch64"
1520
- arch: ppc64le
21+
env: CIBW_BUILD="cp39-manylinux_ppc64le"
22+
- arch: ppc64le
23+
env: CIBW_BUILD="cp39-musllinux_ppc64le"
24+
- arch: s390x
25+
env: CIBW_BUILD="cp39-manylinux_s390x"
1626
- arch: s390x
27+
env: CIBW_BUILD="cp39-musllinux_s390x"
1728

1829
install:
19-
- python -m pip install cibuildwheel==2.2.0a1
30+
- python -m pip install cibuildwheel==2.3.1
2031
- python -m pip install -r requirements-deploy.txt
2132

2233
script:

CMakeLists.txt

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ if(CMakePythonDistributions_SUPERBUILD)
3333

3434
option(BUILD_VERBOSE "Build reporting additional information (e.g download progress, ...)" ON)
3535

36+
option(RUN_CMAKE_TEST "Run CMake test suite when built from sources" ON)
37+
38+
set(RUN_CMAKE_TEST_EXCLUDE "BootstrapTest" CACHE STRING "CMake test suite exclusion regex")
39+
3640
set(CMakePythonDistributions_ARCHIVE_DOWNLOAD_DIR "${CMAKE_BINARY_DIR}"
3741
CACHE PATH "Directory where to download archives"
3842
)
@@ -261,6 +265,13 @@ set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\
261265
message(STATUS "SuperBuild - CMakeProject-build - OPENSSL_ROOT_DIR: ${OPENSSL_ROOT_DIR}")
262266
endif()
263267

268+
if(DEFINED CMAKE_CXX_STANDARD)
269+
list(APPEND _cmake_cache_args
270+
-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
271+
)
272+
message(STATUS "SuperBuild - CMakeProject-build - CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}")
273+
endif()
274+
264275
ExternalProject_add(CMakeProject-build
265276
SOURCE_DIR ${CMakeProject_SOURCE_DIR}
266277
BINARY_DIR ${CMakeProject_BINARY_DIR}
@@ -271,7 +282,7 @@ set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\
271282
CMAKE_CACHE_ARGS
272283
-DBUILD_CursesDialog:BOOL=OFF
273284
-DCMAKE_USE_OPENSSL:BOOL=ON
274-
-DBUILD_TESTING:BOOL=OFF
285+
-DBUILD_TESTING:BOOL=ON
275286
-DCMake_INSTALL_DEPENDENCIES:BOOL=ON
276287
-DCMAKE_INSTALL_MESSAGE:STRING=NEVER
277288
${_common_cache_args}
@@ -285,6 +296,8 @@ set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\
285296
LibUV
286297
)
287298

299+
set(CMAKEPROJECT_BUILD_LAST_STEP "build")
300+
288301
find_program(STRIP_EXECUTABLE strip)
289302
if(STRIP_EXECUTABLE)
290303

@@ -293,12 +306,25 @@ set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\
293306
set(ctest_executable "${CMakeProject_BINARY_DIR}/bin/ctest")
294307

295308
ExternalProject_Add_Step(CMakeProject-build strip_executables
296-
DEPENDEES build
309+
DEPENDEES ${CMAKEPROJECT_BUILD_LAST_STEP}
297310
COMMENT "Stripping CMake executables"
298311
COMMAND ${STRIP_EXECUTABLE} ${cmake_executable}
299312
COMMAND ${STRIP_EXECUTABLE} ${cpack_executable}
300313
COMMAND ${STRIP_EXECUTABLE} ${ctest_executable}
314+
USES_TERMINAL 1
315+
)
316+
set(CMAKEPROJECT_BUILD_LAST_STEP "strip_executables")
317+
endif()
318+
319+
if(RUN_CMAKE_TEST)
320+
ExternalProject_Add_Step(CMakeProject-build run_cmake_test_suite
321+
DEPENDEES ${CMAKEPROJECT_BUILD_LAST_STEP}
322+
COMMENT "Running CMake test suite, exclusion list: '${RUN_CMAKE_TEST_EXCLUDE}'"
323+
COMMAND ./bin/ctest --force-new-ctest-process --stop-on-failure --output-on-failure -j2 -E ${RUN_CMAKE_TEST_EXCLUDE}
324+
WORKING_DIRECTORY ${CMakeProject_BINARY_DIR}
325+
USES_TERMINAL 1
301326
)
327+
set(CMAKEPROJECT_BUILD_LAST_STEP "run_cmake_test_suite")
302328
endif()
303329
else()
304330
cpd_ExternalProject_Add_Empty(CMakeProject-build "CMakeProject-src-download")

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ before-all = [
2828
"ninja --version",
2929
"./scripts/manylinux-build-and-install-openssl.sh",
3030
]
31+
environment = { SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=2;link=1 -DCMAKE_CXX_STANDARD:STRING=11" }
3132

32-
[tool.cibuildwheel.linux.environment]
33-
SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=2;link=1"
33+
[[tool.cibuildwheel.overrides]]
34+
select = "*-musllinux*"
35+
environment = { SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=2;link=1 -DRUN_CMAKE_TEST_EXCLUDE:STRING='BootstrapTest|ExportImport|RunCMake.install|RunCMake.file-GET_RUNTIME_DEPENDENCIES'" }
3436

3537
[tool.cibuildwheel.macos.environment]
3638
MACOSX_DEPLOYMENT_TARGET = "10.10"

0 commit comments

Comments
 (0)