From e138254bc0abb5ee2b3487d83ec309de109a91ab Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 1 Feb 2023 13:29:21 +0200 Subject: [PATCH] Workaround MSVC 2019 issue - add version info to swig bindings - include manifest 1.2 schema IB-7392 Signed-off-by: Raul Metsma --- libdigidocpp.wxs | 2 ++ src/CMakeLists.txt | 16 +++++++++++----- src/digidoc-tool.cpp | 2 +- src/libdigidocpp.i.h | 4 ++-- src/libdigidocpp.rc | 8 ++++---- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/libdigidocpp.wxs b/libdigidocpp.wxs index 167960857..0dbb38bec 100644 --- a/libdigidocpp.wxs +++ b/libdigidocpp.wxs @@ -83,6 +83,7 @@ + @@ -147,6 +148,7 @@ + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 57b4afb2d..cf1d73f58 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -140,6 +140,9 @@ set( CRYPTO_HEADER crypto/X509Cert.h ) +add_library(digidocpp_ver INTERFACE) +target_sources(digidocpp_ver INTERFACE libdigidocpp.rc) + add_library(digidocpp_util STATIC util/File.cpp util/log.cpp @@ -192,7 +195,6 @@ add_library(digidocpp ${PUBLIC_HEADER} ${CRYPTO_HEADER} ${XML_HEADER} - libdigidocpp.rc Container.cpp ASiContainer.cpp ASiC_E.cpp @@ -238,10 +240,11 @@ set_target_properties(digidocpp PROPERTIES FRAMEWORK "${FRAMEWORK}" MACOSX_FRAMEWORK_IDENTIFIER "ee.ria.digidocpp" MACOSX_RPATH YES + COMPILE_DEFINITIONS TARGET_NAME="$" ) target_include_directories(digidocpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(digidocpp PRIVATE ${CMAKE_DL_LIBS} minizip digidocpp_priv) +target_link_libraries(digidocpp PRIVATE ${CMAKE_DL_LIBS} minizip digidocpp_priv digidocpp_ver) if( BUILD_TOOLS ) add_executable(digidoc-tool digidoc-tool.rc digidoc-tool.cpp) @@ -270,7 +273,8 @@ if(SWIG_FOUND) set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/java) swig_add_library(digidoc_java TYPE SHARED LANGUAGE java SOURCES ../libdigidocpp.i) target_include_directories(digidoc_java PRIVATE ${JAVA_INCLUDE_PATH} $<$:${JAVA_INCLUDE_PATH2}>) - target_link_libraries(digidoc_java digidocpp digidocpp_util) + target_compile_definitions(digidoc_java PRIVATE TARGET_NAME="$") + target_link_libraries(digidoc_java digidocpp digidocpp_util digidocpp_ver) if(APPLE) set_target_properties(digidoc_java PROPERTIES MACOSX_RPATH YES INSTALL_RPATH /Library/Frameworks) install(TARGETS digidoc_java DESTINATION /Library/Java/Extensions) @@ -286,7 +290,8 @@ if(SWIG_FOUND) set(CMAKE_SWIG_FLAGS -py3) set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}) swig_add_library(digidoc_python TYPE SHARED LANGUAGE python SOURCES ../libdigidocpp.i) - target_link_libraries(digidoc_python digidocpp digidocpp_util Python3::Module) + target_compile_definitions(digidoc_python PRIVATE TARGET_NAME="$") + target_link_libraries(digidoc_python digidocpp digidocpp_util digidocpp_ver Python3::Module) #configure_file(setup.py.cmake setup.py) #install(CODE "execute_process(COMMAND python3 ${CMAKE_CURRENT_BINARY_DIR}/setup.py install)") if(NOT Python3_SITELIB) @@ -307,7 +312,8 @@ if(SWIG_FOUND) set(CMAKE_SWIG_FLAGS -dllimport digidoc_csharp -namespace digidoc) set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/csharp) swig_add_library(digidoc_csharp TYPE SHARED LANGUAGE csharp SOURCES ../libdigidocpp.i) - target_link_libraries(digidoc_csharp digidocpp digidocpp_util) + target_compile_definitions(digidoc_csharp PRIVATE TARGET_NAME="$") + target_link_libraries(digidoc_csharp digidocpp digidocpp_util digidocpp_ver) install(TARGETS digidoc_csharp DESTINATION ${CMAKE_INSTALL_BINDIR}) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/csharp/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/digidocpp_csharp FILES_MATCHING PATTERN "*.cs") install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/src/digidoc-tool.cpp b/src/digidoc-tool.cpp index a841e6da0..68453c0f2 100644 --- a/src/digidoc-tool.cpp +++ b/src/digidoc-tool.cpp @@ -440,7 +440,7 @@ ToolConfig::ToolConfig(int argc, char *argv[]) else if(arg == "--sigpsssha512") siguri = URI_RSA_PSS_SHA512; else if(arg.find("--tsurl") == 0) tsurl = arg.substr(8); else if(arg.find("--tslurl=") == 0) tslurl = arg.substr(9); - else if(arg.find("--tslcert=") == 0) tslcerts = { X509Cert(arg.substr(10)) }; + else if(arg.find("--tslcert=") == 0) tslcerts = vector{ X509Cert(arg.substr(10)) }; else if(arg == "--TSLAllowExpired") expired = true; else if(arg == "--dontsign") doSign = false; else if(arg == "--nocolor") RED = GREEN = YELLOW = RESET = {}; diff --git a/src/libdigidocpp.i.h b/src/libdigidocpp.i.h index 823e4463b..a34698a82 100644 --- a/src/libdigidocpp.i.h +++ b/src/libdigidocpp.i.h @@ -71,7 +71,7 @@ class SWIGEXPORT DigiDocConf: public digidoc::XmlConfCurrent void setTSLCert(const std::vector &cert) { if(cert.empty()) tslCerts.emplace(); - else tslCerts = { X509Cert(cert, X509Cert::Der) }; + else tslCerts = std::vector{ X509Cert(cert, X509Cert::Der) }; } void addTSLCert(const std::vector &cert) { @@ -89,7 +89,7 @@ class SWIGEXPORT DigiDocConf: public digidoc::XmlConfCurrent void setVerifyServiceCert(const std::vector &cert) { if(cert.empty()) serviceCerts.emplace(); - else serviceCerts = { X509Cert(cert, X509Cert::Der) }; + else serviceCerts = std::vector{ X509Cert(cert, X509Cert::Der) }; } void addVerifyServiceCert(const std::vector &cert) { diff --git a/src/libdigidocpp.rc b/src/libdigidocpp.rc index ba954bf95..682803ae0 100644 --- a/src/libdigidocpp.rc +++ b/src/libdigidocpp.rc @@ -21,12 +21,12 @@ BEGIN BLOCK "040904B0" BEGIN VALUE "CompanyName", "RIA" - VALUE "FileDescription", "digidocpp" + VALUE "FileDescription", TARGET_NAME VALUE "FileVersion", VER_STR(MAJOR_VER.MINOR_VER.RELEASE_VER.BUILD_VER) - VALUE "InternalName", "digidocpp" + VALUE "InternalName", TARGET_NAME VALUE "LegalCopyright", "(C) 2009-2023 Estonian Information System Authority" - VALUE "OriginalFilename", "digidocpp.dll" - VALUE "ProductName", "digidocpp" + VALUE "OriginalFilename", TARGET_NAME ".dll" + VALUE "ProductName", TARGET_NAME VALUE "ProductVersion", VER_STR(MAJOR_VER.MINOR_VER.RELEASE_VER.BUILD_VER) END END