Skip to content

Commit 873fc69

Browse files
authored
Fix Python module compatibility and fix some warnings (#642)
IB-8176 Signed-off-by: Raul Metsma <[email protected]>
1 parent 82729b4 commit 873fc69

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,12 @@ jobs:
6060
cd /Library
6161
zip -q -r ${OLDPWD}/libdigidocpp.${{ matrix.target }}.zip libdigidocpp.*
6262
- name: Archive artifacts
63-
if: matrix.target == 'macos'
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: macOS
67-
path: build/macos/libdigidocpp*.*
68-
- name: Archive artifacts
69-
if: matrix.target != 'macos'
7063
uses: actions/upload-artifact@v4
7164
with:
7265
name: ${{ matrix.target }}
73-
path: libdigidocpp*.zip
66+
path: |
67+
build/macos/libdigidocpp*.*
68+
libdigidocpp*.zip
7469
fedora:
7570
name: Build on Fedora ${{ matrix.container }}
7671
runs-on: ubuntu-latest
@@ -161,7 +156,10 @@ jobs:
161156
VCPKG_DEFAULT_TRIPLET: ${{ matrix.platform }}-windows
162157
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed_${{ matrix.platform }}
163158
- name: Install dependencies
164-
run: choco install doxygen.install -y > $null
159+
run: |
160+
choco install doxygen.install -y > $null
161+
Invoke-WebRequest -UserAgent "Wget" "https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.2.1/swigwin-4.2.1.zip/download" -OutFile swig.zip
162+
tar xf swig.zip
165163
- uses: actions/setup-python@v5
166164
if: matrix.platform == 'x86'
167165
with:
@@ -172,7 +170,7 @@ jobs:
172170
& .\build.ps1 `
173171
-vcvars "${{ matrix.vcvars }}" `
174172
-platform ${{ matrix.platform }} `
175-
-swig C:/ProgramData/chocolatey/bin/swig.exe `
173+
-swig ${{ github.workspace }}/swigwin-4.2.1/swig.exe `
176174
-doxygen "C:/Program files/doxygen/bin/doxygen.exe" `
177175
-boost
178176
- name: Archive artifacts

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ find_package(SWIG)
7878
if(SWIG_FOUND)
7979
find_package(JNI)
8080
find_package(Python3 COMPONENTS Interpreter Development)
81+
if((WIN32 OR APPLE) AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
82+
find_package(Python3 COMPONENTS Development.SABIModule)
83+
endif()
8184
endif()
8285

8386
find_package(Doxygen)

libdigidocpp.i

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@
2323

2424
%begin %{
2525
#ifdef _MSC_VER
26-
#if 1
2726
#define SWIG_PYTHON_INTERPRETER_NO_DEBUG
28-
#include <crtdefs.h>
29-
#else // Python debug symbols are installed
30-
#define PY_NO_LINK_LIB
31-
#endif
3227
#endif
3328
%}
3429
%{

prepare_osx_build_environment.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function openssl {
168168
do
169169
case "${ARGS}" in
170170
*simulator*) CC="" CFLAGS="-arch ${ARCH}" ./Configure iossimulator-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;;
171-
*catalyst*) CC="" CFLAGS="-target ${ARCH}-apple-ios-macabi" ./Configure darwin64-${ARCH} --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;;
171+
*catalyst*) CC="" CFLAGS="-target ${ARCH}-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-macabi" ./Configure darwin64-${ARCH} --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;;
172172
*iphone*) CC="" CFLAGS="" ./Configure ios64-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-module no-engine no-tests no-ui-console enable-ec_nistp_64_gcc_128 ;;
173173
*) CC="" CFLAGS="" ./Configure darwin64-${ARCH} --prefix=${TARGET_PATH} shared no-module no-tests enable-ec_nistp_64_gcc_128
174174
esac

src/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ if(SWIG_FOUND)
198198
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
199199
swig_add_library(digidoc_python LANGUAGE python SOURCES ../libdigidocpp.i)
200200
target_compile_definitions(digidoc_python PRIVATE TARGET_NAME="$<TARGET_NAME:digidoc_python>")
201-
target_link_libraries(digidoc_python digidocpp digidocpp_util digidocpp_ver Python3::Module)
201+
target_link_libraries(digidoc_python digidocpp digidocpp_util digidocpp_ver)
202+
if(TARGET Python3::SABIModule)
203+
target_compile_definitions(digidoc_python PRIVATE Py_LIMITED_API=0x03090000)
204+
target_link_libraries(digidoc_python Python3::SABIModule)
205+
else()
206+
target_link_libraries(digidoc_python Python3::Module)
207+
endif()
202208
#configure_file(setup.py.cmake setup.py)
203209
#install(CODE "execute_process(COMMAND python3 ${CMAKE_CURRENT_BINARY_DIR}/setup.py install)")
204210
if(NOT Python3_SITELIB)

src/XMLDocument.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ struct XMLElem
186186

187187
struct XMLName
188188
{
189-
std::string_view name;
190-
std::string_view ns;
189+
std::string_view name {};
190+
std::string_view ns {};
191191
};
192192

193193
struct XMLNode: public XMLElem<xmlNode>

src/XmlConf.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ SET1CONST(string, setProxyPass, proxyPass)
600600
* @fn void digidoc::XmlConfV5::setPKCS12Cert(const std::string &cert)
601601
* @copydoc digidoc::XmlConf::setPKCS12Cert(const std::string &cert)
602602
*/
603-
SET1CONSTEX(string, setPKCS12Cert, {})
603+
SET1CONSTEX(string, setPKCS12Cert, (void)value)
604604

605605
/**
606606
* @fn void digidoc::XmlConf::setPKCS12Pass(const std::string &pass)
@@ -625,7 +625,7 @@ SET1CONSTEX(string, setPKCS12Cert, {})
625625
* @fn void digidoc::XmlConfV5::setPKCS12Pass(const std::string &pass)
626626
* @copydoc digidoc::XmlConf::setPKCS12Pass(const std::string &pass)
627627
*/
628-
SET1CONSTEX(string, setPKCS12Pass, {})
628+
SET1CONSTEX(string, setPKCS12Pass, (void)value)
629629

630630
/**
631631
* @fn void digidoc::XmlConf::setTSUrl(const std::string &url)
@@ -700,7 +700,7 @@ SET1CONST(string, setVerifyServiceUri, verifyServiceUri)
700700
* @fn void digidoc::XmlConfV5::setPKCS12Disable(bool disable)
701701
* @copydoc digidoc::XmlConf::setPKCS12Disable(bool disable)
702702
*/
703-
SET1EX(bool, setPKCS12Disable, {})
703+
SET1EX([[maybe_unused]] bool, setPKCS12Disable, {})
704704

705705
/**
706706
* @fn void digidoc::XmlConf::setProxyTunnelSSL(bool enable)

test/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ target_link_libraries(TSLTests digidocpp digidocpp_util Boost::unit_test_framewo
1212
if(WIN32)
1313
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
1414
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "/bigobj")
15-
else()
16-
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-unused-variable")
1715
endif()
1816
add_test(NAME runtest
1917
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unittests --build_info=YES --report_level=no --logger=${TEST_FORMAT},all,${CMAKE_CURRENT_BINARY_DIR}/libdigidocpp.xml -- ${CMAKE_CURRENT_SOURCE_DIR}/data

0 commit comments

Comments
 (0)