diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c4023f34..e81f097ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: run: | ./build-library.sh ${{ matrix.target }} install/strip cd /Library - zip -q -r ${OLDPWD}/libdigidocpp.${{ matrix.target }}.zip libdigidocpp.* + zip --symlinks -q -r ${OLDPWD}/libdigidocpp.${{ matrix.target }}.zip libdigidocpp.* - name: Archive artifacts if: matrix.target == 'osx' uses: actions/upload-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index f457a90a1..29fe204aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,8 +39,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..f1459b3cc 100755 --- a/build-library.sh +++ b/build-library.sh @@ -36,7 +36,6 @@ case "$@" in : ${ANDROID_NDK_HOME:=$(ls -d /Volumes/android-ndk-r*/AndroidNDK*.app/Contents/NDK)} TARGET_PATH=/Library/libdigidocpp.${TARGET} CMAKEARGS=" - -DCMAKE_FIND_ROOT_PATH=${TARGET_PATH};/usr/local;/opt/homebrew \ -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \ -DANDROID_PLATFORM=28 \ -DANDROID_ABI=${ARCH} \ @@ -72,13 +71,14 @@ case "$@" in : ${IPHONEOS_DEPLOYMENT_TARGET:="13.0"} export IPHONEOS_DEPLOYMENT_TARGET CMAKEARGS=" + -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_OSX_SYSROOT=${SYSROOT} \ - -DFRAMEWORK=off \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET} \ -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" @@ -93,6 +93,7 @@ cmake --fresh -B ${TARGET} -S . \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \ -DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \ + -DCMAKE_FIND_ROOT_PATH="${TARGET_PATH};/usr/local;/opt/homebrew" \ -DOPENSSL_ROOT_DIR=${TARGET_PATH} \ -DXercesC_ROOT=${TARGET_PATH} \ ${CMAKEARGS} 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 672f50d69..740718aac 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 */, @@ -345,11 +325,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)", @@ -357,7 +338,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"; @@ -366,14 +347,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; @@ -386,11 +370,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)", @@ -398,7 +383,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"; @@ -407,14 +392,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 684310714..95d6fffdb 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 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 634aa8877..c3931d75b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -145,7 +145,7 @@ add_library(digidocpp_util STATIC util/log.cpp ) -target_link_libraries(digidocpp_util PRIVATE $<$:-framework\ CoreFoundation>) +target_link_libraries(digidocpp_util PRIVATE $<$,$>:-framework\ CoreFoundation>) add_library(digidocpp_priv STATIC ${xsd_SRCS} @@ -328,7 +328,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) @@ -357,13 +357,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 @@ -396,31 +395,41 @@ 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() + if(IOS) + add_custom_command(TARGET digidocpp POST_BUILD + COMMAND /usr/libexec/PlistBuddy -c "Add :MinimumOSVersion string ${CMAKE_OSX_DEPLOYMENT_TARGET}" $/Info.plist) + 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() diff --git a/src/util/File.cpp b/src/util/File.cpp index 3a094562f..90c26b865 100644 --- a/src/util/File.cpp +++ b/src/util/File.cpp @@ -279,7 +279,7 @@ string File::digidocppPath() string appData = (fs::path(knownFolder) / "digidocpp").u8string(); CoTaskMemFree(knownFolder); return appData; -#elif defined(ANDROID) +#elif defined(ANDROID) || TARGET_OS_SIMULATOR if(char *var = getenv("HOME")) return (fs::path(var) / ".digidocpp").u8string(); return {};