Skip to content
Merged
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
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Ignore all files in the pybind/build directory
mssql_python/pybind/build/

mssql_python/pybind/pymsbuild/build/

# Ignore pyd file
mssql_python/ddbc_bindings.pyd

# Ignore pycache files and folders
__pycache__/
**/__pycache__/
Expand Down Expand Up @@ -43,6 +38,7 @@ build/
# C extensions
*.so
*.pyd
*.pdb

# IDE files
.vscode/
Expand Down
8 changes: 8 additions & 0 deletions eng/pipelines/build-whl-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ jobs:
TargetFolder: '$(Build.ArtifactStagingDirectory)\all-pyds'
displayName: 'Place PYD file into artifacts directory'

# Copy the built .pdb files to staging folder for artifacts
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.SourcesDirectory)\mssql_python\pybind\build\$(targetArch)\py$(shortPyVer)\Release'
Contents: 'ddbc_bindings.cp$(shortPyVer)-*.pdbs'
TargetFolder: '$(Build.ArtifactStagingDirectory)\all-pdbs'
displayName: 'Place PDB file into artifacts directory'

# Build wheel package for the current architecture
- script: |
python -m pip install --upgrade pip
Expand Down
7 changes: 7 additions & 0 deletions eng/pipelines/pr-validation-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ jobs:
publishLocation: 'Container'
displayName: 'Publish pyd file as artifact'

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'mssql_python/ddbc_bindings.cp313-amd64.pdb'
ArtifactName: 'ddbc_bindings'
publishLocation: 'Container'
displayName: 'Publish pdb file as artifact'

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
Expand Down
14 changes: 14 additions & 0 deletions mssql_python/pybind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ project(ddbc_bindings)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
# Enable PDB generation for all target types
add_compile_options("$<$<CONFIG:Release>:/Zi>")
add_link_options("$<$<CONFIG:Release>:/DEBUG /OPT:REF /OPT:ICF>")
endif()

# Detect platform
if(WIN32)
set(PLATFORM_NAME "windows")
Expand All @@ -19,6 +25,7 @@ endif()
# Set default architecture if not provided
if(NOT DEFINED ARCHITECTURE)
if(WIN32)
# Default to x64 for Windows
set(ARCHITECTURE "win64")
elseif(APPLE)
# Check if we're on Apple Silicon or Intel
Expand Down Expand Up @@ -207,6 +214,13 @@ set_target_properties(ddbc_bindings PROPERTIES
OUTPUT_NAME "ddbc_bindings.cp${PYTHON_VERSION}-${WHEEL_ARCH}"
SUFFIX "${MODULE_EXTENSION}"
)
# Ensure PDB is generated in Release
set_target_properties(ddbc_bindings PROPERTIES
COMPILE_PDB_NAME "ddbc_bindings.cp${PYTHON_VERSION}-${WHEEL_ARCH}"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
PDB_NAME "ddbc_bindings.cp${PYTHON_VERSION}-${WHEEL_ARCH}"
PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)

# Include directories for all architectures
if(NOT DEFINED ODBC_INCLUDE_DIR)
Expand Down
15 changes: 14 additions & 1 deletion mssql_python/pybind/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,20 @@ set OUTPUT_DIR=%BUILD_DIR%\Release

if exist "%OUTPUT_DIR%\%PYD_NAME%" (
copy /Y "%OUTPUT_DIR%\%PYD_NAME%" "%SOURCE_DIR%\.."
echo [SUCCESS] Copied %PYD_NAME% to %SOURCE_DIR%..
echo [SUCCESS] Copied %PYD_NAME% to %SOURCE_DIR%\..

echo [DIAGNOSTIC] Copying PDB file if it exists...
set PDB_NAME=ddbc_bindings.cp%PYTAG%-%WHEEL_ARCH%.pdb
echo [DEBUG] Computed PDB_NAME: !PDB_NAME!

if exist "%OUTPUT_DIR%\!PDB_NAME!" (
echo [DIAGNOSTIC] Found PDB file: "!PDB_NAME!"
echo [DIAGNOSTIC] Copying PDB file to source directory...
copy /Y "%OUTPUT_DIR%\!PDB_NAME!" "%SOURCE_DIR%\.."
echo [SUCCESS] Copied !PDB_NAME! to %SOURCE_DIR%..
) else (
echo [WARNING] PDB file !PDB_NAME! not found in output directory.
)

setlocal enabledelayedexpansion
for %%I in ("%SOURCE_DIR%..") do (
Expand Down