Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python build with Windows #648

Merged
merged 1 commit into from
Dec 2, 2024
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
13 changes: 5 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
run: |
brew update
brew install --formula ninja swig doxygen boost
brew unlink [email protected] || true
brew unlink [email protected] || true
brew unlink [email protected] || true
brew unlink openssl@3 || true
Expand Down Expand Up @@ -136,8 +135,10 @@ jobs:
include:
- toolset: 143
image: windows-2022
vcvars: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat"
- toolset: 142
image: windows-2019
vcvars: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat"
- platform: x86
setenv: amd64_x86
- platform: x64
Expand Down Expand Up @@ -166,17 +167,13 @@ jobs:
Invoke-WebRequest -UserAgent "Wget" "https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.2.1/swigwin-4.2.1.zip/download" -OutFile swig.zip
tar xf swig.zip
- uses: actions/setup-python@v5
if: matrix.platform == 'x86'
if: matrix.platform != 'arm64'
with:
python-version: 3.12
architecture: x86
- name: Setup dev env
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.setenv }}
architecture: ${{ matrix.platform }}
- name: Build
run: |
& .\build.ps1 `
& "${{ matrix.vcvars }}" ${{ matrix.setenv }} "&&" pwsh build.ps1 `
-swig ${{ github.workspace }}/swigwin-4.2.1/swig.exe `
-doxygen "C:/Program files/doxygen/bin/doxygen.exe" `
-boost
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ endif()
find_package(SWIG)
if(SWIG_FOUND)
find_package(JNI)
find_package(Python3 COMPONENTS Interpreter Development)
find_package(Python3 COMPONENTS Development)
if((WIN32 OR APPLE) AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
find_package(Python3 COMPONENTS Development.SABIModule)
endif()
Expand Down
8 changes: 3 additions & 5 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ if($doxygen) {
$cmakeext += "-DDOXYGEN_EXECUTABLE=$doxygen"
$wixext += "-d", "docLocation=$(Get-Location)/$platform/share/doc/libdigidocpp"
}
if($env:VSCMD_ARG_HOST_ARCH -ne "arm64") {
if($platform -eq "arm64" -and $env:VSCMD_ARG_HOST_ARCH -ne "arm64") {
$cmakeext += "-DCMAKE_DISABLE_FIND_PACKAGE_Python3=yes"
$wixext += "-d", "disablePython=1"
if($platform -eq "arm64") {
$boost = $false
}
}
$boost = $false
}
if($boost) {
$cmakeext += "-DVCPKG_MANIFEST_FEATURES=tests"
$target += "check"
Expand Down
8 changes: 1 addition & 7 deletions libdigidocpp.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@
<Files Include="$(var.libdigidocpp)\include\**" />
</ComponentGroup>

<?ifdef var.docLocation ?>
<ComponentGroup Id="Documentation" Directory="INSTALLFOLDER" Subdirectory="documentation">
<Files Include="$(var.docLocation)\**" />
</ComponentGroup>
<?endif?>

<Feature Id="InstallLibdigidocpp" Level="1" Title="Libdigidocpp" Display="expand" ConfigurableDirectory="INSTALLFOLDER">
<ComponentGroupRef Id="Runtime" />
<ComponentGroupRef Id="Dependencies" />
Expand All @@ -124,7 +118,7 @@
</Feature>
<?ifdef var.docLocation ?>
<Feature Id="InstallDocumentation" Level="1" Title="Documentation">
<ComponentGroupRef Id="Documentation" />
<Files Include="$(var.docLocation)\**" Directory="INSTALLFOLDER" Subdirectory="documentation" />
</Feature>
<?endif?>
</Feature>
Expand Down
6 changes: 1 addition & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,11 @@ if(SWIG_FOUND)
endif()
#configure_file(setup.py.cmake setup.py)
#install(CODE "execute_process(COMMAND python3 ${CMAKE_CURRENT_BINARY_DIR}/setup.py install)")
if(NOT Python3_SITELIB)
execute_process(COMMAND /usr/bin/python3 -c
"from distutils import sysconfig;print(sysconfig.get_python_lib(plat_specific=False,standard_lib=False))"
OUTPUT_VARIABLE Python3_SITELIB OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(WIN32)
set(Python3_SITELIB ${CMAKE_INSTALL_BINDIR})
install(FILES $<TARGET_PDB_FILE:digidoc_python> DESTINATION ${Python3_SITELIB} OPTIONAL)
else()
find_package(Python3 COMPONENTS Interpreter) # for Python3_SITELIB
set_target_properties(digidoc_python PROPERTIES SUFFIX .so)
endif()
set_target_properties(digidoc_python PROPERTIES
Expand Down