Skip to content

Commit e3bb42a

Browse files
authored
Cleanup actions and cmake variables (#268)
Also use cpu torch wheel to reduce download Signed-off-by: take-cheeze <takechi101010@gmail.com>
1 parent e260a63 commit e3bb42a

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ jobs:
2424
CIBW_BEFORE_BUILD_LINUX: pip install protobuf
2525
CIBW_BEFORE_BUILD_WINDOWS: python -m pip install protobuf
2626
CIBW_BEFORE_BUILD_MACOS: pip install protobuf
27-
CIBW_TEST_REQUIRES_LINUX: pytest pytest-xdist ruff mypy onnxruntime
27+
CIBW_TEST_REQUIRES_LINUX: pytest pytest-xdist ruff mypy onnxruntime onnxscript
2828
CIBW_TEST_REQUIRES_MACOS: pytest pytest-xdist
2929
CIBW_TEST_REQUIRES_WINDOWS: pytest pytest-xdist
30-
CIBW_BEFORE_TEST_LINUX: pip install onnxscript torch==2.9.1 torchvision==0.24.1
30+
CIBW_BEFORE_TEST_LINUX: pip install torch==2.9.1 torchvision==0.24.1 --index-url https://download.pytorch.org/whl/cpu
3131
CIBW_TEST_COMMAND: pytest {project}/onnxoptimizer/test
3232
CIBW_TEST_COMMAND_LINUX: cd {project} && pytest
3333
CIBW_TEST_SKIP: " *_arm64"
34-
CIBW_ENVIRONMENT: CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5"
35-
CIBW_ENVIRONMENT_WINDOWS: USE_MSVC_STATIC_RUNTIME=0 CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON"
34+
CIBW_ENVIRONMENT: CMAKE_ARGS="-DONNX_USE_LITE_PROTO=ON"
3635
CIBW_BUILD: "${{ matrix.python }}-*"
3736
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*"
3837
name: Build whls ${{ matrix.os }}${{ matrix.python }}

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,10 @@ def run(self):
160160
cmake_args = [
161161
CMAKE,
162162
f"-DPython_INCLUDE_DIR={sysconfig.get_python_inc()}",
163-
f"-DPYTHON_EXECUTABLE={sys.executable}",
163+
f"-DPython_EXECUTABLE={sys.executable}",
164164
"-DONNX_BUILD_PYTHON=ON",
165-
"-DONNX_USE_LITE_PROTO={}".format("ON" if ONNX_USE_LITE_PROTO else "OFF"),
166165
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
167166
f"-DONNX_NAMESPACE={ONNX_NAMESPACE}",
168-
"-DPY_EXT_SUFFIX={}".format(sysconfig.get_config_var("EXT_SUFFIX") or ""),
169167
"-DONNX_OPT_USE_SYSTEM_PROTOBUF={}".format(
170168
"ON" if ONNX_OPT_USE_SYSTEM_PROTOBUF else "OFF"
171169
),

0 commit comments

Comments
 (0)