Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f34619

Browse files
committed
feat: use cibuildwheel for github action build
1 parent62c0cbd commit0f34619

File tree

8 files changed

+42
-39
lines changed

8 files changed

+42
-39
lines changed

‎.github/workflows/build.yml‎

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,22 @@
11
name:Build
22

3-
on:
4-
push:
5-
branches:
6-
-main
7-
pull_request:
8-
workflow_dispatch:
3+
on:[push, pull_request]
94

105
jobs:
11-
build:
6+
build_wheels:
7+
name:Build wheels on ${{ matrix.os }}
8+
runs-on:${{ matrix.os }}
129
strategy:
13-
fail-fast:false
1410
matrix:
15-
os:[ windows-2019, windows-2022, ubuntu-20.04, ubuntu-22.04, macos-11, macos-12 ]
16-
17-
name:Build on ${{ matrix.os }}
18-
runs-on:${{ matrix.os }}
11+
os:[ubuntu-20.04, windows-2019, macos-11]
1912

2013
steps:
21-
-name:Checkout Code
22-
uses:actions/checkout@v4
23-
with:
24-
fetch-depth:0
14+
-uses:actions/checkout@v4
2515

26-
-name:Set up Python
27-
uses:actions/setup-python@v5
28-
with:
29-
python-version:'3.9'
30-
cache:'pip'
31-
32-
-name:Set up CMake and Ninja
33-
uses:lukka/get-cmake@latest
16+
-name:Build wheels
17+
uses:pypa/cibuildwheel@v2.16.5
3418

35-
-name:Build with Conan
36-
run:|
37-
python -m pip install --upgrade pip
38-
pip install conan
39-
conan profile detect
40-
conan export raknet --version 4.081
41-
conan create . --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja
19+
-uses:actions/upload-artifact@v4
20+
with:
21+
name:cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
22+
path:./wheelhouse/*.whl

‎CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ pybind11_add_module(raknet_python MODULE ${RAKNET_PYTHON_SOURCE_FILES})
1515
target_include_directories(raknet_pythonPUBLICinclude)
1616
target_link_libraries(raknet_pythonPRIVATE raknet::raknet)
1717
include(GNUInstallDirs)
18-
install(TARGETS raknet_pythonDESTINATION raknet/COMPONENT python)
18+
install(TARGETS raknet_pythonDESTINATION raknet/COMPONENT pythonOPTIONAL)

‎conanfile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RakNetPythonRecipe(ConanFile):
2121
options= {}
2222
default_options= {"raknet/*:shared":False}
2323

24-
exports_sources="CMakeLists.txt","src/*","include/*","tests/*"
24+
exports_sources="CMakeLists.txt","src/*","include/*"
2525

2626
defrequirements(self):
2727
self.requires("raknet/4.081")

‎pyproject.toml‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,30 @@ Issues = "https://github.com/wu-vincent/raknet-python/issues"
3535

3636
[tool.scikit-build]
3737
cmake.args = ["-G Ninja","--preset conan-release"]
38-
wheel.packages = ["python/src/raknet"]
38+
wheel.packages = ["python/raknet"]
3939
wheel.license-files = ["LICENSE"]
4040
install.components = ["python"]
4141
install.strip =false
4242

4343
[tool.scikit-build.metadata.version]
4444
provider ="scikit_build_core.metadata.regex"
4545
input ="conanfile.py"
46+
47+
[tool.cibuildwheel]
48+
skip = ["*-win32","*-musllinux_x86_64","*_i686"]
49+
test-requires ="pytest"
50+
test-command ="pytest {project}/tests"
51+
before-build = [
52+
"pip install conan",
53+
"conan profile detect --force",
54+
"conan export raknet --version 4.081",
55+
"conan install . --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja"
56+
]
57+
58+
[tool.cibuildwheel.linux]
59+
before-build = [
60+
"pip install conan ninja",
61+
"conan profile detect --force",
62+
"conan export raknet --version 4.081",
63+
"conan install . --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja"
64+
]
File renamed without changes.
File renamed without changes.

‎src/rak_peer.cpp‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
namespacepy= pybind11;
1010

1111
voiddef_rak_peer(pybind11::module &m) {
12-
py::class_<RakNet::RakPeerInterface>(m,"RakPeer")
13-
.def(py::init([]() {
14-
return std::unique_ptr<RakNet::RakPeerInterface>(
15-
RakNet::RakPeerInterface::GetInstance());
16-
}))
12+
py::class_<RakNet::RakPeer>(m,"RakPeer")
13+
.def(py::init<>())
1714
.def(
1815
"start",
1916
[](RakNet::RakPeerInterface &a,constchar *host,int port,int max_connections) {

‎tests/test_imports.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
importimportlib
2+
3+
4+
deftest_imports():
5+
module=importlib.import_module("raknet")
6+
getattr(module,"RakPeer")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp