Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ jobs:

build:
runs-on: ${{ matrix.os }}
needs: [linting]
# needs: [linting]
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", 3.11, 3.12, 3.13, 3.14]
os: [windows-latest]
python-version: [3.11, 3.12, 3.13, 3.14]

steps:
- uses: actions/checkout@v2
Expand All @@ -67,9 +67,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Setup msbuild Windows
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2
- name: Set up MSVC environment # for debug
uses: ilammy/msvc-dev-cmd@v1

# - name: Setup msbuild Windows
# if: runner.os == 'Windows'
# uses: microsoft/setup-msbuild@v1.0.2

- name: Fix Paths Windows
# Make sure that tar.exe from Git is used not from Windows
Expand All @@ -87,14 +90,16 @@ jobs:
if: runner.os == 'Windows'
timeout-minutes: 20
run: |
$PYTHONHOME=$(python -c 'import sys; print(sys.executable);').replace('\', '/')
$PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);").replace('\', '/')
echo "PYTHONHOME=$PYTHONHOME"
echo "PYTHONPATH=$PYTHONPATH"
echo "Running: ${{ matrix.os }}"
bazel.exe --output_base ./bazel-cache build src/python:pydp --config windows --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHONHOME --action_env=PYTHON_LIB_PATH=$PYTHONPATH
copy ./bazel-bin/src/bindings/_pydp.so ./src/pydp/_pydp.pyd
.\build_windows.cmd

- name: Archive build artifacts
# more details https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
uses: actions/upload-artifact@v4
with:
name: build-py${{ matrix.python-version }}
path: |
src
retention-days: 1
- name: Upgrade pip
run: |
pip install --upgrade --user pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
max-parallel: 12
matrix:
# TODO: fix for Mac and Windows.
os: [ubuntu-latest, macos-latest]
os: []#ubuntu-latest, macos-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
Expand Down
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
cmake_minimum_required(VERSION 3.16)
project(PyDP LANGUAGES CXX)

# 1. Keep MSVC runtime Dynamic (Python standard)
# set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

# 2. Force third-party libraries to be built statically so they are baked into the wheel
# set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
# 1. Globally tell CMake to prefer static libraries over shared DLLs
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries" FORCE)
set(OPENSSL_USE_STATIC_LIBS TRUE)

# 2. Specifically override Protobuf/Abseil if they ignore BUILD_SHARED_LIBS
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Build protobuf as static" FORCE)
set(protobuf_MSVC_STATIC_RUNTIME ON CACHE BOOL "Use /MT for protobuf" FORCE)

set(ABSL_MSVC_STATIC_RUNTIME ON CACHE BOOL "Force Abseil to use /MT" FORCE)
set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "" FORCE)
#set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries" FORCE)

# C++ Standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
19 changes: 19 additions & 0 deletions build_windows.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@REM git clone https://github.com/Delphier/dumpbin.git
@REM echo Y| python dumpbin/dumpbin.py
@REM dumpbin.exe /exports *.dll

mkdir build_dir
cd build_dir
cmake -S .. -B . -DOPENSSL_ROOT_DIR="C:\Program Files\OpenSSL"
cmake --build . --parallel --config Release

move "src\bindings\PyDP\Release\_pydp.*-win_amd64.pyd" "..\src\pydp\"
cd ..\src\pydp\
ren "_pydp.*-win_amd64.pyd" "_pydp.pyd"
dir "C:\Program Files\OpenSSL"
dir "C:\Program Files\OpenSSL\bin"
copy "C:\Program Files\OpenSSL\libcrypto*.dll" .
dumpbin.exe /dependents "_pydp.pyd"
dumpbin.exe /dependents "libcrypto-3-x64.dll"

python -c "import _pydp"
Loading