Skip to content

Commit

Permalink
Fix Python module compatibility and fix some warnings (#642)
Browse files Browse the repository at this point in the history
IB-8176

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored Nov 15, 2024
1 parent 82729b4 commit 873fc69
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,12 @@ jobs:
cd /Library
zip -q -r ${OLDPWD}/libdigidocpp.${{ matrix.target }}.zip libdigidocpp.*
- name: Archive artifacts
if: matrix.target == 'macos'
uses: actions/upload-artifact@v4
with:
name: macOS
path: build/macos/libdigidocpp*.*
- name: Archive artifacts
if: matrix.target != 'macos'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: libdigidocpp*.zip
path: |
build/macos/libdigidocpp*.*
libdigidocpp*.zip
fedora:
name: Build on Fedora ${{ matrix.container }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -161,7 +156,10 @@ jobs:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.platform }}-windows
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed_${{ matrix.platform }}
- name: Install dependencies
run: choco install doxygen.install -y > $null
run: |
choco install doxygen.install -y > $null
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'
with:
Expand All @@ -172,7 +170,7 @@ jobs:
& .\build.ps1 `
-vcvars "${{ matrix.vcvars }}" `
-platform ${{ matrix.platform }} `
-swig C:/ProgramData/chocolatey/bin/swig.exe `
-swig ${{ github.workspace }}/swigwin-4.2.1/swig.exe `
-doxygen "C:/Program files/doxygen/bin/doxygen.exe" `
-boost
- name: Archive artifacts
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ find_package(SWIG)
if(SWIG_FOUND)
find_package(JNI)
find_package(Python3 COMPONENTS Interpreter Development)
if((WIN32 OR APPLE) AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
find_package(Python3 COMPONENTS Development.SABIModule)
endif()
endif()

find_package(Doxygen)
Expand Down
5 changes: 0 additions & 5 deletions libdigidocpp.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@

%begin %{
#ifdef _MSC_VER
#if 1
#define SWIG_PYTHON_INTERPRETER_NO_DEBUG
#include <crtdefs.h>
#else // Python debug symbols are installed
#define PY_NO_LINK_LIB
#endif
#endif
%}
%{
Expand Down
2 changes: 1 addition & 1 deletion prepare_osx_build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function openssl {
do
case "${ARGS}" in
*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 ;;
*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 ;;
*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 ;;
*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 ;;
*) CC="" CFLAGS="" ./Configure darwin64-${ARCH} --prefix=${TARGET_PATH} shared no-module no-tests enable-ec_nistp_64_gcc_128
esac
Expand Down
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ if(SWIG_FOUND)
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
swig_add_library(digidoc_python LANGUAGE python SOURCES ../libdigidocpp.i)
target_compile_definitions(digidoc_python PRIVATE TARGET_NAME="$<TARGET_NAME:digidoc_python>")
target_link_libraries(digidoc_python digidocpp digidocpp_util digidocpp_ver Python3::Module)
target_link_libraries(digidoc_python digidocpp digidocpp_util digidocpp_ver)
if(TARGET Python3::SABIModule)
target_compile_definitions(digidoc_python PRIVATE Py_LIMITED_API=0x03090000)
target_link_libraries(digidoc_python Python3::SABIModule)
else()
target_link_libraries(digidoc_python Python3::Module)
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)
Expand Down
4 changes: 2 additions & 2 deletions src/XMLDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ struct XMLElem

struct XMLName
{
std::string_view name;
std::string_view ns;
std::string_view name {};
std::string_view ns {};
};

struct XMLNode: public XMLElem<xmlNode>
Expand Down
6 changes: 3 additions & 3 deletions src/XmlConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ SET1CONST(string, setProxyPass, proxyPass)
* @fn void digidoc::XmlConfV5::setPKCS12Cert(const std::string &cert)
* @copydoc digidoc::XmlConf::setPKCS12Cert(const std::string &cert)
*/
SET1CONSTEX(string, setPKCS12Cert, {})
SET1CONSTEX(string, setPKCS12Cert, (void)value)

/**
* @fn void digidoc::XmlConf::setPKCS12Pass(const std::string &pass)
Expand All @@ -625,7 +625,7 @@ SET1CONSTEX(string, setPKCS12Cert, {})
* @fn void digidoc::XmlConfV5::setPKCS12Pass(const std::string &pass)
* @copydoc digidoc::XmlConf::setPKCS12Pass(const std::string &pass)
*/
SET1CONSTEX(string, setPKCS12Pass, {})
SET1CONSTEX(string, setPKCS12Pass, (void)value)

/**
* @fn void digidoc::XmlConf::setTSUrl(const std::string &url)
Expand Down Expand Up @@ -700,7 +700,7 @@ SET1CONST(string, setVerifyServiceUri, verifyServiceUri)
* @fn void digidoc::XmlConfV5::setPKCS12Disable(bool disable)
* @copydoc digidoc::XmlConf::setPKCS12Disable(bool disable)
*/
SET1EX(bool, setPKCS12Disable, {})
SET1EX([[maybe_unused]] bool, setPKCS12Disable, {})

/**
* @fn void digidoc::XmlConf::setProxyTunnelSSL(bool enable)
Expand Down
2 changes: 0 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ target_link_libraries(TSLTests digidocpp digidocpp_util Boost::unit_test_framewo
if(WIN32)
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "/bigobj")
else()
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-unused-variable")
endif()
add_test(NAME runtest
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
Expand Down

0 comments on commit 873fc69

Please sign in to comment.