diff --git a/CMakeLists.txt b/CMakeLists.txt index 6df4989ce..cdeefeb46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,8 +33,9 @@ list(APPEND CPACK_RPM_RELOCATION_PATHS ${CMAKE_INSTALL_SYSCONFDIR}) set(CPACK_RPM_FILE_NAME RPM-DEFAULT) set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) include(CPack) -if( APPLE ) - set( FRAMEWORK YES CACHE BOOL "Build library as Mac OS X Framework" ) +if(APPLE) + set(FRAMEWORK YES CACHE BOOL "Build library as Mac OS X Framework") + set(FRAMEWORK_DESTINATION /Library/Frameworks CACHE PATH "Mac OS X Framework install destination") endif() find_package(Doxygen) diff --git a/build-library.sh b/build-library.sh index b38bc53c5..f17501c54 100755 --- a/build-library.sh +++ b/build-library.sh @@ -73,12 +73,11 @@ case "$@" in export IPHONEOS_DEPLOYMENT_TARGET CMAKEARGS=" -DCMAKE_OSX_SYSROOT=${SYSROOT} \ - -DFRAMEWORK=off \ -DSWIG_EXECUTABLE=NOTFOUND \ -DBoost_INCLUDE_DIR=NOTFOUND \ -DDOXYGEN_EXECUTABLE=NOTFOUND \ - -DBUILD_TOOLS=NO \ - -DBUILD_SHARED_LIBS=NO" + -DFRAMEWORK_DESTINATION=${TARGET_PATH}/lib + -DBUILD_TOOLS=NO" ;; *) echo "Building for macOS" diff --git a/cmake b/cmake index 0ead93415..bf6d6327f 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 0ead93415bb874083a46d8ef812d9d8b0dedb169 +Subproject commit bf6d6327f226c79834b8ab3034e0f3dac7f4d39a diff --git a/examples/ios/README.md b/examples/ios/README.md index bca165a76..01c8b63b6 100644 --- a/examples/ios/README.md +++ b/examples/ios/README.md @@ -12,5 +12,4 @@ Open Xcode project and run on simulator -AppDelegate.mm contains how to override digidoc::XmlConf to point right cache folder for TSL lists and XSD schema folders. -Project also includes schema folder (/Library/libdigidocpp.iphoneos/etc/digidocpp/schema). +AppDelegate.mm contains how to override digidoc::XmlConf to point right cache folder for TSL lists. diff --git a/examples/ios/libdigidocpp.xcodeproj/project.pbxproj b/examples/ios/libdigidocpp.xcodeproj/project.pbxproj index 4ed89b7b1..4b70345a3 100644 --- a/examples/ios/libdigidocpp.xcodeproj/project.pbxproj +++ b/examples/ios/libdigidocpp.xcodeproj/project.pbxproj @@ -8,31 +8,37 @@ /* Begin PBXBuildFile section */ 4E25CC401B5D1D85005E0B79 /* test.bdoc in Resources */ = {isa = PBXBuildFile; fileRef = 4E25CC3F1B5D1D85005E0B79 /* test.bdoc */; }; - 4E25CC421B5D1EDA005E0B79 /* schema in Resources */ = {isa = PBXBuildFile; fileRef = 4E25CC411B5D1EDA005E0B79 /* schema */; }; 4E26A2292AB4E38600E2B732 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4E26A2282AB4E38600E2B732 /* LaunchScreen.storyboard */; }; + 4E34C8402AE9292A00DD78B0 /* digidocpp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E34C83F2AE9292A00DD78B0 /* digidocpp.framework */; }; + 4E34C8412AE9292A00DD78B0 /* digidocpp.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4E34C83F2AE9292A00DD78B0 /* digidocpp.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4E76639E1B5A37AC00672ACF /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4E76639D1B5A37AC00672ACF /* main.mm */; }; 4E7663A11B5A37AC00672ACF /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4E7663A01B5A37AC00672ACF /* AppDelegate.mm */; }; 4E7663A41B5A37AC00672ACF /* MasterViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4E7663A31B5A37AC00672ACF /* MasterViewController.mm */; }; 4E7663AA1B5A37AC00672ACF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4E7663A81B5A37AC00672ACF /* Main.storyboard */; }; 4E7663AC1B5A37AC00672ACF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4E7663AB1B5A37AC00672ACF /* Images.xcassets */; }; - 4E85E5F7285364BF00A65763 /* libdigidocpp_util.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E85E5F6285364BF00A65763 /* libdigidocpp_util.a */; }; - 4ECD5FAA2010A15A00BCC616 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FA92010A15A00BCC616 /* libcrypto.a */; }; - 4ECD5FB02010A1B700BCC616 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FAB2010A1B700BCC616 /* libssl.a */; }; - 4ECD5FB12010A1B700BCC616 /* libxalan-c.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FAC2010A1B700BCC616 /* libxalan-c.a */; }; - 4ECD5FB22010A1B700BCC616 /* libxerces-c.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FAD2010A1B700BCC616 /* libxerces-c.a */; }; - 4ECD5FB32010A1B700BCC616 /* libxalanMsg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FAE2010A1B700BCC616 /* libxalanMsg.a */; }; - 4ECD5FB42010A1B700BCC616 /* libxml-security-c.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FAF2010A1B700BCC616 /* libxml-security-c.a */; }; 4ECD5FB72010A33800BCC616 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FB62010A33800BCC616 /* libz.tbd */; }; 4ECD5FBB2010A38900BCC616 /* libminizip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FB82010A38900BCC616 /* libminizip.a */; }; - 4ECD5FBC2010A38900BCC616 /* libdigidocpp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FB92010A38900BCC616 /* libdigidocpp.a */; }; - 4ECD5FBD2010A38900BCC616 /* libdigidocpp_priv.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD5FBA2010A38900BCC616 /* libdigidocpp_priv.a */; }; 4EF2169520496F780013677E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EF2169420496F780013677E /* UIKit.framework */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + 4E34C8422AE9292A00DD78B0 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 4E34C8412AE9292A00DD78B0 /* digidocpp.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 4E25CC3F1B5D1D85005E0B79 /* test.bdoc */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.bdoc; sourceTree = ""; }; - 4E25CC411B5D1EDA005E0B79 /* schema */ = {isa = PBXFileReference; lastKnownFileType = folder; name = schema; path = "$(SDKPATH)/etc/digidocpp/schema"; sourceTree = ""; }; 4E26A2282AB4E38600E2B732 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; + 4E34C83F2AE9292A00DD78B0 /* digidocpp.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = digidocpp.framework; path = "$(SDKPATH)/lib/digidocpp.framework"; sourceTree = ""; }; 4E7663981B5A37AC00672ACF /* libdigidocpp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = libdigidocpp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4E76639C1B5A37AC00672ACF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4E76639D1B5A37AC00672ACF /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; @@ -41,18 +47,9 @@ 4E7663A31B5A37AC00672ACF /* MasterViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MasterViewController.mm; sourceTree = ""; }; 4E7663A91B5A37AC00672ACF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 4E7663AB1B5A37AC00672ACF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 4E85E5F6285364BF00A65763 /* libdigidocpp_util.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdigidocpp_util.a; path = "$(SDKPATH)/lib/libdigidocpp_util.a"; sourceTree = ""; }; 4EAC9AA729125D5200A39880 /* libdigidocpp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = libdigidocpp.entitlements; sourceTree = ""; }; - 4ECD5FA92010A15A00BCC616 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "$(SDKPATH)/lib/libcrypto.a"; sourceTree = ""; }; - 4ECD5FAB2010A1B700BCC616 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "$(SDKPATH)/lib/libssl.a"; sourceTree = ""; }; - 4ECD5FAC2010A1B700BCC616 /* libxalan-c.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libxalan-c.a"; path = "$(SDKPATH)/lib/libxalan-c.a"; sourceTree = ""; }; - 4ECD5FAD2010A1B700BCC616 /* libxerces-c.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libxerces-c.a"; path = "$(SDKPATH)/lib/libxerces-c.a"; sourceTree = ""; }; - 4ECD5FAE2010A1B700BCC616 /* libxalanMsg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libxalanMsg.a; path = "$(SDKPATH)/lib/libxalanMsg.a"; sourceTree = ""; }; - 4ECD5FAF2010A1B700BCC616 /* libxml-security-c.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libxml-security-c.a"; path = "$(SDKPATH)/lib/libxml-security-c.a"; sourceTree = ""; }; 4ECD5FB62010A33800BCC616 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 4ECD5FB82010A38900BCC616 /* libminizip.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libminizip.a; path = "$(SDKPATH)/lib/libminizip.a"; sourceTree = ""; }; - 4ECD5FB92010A38900BCC616 /* libdigidocpp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdigidocpp.a; path = "$(SDKPATH)/lib/libdigidocpp.a"; sourceTree = ""; }; - 4ECD5FBA2010A38900BCC616 /* libdigidocpp_priv.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdigidocpp_priv.a; path = "$(SDKPATH)/lib/libdigidocpp_priv.a"; sourceTree = ""; }; 4ED367C424EA910E0020905B /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 4EF2169420496F780013677E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -63,17 +60,9 @@ buildActionMask = 2147483647; files = ( 4EF2169520496F780013677E /* UIKit.framework in Frameworks */, - 4ECD5FBC2010A38900BCC616 /* libdigidocpp.a in Frameworks */, - 4ECD5FBD2010A38900BCC616 /* libdigidocpp_priv.a in Frameworks */, 4ECD5FBB2010A38900BCC616 /* libminizip.a in Frameworks */, - 4ECD5FB42010A1B700BCC616 /* libxml-security-c.a in Frameworks */, - 4ECD5FB02010A1B700BCC616 /* libssl.a in Frameworks */, - 4ECD5FAA2010A15A00BCC616 /* libcrypto.a in Frameworks */, - 4ECD5FB12010A1B700BCC616 /* libxalan-c.a in Frameworks */, - 4ECD5FB32010A1B700BCC616 /* libxalanMsg.a in Frameworks */, - 4E85E5F7285364BF00A65763 /* libdigidocpp_util.a in Frameworks */, - 4ECD5FB22010A1B700BCC616 /* libxerces-c.a in Frameworks */, 4ECD5FB72010A33800BCC616 /* libz.tbd in Frameworks */, + 4E34C8402AE9292A00DD78B0 /* digidocpp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -111,7 +100,6 @@ 4E76639C1B5A37AC00672ACF /* Info.plist */, 4E76639D1B5A37AC00672ACF /* main.mm */, 4E25CC3F1B5D1D85005E0B79 /* test.bdoc */, - 4E25CC411B5D1EDA005E0B79 /* schema */, ); path = libdigidocpp; sourceTree = ""; @@ -120,16 +108,8 @@ isa = PBXGroup; children = ( 4EF2169420496F780013677E /* UIKit.framework */, - 4ECD5FA92010A15A00BCC616 /* libcrypto.a */, - 4ECD5FB92010A38900BCC616 /* libdigidocpp.a */, - 4ECD5FBA2010A38900BCC616 /* libdigidocpp_priv.a */, - 4E85E5F6285364BF00A65763 /* libdigidocpp_util.a */, + 4E34C83F2AE9292A00DD78B0 /* digidocpp.framework */, 4ECD5FB82010A38900BCC616 /* libminizip.a */, - 4ECD5FAB2010A1B700BCC616 /* libssl.a */, - 4ECD5FAC2010A1B700BCC616 /* libxalan-c.a */, - 4ECD5FAE2010A1B700BCC616 /* libxalanMsg.a */, - 4ECD5FAD2010A1B700BCC616 /* libxerces-c.a */, - 4ECD5FAF2010A1B700BCC616 /* libxml-security-c.a */, 4ECD5FB62010A33800BCC616 /* libz.tbd */, ); name = Frameworks; @@ -145,6 +125,7 @@ 4E7663941B5A37AC00672ACF /* Sources */, 4E7663951B5A37AC00672ACF /* Frameworks */, 4E7663961B5A37AC00672ACF /* Resources */, + 4E34C8422AE9292A00DD78B0 /* Embed Frameworks */, ); buildRules = ( ); @@ -193,7 +174,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4E25CC421B5D1EDA005E0B79 /* schema in Resources */, 4E7663AA1B5A37AC00672ACF /* Main.storyboard in Resources */, 4E7663AC1B5A37AC00672ACF /* Images.xcassets in Resources */, 4E26A2292AB4E38600E2B732 /* LaunchScreen.storyboard in Resources */, @@ -343,11 +323,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; BUILD_NUMBER = 0; CODE_SIGN_ENTITLEMENTS = libdigidocpp/libdigidocpp.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(BUILD_NUMBER)"; DEVELOPMENT_TEAM = ET847QJV9F; + "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; + FRAMEWORK_SEARCH_PATHS = "$(SDKPATH)/lib"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", "TESTING=$(TESTING)", @@ -355,7 +336,7 @@ GENERATE_INFOPLIST_FILE = YES; HEADER_SEARCH_PATHS = ( "$(SDKPATH)/include", - "$(MINIZIP)", + "$(PROJECT_DIR)/../../src/minizip", ); INFOPLIST_FILE = libdigidocpp/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity"; @@ -364,14 +345,17 @@ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = "$(SDKPATH)/lib"; MARKETING_VERSION = 1.0; - MINIZIP = "$(PROJECT_DIR)/../../src/minizip"; - PRODUCT_BUNDLE_IDENTIFIER = "ee.ria.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = ee.ria.libdigidocpp.app; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKPATH = /Library/libdigidocpp.iphoneos; - "SDKPATH[sdk=iphonesimulator*]" = /Library/libdigidocpp.iphonesimulator; - "SDKPATH[sdk=macosx*]" = /Library/libdigidocpp.iphonecatalyst; + SDKPATH = "$(LOCAL_LIBRARY_DIR)/libdigidocpp.iphoneos"; + "SDKPATH[sdk=iphonesimulator*]" = "$(LOCAL_LIBRARY_DIR)/libdigidocpp.iphonesimulator"; + "SDKPATH[sdk=macosx*]" = "$(LOCAL_LIBRARY_DIR)/libdigidocpp.iphonecatalyst"; SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; TESTING = 0; @@ -384,11 +368,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; BUILD_NUMBER = 0; CODE_SIGN_ENTITLEMENTS = libdigidocpp/libdigidocpp.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(BUILD_NUMBER)"; DEVELOPMENT_TEAM = ET847QJV9F; + "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; + FRAMEWORK_SEARCH_PATHS = "$(SDKPATH)/lib"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", "TESTING=$(TESTING)", @@ -396,7 +381,7 @@ GENERATE_INFOPLIST_FILE = YES; HEADER_SEARCH_PATHS = ( "$(SDKPATH)/include", - "$(MINIZIP)", + "$(PROJECT_DIR)/../../src/minizip", ); INFOPLIST_FILE = libdigidocpp/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity"; @@ -405,14 +390,17 @@ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = "$(SDKPATH)/lib"; MARKETING_VERSION = 1.0; - MINIZIP = "$(PROJECT_DIR)/../../src/minizip"; - PRODUCT_BUNDLE_IDENTIFIER = "ee.ria.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = ee.ria.libdigidocpp.app; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKPATH = /Library/libdigidocpp.iphoneos; - "SDKPATH[sdk=iphonesimulator*]" = /Library/libdigidocpp.iphonesimulator; - "SDKPATH[sdk=macosx*]" = /Library/libdigidocpp.iphonecatalyst; + SDKPATH = "$(LOCAL_LIBRARY_DIR)/libdigidocpp.iphoneos"; + "SDKPATH[sdk=iphonesimulator*]" = "$(LOCAL_LIBRARY_DIR)/libdigidocpp.iphonesimulator"; + "SDKPATH[sdk=macosx*]" = "$(LOCAL_LIBRARY_DIR)/libdigidocpp.iphonecatalyst"; SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; TESTING = 0; diff --git a/examples/ios/libdigidocpp/AppDelegate.mm b/examples/ios/libdigidocpp/AppDelegate.mm index dca970e74..9e41f0146 100644 --- a/examples/ios/libdigidocpp/AppDelegate.mm +++ b/examples/ios/libdigidocpp/AppDelegate.mm @@ -13,31 +13,26 @@ #include #include -class DigiDocConf: public digidoc::ConfCurrent +class DigiDocConf final: public digidoc::ConfCurrent { public: - int logLevel() const override + int logLevel() const final { return 4; } - std::string logFile() const override + std::string logFile() const final { return [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/libdigidocpp.log"].UTF8String; } - std::string TSLCache() const override + std::string TSLCache() const final { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *libraryDirectory = paths[0]; [NSFileManager.defaultManager createFileAtPath:[libraryDirectory stringByAppendingPathComponent:@"EE_T.xml"] contents:nil attributes:nil]; return libraryDirectory.UTF8String; } - - std::string xsdPath() const override - { - return [NSBundle.mainBundle pathForResource:@"schema" ofType:NSString.string].UTF8String; - } }; @implementation AppDelegate diff --git a/examples/ios/libdigidocpp/MasterViewController.mm b/examples/ios/libdigidocpp/MasterViewController.mm index bef6eb98f..e2f05970f 100644 --- a/examples/ios/libdigidocpp/MasterViewController.mm +++ b/examples/ios/libdigidocpp/MasterViewController.mm @@ -14,6 +14,8 @@ #include #include "unzip.h" +#include + @interface NSString (Digidoc) + (NSString*)stdstring:(const std::string&)str; @end @@ -83,7 +85,7 @@ - (IBAction)runTest:(id)sender { if(unzResult != UNZ_OK) break; std::string fileNameTmp(fileInfo.size_filename, 0); - unzResult = unzGetCurrentFileInfo(open, &fileInfo, fileNameTmp.c_str(), uLong(fileNameTmp.size()), nullptr, 0, nullptr, 0); + unzResult = unzGetCurrentFileInfo(open, &fileInfo, fileNameTmp.data(), uLong(fileNameTmp.size()), nullptr, 0, nullptr, 0); if(unzResult != UNZ_OK) break; @@ -100,10 +102,10 @@ - (IBAction)runTest:(id)sender { break; int size = 0; - char buf[10240]; + std::array buf{}; NSMutableData *data = [[NSMutableData alloc] init]; - while((size = unzReadCurrentFile(open, buf, 10240)) > 0) - [data appendBytes:buf length:size]; + while((size = unzReadCurrentFile(open, buf.data(), buf.size())) > 0) + [data appendBytes:buf.data() length:size]; unzResult = unzCloseCurrentFile(open); [data writeToFile:file atomically:YES]; @@ -111,7 +113,7 @@ - (IBAction)runTest:(id)sender { NSString *diagnostics = @""; NSMutableArray *dataFiles = [[NSMutableArray alloc] init]; try { - std::unique_ptr d(digidoc::Container::open(file.UTF8String)); + auto d = digidoc::Container::openPtr(file.UTF8String); for (const digidoc::DataFile *f: d->dataFiles()) { [dataFiles addObject:@{ @"f": [NSString stdstring:f->fileName()], diff --git a/examples/ios/libdigidocpp/libdigidocpp.entitlements b/examples/ios/libdigidocpp/libdigidocpp.entitlements index ee95ab7e5..d7c971d31 100644 --- a/examples/ios/libdigidocpp/libdigidocpp.entitlements +++ b/examples/ios/libdigidocpp/libdigidocpp.entitlements @@ -4,6 +4,8 @@ com.apple.security.app-sandbox + com.apple.security.cs.disable-library-validation + com.apple.security.network.client diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d257c71a..012e5ec3e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -331,7 +331,7 @@ install( TARGETS digidocpp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RESOURCE DESTINATION ${DIGIDOCPP_CONFIG_DIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/digidocpp - FRAMEWORK DESTINATION /Library/Frameworks + FRAMEWORK DESTINATION ${FRAMEWORK_DESTINATION} ) if(WIN32) @@ -360,13 +360,12 @@ source_group(Resources FILES ${CMAKE_CURRENT_BINARY_DIR}/digidocpp.conf) source_group(Resources/schemas FILES ${SCHEMA_FILES}) if( FRAMEWORK ) - add_custom_command( TARGET digidoc-tool POST_BUILD - COMMAND cp $ $/Resources ) + install(TARGETS minizip DESTINATION ${CMAKE_INSTALL_LIBDIR}) # for example ios application set_source_files_properties( ${SCHEMA_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/schema ) set_source_files_properties( ${CRYPTO_HEADER} PROPERTIES MACOSX_PACKAGE_LOCATION Headers/crypto ) list( GET XmlSecurityC_LIBRARIES 0 LIBPATH ) get_filename_component( LIBPATH ${LIBPATH} PATH ) - add_custom_target( embedlibs DEPENDS digidoc-tool + add_custom_target( embedlibs DEPENDS digidocpp $ COMMAND mkdir -p $/Libraries COMMAND ln -s -f Versions/Current/Libraries $ COMMAND cp ${XmlSecurityC_LIBRARIES} $/Libraries @@ -399,31 +398,37 @@ if( FRAMEWORK ) -change '${LIBPATH}/libxml-security-c.20.dylib' '@loader_path/Libraries/libxml-security-c.dylib' -change '${LIBPATH}/libxalan-c.112.dylib' '@loader_path/Libraries/libxalan-c.dylib' $ - COMMAND install_name_tool - -change '${LIBPATH}/libcrypto.3.dylib' '@executable_path/../Libraries/libcrypto.dylib' - -change '${LIBPATH}/libssl.3.dylib' '@executable_path/../Libraries/libssl.dylib' - -change '${LIBPATH}/libxerces-c-3.2.dylib' '@executable_path/../Libraries/libxerces-c.dylib' - -change '${LIBPATH}/libxml-security-c.20.dylib' '@executable_path/../Libraries/libxml-security-c.dylib' - -change '${LIBPATH}/libxalan-c.112.dylib' '@executable_path/../Libraries/libxalan-c.dylib' - $/Resources/digidoc-tool - COMMAND touch $ ) - add_custom_target( codesign DEPENDS digidoc-tool + if(BUILD_TOOLS) + add_custom_command(TARGET digidoc-tool POST_BUILD + COMMAND cp $ $/Resources) + add_custom_command(TARGET embedlibs POST_BUILD + COMMAND install_name_tool + -change '${LIBPATH}/libcrypto.3.dylib' '@executable_path/../Libraries/libcrypto.dylib' + -change '${LIBPATH}/libssl.3.dylib' '@executable_path/../Libraries/libssl.dylib' + -change '${LIBPATH}/libxerces-c-3.2.dylib' '@executable_path/../Libraries/libxerces-c.dylib' + -change '${LIBPATH}/libxml-security-c.20.dylib' '@executable_path/../Libraries/libxml-security-c.dylib' + -change '${LIBPATH}/libxalan-c.112.dylib' '@executable_path/../Libraries/libxalan-c.dylib' + $/Resources/digidoc-tool + COMMAND touch $ + ) + endif() + add_custom_target(codesign DEPENDS digidocpp $ COMMAND codesign -f -s "Developer ID Application: ${SIGNCERT}" $/Libraries/* - $/Resources/digidoc-tool + $<$:$/Resources/digidoc-tool> $ - COMMAND touch $ + COMMAND touch $ $<$:$> ) - add_custom_target( pkgbuild DEPENDS digidoc-tool + add_custom_target(pkgbuild DEPENDS digidocpp $ COMMAND make install DESTDIR=install COMMAND pkgbuild --root install "$<$:--sign;${SIGNCERT}>" ${CMAKE_BINARY_DIR}/libdigidocpp_${VERSION}$ENV{VER_SUFFIX}.pkg COMMAND_EXPAND_LISTS ) - add_custom_target( zipdebug DEPENDS digidoc-tool + add_custom_target(zipdebug DEPENDS digidocpp $ COMMAND dsymutil -o libdigidocpp.dSYM $ - COMMAND dsymutil -o libdigidocpp.dSYM $ + $<$:$> COMMAND zip -r ${CMAKE_BINARY_DIR}/libdigidocpp-dbg_${VERSION}$ENV{VER_SUFFIX}.zip libdigidocpp.dSYM ) else()