Skip to content

Commit 77176a8

Browse files
committed
another try on making windows build work
1 parent fb48fab commit 77176a8

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,13 @@ jobs:
127127
uses: pypa/cibuildwheel@v3.3.0
128128
env:
129129
CIBW_ENVIRONMENT_LINUX: "CCACHE_DIR=/host/home/runner/work/sumo/sumo/.ccache"
130-
CIBW_ENVIRONMENT_WINDOWS: "CMAKE_GENERATOR=Ninja CMAKE_ARGS=-DPython_EXECUTABLE={python}"
130+
CIBW_ENVIRONMENT_WINDOWS: "CMAKE_GENERATOR=Ninja SKBUILD_CMAKE_ARGS=-DPython_EXECUTABLE={python}"
131131
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
132132
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux }}
133133
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
134134
# CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" # disable repair process to inspect the wheel
135135
# CIBW_BUILD_VERBOSITY: 2
136+
CMAKE_ARGS: "-DPython_EXECUTABLE={python}"
136137
MACOSX_DEPLOYMENT_TARGET: '14.0'
137138

138139
- uses: actions/upload-artifact@v6

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ if (${CMAKE_VERSION} VERSION_LESS 3.12.0)
221221
# define variable for compatibility
222222
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python executable")
223223
else()
224-
find_package(Python REQUIRED COMPONENTS Interpreter)
224+
# we search for Interpreter _and_ Development to make sure the versions match
225+
find_package(Python COMPONENTS Interpreter Development)
226+
if (NOT Python_FOUND)
227+
message(FATAL_ERROR "Python NOT found")
228+
endif()
225229
endif()
226230
message(STATUS "Found Python: " ${Python_EXECUTABLE})
227231
if (${CMAKE_VERSION} VERSION_LESS 3.15.0 AND (ENABLE_PYTHON_BINDINGS OR ENABLE_JAVA_BINDINGS OR ENABLE_CS_BINDINGS))

src/libsumo/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ if (SWIG_FOUND)
157157
endif(ENABLE_CS_BINDINGS)
158158

159159
if (ENABLE_PYTHON_BINDINGS)
160-
find_package(Python COMPONENTS Development.Module)
161-
if (Python_Development.Module_FOUND)
160+
if (Python_Development.FOUND OR Python_Development.Module_FOUND) # the latter exists only since CMake 3.18
162161
set(CMAKE_SWIG_FLAGS -keyword) # is necessary for using keyword args
163162
# other options which should be evaluated: -builtin, -modern, -extranative
164163
if (FOX_FOUND)

src/libtraci/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ if (SWIG_FOUND)
129129
endif()
130130

131131
if (ENABLE_PYTHON_BINDINGS)
132-
find_package(Python COMPONENTS Development.Module)
133-
if (Python_Development.Module_FOUND)
132+
if (Python_Development.FOUND OR Python_Development.Module_FOUND) # the latter exists only since CMake 3.18
134133
set(CMAKE_SWIG_FLAGS "-keyword") # is necessary for using keyword args
135134
# other options which should be evaluated: -builtin, -modern, -extranative
136135
set(SWIG_OUTFILE_DIR ${CMAKE_CURRENT_BINARY_DIR})

0 commit comments

Comments
 (0)